Beispiel #1
0
    def OnFileImportData(self, event):
        dlg = dialogs.ImportDataDialog(self)
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            if not path:
                dlg.Destroy()
                return

            exp = export.DataImport(self.db, 'gbk')
            try:
                idlg = wx.ProgressDialog(_('Importing...'),
                                         _('Waiting for importing.'),
                                         maximum=100,
                                         parent=self,
                                         style=wx.PD_APP_MODAL
                                         | wx.PD_ELAPSED_TIME
                                         | wx.PD_REMAINING_TIME)
                exp.itemdata(path, idlg)
                idlg.Destroy()
            except Exception, e:
                logfile.info(traceback.format_exc())
                wx.MessageBox(str(e), _('Import Error:'),
                              wx.OK | wx.ICON_INFORMATION)
            else:
                wx.MessageBox(_('Import complete!'), _('Information'),
                              wx.OK | wx.ICON_INFORMATION)
            self.reload()
Beispiel #2
0
 def initcate(self):
     dbx   = datamodel.CategoryData(self.db)
     count = dbx.count()
     #print 'count:', count, 'iscreate:', config.cf.iscreate, 'lang:', config.cf['lang']
     if count == 0 and config.cf.iscreate and config.cf['lang'] == 'zh_CN':
         path = os.path.join(self.rundir, 'data', 'category.csv')
         if not os.path.isfile(path):
             return
         exp = export.DataImport(self.db, 'gbk')
         try:
             exp.category(path)
         except:
             logfile.info(traceback.format_exc())
         self.reload()
Beispiel #3
0
 def initcate(self):
     sql = "select count(*) from category"
     count = self.db.query_one(sql)
     #print 'count:', count, 'iscreate:', config.cf.iscreate, 'lang:', config.cf['lang']
     if count == 0 and config.cf.iscreate and config.cf['lang'] == 'zh_CN':
         path = os.path.join(self.rundir, 'data', 'category.csv')
         if not os.path.isfile(path):
             return
         exp = export.DataImport(self.db, 'gbk')
         try:
             exp.category(path)
         except:
             logfile.info(traceback.format_exc())
         self.reload()
Beispiel #4
0
 def OnFileImportCate(self, event):
     dlg = dialogs.ImportCateDialog(self)
     if dlg.ShowModal() == wx.ID_OK:
         path = dlg.GetPath()
         if not path:
             dlg.Destroy()
             return
         exp = export.DataImport(self.db, 'gbk')
         try:
             exp.category(path)
         except Exception, e:
             logfile.info(traceback.format_exc())
             wx.MessageBox(str(e), _('Import Error:'), wx.OK|wx.ICON_INFORMATION)
         else:
             wx.MessageBox(_('Import complete!'), _('Information'), wx.OK|wx.ICON_INFORMATION)
         self.reload()