Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def edit(self, main_window):
"""
Open the edit dialog, and update the label according to user changes
"""
widget_tree = load_uifile(
os.path.join("labeleditor", "labeleditor.glade"))
dialog = widget_tree.get_object("dialogLabelEditor")
dialog.set_transient_for(main_window)
# don't force the window to be centered. Otherwise, user can't use the
# picker to pick colors from the current document
dialog.set_position(Gtk.WindowPosition.NONE)
self.__ok_button = widget_tree.get_object("buttonOk")
self._pick_button = widget_tree.get_object("buttonPickColor")
PickColorAction(self).connect([self._pick_button])
self._color_chooser = widget_tree.get_object("labelColorChooser")
self._color_chooser.set_rgba(self.label.color)
def __select_importer(self, importers):
widget_tree = load_uifile(
os.path.join("import", "importaction.glade"))
combobox = widget_tree.get_object("comboboxImportAction")
importer_list = widget_tree.get_object("liststoreImportAction")
dialog = widget_tree.get_object("dialogImportSelect")
importer_list.clear()
for importer in importers:
importer_list.append([str(importer), importer])
response = dialog.run()
if not response:
raise Exception("Import cancelled by user")
active_idx = combobox.get_active()
return importer_list[active_idx][1]
def __init__(self, main_window, config):
GObject.GObject.__init__(self)
self.main_window = main_window
self.schedulers = {
'main': main_window.schedulers['main'],
}
self.scanned_pages = 0
self.__config = config
widget_tree = load_uifile(
os.path.join("multiscan", "multiscan.glade"))
# self.widget_tree is for tests/screenshots ONLY
self.widget_tree = widget_tree
self.window = widget_tree.get_object("dialogMultiscan")
scan_scrollbars = widget_tree.get_object("scrolledwindowScan")
self.scan_canvas = Canvas(scan_scrollbars)
self.scan_canvas.set_visible(True)
scan_scrollbars.add(self.scan_canvas)
self.lists = {
'docs': {
'gui': widget_tree.get_object("treeviewScanList"),
'model': widget_tree.get_object("liststoreScanList"),
'columns': {
def __init__(self, main_scheduler, mainwindow_gui, config):
super(SettingsWindow, self).__init__()
self.schedulers = {
'main': main_scheduler,
'progress': JobScheduler('progress'),
}
self.local_schedulers = [
self.schedulers['progress'],
]
widget_tree = load_uifile(
os.path.join("settingswindow", "settingswindow.glade"))
# self.widget_tree is for tests/screenshots ONLY
self.widget_tree = widget_tree
distrib = platform.dist()
if distrib:
distrib = distrib[0].lower()
logger.info("Distribution: [%s]" % distrib)
for widget in widget_tree.get_objects():
if type(widget) == Gtk.LinkButton:
uri = widget.get_uri()
uri += "#" + distrib
widget.set_uri(uri)
self.window = widget_tree.get_object("windowSettings")
self.window.set_transient_for(mainwindow_gui)
def __init__(self, main_win):
widget_tree = load_uifile(
os.path.join("diag", "diagdialog.glade"))
self.buf = widget_tree.get_object("textbufferDiag")
self.dialog = widget_tree.get_object("dialogDiag")
self.dialog.set_transient_for(main_win.window)
self.dialog.connect("response", self.on_response_cb)
self.progressbar = widget_tree.get_object("progressbarDiag")
self.scrollwin = widget_tree.get_object("scrolledwindowDiag")
self._main_win = main_win
self.set_text(_("Please wait. It may take a few minutes ..."))
def __select_file(self):
widget_tree = load_uifile(
os.path.join("import", "importfileselector.glade"))
dialog = widget_tree.get_object("filechooserdialog")
dialog.set_transient_for(self.__main_win.window)
dialog.set_local_only(False)
dialog.set_select_multiple(False)
response = dialog.run()
if response != 0:
logger.info("Import: Canceled by user")
dialog.destroy()
return None
file_uri = dialog.get_uri()
dialog.destroy()
logger.info("Import: %s" % file_uri)
return file_uri
def __init__(self, main_window):
self.widget_tree = load_uifile(
os.path.join("searchdialog", "searchdialog.glade"))
self.__main_win = main_window
self._labels = self.__main_win.docsearch.label_list
self.dialog = self.widget_tree.get_object("searchDialog")
self.dialog.set_transient_for(main_window.window)
self.__search_string = None
keywords = self.__main_win.search_field.get_text()
keywords = keywords.strip()
keywords = re.findall(
r'(?:\[.*\]|(?:[^\s"]|"(?:\\.|[^"])*"))+', keywords
)
def __init__(self, main_window, page):
self.page = page
widget_tree = load_uifile(
os.path.join("pageeditor", "pageeditor.glade"))
self.__dialog = widget_tree.get_object("dialogPageEditing")
self.__dialog.set_transient_for(main_window.window)
img_scrollbars = widget_tree.get_object("scrolledwindowOriginal")
img_canvas = Canvas(img_scrollbars)
img_canvas.set_visible(True)
img_scrollbars.add(img_canvas)
self.__original_img_widgets = {
'img': img_canvas,
'scrolledwindow': img_scrollbars,
'eventbox': widget_tree.get_object("eventboxOriginal"),
'zoom': widget_tree.get_object("adjustmentZoom"),
}
def __init_app_menu(self, config, app):
app_menu = load_uifile(os.path.join("mainwindow", "appmenu.xml"))
advanced_menu = app_menu.get_object("advanced")
if activation.is_activated(config):
menu = app_menu.get_object("menu_end")
menu.remove(0)
app.set_app_menu(app_menu.get_object("app-menu"))
return advanced_menu