def openProject(self, clear_current = True): open_dialog = FileDialog(self.main_window, 'open', file_filters = [(_('OCRFeeder Projects'), [], ['*.ocrf'])]) response = open_dialog.run() project_file = None if response == Gtk.ResponseType.OK: project_file = open_dialog.get_filename() project_loader = ProjectLoader(project_file) pages = project_loader.loadConfiguration() if pages and clear_current: self.clear() for index in range(0, len(pages)): page = pages[index] self.__addImage(page.image_path, select_image = index == 0, page_data = page) open_dialog.destroy() return project_file
def openProject(self, clear_current=True): open_dialog = FileDialog('open', file_filters=[(_('OCRFeeder Projects'), [], ['*.ocrf'])]) response = open_dialog.run() project_file = None if response == gtk.RESPONSE_OK: project_file = open_dialog.get_filename() project_loader = ProjectLoader(project_file) pages = project_loader.loadConfiguration() if pages and clear_current: self.clear() for index in range(0, len(pages)): page = pages[index] self.__addImage(page.image_path, select_image=index == 0) image_reviewer = self.__getCurrentReviewer() image_reviewer.updatePageData(page) open_dialog.destroy() return project_file