Fix undo/redo sample action plugin for latest API
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10212
(cherry picked from commit bb388d47fc
)
This commit is contained in:
parent
0e2f79ad8d
commit
f32c1ab1d2
|
@ -38,7 +38,7 @@ class testundoredo1(ActionPlugin):
|
|||
for track in pcb.GetTracks():
|
||||
pcb.RemoveNative(track)
|
||||
|
||||
for draw in pcb.m_Drawings:
|
||||
for draw in pcb.GetDrawings():
|
||||
pcb.RemoveNative(draw)
|
||||
|
||||
|
||||
|
@ -83,15 +83,15 @@ class testundoredo2(ActionPlugin):
|
|||
footprint.Add(pad_s0)
|
||||
footprint.Add(pad_s1)
|
||||
|
||||
e = EDGE_MODULE(footprint)
|
||||
e = FP_SHAPE(footprint)
|
||||
e.SetStart0(wxPointMM(-1,0))
|
||||
e.SetEnd0(wxPointMM(0,0))
|
||||
e.SetWidth(FromMM(0.2))
|
||||
e.SetLayer(F_SilkS)
|
||||
e.SetShape(S_SEGMENT)
|
||||
module.Add(e)
|
||||
module.SetPosition(wxPointMM(random.randint(20,200),random.randint(20,150)))
|
||||
return module
|
||||
footprint.Add(e)
|
||||
footprint.SetPosition(wxPointMM(random.randint(20,200),random.randint(20,150)))
|
||||
return footprint
|
||||
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ class testundoredo2(ActionPlugin):
|
|||
random.seed()
|
||||
|
||||
for i in range(10):
|
||||
seg = DRAWSEGMENT()
|
||||
seg = PCB_SHAPE()
|
||||
seg.SetLayer( random.choice([Edge_Cuts,Cmts_User,Eco1_User,Eco2_User]) )
|
||||
seg.SetStart( wxPointMM( random.randint(10,100),
|
||||
random.randint(10,100) ) )
|
||||
|
@ -109,11 +109,11 @@ class testundoredo2(ActionPlugin):
|
|||
self.pcb.Add( seg )
|
||||
|
||||
if i%2 == 0:
|
||||
t = TRACK(None)
|
||||
t = PCB_TRACK(None)
|
||||
else:
|
||||
t = VIA(None)
|
||||
t = PCB_VIA(None)
|
||||
#t.SetLayerPair(segments['layerPair'][0],segments['layerPair'][1])
|
||||
t.SetViaType(VIA_THROUGH)
|
||||
t.SetViaType(VIATYPE_THROUGH)
|
||||
t.SetDrill(FromMM(random.randint(1,20)/10.0))
|
||||
t.SetStart(wxPointMM(random.randint(100,150),random.randint(100,150)))
|
||||
t.SetEnd(wxPointMM(random.randint(100,150),random.randint(100,150)))
|
||||
|
@ -121,7 +121,7 @@ class testundoredo2(ActionPlugin):
|
|||
t.SetLayer(random.choice([F_Cu,B_Cu]))
|
||||
self.pcb.Add(t)
|
||||
|
||||
self.createFPCXModule(random.randint(2,40))
|
||||
self.createFPCXFootprint(random.randint(2,40))
|
||||
|
||||
|
||||
class testundoredo3(ActionPlugin):
|
||||
|
@ -138,15 +138,15 @@ class testundoredo3(ActionPlugin):
|
|||
area = pcb.GetArea(i)
|
||||
area.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||
|
||||
for module in pcb.GetFootprints():
|
||||
module.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||
for footprint in pcb.GetFootprints():
|
||||
footprint.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||
if random.randint(0,10) > 5:
|
||||
module.Flip(module.GetPosition())
|
||||
footprint.Flip(footprint.GetPosition(), True)
|
||||
|
||||
for track in pcb.GetTracks():
|
||||
track.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||
|
||||
for draw in pcb.m_Drawings:
|
||||
for draw in pcb.GetDrawings():
|
||||
draw.Move(wxPointMM(random.randint(-20,20),random.randint(-20,20)))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue