Split Utils in a non GUI and GUI part
move GrampsCfg utils to Utils improve import strategy svn: r12680
This commit is contained in:
parent
0ac67e8a59
commit
9d417e2cd6
@ -49,7 +49,7 @@ import const
|
||||
import PageView
|
||||
import ManagedWindow
|
||||
import ConfigParser
|
||||
import Utils
|
||||
from gui.utils import add_menuitem
|
||||
from QuickReports import run_quick_report_by_name
|
||||
import GrampsDisplay
|
||||
from glade import Glade
|
||||
@ -1585,7 +1585,7 @@ class GrampletView(PageView.PersonNavView):
|
||||
in AVAILABLE_GRAMPLETS]
|
||||
names.sort()
|
||||
for name in names:
|
||||
Utils.add_menuitem(qr_menu, name,
|
||||
add_menuitem(qr_menu, name,
|
||||
None, self.add_gramplet)
|
||||
self.uistate.uimanager.get_widget('/Popup/AddGramplet').set_submenu(qr_menu)
|
||||
rg_menu = self.uistate.uimanager.get_widget('/Popup/RestoreGramplet')
|
||||
@ -1602,7 +1602,7 @@ class GrampletView(PageView.PersonNavView):
|
||||
if len(names) > 0:
|
||||
qr_menu = gtk.Menu()
|
||||
for name in names:
|
||||
Utils.add_menuitem(qr_menu, name,
|
||||
add_menuitem(qr_menu, name,
|
||||
None, self.restore_gramplet)
|
||||
self.uistate.uimanager.get_widget('/Popup/RestoreGramplet').set_submenu(qr_menu)
|
||||
if menu:
|
||||
|
@ -51,6 +51,7 @@ from DisplayModels import PeopleModel
|
||||
import PageView
|
||||
from BasicUtils import name_displayer
|
||||
import Utils
|
||||
from gui.utils import add_menuitem
|
||||
from QuestionDialog import ErrorDialog, QuestionDialog
|
||||
import TreeTips
|
||||
import Errors
|
||||
@ -856,7 +857,7 @@ class PersonView(PageView.PersonNavView):
|
||||
if len(reportactions) > 1 :
|
||||
qr_menu = gtk.Menu()
|
||||
for action in reportactions[1:] :
|
||||
Utils.add_menuitem(qr_menu, action[2], None, action[5])
|
||||
add_menuitem(qr_menu, action[2], None, action[5])
|
||||
self.uistate.uimanager.get_widget('/Popup/QuickReport').\
|
||||
set_submenu(qr_menu)
|
||||
if menu:
|
||||
|
@ -46,7 +46,7 @@ import gtk
|
||||
import gen.lib
|
||||
import PageView
|
||||
import DisplayModels
|
||||
import Utils
|
||||
from gui.utils import add_menuitem
|
||||
import Errors
|
||||
import Bookmarks
|
||||
import Config
|
||||
@ -195,7 +195,7 @@ class PlaceView(PageView.ListView):
|
||||
servlist = PluginManager.get_instance().get_mapservice_list()
|
||||
for i, service in zip(range(len(servlist)), servlist):
|
||||
key = service[2].replace(' ', '-')
|
||||
Utils.add_menuitem(menu, service[1], None,
|
||||
add_menuitem(menu, service[1], None,
|
||||
make_callback(self.set_mapservice, key))
|
||||
self.mapservicedata[key] = (service[0], service[2], service[3])
|
||||
|
||||
|
@ -48,6 +48,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import Utils
|
||||
from gui.utils import add_menuitem
|
||||
import Mime
|
||||
import gen.lib
|
||||
import widgets
|
||||
@ -496,8 +497,8 @@ class EditPerson(EditPrimary):
|
||||
menu.set_title(_("Media Object"))
|
||||
obj = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
if obj:
|
||||
Utils.add_menuitem(menu, _("View"), photo, self._popup_view_photo)
|
||||
Utils.add_menuitem(menu, _("Edit Object Properties"), photo,
|
||||
add_menuitem(menu, _("View"), photo, self._popup_view_photo)
|
||||
add_menuitem(menu, _("Edit Object Properties"), photo,
|
||||
self._popup_change_description)
|
||||
menu.popup(None, None, None, event.button, event.time)
|
||||
|
||||
|
@ -197,7 +197,8 @@ class GenericFilter(object):
|
||||
def check(self, db, handle):
|
||||
return self.get_check_func()(db, [handle])
|
||||
|
||||
# progress is optional. If present it must be an instance of Utils.ProgressMeter
|
||||
# progress is optional. If present it must be an instance of
|
||||
# gui.utils.ProgressMeter
|
||||
def apply(self, db, id_list=None, progress=None):
|
||||
m = self.get_check_func()
|
||||
for rule in self.flist:
|
||||
|
@ -56,15 +56,6 @@ from QuestionDialog import ErrorDialog, QuestionDialog2
|
||||
from Errors import NameDisplayError
|
||||
from glade import Glade
|
||||
|
||||
geopresent = True
|
||||
try:
|
||||
import DataViews.GeoView
|
||||
except:
|
||||
geopresent = False
|
||||
#experimental feature, don't show in release
|
||||
if not const.VERSION.find('SVN') == -1:
|
||||
gepresent = False
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
@ -84,34 +75,6 @@ COL_NAME = 1
|
||||
COL_FMT = 2
|
||||
COL_EXPL = 3
|
||||
|
||||
def set_calendar_date_format():
|
||||
format_list = DateHandler.get_date_formats()
|
||||
DateHandler.set_format(Config.get_date_format(format_list))
|
||||
|
||||
def get_researcher():
|
||||
import gen.lib
|
||||
|
||||
n = Config.get(Config.RESEARCHER_NAME)
|
||||
a = Config.get(Config.RESEARCHER_ADDR)
|
||||
c = Config.get(Config.RESEARCHER_CITY)
|
||||
s = Config.get(Config.RESEARCHER_STATE)
|
||||
ct = Config.get(Config.RESEARCHER_COUNTRY)
|
||||
p = Config.get(Config.RESEARCHER_POSTAL)
|
||||
ph = Config.get(Config.RESEARCHER_PHONE)
|
||||
e = Config.get(Config.RESEARCHER_EMAIL)
|
||||
|
||||
owner = gen.lib.Researcher()
|
||||
owner.set_name(n)
|
||||
owner.set_address(a)
|
||||
owner.set_city(c)
|
||||
owner.set_state(s)
|
||||
owner.set_country(ct)
|
||||
owner.set_postal_code(p)
|
||||
owner.set_phone(ph)
|
||||
owner.set_email(e)
|
||||
|
||||
return owner
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -188,7 +151,8 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
||||
MarkupLabel(_('Researcher')))
|
||||
panel.append_page(self.add_color_panel(),
|
||||
MarkupLabel(_('Marker Colors')))
|
||||
if geopresent:
|
||||
import DataViews
|
||||
if DataViews.geopresent:
|
||||
panel.append_page(self.add_geoview_panel(),
|
||||
MarkupLabel(_('Internet Maps')))
|
||||
self.window.show_all()
|
||||
|
@ -50,6 +50,7 @@ import Bookmarks
|
||||
import Errors
|
||||
from Filters import SearchBar
|
||||
import Utils
|
||||
from gui.utils import add_menuitem
|
||||
import const
|
||||
from widgets.menutoolbuttonaction import MenuToolButtonAction
|
||||
|
||||
@ -1041,7 +1042,7 @@ class ListView(BookMarkView):
|
||||
if len(reportactions) > 1 :
|
||||
qr_menu = gtk.Menu()
|
||||
for action in reportactions[1:] :
|
||||
Utils.add_menuitem(qr_menu, action[2], None, action[5])
|
||||
add_menuitem(qr_menu, action[2], None, action[5])
|
||||
self.uistate.uimanager.get_widget('/Popup/QuickReport').\
|
||||
set_submenu(qr_menu)
|
||||
if menu:
|
||||
|
@ -47,6 +47,7 @@ import gobject
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import widgets
|
||||
import ManagedWindow
|
||||
from QuestionDialog import OptionDialog
|
||||
@ -107,7 +108,7 @@ class LastNameDialog(ManagedWindow.ManagedWindow):
|
||||
# build up the list of surnames, keeping track of the count for each
|
||||
# name (this can be a lengthy process, so by passing in the
|
||||
# dictionary we can be certain we only do this once)
|
||||
progress = Utils.ProgressMeter(_('Finding Surnames'))
|
||||
progress = ProgressMeter(_('Finding Surnames'))
|
||||
progress.set_pass(_('Finding surnames'),
|
||||
database.get_number_of_people())
|
||||
for person_handle in database.get_person_handles(False):
|
||||
|
@ -347,7 +347,7 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
|
||||
buffer.set_text("")
|
||||
|
||||
def pre_run(self):
|
||||
from Utils import ProgressMeter
|
||||
from gui.utils import ProgressMeter
|
||||
self.progress = ProgressMeter(self.get_title())
|
||||
|
||||
def run(self):
|
||||
|
@ -48,6 +48,7 @@ import gobject
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
from gen.plug.docgen import BaseDoc, GVDoc
|
||||
import Config
|
||||
from ReportBase import CATEGORY_GRAPHVIZ
|
||||
@ -123,9 +124,9 @@ def _run_long_process_in_thread(func, header):
|
||||
@return: nothing
|
||||
|
||||
"""
|
||||
pbar = Utils.ProgressMeter(_('Processing File'))
|
||||
pbar = ProgressMeter(_('Processing File'))
|
||||
pbar.set_pass(total=40,
|
||||
mode=Utils.ProgressMeter.MODE_ACTIVITY,
|
||||
mode=ProgressMeter.MODE_ACTIVITY,
|
||||
header=header)
|
||||
|
||||
sys_thread = threading.Thread(target=func)
|
||||
|
330
src/Utils.py
330
src/Utils.py
@ -213,48 +213,6 @@ def family_upper_name(family, db):
|
||||
name = mother.get_primary_name().get_upper_name()
|
||||
return name
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def redraw_list(dlist, clist, func):
|
||||
clist.clear()
|
||||
|
||||
index = 0
|
||||
for obj in dlist:
|
||||
col = 0
|
||||
node = clist.append()
|
||||
for data in func(obj):
|
||||
clist.set_value(node, col, data)
|
||||
col = col + 1
|
||||
index = index + 1
|
||||
return index
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def delete_selected(obj, dlist):
|
||||
sel = obj.get_selection()
|
||||
model, node = sel.get_selected()
|
||||
if node:
|
||||
index = model.get_path(node)[0]
|
||||
del dlist[index]
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_menuitem(menu, msg, obj, func):
|
||||
item = gtk.MenuItem(msg)
|
||||
item.set_data('o', obj)
|
||||
item.connect("activate", func)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -334,55 +292,6 @@ def get_unicode_path(path):
|
||||
else:
|
||||
return unicode(path,sys.getfilesystemencoding())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_string_optmenu(mapping, start_val):
|
||||
index = 0
|
||||
start_index = 0
|
||||
keys = mapping.keys()
|
||||
keys.sort()
|
||||
myMenu = gtk.Menu()
|
||||
|
||||
for key in keys:
|
||||
if key == "default":
|
||||
menuitem = gtk.MenuItem(_("default"))
|
||||
else:
|
||||
menuitem = gtk.MenuItem(key)
|
||||
menuitem.set_data("d", mapping[key])
|
||||
menuitem.set_data("l", key)
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
if key == start_val:
|
||||
start_index = index
|
||||
index = index + 1
|
||||
|
||||
if start_index:
|
||||
myMenu.set_active(start_index)
|
||||
return myMenu
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_columns(tree, list):
|
||||
cnum = 0
|
||||
for name in list:
|
||||
renderer = gtk.CellRendererText()
|
||||
renderer.set_fixed_height_from_font(1)
|
||||
column = gtk.TreeViewColumn(name[0], renderer, text=cnum)
|
||||
column.set_min_width(name[1])
|
||||
if name[2] >= 0:
|
||||
column.set_sort_column_id(name[2])
|
||||
if name[0] == '':
|
||||
column.set_clickable(True)
|
||||
column.set_visible(False)
|
||||
cnum = cnum + 1
|
||||
tree.append_column(column)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -447,69 +356,6 @@ def search_for(name):
|
||||
if os.access(fname, os.X_OK) and not os.path.isdir(fname):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Change label appearance
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def bold_label(label, widget=None):
|
||||
if label.__class__ == gtk.Label:
|
||||
text = unicode(label.get_text())
|
||||
text = text.replace('<i>', '')
|
||||
text = text.replace('</i>', '')
|
||||
label.set_text("<b>%s</b>" % text )
|
||||
label.set_use_markup(True)
|
||||
else:
|
||||
clist = label.get_children()
|
||||
text = unicode(clist[1].get_text())
|
||||
text = text.replace('<i>', '')
|
||||
text = text.replace('</i>', '')
|
||||
clist[0].show()
|
||||
clist[1].set_text("<b>%s</b>" % text )
|
||||
clist[1].set_use_markup(True)
|
||||
if widget:
|
||||
widget.window.set_cursor(None)
|
||||
|
||||
def unbold_label(label, widget=None):
|
||||
if label.__class__ == gtk.Label:
|
||||
text = unicode(label.get_text())
|
||||
text = text.replace('<b>', '')
|
||||
text = text.replace('</b>', '')
|
||||
text = text.replace('<i>', '')
|
||||
text = text.replace('</i>', '')
|
||||
label.set_text(text)
|
||||
label.set_use_markup(False)
|
||||
else:
|
||||
clist = label.get_children()
|
||||
text = unicode(clist[1].get_text())
|
||||
text = text.replace('<b>', '')
|
||||
text = text.replace('</b>', '')
|
||||
text = text.replace('<i>', '')
|
||||
text = text.replace('</i>', '')
|
||||
clist[0].hide()
|
||||
clist[1].set_text(text)
|
||||
clist[1].set_use_markup(False)
|
||||
if widget:
|
||||
widget.window.set_cursor(None)
|
||||
|
||||
def temp_label(label, widget=None):
|
||||
if label.__class__ == gtk.Label:
|
||||
text = unicode(label.get_text())
|
||||
text = text.replace('<b>', '')
|
||||
text = text.replace('</b>', '')
|
||||
label.set_text("<i>%s</i>" % text )
|
||||
label.set_use_markup(True)
|
||||
else:
|
||||
clist = label.get_children()
|
||||
text = unicode(clist[1].get_text())
|
||||
text = text.replace('<b>', '')
|
||||
text = text.replace('</b>', '')
|
||||
clist[0].hide()
|
||||
clist[1].set_text("<i>%s</i>" % text )
|
||||
clist[1].set_use_markup(True)
|
||||
if widget:
|
||||
widget.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -965,153 +811,6 @@ def media_path_full(db, filename):
|
||||
return filename
|
||||
mpath = media_path(db)
|
||||
return os.path.join(mpath, filename)
|
||||
|
||||
|
||||
class ProgressMeter(object):
|
||||
"""
|
||||
Progress meter class for GRAMPS.
|
||||
|
||||
The progress meter has two modes:
|
||||
|
||||
MODE_FRACTION is used when you know the number of steps that will be taken.
|
||||
Set the total number of steps, and then call step() that many times.
|
||||
The progress bar will progress from left to right.
|
||||
|
||||
MODE_ACTIVITY is used when you don't know the number of steps that will be
|
||||
taken. Set up the total number of steps for the bar to get from one end of
|
||||
the bar to the other. Then, call step() as many times as you want. The bar
|
||||
will move from left to right until you stop calling step.
|
||||
"""
|
||||
|
||||
MODE_FRACTION = 0
|
||||
MODE_ACTIVITY = 1
|
||||
|
||||
def __init__(self, title, header=''):
|
||||
"""
|
||||
Specify the title and the current pass header.
|
||||
"""
|
||||
self.__mode = ProgressMeter.MODE_FRACTION
|
||||
self.__pbar_max = 100.0
|
||||
self.__pbar_index = 0.0
|
||||
self.__old_val = -1
|
||||
|
||||
self.__dialog = gtk.Dialog()
|
||||
self.__dialog.connect('delete_event', self.__warn)
|
||||
self.__dialog.set_has_separator(False)
|
||||
self.__dialog.set_title(title)
|
||||
self.__dialog.set_border_width(12)
|
||||
self.__dialog.vbox.set_spacing(10)
|
||||
self.__dialog.vbox.set_border_width(24)
|
||||
self.__dialog.set_size_request(350, 125)
|
||||
|
||||
tlbl = gtk.Label('<span size="larger" weight="bold">%s</span>' % title)
|
||||
tlbl.set_use_markup(True)
|
||||
self.__dialog.vbox.add(tlbl)
|
||||
|
||||
self.__lbl = gtk.Label(header)
|
||||
self.__lbl.set_use_markup(True)
|
||||
self.__dialog.vbox.add(self.__lbl)
|
||||
|
||||
self.__pbar = gtk.ProgressBar()
|
||||
self.__dialog.vbox.add(self.__pbar)
|
||||
|
||||
self.__dialog.show_all()
|
||||
if header == '':
|
||||
self.__lbl.hide()
|
||||
|
||||
def set_pass(self, header="", total=100, mode=MODE_FRACTION):
|
||||
"""
|
||||
Reset for another pass. Provide a new header and define number
|
||||
of steps to be used.
|
||||
"""
|
||||
self.__mode = mode
|
||||
self.__pbar_max = total
|
||||
self.__pbar_index = 0.0
|
||||
|
||||
self.__lbl.set_text(header)
|
||||
if header == '':
|
||||
self.__lbl.hide()
|
||||
else:
|
||||
self.__lbl.show()
|
||||
|
||||
if self.__mode is ProgressMeter.MODE_FRACTION:
|
||||
self.__pbar.set_fraction(0.0)
|
||||
else: # ProgressMeter.MODE_ACTIVITY
|
||||
self.__pbar.set_pulse_step(1.0/self.__pbar_max)
|
||||
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration()
|
||||
|
||||
def step(self):
|
||||
"""Click the progress bar over to the next value. Be paranoid
|
||||
and insure that it doesn't go over 100%."""
|
||||
|
||||
if self.__mode is ProgressMeter.MODE_FRACTION:
|
||||
self.__pbar_index = self.__pbar_index + 1.0
|
||||
|
||||
if self.__pbar_index > self.__pbar_max:
|
||||
self.__pbar_index = self.__pbar_max
|
||||
|
||||
try:
|
||||
val = int(100*self.__pbar_index/self.__pbar_max)
|
||||
except ZeroDivisionError:
|
||||
val = 0
|
||||
|
||||
if val != self.__old_val:
|
||||
self.__pbar.set_text("%d%%" % val)
|
||||
self.__pbar.set_fraction(val/100.0)
|
||||
self.__old_val = val
|
||||
else: # ProgressMeter.MODE_ACTIVITY
|
||||
self.__pbar.pulse()
|
||||
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration()
|
||||
|
||||
def __warn(self, *obj):
|
||||
"""
|
||||
Don't let the user close the progress dialog.
|
||||
"""
|
||||
WarningDialog(
|
||||
_("Attempt to force closing the dialog"),
|
||||
_("Please do not force closing this important dialog."),
|
||||
self.__dialog)
|
||||
return True
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Close the progress meter
|
||||
"""
|
||||
self.__dialog.destroy()
|
||||
|
||||
def open_file_with_default_application( file_path ):
|
||||
"""
|
||||
Launch a program to open an arbitrary file. The file will be opened using
|
||||
whatever program is configured on the host as the default program for that
|
||||
type of file.
|
||||
|
||||
@param file_path: The path to the file to be opened.
|
||||
Example: "c:\foo.txt"
|
||||
@type file_path: string
|
||||
@return: nothing
|
||||
"""
|
||||
norm_path = os.path.normpath( file_path )
|
||||
|
||||
if not os.path.exists(norm_path):
|
||||
ErrorDialog(_("Error Opening File"), _("File does not exist"))
|
||||
return
|
||||
|
||||
if os.sys.platform == 'win32':
|
||||
try:
|
||||
os.startfile(norm_path)
|
||||
except WindowsError, msg:
|
||||
ErrorDialog(_("Error Opening File"), str(msg))
|
||||
else:
|
||||
search = os.environ['PATH'].split(':')
|
||||
for lpath in search:
|
||||
prog = os.path.join(lpath, 'xdg-open')
|
||||
if os.path.isfile(prog):
|
||||
os.spawnvpe(os.P_NOWAIT, prog, [prog, norm_path], os.environ)
|
||||
return
|
||||
|
||||
def profile(func, *args):
|
||||
import hotshot.stats
|
||||
@ -1176,4 +875,33 @@ def get_translations():
|
||||
trans = TRANS_TO_KEY.keys()
|
||||
trans.sort(lambda a,b: -cmp(len(a), len(b)))
|
||||
return trans
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_researcher():
|
||||
import gen.lib
|
||||
import Config
|
||||
|
||||
n = Config.get(Config.RESEARCHER_NAME)
|
||||
a = Config.get(Config.RESEARCHER_ADDR)
|
||||
c = Config.get(Config.RESEARCHER_CITY)
|
||||
s = Config.get(Config.RESEARCHER_STATE)
|
||||
ct = Config.get(Config.RESEARCHER_COUNTRY)
|
||||
p = Config.get(Config.RESEARCHER_POSTAL)
|
||||
ph = Config.get(Config.RESEARCHER_PHONE)
|
||||
e = Config.get(Config.RESEARCHER_EMAIL)
|
||||
|
||||
owner = gen.lib.Researcher()
|
||||
owner.set_name(n)
|
||||
owner.set_address(a)
|
||||
owner.set_city(c)
|
||||
owner.set_state(s)
|
||||
owner.set_country(ct)
|
||||
owner.set_postal_code(p)
|
||||
owner.set_phone(ph)
|
||||
owner.set_email(e)
|
||||
|
||||
return owner
|
||||
|
@ -23,7 +23,4 @@
|
||||
Package init for the cli package.
|
||||
"""
|
||||
|
||||
from grampscli import startcli, CLIDbLoader, CLIManager
|
||||
from argparser import ArgParser
|
||||
from arghandler import ArgHandler
|
||||
from clidbman import CLIDbManager
|
||||
# DO NOT IMPORT METHODS/CLASSES FROM src/gui HERE ! Only __all__
|
||||
|
@ -439,7 +439,7 @@ class ArgHandler(object):
|
||||
pmgr = PluginManager.get_instance()
|
||||
if action == 'check':
|
||||
import Check
|
||||
checker = Check.CheckIntegrity(self.dbstate.db, None, None)
|
||||
checker = Check.CheckIntegrity(self.dbstate, None, None)
|
||||
checker.check_for_broken_family_links()
|
||||
checker.cleanup_missing_photos(1)
|
||||
checker.check_parent_relationships()
|
||||
@ -448,6 +448,7 @@ class ArgHandler(object):
|
||||
if errs:
|
||||
checker.report(1)
|
||||
elif action == 'summary':
|
||||
## FIXME, this is broken, Summary no longer has build_report !
|
||||
import Summary
|
||||
text = Summary.build_report(self.dbstate.db, None)
|
||||
print text
|
||||
|
@ -53,7 +53,7 @@ import DbState
|
||||
from gen.db import (GrampsDBDir, FileVersionDeclineToUpgrade)
|
||||
import gen.db.exceptions
|
||||
from gen.plug import PluginManager
|
||||
import GrampsCfg
|
||||
from Utils import get_researcher
|
||||
import RecentFiles
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -251,7 +251,7 @@ class CLIManager(object):
|
||||
|
||||
# apply preferred researcher if loaded file has none
|
||||
res = self.dbstate.db.get_researcher()
|
||||
owner = GrampsCfg.get_researcher()
|
||||
owner = get_researcher()
|
||||
if res.get_name() == "" and owner.get_name() != "":
|
||||
self.dbstate.db.set_researcher(owner)
|
||||
|
||||
|
@ -159,18 +159,18 @@ def run():
|
||||
|
||||
#we start with parsing the arguments to determine if we have a cli or a
|
||||
# gui session
|
||||
from cli import ArgParser
|
||||
from cli.argparser import ArgParser
|
||||
argpars = ArgParser(sys.argv)
|
||||
|
||||
if argpars.need_gui():
|
||||
#A GUI is needed, set it up
|
||||
from gui import startgtkloop
|
||||
from gui.grampsgui import startgtkloop
|
||||
startgtkloop(error, argpars)
|
||||
else:
|
||||
#CLI use of GRAMPS
|
||||
argpars.print_help()
|
||||
|
||||
from cli import startcli
|
||||
from cli.grampscli import startcli
|
||||
startcli(error, argpars)
|
||||
|
||||
run()
|
||||
|
@ -13,6 +13,7 @@ pkgdata_PYTHON = \
|
||||
dbloader.py \
|
||||
dbman.py \
|
||||
grampsgui.py \
|
||||
utilsgui.py \
|
||||
viewmanager.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/gui
|
||||
|
@ -24,9 +24,6 @@
|
||||
Package init for the gui package.
|
||||
"""
|
||||
|
||||
from grampsgui import startgtkloop
|
||||
from viewmanager import ViewManager
|
||||
from dbman import DbManager
|
||||
from dbloader import DbLoader
|
||||
# DO NOT IMPORT METHODS/CLASSES FROM src/gui HERE ! Only __all__
|
||||
|
||||
__all__ = [ "views" ]
|
||||
|
222
src/gui/utilsgui.py
Normal file
222
src/gui/utilsgui.py
Normal file
@ -0,0 +1,222 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id: Utils.py 12603 2009-05-31 14:59:56Z bmcage $
|
||||
|
||||
"""
|
||||
Utility functions that depend on GUI components or for GUI components
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
from gettext import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import Errors
|
||||
from QuestionDialog import WarningDialog, ErrorDialog
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_menuitem(menu, msg, obj, func):
|
||||
"""
|
||||
add a menuitem to menu with label msg, which activates func, and has data
|
||||
obj
|
||||
"""
|
||||
item = gtk.MenuItem(msg)
|
||||
item.set_data('o', obj)
|
||||
item.connect("activate", func)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Progress meter class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class ProgressMeter(object):
|
||||
"""
|
||||
Progress meter class for GRAMPS.
|
||||
|
||||
The progress meter has two modes:
|
||||
|
||||
MODE_FRACTION is used when you know the number of steps that will be taken.
|
||||
Set the total number of steps, and then call step() that many times.
|
||||
The progress bar will progress from left to right.
|
||||
|
||||
MODE_ACTIVITY is used when you don't know the number of steps that will be
|
||||
taken. Set up the total number of steps for the bar to get from one end of
|
||||
the bar to the other. Then, call step() as many times as you want. The bar
|
||||
will move from left to right until you stop calling step.
|
||||
"""
|
||||
|
||||
MODE_FRACTION = 0
|
||||
MODE_ACTIVITY = 1
|
||||
|
||||
def __init__(self, title, header=''):
|
||||
"""
|
||||
Specify the title and the current pass header.
|
||||
"""
|
||||
self.__mode = ProgressMeter.MODE_FRACTION
|
||||
self.__pbar_max = 100.0
|
||||
self.__pbar_index = 0.0
|
||||
self.__old_val = -1
|
||||
|
||||
self.__dialog = gtk.Dialog()
|
||||
self.__dialog.connect('delete_event', self.__warn)
|
||||
self.__dialog.set_has_separator(False)
|
||||
self.__dialog.set_title(title)
|
||||
self.__dialog.set_border_width(12)
|
||||
self.__dialog.vbox.set_spacing(10)
|
||||
self.__dialog.vbox.set_border_width(24)
|
||||
self.__dialog.set_size_request(350, 125)
|
||||
|
||||
tlbl = gtk.Label('<span size="larger" weight="bold">%s</span>' % title)
|
||||
tlbl.set_use_markup(True)
|
||||
self.__dialog.vbox.add(tlbl)
|
||||
|
||||
self.__lbl = gtk.Label(header)
|
||||
self.__lbl.set_use_markup(True)
|
||||
self.__dialog.vbox.add(self.__lbl)
|
||||
|
||||
self.__pbar = gtk.ProgressBar()
|
||||
self.__dialog.vbox.add(self.__pbar)
|
||||
|
||||
self.__dialog.show_all()
|
||||
if header == '':
|
||||
self.__lbl.hide()
|
||||
|
||||
def set_pass(self, header="", total=100, mode=MODE_FRACTION):
|
||||
"""
|
||||
Reset for another pass. Provide a new header and define number
|
||||
of steps to be used.
|
||||
"""
|
||||
self.__mode = mode
|
||||
self.__pbar_max = total
|
||||
self.__pbar_index = 0.0
|
||||
|
||||
self.__lbl.set_text(header)
|
||||
if header == '':
|
||||
self.__lbl.hide()
|
||||
else:
|
||||
self.__lbl.show()
|
||||
|
||||
if self.__mode is ProgressMeter.MODE_FRACTION:
|
||||
self.__pbar.set_fraction(0.0)
|
||||
else: # ProgressMeter.MODE_ACTIVITY
|
||||
self.__pbar.set_pulse_step(1.0/self.__pbar_max)
|
||||
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration()
|
||||
|
||||
def step(self):
|
||||
"""Click the progress bar over to the next value. Be paranoid
|
||||
and insure that it doesn't go over 100%."""
|
||||
|
||||
if self.__mode is ProgressMeter.MODE_FRACTION:
|
||||
self.__pbar_index = self.__pbar_index + 1.0
|
||||
|
||||
if self.__pbar_index > self.__pbar_max:
|
||||
self.__pbar_index = self.__pbar_max
|
||||
|
||||
try:
|
||||
val = int(100*self.__pbar_index/self.__pbar_max)
|
||||
except ZeroDivisionError:
|
||||
val = 0
|
||||
|
||||
if val != self.__old_val:
|
||||
self.__pbar.set_text("%d%%" % val)
|
||||
self.__pbar.set_fraction(val/100.0)
|
||||
self.__old_val = val
|
||||
else: # ProgressMeter.MODE_ACTIVITY
|
||||
self.__pbar.pulse()
|
||||
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration()
|
||||
|
||||
def __warn(self, *obj):
|
||||
"""
|
||||
Don't let the user close the progress dialog.
|
||||
"""
|
||||
WarningDialog(
|
||||
_("Attempt to force closing the dialog"),
|
||||
_("Please do not force closing this important dialog."),
|
||||
self.__dialog)
|
||||
return True
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Close the progress meter
|
||||
"""
|
||||
self.__dialog.destroy()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def open_file_with_default_application( file_path ):
|
||||
"""
|
||||
Launch a program to open an arbitrary file. The file will be opened using
|
||||
whatever program is configured on the host as the default program for that
|
||||
type of file.
|
||||
|
||||
@param file_path: The path to the file to be opened.
|
||||
Example: "c:\foo.txt"
|
||||
@type file_path: string
|
||||
@return: nothing
|
||||
"""
|
||||
norm_path = os.path.normpath( file_path )
|
||||
|
||||
if not os.path.exists(norm_path):
|
||||
ErrorDialog(_("Error Opening File"), _("File does not exist"))
|
||||
return
|
||||
|
||||
if os.sys.platform == 'win32':
|
||||
try:
|
||||
os.startfile(norm_path)
|
||||
except WindowsError, msg:
|
||||
ErrorDialog(_("Error Opening File"), str(msg))
|
||||
else:
|
||||
search = os.environ['PATH'].split(':')
|
||||
for lpath in search:
|
||||
prog = os.path.join(lpath, 'xdg-open')
|
||||
if os.path.isfile(prog):
|
||||
os.spawnvpe(os.P_NOWAIT, prog, [prog, norm_path], os.environ)
|
||||
return
|
@ -55,7 +55,7 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from cli import CLIManager
|
||||
from cli.grampscli import CLIManager
|
||||
from PluginUtils import Tool, PluginWindows, \
|
||||
ReportPluginDialog, ToolPluginDialog
|
||||
import ReportBase
|
||||
|
@ -45,8 +45,8 @@ from gen.plug.menu import BooleanOption, StringOption, NumberOption, \
|
||||
EnumeratedListOption, FilterOption, PersonOption
|
||||
import GrampsLocale
|
||||
import gen.lib
|
||||
from Utils import probably_alive, ProgressMeter
|
||||
|
||||
from Utils import probably_alive
|
||||
from gui.utils import ProgressMeter
|
||||
|
||||
import libholiday
|
||||
from libholiday import g2iso
|
||||
|
@ -51,7 +51,7 @@ from gen.plug.menu import BooleanOption, NumberOption, EnumeratedListOption, \
|
||||
FilterOption, PersonOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
|
||||
import DateHandler
|
||||
from Utils import ProgressMeter
|
||||
from gui.utils import ProgressMeter
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -46,7 +46,8 @@ from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
import Sort
|
||||
from QuestionDialog import ErrorDialog
|
||||
from BasicUtils import name_displayer
|
||||
from Utils import probably_alive, ProgressMeter
|
||||
from Utils import probably_alive
|
||||
from gui.utils import ProgressMeter
|
||||
import gen.lib
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
@ -35,7 +35,7 @@ import re
|
||||
import gen.lib
|
||||
from gen.plug import PluginManager, ExportPlugin
|
||||
import DateHandler
|
||||
from Utils import ProgressMeter
|
||||
from gui.utils import ProgressMeter
|
||||
import ExportOptions
|
||||
|
||||
def makeDB(db):
|
||||
|
@ -48,6 +48,7 @@ log = logging.getLogger(".FamilyLines")
|
||||
#------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import ThumbNails
|
||||
from DateHandler import displayer as _dd
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_GRAPHVIZ
|
||||
@ -394,7 +395,7 @@ class FamilyLinesReport(Report):
|
||||
from the database is going to be output into the report
|
||||
"""
|
||||
|
||||
self.progress = Utils.ProgressMeter(_('Generating Family Lines'),
|
||||
self.progress = ProgressMeter(_('Generating Family Lines'),
|
||||
_('Starting'))
|
||||
|
||||
# starting with the people of interest, we then add parents:
|
||||
|
@ -54,7 +54,7 @@ from QuestionDialog import ErrorDialog
|
||||
from DateHandler import parser as _dp
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
from Utils import gender as gender_map
|
||||
from Utils import ProgressMeter
|
||||
from gui.utils import ProgressMeter
|
||||
from Utils import create_id
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -48,6 +48,7 @@ log = logging.getLogger('.ImportProGen')
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import gen.lib
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gen.plug import PluginManager, ImportPlugin
|
||||
@ -488,7 +489,7 @@ class ProgenParser(object):
|
||||
self.skeys = {} # Caching source handles
|
||||
|
||||
def parse_progen_file(self):
|
||||
self.progress = Utils.ProgressMeter(_("Import from Pro-Gen"), '')
|
||||
self.progress = ProgressMeter(_("Import from Pro-Gen"), '')
|
||||
|
||||
self.def_ = PG30_Def(self.fname)
|
||||
#print self.def_.diag()
|
||||
|
@ -45,7 +45,8 @@ from gen.plug.menu import BooleanOption, StringOption, NumberOption, \
|
||||
EnumeratedListOption, FilterOption, PersonOption
|
||||
import GrampsLocale
|
||||
from gen.lib import NameType, EventType, Name, Date, Person
|
||||
from Utils import probably_alive, ProgressMeter
|
||||
from Utils import probably_alive
|
||||
from gui.utils import ProgressMeter
|
||||
|
||||
import libholiday
|
||||
|
||||
|
@ -37,7 +37,7 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import GrampsDisplay
|
||||
import ManagedWindow
|
||||
|
||||
@ -81,7 +81,7 @@ class ChangeNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
if self.fail:
|
||||
return
|
||||
|
||||
self.progress = Utils.ProgressMeter(_('Checking Family Names'),'')
|
||||
self.progress = ProgressMeter(_('Checking Family Names'),'')
|
||||
self.progress.set_pass(_('Searching family names'),
|
||||
len(self.db.get_surname_list()))
|
||||
self.name_list = []
|
||||
|
@ -36,7 +36,7 @@ from gettext import ngettext
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import locale
|
||||
import ManagedWindow
|
||||
import AutoComp
|
||||
@ -113,7 +113,7 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
self.trans = self.db.transaction_begin("",batch=True)
|
||||
self.db.disable_signals()
|
||||
if not cli:
|
||||
progress = Utils.ProgressMeter(_('Analyzing Events'),'')
|
||||
progress = ProgressMeter(_('Analyzing Events'),'')
|
||||
progress.set_pass('',self.db.get_number_of_events())
|
||||
|
||||
for event_handle in self.db.get_event_handles():
|
||||
|
@ -58,6 +58,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
#import const
|
||||
import ManagedWindow
|
||||
|
||||
@ -243,7 +244,7 @@ class CheckIntegrity(object):
|
||||
'repos' : [],
|
||||
'notes' : [],
|
||||
}
|
||||
self.progress = Utils.ProgressMeter(_('Checking Database'),'')
|
||||
self.progress = ProgressMeter(_('Checking Database'),'')
|
||||
|
||||
def family_errors(self):
|
||||
return len(self.broken_parent_links) + \
|
||||
|
@ -45,7 +45,7 @@ from gettext import gettext as _
|
||||
import gen.lib
|
||||
from PluginUtils import Tool
|
||||
from gen.plug import PluginManager
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
from QuestionDialog import QuestionDialog
|
||||
from DateHandler import parser as _dp
|
||||
from DateHandler import displayer as _dd
|
||||
@ -68,7 +68,7 @@ class DateParserDisplayTest(Tool.Tool):
|
||||
|
||||
|
||||
def run_tool(self):
|
||||
self.progress = Utils.ProgressMeter(_('Running Date Test'),'')
|
||||
self.progress = ProgressMeter(_('Running Date Test'),'')
|
||||
self.progress.set_pass(_('Generating dates'),
|
||||
4)
|
||||
dates = []
|
||||
|
@ -45,6 +45,7 @@ import gtk
|
||||
from Filters import GenericFilter, build_filter_model, Rules
|
||||
import Sort
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
from docgen import ODSTab
|
||||
import const
|
||||
import Errors
|
||||
@ -171,7 +172,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow):
|
||||
def on_apply_clicked(self, obj):
|
||||
cfilter = self.filter_menu[self.filters.get_active()][1]
|
||||
|
||||
progress_bar = Utils.ProgressMeter(_('Comparing events'),'')
|
||||
progress_bar = ProgressMeter(_('Comparing events'),'')
|
||||
progress_bar.set_pass(_('Selecting people'),1)
|
||||
|
||||
plist = cfilter.apply(self.db,
|
||||
@ -288,7 +289,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
|
||||
self.progress_bar.close()
|
||||
|
||||
def build_row_data(self):
|
||||
self.progress_bar = Utils.ProgressMeter(_('Comparing Events'),'')
|
||||
self.progress_bar = ProgressMeter(_('Comparing Events'),'')
|
||||
self.progress_bar.set_pass(_('Building data'),len(self.my_list))
|
||||
for individual_id in self.my_list:
|
||||
individual = self.db.get_person_from_handle(individual_id)
|
||||
|
@ -50,7 +50,7 @@ import GrampsDisplay
|
||||
|
||||
from PluginUtils import Tool
|
||||
from gen.plug import PluginManager
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
from glade import Glade
|
||||
|
||||
CITY_STATE_ZIP = re.compile("((\w|\s)+)\s*,\s*((\w|\s)+)\s*(,\s*((\d|-)+))", re.UNICODE)
|
||||
@ -428,7 +428,7 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
Performs the actual extraction of information
|
||||
"""
|
||||
|
||||
self.progress = Utils.ProgressMeter(_('Checking Place Titles'), '')
|
||||
self.progress = ProgressMeter(_('Checking Place Titles'), '')
|
||||
self.progress.set_pass(_('Looking for place fields'),
|
||||
len(self.db.get_place_handles()))
|
||||
|
||||
|
@ -37,7 +37,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import gen.lib
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import soundex
|
||||
from BasicUtils import name_displayer
|
||||
from QuestionDialog import OkDialog
|
||||
@ -180,7 +180,7 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
|
||||
pass
|
||||
|
||||
def find_potentials(self,thresh):
|
||||
self.progress = Utils.ProgressMeter(_('Find Duplicates'),
|
||||
self.progress = ProgressMeter(_('Find Duplicates'),
|
||||
_('Looking for duplicate people'))
|
||||
|
||||
index = 0
|
||||
|
@ -43,7 +43,7 @@ from ReportBase import ReportUtils
|
||||
from PluginUtils import Tool
|
||||
from Editors import EditPerson, EditFamily
|
||||
import ManagedWindow
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import GrampsDisplay
|
||||
from TransUtils import sgettext as _
|
||||
from glade import Glade
|
||||
@ -96,7 +96,7 @@ class NotRelated(Tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
|
||||
|
||||
|
||||
# start the progress indicator
|
||||
self.progress = Utils.ProgressMeter(self.title,_('Starting'))
|
||||
self.progress = ProgressMeter(self.title,_('Starting'))
|
||||
|
||||
# setup the columns
|
||||
self.model = gtk.TreeStore(
|
||||
@ -226,7 +226,7 @@ class NotRelated(Tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
|
||||
|
||||
# if more than 1 person is selected, use a progress indicator
|
||||
if rows > 1:
|
||||
progress = Utils.ProgressMeter(self.title,_('Starting'))
|
||||
progress = ProgressMeter(self.title,_('Starting'))
|
||||
progress.set_pass(_('Setting marker for %d people') % rows, rows)
|
||||
|
||||
# start the db transaction
|
||||
|
@ -37,7 +37,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import Config
|
||||
import GrampsCfg
|
||||
from Utils import get_researcher
|
||||
import GrampsDisplay
|
||||
from widgets import MonitoredEntry
|
||||
import ManagedWindow
|
||||
@ -159,7 +159,7 @@ class OwnerEditor(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
def on_menu_activate(self, menuitem):
|
||||
"""Copies the owner information from/to the preferences"""
|
||||
if menuitem.name == 'copy_from_preferences_to_db':
|
||||
self.owner.set_from(GrampsCfg.get_researcher())
|
||||
self.owner.set_from(get_researcher())
|
||||
for entry in self.entries:
|
||||
entry.update()
|
||||
|
||||
|
@ -44,7 +44,7 @@ import gobject
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
from PluginUtils import Tool
|
||||
from gen.plug import PluginManager
|
||||
from QuestionDialog import OkDialog
|
||||
@ -117,7 +117,7 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
||||
self.prefix1_list = []
|
||||
self.prefix2_list = []
|
||||
|
||||
self.progress = Utils.ProgressMeter(
|
||||
self.progress = ProgressMeter(
|
||||
_('Extracting Information from Names'), '')
|
||||
self.progress.set_pass(_('Analyzing names'),
|
||||
self.db.get_number_of_people())
|
||||
|
@ -39,7 +39,7 @@ from gettext import gettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import gen.lib
|
||||
from PluginUtils import Tool
|
||||
from gen.plug import PluginManager
|
||||
@ -60,7 +60,7 @@ class ReorderIds(Tool.BatchTool):
|
||||
db = dbstate.db
|
||||
self.uistate = uistate
|
||||
if uistate:
|
||||
self.progress = Utils.ProgressMeter(_('Reordering GRAMPS IDs'),'')
|
||||
self.progress = ProgressMeter(_('Reordering GRAMPS IDs'),'')
|
||||
else:
|
||||
print "Reordering GRAMPS IDs..."
|
||||
|
||||
|
@ -79,7 +79,6 @@ log = logging.getLogger(".WebPage")
|
||||
from gen.lib import UrlType, EventType, Person, date, Date, ChildRefType, \
|
||||
FamilyRelType, NameType, Name
|
||||
import const
|
||||
from GrampsCfg import get_researcher
|
||||
import Sort
|
||||
from gen.plug import PluginManager
|
||||
from gen.plug.menu import PersonOption, NumberOption, StringOption, \
|
||||
@ -88,6 +87,7 @@ from gen.plug.menu import PersonOption, NumberOption, StringOption, \
|
||||
from ReportBase import (Report, ReportUtils, MenuReportOptions, CATEGORY_WEB,
|
||||
Bibliography, CSS_FILES )
|
||||
import Utils
|
||||
from gui.utils import ProgressMeter
|
||||
import ThumbNails
|
||||
import ImgManip
|
||||
import Mime
|
||||
@ -198,7 +198,7 @@ class BasePage(object):
|
||||
|
||||
self.page_title = ""
|
||||
|
||||
self.author = get_researcher().get_name()
|
||||
self.author = Utils.get_researcher().get_name()
|
||||
if self.author:
|
||||
self.author = self.author.replace(',,,', '')
|
||||
self.up = False
|
||||
@ -2326,7 +2326,7 @@ class ContactPage(BasePage):
|
||||
if contactimg:
|
||||
summaryarea += contactimg
|
||||
|
||||
r = get_researcher()
|
||||
r = Utils.get_researcher()
|
||||
|
||||
with Html('div', id='researcher') as researcher:
|
||||
summaryarea += researcher
|
||||
@ -3682,7 +3682,7 @@ class NavWebReport(Report):
|
||||
value)
|
||||
return
|
||||
|
||||
self.progress = Utils.ProgressMeter(_("Narrated Web Site Report"), '')
|
||||
self.progress = ProgressMeter(_("Narrated Web Site Report"), '')
|
||||
|
||||
# Build the person list
|
||||
ind_list = self.build_person_list()
|
||||
|
@ -54,7 +54,6 @@ log = logging.getLogger(".WebPage")
|
||||
#------------------------------------------------------------------------
|
||||
from gen.lib import date, Date, Name, Person, NameType, EventType
|
||||
import const
|
||||
from GrampsCfg import get_researcher
|
||||
from gen.plug import PluginManager
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_WEB, \
|
||||
CSS_FILES
|
||||
@ -63,7 +62,8 @@ from gen.plug.menu import BooleanOption, NumberOption, StringOption, \
|
||||
DestinationOption
|
||||
import GrampsLocale
|
||||
from QuestionDialog import WarningDialog
|
||||
from Utils import probably_alive, ProgressMeter, xml_lang
|
||||
from Utils import probably_alive, xml_lang, get_researcher
|
||||
from gui.utils import ProgressMeter
|
||||
from DateHandler import displayer as _dd
|
||||
|
||||
from BasicUtils import name_displayer as _nd
|
||||
|
Loading…
x
Reference in New Issue
Block a user