Converted gramps_main.py to a class, replace utils.py with Utils.py and

Config.py with GrampsCfg.py (for pychecker)


svn: r789
This commit is contained in:
Don Allingham
2002-02-22 03:55:32 +00:00
parent 8285071eee
commit d9c223deed
66 changed files with 2085 additions and 2513 deletions

View File

@@ -20,7 +20,7 @@
"Graphical Reports/Ancestor Chart"
import Config
import GrampsCfg
import os
import string
@@ -88,10 +88,10 @@ class AncestorChart:
B = person.getBirth().getPlaceName()
D = person.getDeath().getPlaceName()
i = "%s" % person.getId()
A = Config.attr_name
A = GrampsCfg.attr_name
a = ""
for attr in person.getAttributeList():
if attr.getType() == Config.attr_name:
if attr.getType() == GrampsCfg.attr_name:
a = attr.getValue()
break

View File

@@ -26,7 +26,7 @@ import gnome.ui
import libglade
import const
import utils
import Utils
import intl
_ = intl.gettext
@@ -52,8 +52,8 @@ class ChangeTypes:
self.glade.get_widget("new").set_popdown_strings(const.personalEvents)
self.glade.signal_autoconnect({
"on_close_clicked" : utils.destroy_passed_object,
"on_combo_insert_text" : utils.combo_insert_text,
"on_close_clicked" : Utils.destroy_passed_object,
"on_combo_insert_text" : Utils.combo_insert_text,
"on_apply_clicked" : self.on_apply_clicked
})
@@ -70,7 +70,7 @@ class ChangeTypes:
if event.getName() == original:
event.setName(new)
modified = modified + 1
utils.modified()
Utils.modified()
if modified == 1:
msg = _("1 event record was modified")
@@ -78,7 +78,7 @@ class ChangeTypes:
msg = _("%d event records were modified") % modified
gnome.ui.GnomeOkDialog(msg)
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
#------------------------------------------------------------------------
#

View File

@@ -21,7 +21,7 @@
"Database Processing/Check and repair database"
import RelLib
import utils
import Utils
import intl
_ = intl.gettext
@@ -81,7 +81,7 @@ class CheckIntegrity:
break
else:
family.removeChild(child)
utils.modified()
Utils.modified()
self.broken_links.append((child,family))
#-------------------------------------------------------------------------
@@ -104,7 +104,7 @@ class CheckIntegrity:
family_list = self.db.getFamilyMap().values()[:]
for family in family_list:
if family.getFather() == None and family.getMother() == None:
utils.modified()
Utils.modified()
self.empty_family.append(family)
self.delete_empty_family(family)
@@ -200,7 +200,7 @@ class CheckIntegrity:
glade_file = base + os.sep + "summary.glade"
topDialog = libglade.GladeXML(glade_file,"summary")
topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
})
title = _("Check Integrity")
top = topDialog.get_widget("summary")

View File

@@ -27,8 +27,6 @@ from DrawDoc import *
from Report import *
from TextDoc import *
import Config
import libglade
import gtk
import string

View File

@@ -22,9 +22,9 @@
from RelLib import *
import os
import utils
import Utils
import intl
import Config
import GrampsCfg
_ = intl.gettext
@@ -51,7 +51,7 @@ class DesBrowse:
self.glade = libglade.GladeXML(glade_file,"top")
self.glade.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
})
top = self.glade.get_widget("top")
tree= self.glade.get_widget("tree1")
@@ -60,7 +60,7 @@ class DesBrowse:
top.show()
def add_to_tree(self,tree,person):
item = gtk.GtkTreeItem(Config.nameof(person))
item = gtk.GtkTreeItem(GrampsCfg.nameof(person))
item.show()
item.connect('button-press-event',self.button_press_event)
item.set_data('d',person)

View File

@@ -27,7 +27,7 @@
#------------------------------------------------------------------------
import os
import sort
import utils
import Utils
import string
import ListColors
import Filter
@@ -151,7 +151,7 @@ class EventComparison:
"on_filter_save_clicked" : self.on_filter_save_clicked,
"on_filter_load_clicked" : self.on_filter_load_clicked,
"on_apply_clicked" : self.on_apply_clicked,
"destroy_passed_object" : utils.destroy_passed_object
"destroy_passed_object" : Utils.destroy_passed_object
})
top =self.filterDialog.get_widget("filters")
@@ -224,8 +224,8 @@ class EventComparison:
if len(names) > 0:
self.filter_combo.set_popdown_strings(names)
self.load_dialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"combo_insert_text" : utils.combo_insert_text,
"destroy_passed_object" : Utils.destroy_passed_object,
"combo_insert_text" : Utils.combo_insert_text,
"on_load_filter" : self.on_save_filter,
})
@@ -237,8 +237,8 @@ class EventComparison:
if len(names) > 0:
self.filter_combo.set_popdown_strings(names)
self.load_dialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"combo_insert_text" : utils.combo_insert_text,
"destroy_passed_object" : Utils.destroy_passed_object,
"combo_insert_text" : Utils.combo_insert_text,
"on_load_filter" : self.on_load_filter,
})
@@ -256,12 +256,12 @@ class EventComparison:
name = Filter.get_filter_description(name)
self.filter_list_obj.append([name,f.get_text(),invert])
self.filter_list_obj.thaw()
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
def on_save_filter(self,obj):
name = self.load_dialog.get_widget("name").get_text()
self.interface.save_filter(name,self.filter_list)
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
def on_filter_name_changed(self,obj):
self.qual = obj.get_data(QUALIFIER)
@@ -376,7 +376,7 @@ class DisplayChart:
self.topDialog = libglade.GladeXML(self.glade_file,"view")
self.topDialog.signal_autoconnect({
"on_write_table" : self.on_write_table,
"destroy_passed_object" : utils.destroy_passed_object
"destroy_passed_object" : Utils.destroy_passed_object
})
self.top = self.topDialog.get_widget("view")
@@ -478,7 +478,7 @@ class DisplayChart:
self.form.signal_autoconnect({
"on_save_clicked" : self.on_save_clicked,
"on_html_toggled" : self.on_html_toggled,
"destroy_passed_object" : utils.destroy_passed_object
"destroy_passed_object" : Utils.destroy_passed_object
})
self.save_form = self.form.get_widget("dialog1")
self.save_form.show()
@@ -505,7 +505,7 @@ class DisplayChart:
spreadsheet.write_table_data(bottom)
spreadsheet.finalize()
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
#-------------------------------------------------------------------------
#

View File

@@ -26,7 +26,7 @@ import posixpath
import re
import sort
import string
import utils
import Utils
import intl
_ = intl.gettext
@@ -155,7 +155,7 @@ def report(database,person):
else:
boxes.append( (x, y, (personList[id].getGender() == Person.female), id ) )
personList[id].setPosition( (x,y) )
utils.modified()
Utils.modified()
else:
print "just lost person with key %s" % (id)
@@ -368,7 +368,7 @@ def button_release_event(widget, event):
id = b[3]
person = db.findPersonNoMap(id)
person.setPosition( (b[0], b[1]) )
utils.modified()
Utils.modified()
redraw_tree( widget )
return TRUE

View File

@@ -22,6 +22,7 @@
import os
import intl
import Utils
_ = intl.gettext
@@ -154,7 +155,7 @@ class GraphVizDialog(ReportDialog):
"""Build a one item menu of document types that are
appropriate for this report."""
map = {"Graphviz (dot)" : None}
myMenu = utils.build_string_optmenu(map, None)
myMenu = Utils.build_string_optmenu(map, None)
self.format_menu.set_menu(myMenu)
def make_document(self):

View File

@@ -24,8 +24,6 @@ import RelLib
import const
import os
import string
import utils
import Config
import intl
_ = intl.gettext

View File

@@ -21,10 +21,10 @@
"Database Processing/Merge people"
import RelLib
import utils
import Utils
import soundex
import intl
import Config
import GrampsCfg
_ = intl.gettext
import string
@@ -104,13 +104,13 @@ class Merge:
top.signal_autoconnect({
"on_merge_ok_clicked" : self.on_merge_ok_clicked,
"destroy_passed_object" : utils.destroy_passed_object
"destroy_passed_object" : Utils.destroy_passed_object
})
def on_merge_ok_clicked(self,obj):
active = self.menu.get_menu().get_active().get_data("v")
self.use_soundex = self.soundex_obj.get_active()
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
self.find_potentials(active)
self.show()
@@ -186,7 +186,7 @@ class Merge:
self.window = top.get_widget("mergelist")
self.mlist = top.get_widget("mlist")
top.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_do_merge_clicked" : self.on_do_merge_clicked,
})
self.mlist.connect('button-press-event',self.button_press_event)
@@ -241,7 +241,7 @@ class Merge:
def update_and_destroy(self,obj):
self.update(1)
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
def list_reduce(self,list1,list2):
value = 0
@@ -487,7 +487,7 @@ class Merge:
def name_of(p):
if not p:
return ""
return "%s (%s)" % ( Config.nameof(p),p.getId())
return "%s (%s)" % ( GrampsCfg.nameof(p),p.getId())
def get_name_obj(person):
if person:

View File

@@ -23,7 +23,7 @@
import os
import re
import intl
import utils
import Utils
_ = intl.gettext
@@ -83,7 +83,7 @@ class PatchNames:
self.top = libglade.GladeXML(glade_file,"summary")
self.top.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_ok_clicked" : self.on_ok_clicked
})
self.top.get_widget("textwindow").show_string(msg)
@@ -96,15 +96,15 @@ class PatchNames:
name = grp[0].getPrimaryName()
name.setFirstName(grp[1])
grp[0].setNickName(grp[2])
utils.modified()
Utils.modified()
for grp in self.title_list:
name = grp[0].getPrimaryName()
name.setFirstName(grp[2])
name.setTitle(grp[1])
utils.modified()
Utils.modified()
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
self.cb(1)
#------------------------------------------------------------------------

View File

@@ -33,7 +33,7 @@ import os
import re
import string
import const
import utils
import Utils
import gtk
import gnome.ui
@@ -93,17 +93,17 @@ def importData(database, filename):
statusWindow = statusTop.get_widget("status")
statusTop.get_widget("close").set_sensitive(0)
statusTop.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object
"destroy_passed_object" : Utils.destroy_passed_object
})
try:
g = GedcomParser(database,filename,statusTop)
except IOError,msg:
utils.destroy_passed_object(statusWindow)
Utils.destroy_passed_object(statusWindow)
gnome.ui.GnomeErrorDialog(_("%s could not be opened\n") % filename + str(msg))
return
except:
utils.destroy_passed_object(statusWindow)
Utils.destroy_passed_object(statusWindow)
gnome.ui.GnomeErrorDialog(_("%s could not be opened\n") % filename)
return
@@ -111,7 +111,7 @@ def importData(database, filename):
statusTop.get_widget("close").set_sensitive(1)
utils.modified()
Utils.modified()
if callback:
callback(1)
@@ -803,7 +803,7 @@ class GedcomParser:
photo = Photo()
photo.setPath(path)
photo.setDescription(title)
photo.setMimeType(utils.get_mime_type(path))
photo.setMimeType(Utils.get_mime_type(path))
self.db.addObject(photo)
oref = ObjectRef()
oref.setReference(photo)
@@ -838,7 +838,7 @@ class GedcomParser:
photo = Photo()
photo.setPath(path)
photo.setDescription(title)
photo.setMimeType(utils.get_mime_type(path))
photo.setMimeType(Utils.get_mime_type(path))
self.db.addObject(photo)
oref = ObjectRef()
oref.setReference(photo)
@@ -873,7 +873,7 @@ class GedcomParser:
photo = Photo()
photo.setPath(path)
photo.setDescription(title)
photo.setMimeType(utils.get_mime_type(path))
photo.setMimeType(Utils.get_mime_type(path))
self.db.addObject(photo)
oref = ObjectRef()
oref.setReference(photo)
@@ -1647,7 +1647,7 @@ def on_ok_clicked(obj):
else:
clear_data = 0
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
importData(db,name)
#-------------------------------------------------------------------------
@@ -1667,7 +1667,7 @@ def readData(database,active_person,cb):
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
dic = {
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_ok_clicked" : on_ok_clicked
}

View File

@@ -22,7 +22,7 @@
import libglade
from ReadXML import *
import utils
import Utils
import intl
_ = intl.gettext
@@ -53,7 +53,7 @@ def readData(database,active_person,cb):
glade_file = base + os.sep + "grampsimport.glade"
dic = {
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_ok_clicked" : on_ok_clicked
}
@@ -78,7 +78,7 @@ def on_ok_clicked(obj):
name = topDialog.get_widget("filename").get_text()
name = name + os.sep + const.indexFile
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
importData(db,name,progress)
callback(1)

View File

@@ -29,7 +29,7 @@ from libglade import *
import RelLib
import sort
import intl
import utils
import Utils
_ = intl.gettext
@@ -319,7 +319,7 @@ class RelCalc:
self.people.thaw()
self.glade.signal_autoconnect({
"on_close_clicked" : utils.destroy_passed_object,
"on_close_clicked" : Utils.destroy_passed_object,
"on_apply_clicked" : self.on_apply_clicked
})

View File

@@ -24,7 +24,7 @@ scheme specified in the database's prefix ids
"""
import re
import utils
import Utils
import intl
_ = intl.gettext
@@ -39,7 +39,7 @@ def runTool(database,active_person,callback):
make_new_ids(database.getObjectMap(),database.oprefix)
make_new_ids(database.getSourceMap(),database.sprefix)
make_new_ids(database.getPlaceMap(),database.pprefix)
utils.modified()
Utils.modified()
callback(1)

View File

@@ -25,7 +25,7 @@ import os
import posixpath
import re
import string
import utils
import Utils
import intl
_ = intl.gettext
@@ -45,7 +45,7 @@ def report(database,person):
topDialog = GladeXML(glade_file,"summary")
topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
})
personList = database.getPersonMap().values()

View File

@@ -26,7 +26,7 @@ import posixpath
import re
import sort
import string
import utils
import Utils
import intl
_ = intl.gettext
@@ -60,7 +60,7 @@ def runTool(database,active_person,callback):
verifySettings = GladeXML(glade_file,"verify_settings")
verifySettings.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_verify_ok_clicked" : on_apply_clicked
})
@@ -272,7 +272,7 @@ def on_apply_clicked(obj):
verifyResult = GladeXML(glade_file,"verify_result")
verifyResult.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
})
top = verifyResult.get_widget("verify_result")
textwindow = verifyResult.get_widget("textwindow")

View File

@@ -24,8 +24,7 @@ from RelLib import *
from HtmlDoc import *
import const
import utils
import Config
import GrampsCfg
import intl
_ = intl.gettext
@@ -844,7 +843,7 @@ class WebReportDialog(ReportDialog):
"""Get the name of the directory to which the target dialog
box should default. This value can be set in the preferences
panel."""
return Config.web_dir
return GrampsCfg.web_dir
def set_default_directory(self, value):
"""Save the name of the current directory, so that any future
@@ -854,7 +853,7 @@ class WebReportDialog(ReportDialog):
This means that the last directory used will only be
remembered for this session of gramps unless the user saves
his/her preferences."""
Config.web_dir = value
GrampsCfg.web_dir = value
#------------------------------------------------------------------------
#

View File

@@ -25,7 +25,7 @@ import os
import string
import time
import const
import utils
import Utils
import intl
import Date
_ = intl.gettext
@@ -410,7 +410,7 @@ class GedcomWriter:
self.topDialog = libglade.GladeXML(glade_file,"gedcomExport")
self.topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_ok_clicked" : self.on_ok_clicked
})
@@ -484,13 +484,13 @@ class GedcomWriter:
(self.plist,self.flist,self.slist) = filter(self.db,self.person,self.private)
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
self.exprogress = libglade.GladeXML(glade_file,"exportprogress")
self.exprogress.signal_autoconnect({
"on_close_clicked" : utils.destroy_passed_object
"on_close_clicked" : Utils.destroy_passed_object
})
self.fbar = self.exprogress.get_widget("fbar")
@@ -499,7 +499,7 @@ class GedcomWriter:
self.progress = self.exprogress.get_widget('exportprogress')
closebtn = self.exprogress.get_widget("close")
closebtn.connect("clicked",utils.destroy_passed_object)
closebtn.connect("clicked",Utils.destroy_passed_object)
closebtn.set_sensitive(0)
self.export_data(name)

View File

@@ -25,7 +25,7 @@ import os
import string
import time
import const
import utils
import Utils
import intl
_ = intl.gettext
@@ -531,7 +531,7 @@ def on_ok_clicked(obj):
filter()
exportData(db,name)
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
#-------------------------------------------------------------------------
#
@@ -550,7 +550,7 @@ def writeData(database,person):
glade_file = base + os.sep + "pafexport.glade"
dic = {
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_ok_clicked" : on_ok_clicked
}

View File

@@ -27,7 +27,7 @@ import WriteXML
import time
import os
import TarFile
import utils
import Utils
import libglade
from cStringIO import StringIO
@@ -46,7 +46,7 @@ def writeData(database,person):
glade_file = base + os.sep + "pkgexport.glade"
dic = {
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_ok_clicked" : on_ok_clicked
}
@@ -65,7 +65,7 @@ def on_ok_clicked(obj):
global topDialog
name = topDialog.get_widget("filename").get_text()
utils.destroy_passed_object(obj)
Utils.destroy_passed_object(obj)
exportData(db,name)
def callback(a):

View File

@@ -26,7 +26,7 @@ import posixpath
import re
import sort
import string
import utils
import Utils
import intl
_ = intl.gettext
@@ -40,7 +40,7 @@ def report(database,person):
glade_file = base + os.sep + "summary.glade"
topDialog = GladeXML(glade_file,"summary")
topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"destroy_passed_object" : Utils.destroy_passed_object,
})
thisgen = []
allgen = []

View File

@@ -28,7 +28,7 @@ from libglade import *
import RelLib
import soundex
import utils
import Utils
import intl
_ = intl.gettext
@@ -50,8 +50,8 @@ class SoundGen:
self.glade = GladeXML(glade_file,"soundEx")
self.glade.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"on_combo_insert_text" : utils.combo_insert_text,
"destroy_passed_object" : Utils.destroy_passed_object,
"on_combo_insert_text" : Utils.combo_insert_text,
"on_apply_clicked" : self.on_apply_clicked,
})