def on_import_db(self, event): # wxGlade: admin_dash.<event_handler>
'''
msg="This feature is suspended"
dlg = wx.MessageDialog(self, msg, '',wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
return 0
'''
msg="Importing may overwrite some of the existing data \n Do you want to continue?"
dlg = wx.MessageDialog(self, msg)#,wx.SAVE|wx.ICON_QUESTION)
if dlg.ShowModal() == wx.ID_OK:
dir = "/home"
wcd="Exam Files(*.xam)|*.xam|"
open_dlg = wx.FileDialog(self, message='Choose a file', defaultDir=dir, defaultFile='', wildcard=wcd, style=wx.OPEN|wx.CHANGE_DIR)
if open_dlg.ShowModal() == wx.ID_OK:
path = open_dlg.GetPath()
try:
self.DB.import_(path)
dlg = wx.MessageDialog(self, 'Successfully imported', '',wx.OK | wx.ICON_INFORMATION)
except:
dlg = wx.MessageDialog(self, 'Sorry, Could not import', '',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
self.label_import_db.SetForegroundColour(self.label_fg_color)
event.Skip()
评论列表
文章目录