def on_save(self, event): # wxGlade: student_profie.<event_handler>
if self.button_save.Label=="Edit":
self.on_edit()
self.button_delete.Disable()
else:
# if button save
if self.text_ctrl_name.Value and self.combo_box_adno.GetValue():
if not self.validate_all():
event.Skip()
return 0
if self.add_flag:
result=self.db_insert()
else:
result=self.db_update()
if result:
if self.prof_pic_path!='':
from shutil import copyfile
cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
dest=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"
copyfile(self.prof_pic_path,dest)
self.load_admission_no()
self.button_save.Disable()
else:
msg= "Admission number and name mandatory"
dlg = wx.MessageDialog(self, msg, '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
self.button_save.Label="Edit"
self.set_editable(False)
self.bitmap_photo.Enable(False)
cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
path=cur_dir+"/Resources/img/browse.jpg"
self.bitmap_photo = wx.BitmapButton(self.panel_1, wx.ID_ANY,wx.Bitmap(path, wx.BITMAP_TYPE_ANY))
self.__set_properties()
self.__do_layout()
event.Skip()
评论列表
文章目录