def InitUI(self):
# these need to be set by whoever calls the dialog box before it's created
device = config_ctrl_pnl.device_toedit
gpio = config_ctrl_pnl.gpio_toedit
wiring = config_ctrl_pnl.wiring_toedit
# draw the pannel
pnl = wx.Panel(self)
wx.StaticText(self, label='Device GPIO Config', pos=(20, 10))
#background image
png = wx.Image('./relaydialogue.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
# devices combo box
switch_list = self.list_switch_scripts()
unlinked_devices = self.list_unused_devices(switch_list)
wx.StaticText(self, label='Device;', pos=(20, 50))
self.devices_combo = wx.ComboBox(self, choices = unlinked_devices, pos=(90,50), size=(175, 25))
self.devices_combo.SetValue(device)
# gpio text box
wx.StaticText(self, label='GPIO', pos=(10, 100))
self.gpio_tc = wx.TextCtrl(self, pos=(56, 98), size=(40, 25))
self.gpio_tc.SetValue(gpio)
self.gpio_tc.Bind(wx.EVT_CHAR, self.onChar) #limit to valid gpio numbers
# wiring direction combo box
wiring_choices = ['low', 'high']
wx.StaticText(self, label='Wiring side;', pos=(100, 100))
self.wiring_combo = wx.ComboBox(self, choices = wiring_choices, pos=(200,98), size=(110, 25))
self.wiring_combo.SetValue(wiring)
#Buttom Row of Buttons
okButton = wx.Button(self, label='Ok', pos=(200, 250))
closeButton = wx.Button(self, label='Cancel', pos=(300, 250))
okButton.Bind(wx.EVT_BUTTON, self.set_new_gpio_link)
closeButton.Bind(wx.EVT_BUTTON, self.OnClose)
评论列表
文章目录