Changes to imports - part 1

svn: r20485
This commit is contained in:
Nick Hall 2012-10-02 19:29:32 +00:00
parent 507487f9c4
commit 2f87a2d38a
22 changed files with 57 additions and 59 deletions

View File

@ -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

View File

@ -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)

View File

@ -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()

View File

@ -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]

View File

@ -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):
"""

View File

@ -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

View File

@ -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'))

View File

@ -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"))

View File

@ -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

View File

@ -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
#-------------------------------------------------------------------------
#

View File

@ -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

View File

@ -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

View File

@ -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):
"""

View File

@ -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')

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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