def OnSave(self, event): # wxGlade: working_days.<event_handler>
t1=str(self.text_ctrl_1.Value)
t2=str(self.text_ctrl_2.Value)
t3=str(self.text_ctrl_3.Value)
err=False
if not self.text_ctrl_1.Value.isdigit() and not self.text_ctrl_1.Value=='':err=True;self.text_ctrl_1.Value=''
if not self.text_ctrl_2.Value.isdigit() and not self.text_ctrl_2.Value=='':err=True;self.text_ctrl_2.Value=''
if not self.text_ctrl_3.Value.isdigit() and not self.text_ctrl_3.Value=='':err=True;self.text_ctrl_3.Value=''
if err:
dlg = wx.MessageDialog(self, 'Working days should be a digit', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return 0
try:
self.DB.Set_Working_Days(self.YEAR,'1',self.text_ctrl_1.Value)
self.DB.Set_Working_Days(self.YEAR,'2',self.text_ctrl_2.Value)
self.DB.Set_Working_Days(self.YEAR,'3',self.text_ctrl_3.Value)
dlg = wx.MessageDialog(self, 'Successfully Saved', '',wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
except:
dlg = wx.MessageDialog(self, 'Some error occured', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
event.Skip()
# end of class working_days
评论列表
文章目录