Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def do(self):
SimpleAction.do(self)
labeleditor = LabelEditor()
if labeleditor.edit(self.__main_win.window):
logger.info("Adding label %s to doc %s"
% (labeleditor.label, self.__main_win.doc[1]))
self.__main_win.docsearch.add_label(self.__main_win.doc[1],
labeleditor.label)
self.__main_win.refresh_label_list()
self.__main_win.refresh_docs([self.__main_win.doc])
def do(self):
"""
Ask for confirmation and then delete the page being viewed.
"""
if not ask_confirmation(self.__main_win.window):
return
SimpleAction.do(self)
logger.info("Deleting ...")
self.__main_win.page.destroy()
logger.info("Deleted")
self.__main_win.page = None
for widget in self.__main_win.need_page_widgets:
widget.set_sensitive(False)
self.__main_win.refresh_docs([self.__main_win.doc])
self.__main_win.refresh_page_list()
self.__main_win.refresh_label_list()
def do(self):
SimpleAction.do(self)
os.system('xdg-open "%s"' % (self.__main_win.doc[1].path))
def do(self):
SimpleAction.do(self)
self.__main_win.schedulers['main'].cancel_all(
self.__main_win.job_factories['img_builder'])
job = self.__main_win.job_factories['img_builder'].make(
self.__main_win.page)
self.__main_win.schedulers['main'].schedule(job)
def open_dialog(self, to_export):
SimpleAction.do(self)
self.main_win.export['estimated_size'].set_text("")
self.main_win.export['fileFormat']['model'].clear()
nb_export_formats = 0
formats = to_export.get_export_formats()
logger.info("[Export]: Supported formats: %s" % formats)
for out_format in to_export.get_export_formats():
self.main_win.export['fileFormat']['model'].append([out_format])
nb_export_formats += 1
self.main_win.export['buttons']['select_path'].set_sensitive(
nb_export_formats >= 1)
self.main_win.export['fileFormat']['widget'].set_active(0)
self.main_win.export['dialog'].set_visible(True)
self.main_win.export['buttons']['ok'].set_sensitive(False)
self.main_win.export['export_path'].set_text("")
self.main_win.lists['zoom_levels']['gui'].set_sensitive(False)
self.main_win.disable_boxes()
def do(self):
SimpleAction.do(self)
self.main_win.lists['zoom_levels']['gui'].set_sensitive(True)
self.main_win.export['dialog'].set_visible(False)
self.main_win.export['exporter'] = None
# force refresh of the current page
self.main_win.show_page(self.main_win.page)
def do(self):
SimpleAction.do(self)
chooser = Gtk.FileChooserDialog(title=_("Save as"),
parent=self.__main_win.window,
action=Gtk.FileChooserAction.SAVE,
buttons=(Gtk.STOCK_CANCEL,
Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE,
Gtk.ResponseType.OK))
file_filter = Gtk.FileFilter()
file_filter.set_name(str(self.__main_win.export['exporter']))
mime = self.__main_win.export['exporter'].get_mime_type()
file_filter.add_mime_type(mime)
chooser.add_filter(file_filter)
response = chooser.run()
filepath = chooser.get_filename()
chooser.destroy()
def do(self):
SimpleAction.do(self)
self.__main_win.window.destroy()
def do(self):
SimpleAction.do(self)
zoom_liststore = self.__main_win.lists['zoom_levels']['model']
zoom_list = [
(zoom_liststore[zoom_idx][1], zoom_idx)
for zoom_idx in range(0, len(zoom_liststore))
]
zoom_list.append((99999.0, -1))
zoom_list.sort()
current_zoom = self.__main_win.get_zoom_factor()
# figures out where the current zoom fits in the zoom list
current_idx = -1
for zoom_list_idx in range(0, len(zoom_list)):
def do(self):
if not ask_confirmation(self.__main_win.window):
return
SimpleAction.do(self)
self.__main_win.schedulers['main'].cancel_all(
self.__main_win.job_factories['ocr_redoer'])
job = self.__main_win.job_factories['ocr_redoer'].make(
self.__main_win.docsearch)
self.__main_win.schedulers['main'].schedule(job)