Move delete to a button
This commit is contained in:
@ -22,6 +22,12 @@ import FillArea
|
|||||||
import wx
|
import wx
|
||||||
import FillAreaDialog
|
import FillAreaDialog
|
||||||
|
|
||||||
|
class FillAreaDialogEx(FillAreaDialog.FillAreaDialog):
|
||||||
|
|
||||||
|
def onDeleteClick( self, event ):
|
||||||
|
return self.EndModal(wx.ID_DELETE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FillAreaAction(pcbnew.ActionPlugin):
|
class FillAreaAction(pcbnew.ActionPlugin):
|
||||||
|
|
||||||
@ -31,14 +37,14 @@ class FillAreaAction(pcbnew.ActionPlugin):
|
|||||||
self.description = ""
|
self.description = ""
|
||||||
|
|
||||||
def Run(self):
|
def Run(self):
|
||||||
a = FillAreaDialog.FillAreaDialog(None)
|
a = FillAreaDialogEx(None)
|
||||||
a.m_SizeMM.SetValue("0.35")
|
a.m_SizeMM.SetValue("0.35")
|
||||||
a.m_StepMM.SetValue("2.54")
|
a.m_StepMM.SetValue("2.54")
|
||||||
a.m_DrillMM.SetValue("0.3")
|
a.m_DrillMM.SetValue("0.3")
|
||||||
a.m_Netname.SetValue("auto")
|
a.m_Netname.SetValue("auto")
|
||||||
a.m_ClearanceMM.SetValue("0.2")
|
a.m_ClearanceMM.SetValue("0.2")
|
||||||
|
modal_result = a.ShowModal()
|
||||||
if a.ShowModal() == wx.ID_OK:
|
if modal_result == wx.ID_OK:
|
||||||
fill = FillArea.FillArea()
|
fill = FillArea.FillArea()
|
||||||
try:
|
try:
|
||||||
fill.SetStepMM(float(a.m_StepMM.GetValue()))
|
fill.SetStepMM(float(a.m_StepMM.GetValue()))
|
||||||
@ -53,11 +59,18 @@ class FillAreaAction(pcbnew.ActionPlugin):
|
|||||||
fill.SetRandom()
|
fill.SetRandom()
|
||||||
if a.m_only_selected.IsChecked():
|
if a.m_only_selected.IsChecked():
|
||||||
fill.OnlyOnSelectedArea()
|
fill.OnlyOnSelectedArea()
|
||||||
if a.m_delete_vias.IsChecked():
|
|
||||||
fill.DeleteVias()
|
|
||||||
fill.Run()
|
fill.Run()
|
||||||
except Exception:
|
except Exception:
|
||||||
wx.MessageDialog(None, "Invalid parameter")
|
wx.MessageDialog(None, "Invalid parameter")
|
||||||
|
if modal_result == wx.ID_DELETE:
|
||||||
|
try:
|
||||||
|
fill = FillArea.FillArea()
|
||||||
|
if a.m_Debug.IsChecked():
|
||||||
|
fill.SetDebug()
|
||||||
|
fill.DeleteVias()
|
||||||
|
fill.Run()
|
||||||
|
except Exception:
|
||||||
|
wx.MessageDialog(None, "Invalid parameter for delete")
|
||||||
else:
|
else:
|
||||||
print "Cancel"
|
print "Cancel"
|
||||||
a.Destroy()
|
a.Destroy()
|
||||||
|
@ -21,6 +21,8 @@ class FillAreaDialog ( wx.Dialog ):
|
|||||||
|
|
||||||
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
|
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
|
||||||
|
|
||||||
|
bSizer3 = wx.BoxSizer( wx.VERTICAL )
|
||||||
|
|
||||||
fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
|
fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
|
||||||
fgSizer1.SetFlexibleDirection( wx.BOTH )
|
fgSizer1.SetFlexibleDirection( wx.BOTH )
|
||||||
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||||
@ -83,19 +85,15 @@ class FillAreaDialog ( wx.Dialog ):
|
|||||||
self.m_only_selected = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
self.m_only_selected = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||||
fgSizer1.Add( self.m_only_selected, 0, wx.ALL, 5 )
|
fgSizer1.Add( self.m_only_selected, 0, wx.ALL, 5 )
|
||||||
|
|
||||||
self.m_staticText10 = wx.StaticText( self, wx.ID_ANY, u"Delete generated vias", wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
||||||
self.m_staticText10.Wrap( -1 )
|
|
||||||
fgSizer1.Add( self.m_staticText10, 0, wx.ALL, 5 )
|
|
||||||
|
|
||||||
self.m_delete_vias = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
bSizer3.Add( fgSizer1, 1, wx.EXPAND, 5 )
|
||||||
fgSizer1.Add( self.m_delete_vias, 0, wx.ALL, 5 )
|
|
||||||
|
|
||||||
self.m_staticText71 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
||||||
self.m_staticText71.Wrap( -1 )
|
|
||||||
fgSizer1.Add( self.m_staticText71, 0, wx.ALL, 5 )
|
|
||||||
|
|
||||||
bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
|
bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
|
||||||
|
|
||||||
|
self.m_staticText101 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||||
|
self.m_staticText101.Wrap( -1 )
|
||||||
|
bSizer1.Add( self.m_staticText101, 1, wx.ALL, 5 )
|
||||||
|
|
||||||
self.m_button1 = wx.Button( self, wx.ID_OK, u"Run", wx.DefaultPosition, wx.DefaultSize, 0 )
|
self.m_button1 = wx.Button( self, wx.ID_OK, u"Run", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||||
self.m_button1.SetDefault()
|
self.m_button1.SetDefault()
|
||||||
bSizer1.Add( self.m_button1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
bSizer1.Add( self.m_button1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
||||||
@ -103,16 +101,27 @@ class FillAreaDialog ( wx.Dialog ):
|
|||||||
self.m_button2 = wx.Button( self, wx.ID_CANCEL, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
|
self.m_button2 = wx.Button( self, wx.ID_CANCEL, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||||
bSizer1.Add( self.m_button2, 0, wx.ALL, 5 )
|
bSizer1.Add( self.m_button2, 0, wx.ALL, 5 )
|
||||||
|
|
||||||
|
self.m_button3_delete = wx.Button( self, wx.ID_DELETE, u"Delete Vias", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||||
fgSizer1.Add( bSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
bSizer1.Add( self.m_button3_delete, 0, wx.ALL, 5 )
|
||||||
|
|
||||||
|
|
||||||
self.SetSizer( fgSizer1 )
|
bSizer3.Add( bSizer1, 0, wx.EXPAND|wx.ALIGN_RIGHT, 5 )
|
||||||
|
|
||||||
|
|
||||||
|
self.SetSizer( bSizer3 )
|
||||||
self.Layout()
|
self.Layout()
|
||||||
|
|
||||||
self.Centre( wx.BOTH )
|
self.Centre( wx.BOTH )
|
||||||
|
|
||||||
|
# Connect Events
|
||||||
|
self.m_button3_delete.Bind( wx.EVT_BUTTON, self.onDeleteClick )
|
||||||
|
|
||||||
def __del__( self ):
|
def __del__( self ):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# Virtual event handlers, overide them in your derived class
|
||||||
|
def onDeleteClick( self, event ):
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user