Convert gui to use relative imports

svn: r20506
This commit is contained in:
Nick Hall 2012-10-03 15:34:50 +00:00
parent 3a52f3afcb
commit 1cde34b45d
18 changed files with 80 additions and 80 deletions

View File

@ -56,7 +56,7 @@ from gi.repository import GdkPixbuf
from gramps.gen.const import (AUTHORS, AUTHORS_FILE, COMMENTS, COPYRIGHT_MSG, from gramps.gen.const import (AUTHORS, AUTHORS_FILE, COMMENTS, COPYRIGHT_MSG,
DOCUMENTERS, LICENSE_FILE, PROGRAM_NAME, SPLASH, DOCUMENTERS, LICENSE_FILE, PROGRAM_NAME, SPLASH,
TRANSLATORS, URL_HOMEPAGE, VERSION) TRANSLATORS, URL_HOMEPAGE, VERSION)
from gramps.gui.display import display_url from .display import display_url
from gramps.gen.config import config from gramps.gen.config import config
if config.get('preferences.use-bsddb3'): if config.get('preferences.use-bsddb3'):

View File

@ -50,15 +50,15 @@ from gramps.gen.const import IMAGE_DIR, URL_MANUAL_PAGE
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gen.lib import NoteType from gramps.gen.lib import NoteType
from gramps.gen.datehandler import get_date from gramps.gen.datehandler import get_date
from gramps.gui.display import display_help from .display import display_help
from gramps.gui.managedwindow import ManagedWindow from .managedwindow import ManagedWindow
from gramps.gen.ggettext import sgettext as _ from gramps.gen.ggettext import sgettext as _
from gramps.gen.utils.trans import trans_objclass from gramps.gen.utils.trans import trans_objclass
from gramps.gen.constfunc import mac from gramps.gen.constfunc import mac
from gramps.gui.glade import Glade from .glade import Glade
from gramps.gui.ddtargets import DdTargets from .ddtargets import DdTargets
from gramps.gui.makefilter import make_filter from .makefilter import make_filter
from gramps.gui.utils import is_right_click from .utils import is_right_click
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1517,7 +1517,7 @@ class MultiTreeView(Gtk.TreeView):
self.defer_select=False self.defer_select=False
def edit_obj(self, objclass, handle): def edit_obj(self, objclass, handle):
from gramps.gui.editors import (EditPerson, EditEvent, EditFamily, EditSource, from .editors import (EditPerson, EditEvent, EditFamily, EditSource,
EditPlace, EditRepository, EditNote, EditMedia) EditPlace, EditRepository, EditNote, EditMedia)
if objclass == 'Person': if objclass == 'Person':
person = self.dbstate.db.get_person_from_handle(handle) person = self.dbstate.db.get_person_from_handle(handle)

View File

@ -48,8 +48,8 @@ from gi.repository import GObject
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.managedwindow import ManagedWindow from .managedwindow import ManagedWindow
from gramps.gui.glade import Glade from .glade import Glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -58,10 +58,10 @@ from gramps.gen.utils.keyword import (get_keywords, get_translation_from_keyword
get_translations, get_keyword_from_translation) get_translations, get_keyword_from_translation)
from gramps.gen.lib import Date, FamilyRelType from gramps.gen.lib import Date, FamilyRelType
from gramps.gen.lib import Name, Surname, NameOriginType from gramps.gen.lib import Name, Surname, NameOriginType
from gramps.gui.managedwindow import ManagedWindow from .managedwindow import ManagedWindow
from gramps.gui.widgets import MarkupLabel, BasicLabel from .widgets import MarkupLabel, BasicLabel
from gramps.gui.dialog import ErrorDialog, QuestionDialog2, OkDialog from .dialog import ErrorDialog, QuestionDialog2, OkDialog
from gramps.gui.glade import Glade from .glade import Glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -62,10 +62,10 @@ from gramps.gen.db.exceptions import (DbUpgradeRequiredError,
DbVersionError, DbVersionError,
DbEnvironmentError) DbEnvironmentError)
from gramps.gen.utils.file import get_unicode_path_from_file_chooser from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from gramps.gui.pluginmanager import GuiPluginManager from .pluginmanager import GuiPluginManager
from gramps.gui.dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2, from .dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
WarningDialog) WarningDialog)
from gramps.gui.user import User from .user import User
from gramps.gen.errors import DbError from gramps.gen.errors import DbError
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -70,14 +70,14 @@ from gi.repository import Pango
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.ggettext import gettext as _ from gramps.gen.ggettext import gettext as _
from gramps.gui.user import User from .user import User
from gramps.gui.dialog import ErrorDialog, QuestionDialog, QuestionDialog2 from .dialog import ErrorDialog, QuestionDialog, QuestionDialog2
from gramps.gen.db import DbBsddb from gramps.gen.db import DbBsddb
from gramps.gui.pluginmanager import GuiPluginManager from .pluginmanager import GuiPluginManager
from gramps.cli.clidbman import CLIDbManager, NAME_FILE, time_val from gramps.cli.clidbman import CLIDbManager, NAME_FILE, time_val
from gramps.gui.ddtargets import DdTargets from .ddtargets import DdTargets
from gramps.gen.recentfiles import rename_filename, remove_filename from gramps.gen.recentfiles import rename_filename, remove_filename
from gramps.gui.glade import Glade from .glade import Glade
from gramps.gen.db.backup import restore from gramps.gen.db.backup import restore
from gramps.gen.db.exceptions import DbException from gramps.gen.db.exceptions import DbException
from gramps.gen.utils.file import get_unicode_path_from_env_var from gramps.gen.utils.file import get_unicode_path_from_env_var

View File

@ -39,7 +39,7 @@
The module defines a singleton instance of _DdTargets called DdTargets. The module defines a singleton instance of _DdTargets called DdTargets.
from gramps.gui.ddtargets import DdTargets from .ddtargets import DdTargets
drag_dest_set(Gtk.DestDefaults.ALL, drag_dest_set(Gtk.DestDefaults.ALL,
DdTargets.all_targets(), DdTargets.all_targets(),

View File

@ -45,7 +45,7 @@ from gi.repository import GdkPixbuf
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import ICON from gramps.gen.const import ICON
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gui.glade import Glade from .glade import Glade
from gramps.gen.ggettext import gettext as _ from gramps.gen.ggettext import gettext as _
try: try:

View File

@ -55,13 +55,13 @@ from gi.repository import GObject
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.utils.callback import Callback from gramps.gen.utils.callback import Callback
from gramps.gui.utils import process_pending_events from .utils import process_pending_events
from gramps.gui.views.navigationview import NavigationView from .views.navigationview import NavigationView
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gen.display.name import displayer as name_displayer from gramps.gen.display.name import displayer as name_displayer
from gramps.gui.managedwindow import GrampsWindowManager from .managedwindow import GrampsWindowManager
from gramps.gen.relationship import get_relationship_calculator from gramps.gen.relationship import get_relationship_calculator
from gramps.gui.glade import Glade from .glade import Glade
from gramps.gen.utils.db import navigation_label from gramps.gen.utils.db import navigation_label
DISABLED = -1 DISABLED = -1
@ -306,7 +306,7 @@ def by_time(first, second):
return cmp(second.get_time(), first.get_time()) return cmp(second.get_time(), first.get_time())
from gramps.gui.logger import RotateHandler from .logger import RotateHandler
class WarnHandler(RotateHandler): class WarnHandler(RotateHandler):

View File

@ -48,18 +48,18 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR
from gramps.gui.managedwindow import ManagedWindow from .managedwindow import ManagedWindow
from gramps.gui.display import display_help, display_url from .display import display_help, display_url
from gramps.gui.widgets.grampletpane import (AVAILABLE_GRAMPLETS, from .widgets.grampletpane import (AVAILABLE_GRAMPLETS,
GET_AVAILABLE_GRAMPLETS, GET_AVAILABLE_GRAMPLETS,
GET_GRAMPLET_LIST, GET_GRAMPLET_LIST,
get_gramplet_opts, get_gramplet_opts,
get_gramplet_options_by_name, get_gramplet_options_by_name,
make_requested_gramplet, make_requested_gramplet,
GuiGramplet) GuiGramplet)
from gramps.gui.widgets.undoablebuffer import UndoableBuffer from .widgets.undoablebuffer import UndoableBuffer
from gramps.gui.utils import is_right_click from .utils import is_right_click
from gramps.gui.dialog import QuestionDialog from .dialog import QuestionDialog
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -88,7 +88,7 @@ def register_stock_icons ():
Add the gramps names for its icons (eg gramps-person) to the GTK icon Add the gramps names for its icons (eg gramps-person) to the GTK icon
factory. This allows all gramps modules to call up the icons by their name factory. This allows all gramps modules to call up the icons by their name
""" """
from gramps.gui.pluginmanager import base_reg_stock_icons from .pluginmanager import base_reg_stock_icons
#iconpath to the base image. The front of the list has highest priority #iconpath to the base image. The front of the list has highest priority
if win(): if win():
@ -186,7 +186,7 @@ def _display_welcome_message():
Display a welcome message to the user. Display a welcome message to the user.
""" """
if not config.get('behavior.betawarn'): if not config.get('behavior.betawarn'):
from gramps.gui.dialog import WarningDialog from .dialog import WarningDialog
WarningDialog( WarningDialog(
_('Danger: This is unstable code!'), _('Danger: This is unstable code!'),
_("This Gramps 3.x-trunk is a development release. " _("This Gramps 3.x-trunk is a development release. "
@ -226,7 +226,7 @@ class Gramps(object):
import viewmanager import viewmanager
from viewmanager import ViewManager from viewmanager import ViewManager
from gramps.cli.arghandler import ArgHandler from gramps.cli.arghandler import ArgHandler
from gramps.gui.tipofday import TipOfDay from .tipofday import TipOfDay
register_stock_icons() register_stock_icons()
@ -259,7 +259,7 @@ class Gramps(object):
TipOfDay(self.vm.uistate) TipOfDay(self.vm.uistate)
def argerrorfunc(self, string): def argerrorfunc(self, string):
from gramps.gui.dialog import ErrorDialog from .dialog import ErrorDialog
""" Show basic errors in argument handling in GUI fashion""" """ Show basic errors in argument handling in GUI fashion"""
ErrorDialog(_("Error parsing arguments"), string) ErrorDialog(_("Error parsing arguments"), string)
@ -274,7 +274,7 @@ def __startgramps(errors, argparser):
Main startup function started via GObject.timeout_add Main startup function started via GObject.timeout_add
First action inside the gtk loop First action inside the gtk loop
""" """
from gramps.gui.dialog import ErrorDialog from .dialog import ErrorDialog
#handle first existing errors in GUI fashion #handle first existing errors in GUI fashion
if errors: if errors:
ErrorDialog(errors[0], errors[1]) ErrorDialog(errors[0], errors[1])
@ -287,7 +287,7 @@ def __startgramps(errors, argparser):
sys.exit(1) sys.exit(1)
# add gui logger # add gui logger
from gramps.gui.logger import RotateHandler, GtkHandler from .logger import RotateHandler, GtkHandler
form = logging.Formatter(fmt="%(relativeCreated)d: %(levelname)s: " form = logging.Formatter(fmt="%(relativeCreated)d: %(levelname)s: "
"%(filename)s: line %(lineno)d: %(message)s") "%(filename)s: line %(lineno)d: %(message)s")
# Create the log handlers # Create the log handlers

View File

@ -21,7 +21,7 @@
# $Id$ # $Id$
import time import time
from gramps.gui.editors import EditFilter from .editors import EditFilter
from gramps.gen.const import CUSTOM_FILTERS from gramps.gen.const import CUSTOM_FILTERS
from gramps.gen.filters import (rules, FilterList, GenericFilterFactory, from gramps.gen.filters import (rules, FilterList, GenericFilterFactory,
reload_custom_filters) reload_custom_filters)

View File

@ -49,7 +49,7 @@ from gi.repository import Gtk
from gramps.gen.const import GLADE_FILE, ICON from gramps.gen.const import GLADE_FILE, ICON
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gui.glade import Glade from .glade import Glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -321,7 +321,7 @@ class ManagedWindow(object):
The usage from derived classes is envisioned as follows: The usage from derived classes is envisioned as follows:
from gramps.gui.managedwindow import ManagedWindow from .managedwindow import ManagedWindow
class SomeWindowClass(ManagedWindow): class SomeWindowClass(ManagedWindow):
def __init__(self,uistate,dbstate,track): def __init__(self,uistate,dbstate,track):
window_id = self # Or e.g. window_id = person.handle window_id = self # Or e.g. window_id = person.handle

View File

@ -47,9 +47,9 @@ import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import IMAGE_DIR, TIP_DATA from gramps.gen.const import IMAGE_DIR, TIP_DATA
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gui.managedwindow import ManagedWindow from .managedwindow import ManagedWindow
from gramps.gui.dialog import ErrorDialog from .dialog import ErrorDialog
from gramps.gui.glade import Glade from .glade import Glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -44,8 +44,8 @@ from gi.repository import GObject
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.dialog import QuestionDialog from .dialog import QuestionDialog
from gramps.gui.managedwindow import ManagedWindow from .managedwindow import ManagedWindow
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -37,8 +37,8 @@ import sys
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.user import User from gramps.gen.user import User
from gramps.gui.utils import ProgressMeter from .utils import ProgressMeter
from gramps.gui.dialog import (WarningDialog, ErrorDialog, DBErrorDialog, from .dialog import (WarningDialog, ErrorDialog, DBErrorDialog,
InfoDialog) InfoDialog)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -285,7 +285,7 @@ class ProgressMeter(object):
""" """
Don't let the user close the progress dialog. Don't let the user close the progress dialog.
""" """
from gramps.gui.dialog import WarningDialog from .dialog import WarningDialog
WarningDialog( WarningDialog(
_("Attempt to force closing the dialog"), _("Attempt to force closing the dialog"),
_("Please do not force closing this important dialog."), _("Please do not force closing this important dialog."),
@ -355,7 +355,7 @@ def open_file_with_default_application( file_path ):
@type file_path: string @type file_path: string
@return: nothing @return: nothing
""" """
from gramps.gui.dialog import ErrorDialog from .dialog import ErrorDialog
norm_path = os.path.normpath( file_path ) norm_path = os.path.normpath( file_path )
if not os.path.exists(norm_path): if not os.path.exists(norm_path):

View File

@ -66,38 +66,38 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.cli.grampscli import CLIManager from gramps.cli.grampscli import CLIManager
from gramps.gui.user import User from .user import User
from gramps.gui.plug import tool from .plug import tool
from gramps.gen.plug import (START, END) from gramps.gen.plug import (START, END)
from gramps.gen.plug import REPORT from gramps.gen.plug import REPORT
from gramps.gen.plug.report._constants import standalone_categories from gramps.gen.plug.report._constants import standalone_categories
from gramps.gui.plug import (PluginWindows, ReportPluginDialog, ToolPluginDialog) from .plug import (PluginWindows, ReportPluginDialog, ToolPluginDialog)
from gramps.gui.plug.report import report from .plug.report import report
from gramps.gen.plug.utils import version_str_to_tup, load_addon_file from gramps.gen.plug.utils import version_str_to_tup, load_addon_file
from gramps.gui.pluginmanager import GuiPluginManager from .pluginmanager import GuiPluginManager
from gramps.gen.relationship import get_relationship_calculator from gramps.gen.relationship import get_relationship_calculator
from gramps.gui.displaystate import DisplayState, RecentDocsMenu from .displaystate import DisplayState, RecentDocsMenu
from gramps.gen.const import (HOME_DIR, ICON, URL_BUGTRACKER, URL_HOMEPAGE, from gramps.gen.const import (HOME_DIR, ICON, URL_BUGTRACKER, URL_HOMEPAGE,
URL_MAILINGLIST, URL_MANUAL_PAGE, URL_WIKISTRING, URL_MAILINGLIST, URL_MANUAL_PAGE, URL_WIKISTRING,
WIKI_EXTRAPLUGINS) WIKI_EXTRAPLUGINS)
from gramps.gen.constfunc import is_quartz from gramps.gen.constfunc import is_quartz
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from gramps.gui.dialog import (ErrorDialog, WarningDialog, QuestionDialog2, from .dialog import (ErrorDialog, WarningDialog, QuestionDialog2,
InfoDialog) InfoDialog)
from gramps.gui import widgets from . import widgets
from gramps.gui.undohistory import UndoHistory from .undohistory import UndoHistory
from gramps.gen.utils.file import (media_path_full, get_unicode_path_from_env_var, from gramps.gen.utils.file import (media_path_full, get_unicode_path_from_env_var,
get_unicode_path_from_file_chooser) get_unicode_path_from_file_chooser)
from gramps.gui.dbloader import DbLoader from .dbloader import DbLoader
from gramps.gui.display import display_help, display_url from .display import display_help, display_url
from gramps.gui.widgets.progressdialog import ProgressMonitor, GtkProgressDialog from .widgets.progressdialog import ProgressMonitor, GtkProgressDialog
from gramps.gui.configure import GrampsPreferences from .configure import GrampsPreferences
from gramps.gen.db.backup import backup from gramps.gen.db.backup import backup
from gramps.gen.db.exceptions import DbException from gramps.gen.db.exceptions import DbException
from gramps.gui.aboutdialog import GrampsAboutDialog from .aboutdialog import GrampsAboutDialog
from gramps.gui.navigator import Navigator from .navigator import Navigator
from gramps.gui.views.tags import Tags from .views.tags import Tags
from gramps.gen.utils.configmanager import safe_eval from gramps.gen.utils.configmanager import safe_eval
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -435,16 +435,16 @@ class ViewManager(CLIManager):
if addon_update_list: if addon_update_list:
self.update_addons(addon_update_list) self.update_addons(addon_update_list)
elif force: elif force:
from gramps.gui.dialog import OkDialog from .dialog import OkDialog
OkDialog(_("There are no available addons of this type"), OkDialog(_("There are no available addons of this type"),
_("Checked for '%s'") % _("Checked for '%s'") %
_("' and '").join([_(t) for t in config.get('behavior.check-for-update-types')]), _("' and '").join([_(t) for t in config.get('behavior.check-for-update-types')]),
self.window) self.window)
def update_addons(self, addon_update_list): def update_addons(self, addon_update_list):
from gramps.gui.glade import Glade from .glade import Glade
from gramps.gui.managedwindow import set_titles from .managedwindow import set_titles
from gramps.gui.listmodel import ListModel, NOSORT, TOGGLE from .listmodel import ListModel, NOSORT, TOGGLE
glade = Glade("updateaddons.glade") glade = Glade("updateaddons.glade")
self.update_dialog = glade.toplevel self.update_dialog = glade.toplevel
set_titles(self.update_dialog, glade.get_object('title'), set_titles(self.update_dialog, glade.get_object('title'),
@ -521,8 +521,8 @@ class ViewManager(CLIManager):
""" """
Process all of the selected addons. Process all of the selected addons.
""" """
from gramps.gui.dialog import OkDialog from .dialog import OkDialog
from gramps.gui.widgets.progressdialog import LongOpStatus from .widgets.progressdialog import LongOpStatus
self.update_dialog.hide() self.update_dialog.hide()
model = self.list.model model = self.list.model
@ -1112,7 +1112,7 @@ class ViewManager(CLIManager):
""" """
Display Tip of the day Display Tip of the day
""" """
from gramps.gui.tipofday import TipOfDay from .tipofday import TipOfDay
TipOfDay(self.uistate) TipOfDay(self.uistate)
def __plugin_status(self, obj=None, data=None): def __plugin_status(self, obj=None, data=None):
@ -1200,7 +1200,7 @@ class ViewManager(CLIManager):
return None return None
def __create_dummy_page(self, pdata, error): def __create_dummy_page(self, pdata, error):
from gramps.gui.views.pageview import DummyPage from .views.pageview import DummyPage
return DummyPage(pdata.name, pdata, self.dbstate, self.uistate, return DummyPage(pdata.name, pdata, self.dbstate, self.uistate,
_("View failed to load. Check error output."), error) _("View failed to load. Check error output."), error)
@ -1472,7 +1472,7 @@ class ViewManager(CLIManager):
""" """
Make a quick XML back with or without media. Make a quick XML back with or without media.
""" """
from gramps.gui.dialog import QuestionDialog2 from .dialog import QuestionDialog2
window = Gtk.Dialog(_("Gramps XML Backup"), window = Gtk.Dialog(_("Gramps XML Backup"),
self.uistate.window, self.uistate.window,
Gtk.DialogFlags.DESTROY_WITH_PARENT, None) Gtk.DialogFlags.DESTROY_WITH_PARENT, None)
@ -1663,7 +1663,7 @@ class ViewManager(CLIManager):
""" """
Displays the Clipboard Displays the Clipboard
""" """
from gramps.gui.clipboard import ClipboardWindow from .clipboard import ClipboardWindow
try: try:
ClipboardWindow(self.dbstate, self.uistate) ClipboardWindow(self.dbstate, self.uistate)
except WindowActiveError: except WindowActiveError:
@ -1705,7 +1705,7 @@ class ViewManager(CLIManager):
Calls the ExportAssistant to export data Calls the ExportAssistant to export data
""" """
if self.dbstate.db.db_is_open: if self.dbstate.db.db_is_open:
from gramps.gui.plug.export import ExportAssistant from .plug.export import ExportAssistant
try: try:
ExportAssistant(self.dbstate, self.uistate) ExportAssistant(self.dbstate, self.uistate)
except WindowActiveError: except WindowActiveError: