Continued work on GEP008: Move BasicUtils/UpdateCallback.py to gen/updatecallback.py.

svn: r14025
This commit is contained in:
Brian Matherly 2010-01-10 20:21:10 +00:00
parent 2a36355a8b
commit 252ef6daee
17 changed files with 27 additions and 29 deletions

View File

@ -53,6 +53,7 @@ src/cli/grampscli.py
# gen API # gen API
src/gen/__init__.py src/gen/__init__.py
src/gen/updatecallback.py
# gen utils API # gen utils API
src/gen/utils/__init__.py src/gen/utils/__init__.py
@ -301,7 +302,6 @@ src/gui/widgets/validatedmaskedentry.py
src/Simple/_SimpleTable.py src/Simple/_SimpleTable.py
# BasicUtils package # BasicUtils package
src/BasicUtils/_UpdateCallback.py
src/BasicUtils/_NameDisplay.py src/BasicUtils/_NameDisplay.py
# Config package # Config package

View File

@ -6,7 +6,6 @@
pkgdatadir = $(datadir)/@PACKAGE@/BasicUtils pkgdatadir = $(datadir)/@PACKAGE@/BasicUtils
pkgdata_PYTHON = \ pkgdata_PYTHON = \
_UpdateCallback.py\
_NameDisplay.py\ _NameDisplay.py\
__init__.py __init__.py

View File

@ -20,5 +20,4 @@
# $Id: __init__.py$ # $Id: __init__.py$
from _UpdateCallback import UpdateCallback
from _NameDisplay import displayer as name_displayer from _NameDisplay import displayer as name_displayer

View File

@ -13,7 +13,8 @@ SUBDIRS = \
pkgdatadir = $(datadir)/@PACKAGE@/gen pkgdatadir = $(datadir)/@PACKAGE@/gen
pkgdata_PYTHON = \ pkgdata_PYTHON = \
__init__.py __init__.py \
updatecallback.py
pkgpyexecdir = @pkgpyexecdir@/gen pkgpyexecdir = @pkgpyexecdir@/gen
pkgpythondir = @pkgpythondir@/gen pkgpythondir = @pkgpythondir@/gen

View File

@ -56,7 +56,7 @@ from gen.db import (DbBsddbRead, DbWriteBase, BSDDBTxn,
DbUndoBSDDB as DbUndo) DbUndoBSDDB as DbUndo)
from gen.db.dbconst import * from gen.db.dbconst import *
from gen.utils.callback import Callback from gen.utils.callback import Callback
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
import Errors import Errors
_LOG = logging.getLogger(DBLOGNAME) _LOG = logging.getLogger(DBLOGNAME)

View File

@ -44,7 +44,7 @@ import const
import libgedcom import libgedcom
import Errors import Errors
from ExportOptions import WriterOptionBox from ExportOptions import WriterOptionBox
import BasicUtils from gen.updatecallback import UpdateCallback
from Utils import media_path_full from Utils import media_path_full
import gen.proxy import gen.proxy
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
@ -202,16 +202,16 @@ def event_has_subordinate_data(event, event_ref):
# GedcomWriter class # GedcomWriter class
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class GedcomWriter(BasicUtils.UpdateCallback): class GedcomWriter(UpdateCallback):
""" """
The GEDCOM writer creates a GEDCOM file that contains the exported The GEDCOM writer creates a GEDCOM file that contains the exported
information from the database. It derives from BasicUtils.UpdateCallback information from the database. It derives from UpdateCallback
so that it can provide visual feedback via a progress bar if needed. so that it can provide visual feedback via a progress bar if needed.
""" """
def __init__(self, database, cmd_line=0, def __init__(self, database, cmd_line=0,
option_box=None, callback=None): option_box=None, callback=None):
BasicUtils.UpdateCallback.__init__(self, callback) UpdateCallback.__init__(self, callback)
self.dbase = database self.dbase = database
self.cmd_line = cmd_line self.cmd_line = cmd_line

View File

@ -59,7 +59,6 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from ExportOptions import WriterOptionBox from ExportOptions import WriterOptionBox
#from BasicUtils import UpdateCallback
import gen.proxy import gen.proxy
from ExportXml import XmlWriter from ExportXml import XmlWriter
import Utils import Utils

View File

@ -56,7 +56,7 @@ log = logging.getLogger(".WriteXML")
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
from gen.db.exceptions import DbWriteFailure from gen.db.exceptions import DbWriteFailure
import const import const
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog

View File

@ -57,7 +57,7 @@ from gen.db.exceptions import DbVersionError
import const import const
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
from Errors import HandleError from Errors import HandleError
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
from BasicUtils import name_displayer from BasicUtils import name_displayer
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -45,7 +45,7 @@ import DateHandler
from BasicUtils import name_displayer from BasicUtils import name_displayer
from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY, from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY,
MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY) MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY)
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
import const import const
import libgrampsxml import libgrampsxml
from libmixin import DbMixin from libmixin import DbMixin

View File

@ -111,7 +111,7 @@ LOG = logging.getLogger(".libgedcom")
import Errors import Errors
import const import const
import gen.lib import gen.lib
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
import Mime import Mime
import LdsUtils import LdsUtils
import Utils import Utils

View File

@ -52,7 +52,7 @@ import GrampsDisplay
import Assistant import Assistant
import Errors import Errors
from gen.lib import MediaObject from gen.lib import MediaObject
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
from PluginUtils import Tool from PluginUtils import Tool
from Utils import media_path_full, relative_path, media_path from Utils import media_path_full, relative_path, media_path
from TransUtils import sgettext as _ from TransUtils import sgettext as _

View File

@ -51,14 +51,14 @@ log = logging.getLogger(".Rebuild")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from PluginUtils import Tool from PluginUtils import Tool
from QuestionDialog import OkDialog from QuestionDialog import OkDialog
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# runTool # runTool
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Rebuild(Tool.Tool,UpdateCallback): class Rebuild(Tool.Tool, UpdateCallback):
def __init__(self, dbstate, uistate, options_class, name, callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
@ -75,7 +75,7 @@ class Rebuild(Tool.Tool,UpdateCallback):
uistate.progress.show() uistate.progress.show()
uistate.push_message(dbstate, _("Rebuilding secondary indices...")) uistate.push_message(dbstate, _("Rebuilding secondary indices..."))
UpdateCallback.__init__(self,self.callback) UpdateCallback.__init__(self, self.callback)
self.set_total(11) self.set_total(11)
self.db.rebuild_secondary(self.update) self.db.rebuild_secondary(self.update)
self.reset() self.reset()

View File

@ -53,14 +53,14 @@ log = logging.getLogger(".RebuildRefMap")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from PluginUtils import Tool from PluginUtils import Tool
from QuestionDialog import OkDialog from QuestionDialog import OkDialog
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# runTool # runTool
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class RebuildRefMap(Tool.Tool,UpdateCallback): class RebuildRefMap(Tool.Tool, UpdateCallback):
def __init__(self, dbstate, uistate, options_class, name, callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
@ -79,7 +79,7 @@ class RebuildRefMap(Tool.Tool,UpdateCallback):
self.callback = None self.callback = None
print "Rebuilding reference maps..." print "Rebuilding reference maps..."
UpdateCallback.__init__(self,self.callback) UpdateCallback.__init__(self, self.callback)
self.set_total(6) self.set_total(6)
self.db.reindex_reference_map(self.update) self.db.reindex_reference_map(self.update)
self.reset() self.reset()

View File

@ -56,7 +56,7 @@ import gobject
import Errors import Errors
import ManagedWindow import ManagedWindow
from DateHandler import displayer as _dd from DateHandler import displayer as _dd
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
from PluginUtils import Tool from PluginUtils import Tool
from glade import Glade from glade import Glade

View File

@ -58,7 +58,7 @@ from gui.editors import EditPerson, EditFamily
import Utils import Utils
import GrampsDisplay import GrampsDisplay
from ManagedWindow import ManagedWindow from ManagedWindow import ManagedWindow
from BasicUtils import UpdateCallback from gen.updatecallback import UpdateCallback
from PluginUtils import Tool from PluginUtils import Tool
from TransUtils import sgettext as _ from TransUtils import sgettext as _
from glade import Glade from glade import Glade
@ -224,11 +224,11 @@ def get_marriage_date(db,family):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Verify(Tool.Tool, ManagedWindow, UpdateCallback): class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
def __init__(self, dbstate, uistate, options_class, name,callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
self.label = _('Database Verify tool') self.label = _('Database Verify tool')
Tool.Tool.__init__(self, dbstate, options_class, name) Tool.Tool.__init__(self, dbstate, options_class, name)
ManagedWindow.__init__(self,uistate,[],self.__class__) ManagedWindow.__init__(self, uistate,[], self.__class__)
UpdateCallback.__init__(self,self.uistate.pulse_progressbar) UpdateCallback.__init__(self, self.uistate.pulse_progressbar)
self.dbstate = dbstate self.dbstate = dbstate
if uistate: if uistate:
@ -237,11 +237,11 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
self.add_results = self.add_results_cli self.add_results = self.add_results_cli
self.run_tool(cli=True) self.run_tool(cli=True)
def add_results_cli(self,results): def add_results_cli(self, results):
# print data for the user, no GUI # print data for the user, no GUI
(msg,gramps_id, name,the_type,rule_id,severity, handle) = results (msg,gramps_id, name, the_type, rule_id, severity, handle) = results
if severity == Rule.WARNING: if severity == Rule.WARNING:
print "W: %s, %s: %s, %s" % (msg,the_type,gramps_id, name) print "W: %s, %s: %s, %s" % (msg,the_type, gramps_id, name)
elif severity == Rule.ERROR: elif severity == Rule.ERROR:
print "E: %s, %s: %s, %s" % (msg,the_type,gramps_id, name) print "E: %s, %s: %s, %s" % (msg,the_type,gramps_id, name)
else: else: