def actionSaveRecord(self,event): fname = self.recordPart.lbFileName.GetPath() if fname == '' : wx.MessageBox(_('You must give a valid filename to record the document')) return direct = os.path.dirname(fname) if not os.path.exists(direct) : if utilities.ask(_('The directory {dname} does not exists. Should it be created ?'.format(dname=direct))) : try: os.makedirs(direct) except Exception as E: logging.exception('Unable to create directory '+direct + ':' + str(E)) #raise Exception('Unable to add the file to the disk') return else: raise Exception('Unable to add the file to the disk') try: #if not data.theData.save_file(fname,self.recordPart.lbTitle.Value,self.recordPart.lbDescription.Value,self.recordPart.lbTags.Value) : raise _('Unable to add the file to the disk') if not data.theData.save_file(fname,self.recordPart.lbTitle.Value,self.recordPart.lbDescription.Value,self.recordPart.lbTags.Value) : wx.MessageBox(_('Unable to add the file to the disk')) return except Exception,E: logging.debug('Unable to save the file ' + fname + ':' + str(E)) return
def onNewScannerData(self): data.theData.current_image=len(data.theData.pil_images)-1 self.docWin.showCurrentImage() try: auto_cont=str_to_bool(self.currentOptions['manual_multipage']) except: auto_cont=False if auto_cont and utilities.ask(_('Do you want to add new page(s) ?')) : self.do_scan()
def onClose(self,event): if len(data.theData.pil_images)==0 or utilities.ask(_('The scanned images are not saved. Are you sure you want to quit the scan window?')) : self.Destroy()