def insert_doc(self): doc_file = dialogs.get_open_file_name(self.mw, self, config.import_dir, _('Import file...')) if os.path.lexists(doc_file) and os.path.isfile(doc_file): try: self.current_doc.insert_doc(doc_file) except: details = sys.exc_info()[1].__str__() + sys.exc_info()[2].__str__() msg = _('Cannot import file') msg = "%s '%s'" % (msg, doc_file) sec = _('The file may be corrupted or not supported format') dialogs.msg_dialog(self.mw, self.appdata.app_name, msg, sec, details) return config.import_dir = os.path.dirname(doc_file)
def insert_doc(self): doc_file = dialogs.get_open_file_name(self.mw, self, config.import_dir, _('Import file...')) if os.path.lexists(doc_file) and os.path.isfile(doc_file): try: self.current_doc.insert_doc(doc_file) except: details = sys.exc_info()[1].__str__() + sys.exc_info( )[2].__str__() msg = _('Cannot import file') msg = "%s '%s'" % (msg, doc_file) sec = _('The file may be corrupted or not supported format') dialogs.msg_dialog(self.mw, self.appdata.app_name, msg, sec, details) return config.import_dir = os.path.dirname(doc_file)
def open(self, doc_file='', silent=False): if not doc_file: doc_file = dialogs.get_open_file_name(self.mw, self, config.open_dir) if os.path.lexists(doc_file) and os.path.isfile(doc_file): try: doc = PD_Presenter(self, doc_file, silent) except: details = sys.exc_info()[1].__str__() + sys.exc_info()[2].__str__() msg = _('Cannot open file') msg = "%s '%s'" % (msg, doc_file) sec = _('The file may be corrupted or not supported format') dialogs.msg_dialog(self.mw, self.appdata.app_name, msg, sec, details) return self.docs.append(doc) self.set_current_doc(doc) config.open_dir = os.path.dirname(doc_file) events.emit(events.APP_STATUS, _('Document opened'))
def open(self, doc_file='', silent=False): if not doc_file: doc_file = dialogs.get_open_file_name(self.mw, self, config.open_dir) if os.path.lexists(doc_file) and os.path.isfile(doc_file): try: doc = PD_Presenter(self, doc_file, silent) except: details = sys.exc_info()[1].__str__() + sys.exc_info( )[2].__str__() msg = _('Cannot open file') msg = "%s '%s'" % (msg, doc_file) sec = _('The file may be corrupted or not supported format') dialogs.msg_dialog(self.mw, self.appdata.app_name, msg, sec, details) return self.docs.append(doc) self.set_current_doc(doc) config.open_dir = os.path.dirname(doc_file) events.emit(events.APP_STATUS, _('Document opened'))