101 lines
4.1 KiB
Python
101 lines
4.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import wx
|
|
import wx.xrc
|
|
|
|
|
|
class CircularZoneDlg ( wx.Dialog ):
|
|
|
|
def __init__( self, parent ):
|
|
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Circular zone parameters", pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
|
|
|
|
self.SetMinSize( wx.Size( 250, 410 ) )
|
|
|
|
bSizer3 = wx.BoxSizer( wx.VERTICAL )
|
|
|
|
self.m_comment = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
self.m_comment.Wrap( -1 )
|
|
bSizer3.Add( self.m_comment, 0, wx.ALL|wx.EXPAND, 5 )
|
|
|
|
sbSizerDim = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Dimension Type" ), wx.VERTICAL )
|
|
|
|
self.m_radio_radius = wx.RadioButton( sbSizerDim.GetStaticBox(), wx.ID_ANY, u"Radius", wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
self.m_radio_radius.SetValue(True)
|
|
sbSizerDim.Add( self.m_radio_radius, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
|
|
|
self.m_radio_diameter = wx.RadioButton( sbSizerDim.GetStaticBox(), wx.ID_ANY, u"Diameter", wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
sbSizerDim.Add( self.m_radio_diameter, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
|
|
|
bSizer3.Add( sbSizerDim, 0, wx.ALL|wx.EXPAND, 5 )
|
|
|
|
sbSizerValue = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Radius (mm)" ), wx.HORIZONTAL )
|
|
self.sbSizerValue = sbSizerValue
|
|
|
|
self.m_radiusMM = wx.TextCtrl( sbSizerValue.GetStaticBox(), wx.ID_ANY, u"10", wx.DefaultPosition, wx.Size( 100,-1 ), 0 )
|
|
sbSizerValue.Add( self.m_radiusMM, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
|
|
|
bSizer3.Add( sbSizerValue, 0, wx.ALL|wx.EXPAND, 5 )
|
|
|
|
sbSizerLayer = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Layer" ), wx.HORIZONTAL )
|
|
|
|
m_comboBoxLayerChoices = []
|
|
self.m_comboBoxLayer = wx.ComboBox( sbSizerLayer.GetStaticBox(), wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.Size( 200,-1 ), m_comboBoxLayerChoices, 0 )
|
|
sbSizerLayer.Add( self.m_comboBoxLayer, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
|
|
|
|
bSizer3.Add( sbSizerLayer, 0, wx.ALL|wx.EXPAND, 5 )
|
|
|
|
sbSizer1 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Type of Zone" ), wx.VERTICAL )
|
|
|
|
self.m_radio_std = wx.RadioButton( sbSizer1.GetStaticBox(), wx.ID_ANY, u"Standard", wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
sbSizer1.Add( self.m_radio_std, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 5 )
|
|
|
|
self.m_radio_out = wx.RadioButton( sbSizer1.GetStaticBox(), wx.ID_ANY, u"Keepout", wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
sbSizer1.Add( self.m_radio_out, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
|
|
|
bSizer3.Add( sbSizer1, 0, wx.ALL|wx.EXPAND, 5 )
|
|
|
|
sbSizer2 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Number of segments" ), wx.VERTICAL )
|
|
|
|
self.m_textCtrl_seg = wx.TextCtrl( sbSizer2.GetStaticBox(), wx.ID_ANY, u"64", wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
|
|
sbSizer2.Add( self.m_textCtrl_seg, 0, wx.ALL|wx.EXPAND, 5 )
|
|
|
|
bSizer3.Add( sbSizer2, 0, wx.ALL|wx.EXPAND, 5 )
|
|
|
|
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|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5 )
|
|
|
|
self.m_button1 = wx.Button( self, wx.ID_OK, u"Create", wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
self.m_button1.SetDefault()
|
|
bSizer1.Add( self.m_button1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
|
|
|
self.m_button2 = wx.Button( self, wx.ID_CANCEL, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
|
|
bSizer1.Add( self.m_button2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
|
|
|
bSizer3.Add( bSizer1, 0, wx.ALIGN_RIGHT|wx.EXPAND, 5 )
|
|
|
|
self.SetSizer( bSizer3 )
|
|
self.Layout()
|
|
self.Fit()
|
|
|
|
self.Centre( wx.BOTH )
|
|
|
|
self.m_radio_radius.Bind(wx.EVT_RADIOBUTTON, self.OnDimToggle)
|
|
self.m_radio_diameter.Bind(wx.EVT_RADIOBUTTON, self.OnDimToggle)
|
|
|
|
def OnDimToggle(self, event):
|
|
if self.m_radio_radius.GetValue():
|
|
new_label = u"Radius (mm)"
|
|
else:
|
|
new_label = u"Diameter (mm)"
|
|
|
|
self.sbSizerValue.GetStaticBox().SetLabel(new_label)
|
|
self.sbSizerValue.Layout()
|
|
self.Refresh()
|
|
event.Skip()
|
|
|
|
def __del__( self ):
|
|
pass
|