def InitUI(self):
#
on_hour = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_on"].split(":")[0])
on_min = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_on"].split(":")[1])
off_hour = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_off"].split(":")[0])
off_min = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_off"].split(":")[1])
# draw the pannel and text
pnl = wx.Panel(self)
wx.StaticText(self, label='Lamp Config;', pos=(20, 10))
# hour on - first line
wx.StaticText(self, label='on time', pos=(10, 50))
self.on_hour_spin = wx.SpinCtrl(self, min=0, max=23, value=str(on_hour), pos=(80, 35), size=(60, 50))
self.on_hour_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
wx.StaticText(self, label=':', pos=(145, 50))
self.on_min_spin = wx.SpinCtrl(self, min=0, max=59, value=str(on_min), pos=(155, 35), size=(60, 50))
self.on_min_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
# length on on period - second line
wx.StaticText(self, label='Lamp on for ', pos=(25, 100))
self.on_period_h_spin = wx.SpinCtrl(self, min=0, max=23, value="", pos=(130, 85), size=(60, 50))
self.on_period_h_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
wx.StaticText(self, label='hours and ', pos=(195, 100))
self.on_period_m_spin = wx.SpinCtrl(self, min=0, max=59, value="", pos=(280, 85), size=(60, 50))
self.on_period_m_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
wx.StaticText(self, label='min', pos=(345, 100))
# off time - third line (worked out by above or manual input)
wx.StaticText(self, label='off time', pos=(10, 150))
self.off_hour_spin = wx.SpinCtrl(self, min=0, max=23, value=str(off_hour), pos=(80, 135), size=(60, 50))
self.off_hour_spin.Bind(wx.EVT_SPINCTRL, self.off_spun)
wx.StaticText(self, label=':', pos=(145, 150))
self.off_min_spin = wx.SpinCtrl(self, min=0, max=59, value=str(off_min), pos=(155, 135), size=(60, 50))
self.off_min_spin.Bind(wx.EVT_SPINCTRL, self.off_spun)
# cron timing of switches
wx.StaticText(self, label='Cron Timing of Switches;', pos=(10, 250))
wx.StaticText(self, label='Current New', pos=(50, 280))
lamp_on_string = MainApp.config_ctrl_pannel.get_cron_time("lamp_on.py").strip()
lamp_off_string = MainApp.config_ctrl_pannel.get_cron_time("lamp_off.py").strip()
wx.StaticText(self, label=" on;", pos=(20, 310))
wx.StaticText(self, label="off;", pos=(20, 340))
self.cron_lamp_on = wx.StaticText(self, label=lamp_on_string, pos=(60, 310))
self.cron_lamp_off = wx.StaticText(self, label=lamp_off_string, pos=(60, 340))
new_on_string = (str(on_min) + " " + str(on_hour) + " * * *")
new_off_string = (str(off_min) + " " + str(off_hour) + " * * *")
self.new_on_string_text = wx.StaticText(self, label=new_on_string, pos=(220, 310))
self.new_off_string_text = wx.StaticText(self, label=new_off_string, pos=(220, 340))
# set lamp period values
on_period_hour, on_period_min = self.calc_light_period(on_hour, on_min, off_hour, off_min)
self.on_period_h_spin.SetValue(on_period_hour)
self.on_period_m_spin.SetValue(on_period_min)
#ok and cancel buttons
self.ok_btn = wx.Button(self, label='Ok', pos=(15, 450), size=(175, 30))
self.ok_btn.Bind(wx.EVT_BUTTON, self.ok_click)
self.cancel_btn = wx.Button(self, label='Cancel', pos=(315, 450), size=(175, 30))
self.cancel_btn.Bind(wx.EVT_BUTTON, self.cancel_click)