diff --git a/gramps/gui/clipboard.py b/gramps/gui/clipboard.py index 91c2ddd38..00ca79f83 100644 --- a/gramps/gui/clipboard.py +++ b/gramps/gui/clipboard.py @@ -58,7 +58,7 @@ from gen.constfunc import mac from gui.glade import Glade from gui.ddtargets import DdTargets from gui.makefilter import make_filter -import gui.utils +from gramps.gui.utils import is_right_click #------------------------------------------------------------------------- # @@ -1438,7 +1438,7 @@ class MultiTreeView(Gtk.TreeView): # Here we intercept mouse clicks on selected items so that we can # drag multiple items without the click selecting only one target = self.get_path_at_pos(int(event.x), int(event.y)) - if gui.utils.is_right_click(event): + if is_right_click(event): selection = widget.get_selection() store, paths = selection.get_selected_rows() tpath = paths[0] if len(paths) > 0 else None diff --git a/gramps/gui/editors/displaytabs/embeddedlist.py b/gramps/gui/editors/displaytabs/embeddedlist.py index 28d5ebff5..0223dd7c3 100644 --- a/gramps/gui/editors/displaytabs/embeddedlist.py +++ b/gramps/gui/editors/displaytabs/embeddedlist.py @@ -44,7 +44,7 @@ from gi.repository import Pango # GRAMPS classes # #------------------------------------------------------------------------- -import gui.utils +from gramps.gui.utils import is_right_click from buttontab import ButtonTab #------------------------------------------------------------------------- @@ -99,7 +99,7 @@ class EmbeddedList(ButtonTab): """ Handle button press, not double-click, that is done in init_interface """ - if gui.utils.is_right_click(event): + if is_right_click(event): ref = self.get_selected() if ref: self.right_click(obj, event) diff --git a/gramps/gui/editors/displaytabs/gallerytab.py b/gramps/gui/editors/displaytabs/gallerytab.py index 0b0cbd832..ffce2304e 100644 --- a/gramps/gui/editors/displaytabs/gallerytab.py +++ b/gramps/gui/editors/displaytabs/gallerytab.py @@ -49,7 +49,7 @@ from gi.repository import GObject # GRAMPS classes # #------------------------------------------------------------------------- -import gui.utils +from gramps.gui.utils import is_right_click, open_file_with_default_application from gui.dbguielement import DbGUIElement from gui.selectors import SelectorFactory import gen.lib @@ -69,7 +69,7 @@ from gen.const import THUMBSCALE # #------------------------------------------------------------------------- def make_launcher(path): - return lambda x: gui.utils.open_file_with_default_application(path) + return lambda x: open_file_with_default_application(path) #------------------------------------------------------------------------- # @@ -115,7 +115,7 @@ class GalleryTab(ButtonTab, DbGUIElement): if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: self.edit_button_clicked(obj) return True - elif gui.utils.is_right_click(event): + elif is_right_click(event): reflist = self.iconlist.get_selected_items() if len(reflist) == 1: path = reflist[0].get_indices() diff --git a/gramps/gui/editors/displaytabs/groupembeddedlist.py b/gramps/gui/editors/displaytabs/groupembeddedlist.py index 0c9a62dda..84462ec4e 100644 --- a/gramps/gui/editors/displaytabs/groupembeddedlist.py +++ b/gramps/gui/editors/displaytabs/groupembeddedlist.py @@ -42,7 +42,7 @@ from gi.repository import GObject # GRAMPS classes # #------------------------------------------------------------------------- -import gui.utils +from gramps.gui.utils import is_right_click from embeddedlist import EmbeddedList #------------------------------------------------------------------------- @@ -104,7 +104,7 @@ class GroupEmbeddedList(EmbeddedList): """ Handle button press, not double-click, that is done in init_interface """ - if gui.utils.is_right_click(event): + if is_right_click(event): obj = self.get_selected() if obj and obj[1]: self._tmpgroup = obj[0] diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index ba4816b18..3492e1c46 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -52,7 +52,7 @@ from gi.repository import Pango #------------------------------------------------------------------------- from gen.utils.file import media_path_full from gui.thumbnails import get_thumbnail_image -import gui.utils +from gramps.gui.utils import is_right_click, open_file_with_default_application from gen.utils.db import get_birth_or_fallback import gen.lib from gen.db import DbTxn @@ -605,7 +605,7 @@ class EditPerson(EditPrimary): except WindowActiveError: pass - elif gui.utils.is_right_click(event): + elif is_right_click(event): media_list = self.obj.get_media_list() if media_list: photo = media_list[0] @@ -639,7 +639,7 @@ class EditPerson(EditPrimary): object_handle = photo.get_reference_handle() ref_obj = self.db.get_object_from_handle(object_handle) photo_path = media_path_full(self.db, ref_obj.get_path()) - gui.utils.open_file_with_default_application(photo_path) + open_file_with_default_application(photo_path) def _popup_change_description(self, obj): """ diff --git a/gramps/gui/editors/editprimary.py b/gramps/gui/editors/editprimary.py index 06df9b3b3..5adc36c25 100644 --- a/gramps/gui/editors/editprimary.py +++ b/gramps/gui/editors/editprimary.py @@ -44,7 +44,7 @@ from gui.managedwindow import ManagedWindow import gen.datehandler from gen.display.name import displayer as name_displayer from gen.config import config -import gui.utils +from gramps.gui.utils import is_right_click from gui.display import display_help from gui.dialog import SaveDialog import gen.lib @@ -284,7 +284,7 @@ class EditPrimary(ManagedWindow, DbGUIElement): pressed while on contexteventbox It opens a context menu with possible actions """ - if gui.utils.is_right_click(event): + if is_right_click(event): if self.obj.get_handle() == 0 : return False diff --git a/gramps/gui/grampsbar.py b/gramps/gui/grampsbar.py index 574a4e4df..966941435 100644 --- a/gramps/gui/grampsbar.py +++ b/gramps/gui/grampsbar.py @@ -58,7 +58,7 @@ from gui.widgets.grampletpane import (AVAILABLE_GRAMPLETS, make_requested_gramplet, GuiGramplet) from gui.widgets.undoablebuffer import UndoableBuffer -import gui.utils +from gramps.gui.utils import is_right_click from gui.dialog import QuestionDialog #------------------------------------------------------------------------- @@ -416,7 +416,7 @@ class GrampsBar(Gtk.Notebook): """ Called when a button is pressed in the tabs section of the GrampsBar. """ - if gui.utils.is_right_click(event): + if is_right_click(event): menu = Gtk.Menu() ag_menu = Gtk.MenuItem(label=_('Add a gramplet')) diff --git a/gramps/gui/plug/export/_exportoptions.py b/gramps/gui/plug/export/_exportoptions.py index 0f0bb2d9a..1ccbfb41c 100644 --- a/gramps/gui/plug/export/_exportoptions.py +++ b/gramps/gui/plug/export/_exportoptions.py @@ -245,7 +245,7 @@ class WriterOptionBox(object): """ # Make a box and put the option in it: from gi.repository import Gtk - import gui.widgets + from gramps.gui.widgets import SimpleButton button = Gtk.Button(ngettext("%d Person", "%d People", 0) % 0) button.set_size_request(107, -1) button.connect("clicked", self.show_preview_data) @@ -262,7 +262,7 @@ class WriterOptionBox(object): box.pack_start(label, False, True, 0) box.pack_start(self.filter_obj, True, True, 0) box.pack_start( - gui.widgets.SimpleButton(Gtk.STOCK_EDIT, + SimpleButton(Gtk.STOCK_EDIT, lambda obj: self.edit_filter('Person', self.filter_obj)), False, True, 0) button.set_tooltip_text(_("Click to see preview after person filter")) @@ -279,7 +279,7 @@ class WriterOptionBox(object): box.pack_start(label_note, False, True, 0) box.pack_start(self.filter_note, True, True, 0) box.pack_start( - gui.widgets.SimpleButton(Gtk.STOCK_EDIT, + SimpleButton(Gtk.STOCK_EDIT, lambda obj: self.edit_filter('Note', self.filter_note)), False, True, 0) button.set_tooltip_text(_("Click to see preview after note filter")) diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index e50a8a316..7845c39ad 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -67,7 +67,7 @@ from gui.editors import FilterEditor from gen.ggettext import sgettext as _ from gui.ddtargets import DdTargets from gui.plug.quick import create_quickreport_menu, create_web_connect_menu -import gui.utils +from gramps.gui.utils import is_right_click #---------------------------------------------------------------- # @@ -804,7 +804,7 @@ class ListView(NavigationView): else: self.edit(obj) return True - elif gui.utils.is_right_click(event): + elif is_right_click(event): menu = self.uistate.uimanager.get_widget('/Popup') if menu: # Quick Reports diff --git a/gramps/gui/views/tags.py b/gramps/gui/views/tags.py index b69d5b946..7df9e40eb 100644 --- a/gramps/gui/views/tags.py +++ b/gramps/gui/views/tags.py @@ -50,7 +50,7 @@ from gui.listmodel import ListModel, NOSORT, COLOR, INTEGER from gen.const import URL_MANUAL_PAGE from gui.display import display_help from gui.dialog import ErrorDialog, QuestionDialog2 -import gui.widgets.progressdialog as progressdlg +import gramps.gui.widgets.progressdialog as progressdlg #------------------------------------------------------------------------- # diff --git a/gramps/gui/views/treemodels/treebasemodel.py b/gramps/gui/views/treemodels/treebasemodel.py index 8334f5694..03473a252 100644 --- a/gramps/gui/views/treemodels/treebasemodel.py +++ b/gramps/gui/views/treemodels/treebasemodel.py @@ -56,7 +56,7 @@ from gi.repository import Gtk # #------------------------------------------------------------------------- from gen.utils.cast import conv_str_tosrtkey, conv_unicode_tosrtkey -import gui.widgets.progressdialog as progressdlg +import gramps.gui.widgets.progressdialog as progressdlg from lru import LRU from bisect import bisect_right from gen.filters import SearchFilter, ExactSearchFilter diff --git a/gramps/gui/widgets/fanchart.py b/gramps/gui/widgets/fanchart.py index fd2442ec3..6f6200777 100644 --- a/gramps/gui/widgets/fanchart.py +++ b/gramps/gui/widgets/fanchart.py @@ -59,7 +59,7 @@ from gen.errors import WindowActiveError from gui.editors import EditPerson, EditFamily from gui.widgets.reorderfam import Reorder import gen.lib -import gui.utils +from gramps.gui.utils import color_graph_box, hex_to_rgb, is_right_click from gui.ddtargets import DdTargets from gen.utils.alive import probably_alive from gen.utils.libformatting import FormattingHelper @@ -331,8 +331,8 @@ class FanChartBaseWidget(Gtk.DrawingArea): needed for the background of the boxes """ maxgen = self.generations - cstart = gui.utils.hex_to_rgb(self.grad_start) - cend = gui.utils.hex_to_rgb(self.grad_end) + cstart = hex_to_rgb(self.grad_start) + cend = hex_to_rgb(self.grad_end) self.cstart_hsv = colorsys.rgb_to_hsv(cstart[0]/255, cstart[1]/255, cstart[2]/255) self.cend_hsv = colorsys.rgb_to_hsv(cend[0]/255, cend[1]/255, @@ -424,8 +424,8 @@ class FanChartBaseWidget(Gtk.DrawingArea): alive = probably_alive(person, self.dbstate.db) except RuntimeError: alive = False - backgr, border = gui.utils.color_graph_box(alive, person.gender) - color = gui.utils.hex_to_rgb(backgr) + backgr, border = color_graph_box(alive, person.gender) + color = hex_to_rgb(backgr) elif self.background == BACKGROUND_SINGLE_COLOR: color = self.maincolor elif self.background == BACKGROUND_GRAD_AGE: @@ -840,7 +840,7 @@ class FanChartBaseWidget(Gtk.DrawingArea): #right click on person, context menu # Do things based on state, event.get_state(), or button, event.button - if gui.utils.is_right_click(event): + if is_right_click(event): person = self.person_at(generation, selected, btype) family = self.family_at(generation, selected, btype) fhandle = None diff --git a/gramps/gui/widgets/fanchartdesc.py b/gramps/gui/widgets/fanchartdesc.py index 2a0b3f589..8f7c41606 100644 --- a/gramps/gui/widgets/fanchartdesc.py +++ b/gramps/gui/widgets/fanchartdesc.py @@ -57,7 +57,7 @@ from gen.display.name import displayer as name_displayer from gen.errors import WindowActiveError from gui.editors import EditPerson, EditFamily import gen.lib -import gui.utils +from gramps.gui.utils import hex_to_rgb from gui.ddtargets import DdTargets from gen.utils.alive import probably_alive from gen.utils.libformatting import FormattingHelper @@ -129,7 +129,7 @@ class FanChartDescWidget(FanChartBaseWidget): self.alpha_filter = alpha_filter self.form = form self.anglealgo = angle_algo - self.dupcolor = gui.utils.hex_to_rgb(dupcolor) + self.dupcolor = hex_to_rgb(dupcolor) def gen_pixels(self): """ diff --git a/gramps/gui/widgets/grampletpane.py b/gramps/gui/widgets/grampletpane.py index fa4bc7584..1ba28eaa1 100644 --- a/gramps/gui/widgets/grampletpane.py +++ b/gramps/gui/widgets/grampletpane.py @@ -48,7 +48,7 @@ from gen.errors import WindowActiveError from gen.const import URL_MANUAL_PAGE, VERSION_DIR from gui.editors import EditPerson, EditFamily from gui.managedwindow import ManagedWindow -import gui.utils +from gramps.gui.utils import is_right_click, rgb_to_hex from gui.widgets.menuitem import add_menuitem from gui.plug.quick import run_quick_report_by_name from gui.display import display_help, display_url @@ -190,7 +190,7 @@ class LinkTag(Gtk.TextTag): linkcolor = Gtk.Label(label='test') #needed to avoid label destroyed to early linkcolor = linkcolor.get_style_context().lookup_color('link_color') if linkcolor[0]: - linkcolor = gui.utils.rgb_to_hex((linkcolor[1].red, linkcolor[1].green, + linkcolor = rgb_to_hex((linkcolor[1].red, linkcolor[1].green, linkcolor[1].blue)) else: linkcolor = 'blue' @@ -615,7 +615,7 @@ class GuiGramplet(object): elif event.type == Gdk.EventType.BUTTON_PRESS: # single self.uistate.set_active(handle, 'Person') return True # handled event - elif gui.utils.is_right_click(event): + elif is_right_click(event): #FIXME: add a popup menu with options try: EditPerson(self.dbstate, @@ -676,7 +676,7 @@ class GuiGramplet(object): elif event.type == Gdk.EventType.BUTTON_PRESS: # single self.uistate.set_active(handle, 'Family') return True # handle event - elif gui.utils.is_right_click(event): + elif is_right_click(event): #FIXME: add a popup menu with options try: EditFamily(self.dbstate, @@ -1405,7 +1405,7 @@ class GrampletPane(Gtk.ScrolledWindow): print "Can't make gramplet of type '%s'." % name def _button_press(self, obj, event): - if gui.utils.is_right_click(event): + if is_right_click(event): self._popup_xy = (event.x, event.y) uiman = self.uistate.uimanager ag_menu = uiman.get_widget('/GrampletPopup/AddGramplet') diff --git a/gramps/plugins/bookreport.py b/gramps/plugins/bookreport.py index 761b7f14e..db8ce11a5 100644 --- a/gramps/plugins/bookreport.py +++ b/gramps/plugins/bookreport.py @@ -78,8 +78,8 @@ from gui.dialog import WarningDialog, ErrorDialog from gen.plug.menu import PersonOption, FilterOption, FamilyOption from gui.managedwindow import ManagedWindow, set_titles from gui.glade import Glade -import gui.utils -import gui.user +from gramps.gui.utils import is_right_click, open_file_with_default_application +from gramps.gui.user import User from gui.plug import make_gui_option from types import ClassType @@ -972,7 +972,7 @@ class BookReportSelector(ManagedWindow): """ if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: self.on_setup_clicked(obj) - elif gui.utils.is_right_click(event): + elif is_right_click(event): self.build_book_context_menu(event) def avail_button_press(self, obj, event): @@ -982,7 +982,7 @@ class BookReportSelector(ManagedWindow): """ if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: self.on_add_clicked(obj) - elif gui.utils.is_right_click(event): + elif is_right_click(event): self.build_avail_context_menu(event) def build_book_context_menu(self, event): @@ -1310,7 +1310,7 @@ class BookReportDialog(DocReportDialog): """Create a document of the type requested by the user.""" pstyle = self.paper_frame.get_paper_style() self.doc = self.format(self.selected_style, pstyle) - user = gui.user.User() + user = User() self.rptlist = [] for item in self.book.get_item_list(): item.option_class.set_document(self.doc) @@ -1336,7 +1336,7 @@ class BookReportDialog(DocReportDialog): self.doc.close() if self.open_with_app.get_active(): - gui.utils.open_file_with_default_application(self.target_path) + open_file_with_default_application(self.target_path) def init_options(self, option_class): try: diff --git a/gramps/plugins/gramplet/fanchartdescgramplet.py b/gramps/plugins/gramplet/fanchartdescgramplet.py index 555bd9b3e..cdbf321d9 100644 --- a/gramps/plugins/gramplet/fanchartdescgramplet.py +++ b/gramps/plugins/gramplet/fanchartdescgramplet.py @@ -47,7 +47,6 @@ from gen.plug import Gramplet import gen.lib from gen.errors import WindowActiveError from gui.editors import EditPerson -import gui.utils from gui.widgets.fanchartdesc import (FanChartDescWidget, FanChartDescGrampsGUI, ANGLE_WEIGHT) from gui.widgets.fanchart import FORM_HALFCIRCLE, BACKGROUND_SCHEME1 diff --git a/gramps/plugins/gramplet/fanchartgramplet.py b/gramps/plugins/gramplet/fanchartgramplet.py index 80957630e..92fffca81 100644 --- a/gramps/plugins/gramplet/fanchartgramplet.py +++ b/gramps/plugins/gramplet/fanchartgramplet.py @@ -53,7 +53,6 @@ from gen.plug import Gramplet import gen.lib from gen.errors import WindowActiveError from gui.editors import EditPerson -import gui.utils from gui.widgets.fanchart import (FanChartWidget, FanChartGrampsGUI, FORM_HALFCIRCLE, BACKGROUND_SCHEME1) diff --git a/gramps/plugins/tool/leak.py b/gramps/plugins/tool/leak.py index 5d13c5b09..ec7c8c131 100644 --- a/gramps/plugins/tool/leak.py +++ b/gramps/plugins/tool/leak.py @@ -57,7 +57,7 @@ from gui.plug import tool from gui.managedwindow import ManagedWindow from gui.dialog import InfoDialog from gui.glade import Glade -import gui.utils +from gramps.gui.utils import is_right_click #------------------------------------------------------------------------- # @@ -118,7 +118,7 @@ class Leak(tool.Tool, ManagedWindow): if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: self.referenced_in() return True - elif gui.utils.is_right_click(event): + elif is_right_click(event): self.refers_to() return True diff --git a/gramps/plugins/tool/ownereditor.py b/gramps/plugins/tool/ownereditor.py index 9a354f60e..ae1d2acea 100644 --- a/gramps/plugins/tool/ownereditor.py +++ b/gramps/plugins/tool/ownereditor.py @@ -46,7 +46,7 @@ from gui.managedwindow import ManagedWindow from gui.plug import tool from gen.ggettext import sgettext as _ from gui.glade import Glade -import gui.utils +from gramps.gui.utils import is_right_click #------------------------------------------------------------------------- # @@ -155,7 +155,7 @@ class OwnerEditor(tool.Tool, ManagedWindow): def on_button_press_event(self, obj, event): """Shows popup-menu for db <-> preferences copying""" - if gui.utils.is_right_click(event): + if is_right_click(event): self.menu.popup(None, None, None, None, 0, 0) def build_menu_names(self, obj): diff --git a/gramps/plugins/view/fanchartdescview.py b/gramps/plugins/view/fanchartdescview.py index 6b2264927..f1887f8f7 100644 --- a/gramps/plugins/view/fanchartdescview.py +++ b/gramps/plugins/view/fanchartdescview.py @@ -43,8 +43,8 @@ from gen.ggettext import gettext as _ # #------------------------------------------------------------------------- import gen.lib -import gui.widgets.fanchart as fanchart -import gui.widgets.fanchartdesc as fanchartdesc +import gramps.gui.widgets.fanchart as fanchart +import gramps.gui.widgets.fanchartdesc as fanchartdesc from gui.views.navigationview import NavigationView from gui.views.bookmarks import PersonBookmarks from gui.utils import SystemFonts diff --git a/gramps/plugins/view/fanchartview.py b/gramps/plugins/view/fanchartview.py index e8e5537e9..281b05664 100644 --- a/gramps/plugins/view/fanchartview.py +++ b/gramps/plugins/view/fanchartview.py @@ -43,7 +43,7 @@ from gen.ggettext import gettext as _ # #------------------------------------------------------------------------- import gen.lib -import gui.widgets.fanchart as fanchart +import gramps.gui.widgets.fanchart as fanchart from gui.views.navigationview import NavigationView from gui.views.bookmarks import PersonBookmarks from gui.utils import SystemFonts diff --git a/gramps/plugins/view/pedigreeview.py b/gramps/plugins/view/pedigreeview.py index 2ef2bd2a6..4b3cfc547 100644 --- a/gramps/plugins/view/pedigreeview.py +++ b/gramps/plugins/view/pedigreeview.py @@ -71,7 +71,7 @@ from gui.views.bookmarks import PersonBookmarks from gen.const import CUSTOM_FILTERS from gen.constfunc import is_quartz, win from gui.dialog import RunDatabaseRepair, ErrorDialog -import gui.utils +from gramps.gui.utils import color_graph_box, hex_to_rgb_float, is_right_click #------------------------------------------------------------------------- # @@ -195,9 +195,9 @@ class PersonBoxWidgetCairo(_PersonWidgetBase): gender = self.person.get_gender() else: gender = None - self.bgcolor, self.bordercolor = gui.utils.color_graph_box(alive, gender) - self.bgcolor = gui.utils.hex_to_rgb_float(self.bgcolor) - self.bordercolor = gui.utils.hex_to_rgb_float(self.bordercolor) + self.bgcolor, self.bordercolor = color_graph_box(alive, gender) + self.bgcolor = hex_to_rgb_float(self.bgcolor) + self.bordercolor = hex_to_rgb_float(self.bordercolor) self.img_surf = None if image: @@ -1326,7 +1326,7 @@ class PedigreeView(NavigationView): self._last_y = event.y self._in_move = True return True - elif gui.utils.is_right_click(event): + elif is_right_click(event): self.cb_on_show_option_menu(widget, event) return True return False @@ -1380,7 +1380,7 @@ class PedigreeView(NavigationView): or submenu for person for mouse right click. And setup plug for button press on person widget. """ - if gui.utils.is_right_click(event): + if is_right_click(event): self.cb_build_full_nav_menu(obj, event, person_handle, family_handle) return True @@ -1395,7 +1395,7 @@ class PedigreeView(NavigationView): on family line or call full submenu for mouse right click. And setup plug for button press on family line. """ - if gui.utils.is_right_click(event): + if is_right_click(event): self.cb_build_relation_nav_menu(obj, event, family_handle) return True elif event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: @@ -1412,7 +1412,7 @@ class PedigreeView(NavigationView): if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: self.cb_add_parents(obj, person_handle, family_handle) return True - elif gui.utils.is_right_click(event): + elif is_right_click(event): self.cb_build_missing_parent_nav_menu(obj, event, person_handle, family_handle) return True