def __init__(self, parent): ''' Constructor ''' wx.Dialog.__init__(self, parent, -1, _('Survey directory'),style=wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.panel = wx.Panel(self, -1) self.docViewSizer = wx.BoxSizer(wx.VERTICAL) self.upPart = wx.BoxSizer(wx.HORIZONTAL) self.recordSizer = wx.BoxSizer(wx.HORIZONTAL) self.moreAdd=None self.docID=None #self.docList = wx.TreeCtrl(self.panel,-1,style=wx.TR_DEFAULT_STYLE|wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT) #wx.ListBox(self.panel,-1)# self.tabFrame = wx.Notebook(self.panel,-1) self.dirSurveyFrame = self.SurveyContent(self.tabFrame,self) self.missOCRFrame = self.MissOCRContent(self.tabFrame,self) self.passwordProblemFrame = self.PasswordProblemContent(self.tabFrame,self) self.fileProblemsFrame = self.FileProblemContent(self.tabFrame,self) self.tabFrame.AddPage(self.dirSurveyFrame,self.dirSurveyFrame.GetName()) self.tabFrame.AddPage(self.missOCRFrame,self.missOCRFrame.GetName()) self.tabFrame.AddPage(self.fileProblemsFrame,self.fileProblemsFrame.GetName()) self.tabFrame.AddPage(self.passwordProblemFrame,self.passwordProblemFrame.GetName()) #self.prefSizer.Add(self.tabFrame,(1,0),span=(1,3),flag=wx.EXPAND|wx.ALL) self.upPart.Add(self.tabFrame,1,wx.EXPAND) self.docWin = docWindow.docWindow(self.panel,-1) self.docViewSizer.Add(self.upPart,1,wx.EXPAND) #self.upPart.Add(self.docList,1,wx.EXPAND) self.upPart.Add(self.docWin,1,wx.EXPAND) self.recordPart = RecordWidget.RecordWidget(self.panel) self.recordPart.lbFileName.Disable() self.recordSizer.Add(self.recordPart,1,wx.EXPAND) self.btAddRecord = wx.Button(self.panel,-1,_('Add/Update')) self.docViewSizer.Add(self.recordSizer,0,wx.EXPAND) self.recordButtonSizer = wx.BoxSizer(wx.VERTICAL) self.recordButtonSizer.Add(self.btAddRecord,1,wx.EXPAND) self.recordSizer.Add(self.recordButtonSizer) self.panel.SetSizerAndFit(self.docViewSizer) #self.Bind(wx.EVT_TREE_SEL_CHANGED,self.actionDocSelect,self.docList) #self.docList.Bin(wx.EVT_TREE_SEL_CHANGED, handler) self.Bind(wx.EVT_BUTTON, self.actionDoAdd, self.btAddRecord) for ipage in range(self.tabFrame.GetPageCount()) : self.tabFrame.GetPage(ipage).populate() # self.dirSurveyFrame.populate() # self.missOCRFrame.populate() # self.fileProblemsFrame.populate() self.SetSizeWH(1000,600)
def __init__(self,parent, title,filename=None): ''' Constructor ''' wx.Dialog.__init__(self, parent, -1, _('Adding a documents to the database'),style=wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.RESIZE_BORDER | 0 | 0 | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.panel = wx.Panel(self, -1) if not filename: dlg = wx.FileDialog(self,style=wx.FD_OPEN,message=_('filename of the document to add')) if dlg.ShowModal(): filename = os.path.join(dlg.Directory,dlg.Filename) if not filename : return try: data.theData.load_file(filename, do_clear=False) except: pass self.totSizer = wx.BoxSizer(wx.VERTICAL) self.horSizer = wx.BoxSizer(wx.HORIZONTAL) self.docWin = docWindow.docWindow(self.panel,-1) self.recordPart = RecordWidget.RecordWidget(self.panel,filename) self.recordPart.cbOCR.SetValue(str_to_bool(theConfig.get_param('OCR', 'autoStart','1'))) self.btSizer = wx.BoxSizer(wx.HORIZONTAL) self.btOk = wx.Button(self.panel,-1,_('Ok')) self.btCancel = wx.Button(self.panel,-1,_('Cancel')) self.btSizer.Add(self.btOk,1,wx.EXPAND) self.btSizer.Add(self.btCancel,1,wx.EXPAND) self.horSizer.Add(self.recordPart,1,wx.EXPAND) self.horSizer.Add(self.docWin,1,wx.EXPAND) self.totSizer.Add(self.horSizer,1,wx.EXPAND) self.totSizer.Add(self.btSizer,0,wx.EXPAND) self.panel.SetSizerAndFit(self.totSizer) self.totSizer.Fit(self) self.Bind(wx.EVT_BUTTON, self.actionDoAdd, self.btOk) self.Bind(wx.EVT_BUTTON, self.actionClose, self.btCancel)