From 48283abac173dfbe057747b2842c5d603a1b25cc Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 2 Dec 2005 05:08:01 +0000 Subject: [PATCH] * various: pychecker fixes svn: r5466 --- gramps2/ChangeLog | 1 + gramps2/src/ArgHandler.py | 1 - gramps2/src/ChooseParents.py | 13 +++++++------ gramps2/src/EditPerson.py | 2 +- gramps2/src/EditPlace.py | 1 - gramps2/src/EditSource.py | 1 - gramps2/src/GrampsDbBase.py | 2 +- gramps2/src/GrampsInMemDB.py | 2 +- gramps2/src/MergeData.py | 2 +- gramps2/src/MergePeople.py | 4 ++-- gramps2/src/NameDisplay.py | 8 -------- gramps2/src/Options.py | 1 - gramps2/src/PedView.py | 1 - gramps2/src/ReadGedcom.py | 4 +--- gramps2/src/RelLib.py | 7 ++++++- gramps2/src/ReportOptions.py | 8 +------- gramps2/src/SelectObject.py | 1 - gramps2/src/Sources.py | 1 - gramps2/src/StyleEditor.py | 1 + 19 files changed, 23 insertions(+), 38 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index acceab7dd..54d18ab08 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2005-12-01 Don Allingham + * various: pychecker fixes * src/DateParser.py: properly call the date checking routine 2005-12-01 Alex Roitman diff --git a/gramps2/src/ArgHandler.py b/gramps2/src/ArgHandler.py index 215f2d106..e8262e77b 100644 --- a/gramps2/src/ArgHandler.py +++ b/gramps2/src/ArgHandler.py @@ -33,7 +33,6 @@ Module responsible for handling the command line arguments for GRAMPS. #------------------------------------------------------------------------- import os import getopt -import time from gettext import gettext as _ #------------------------------------------------------------------------- diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index 0dc03c4d0..c583697c5 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -811,6 +811,10 @@ class LikelyFilter(GenericFilter.Rule): labels = [ 'Person handle' ] category = _('General filters') + def __init__(self,data_list,gender): + GenericFilter.Rule.__init__(self,data_list) + self.gender = gender + def prepare(self,db): person = db.get_person_from_handle(self.list[0]) birth = db.get_event_from_handle(person.birth_handle) @@ -833,12 +837,10 @@ class LikelyFilter(GenericFilter.Rule): class LikelyFather(LikelyFilter): name = _('Likely Father') - description = _('Matches likely fathers') + description = _('Matches likely fathersn') def __init__(self,data_list): - GenericFilter.Rule.__init__(self,data_list) - self.gender = RelLib.Person.MALE - + LikelyFilter.__init__(self,data_list,RelLib.Person.MALE) class LikelyMother(LikelyFilter): @@ -846,6 +848,5 @@ class LikelyMother(LikelyFilter): description = _('Matches likely mothers') def __init__(self,data_list): - GenericFilter.Rule.__init__(self,data_list) - self.gender = RelLib.Person.FEMALE + LikelyFilter.__init__(self,data_list,RelLib.Person.FEMALE) diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 6f572aa28..8124b0f0d 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -1255,7 +1255,7 @@ class EditPerson: def on_web_go_clicked(self,obj): """Attempts to display the selected URL in a web browser""" - test = self.web_url.get() + text = self.web_url.get() if text: GrampsDisplay.url(text) diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index ae2e61ad8..9c4911d13 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -384,7 +384,6 @@ class EditPlace: def on_web_go_clicked(self,obj): text = self.web_url.get() if text != "": - import GrampsDisplay GrampsDisplay.url(text) def set(self,field,getf,setf): diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 13b7480ec..316ec98ab 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -304,7 +304,6 @@ class EditSource: source = self.db.get_source_from_handle(handle) EditSource(source,self.db,self.parent,None,self.db.readonly) elif data_type == 5: - import ImageSelect media = self.db.get_object_from_handle(handle) ImageSelect.GlobalMediaProperties(self.db,media,self) diff --git a/gramps2/src/GrampsDbBase.py b/gramps2/src/GrampsDbBase.py index 972f1e27d..d6b68a024 100644 --- a/gramps2/src/GrampsDbBase.py +++ b/gramps2/src/GrampsDbBase.py @@ -251,7 +251,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): def get_event_cursor(self): assert False, "Needs to be overridden in the derived class" - def load(self,name,callback): + def load(self,name,callback,mode="w"): """ Opens the specified database. The method needs to be overridden in the derived class. diff --git a/gramps2/src/GrampsInMemDB.py b/gramps2/src/GrampsInMemDB.py index 004d13836..ddc6a4241 100644 --- a/gramps2/src/GrampsInMemDB.py +++ b/gramps2/src/GrampsInMemDB.py @@ -86,7 +86,7 @@ class GrampsInMemDB(GrampsDbBase): self.oid_trans = {} self.undodb = [] - def load(self,name,callback): + def load(self,name,callback,mode="w"): pass def get_person_cursor(self): diff --git a/gramps2/src/MergeData.py b/gramps2/src/MergeData.py index 860a06871..1bdf55994 100644 --- a/gramps2/src/MergeData.py +++ b/gramps2/src/MergeData.py @@ -220,7 +220,7 @@ class MergeSources: def help(self,obj): """Display the relevant portion of GRAMPS manual""" - help_display('gramps-manual','adv-merge-sources') + GrampsDisplay.help('adv-merge-sources') def merge(self,obj): """ diff --git a/gramps2/src/MergePeople.py b/gramps2/src/MergePeople.py index 562253f1e..8be791fb0 100644 --- a/gramps2/src/MergePeople.py +++ b/gramps2/src/MergePeople.py @@ -156,9 +156,9 @@ class Compare: slist = person.get_family_handle_list() if len(slist) > 0: for fid in slist: - (fn,mn,id) = self.get_parent_info(fid) + (fn,mn,pid) = self.get_parent_info(fid) family = self.db.get_family_from_handle(fid) - self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),id)) + self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),pid)) spouse_id = ReportUtils.find_spouse(person,family) if spouse_id: spouse = self.db.get_person_from_handle(spouse_id) diff --git a/gramps2/src/NameDisplay.py b/gramps2/src/NameDisplay.py index 762e75878..74c1603b6 100644 --- a/gramps2/src/NameDisplay.py +++ b/gramps2/src/NameDisplay.py @@ -24,14 +24,6 @@ Class handling language-specific displaying of names. """ -#------------------------------------------------------------------------- -# -# Standard python modules -# -#------------------------------------------------------------------------- -import os -import locale - #------------------------------------------------------------------------- # # GRAMPS modules diff --git a/gramps2/src/Options.py b/gramps2/src/Options.py index e64a41ba1..871f5a26a 100644 --- a/gramps2/src/Options.py +++ b/gramps2/src/Options.py @@ -416,7 +416,6 @@ class Options: if self.enable_dict: self.options_dict.update(self.enable_dict) - print name self.handler = OptionHandler(name,self.options_dict,person_id) def set_new_options(self): diff --git a/gramps2/src/PedView.py b/gramps2/src/PedView.py index b6965c811..f26aa838f 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/src/PedView.py @@ -47,7 +47,6 @@ except: # Gramps Modules # #------------------------------------------------------------------------- -import GrampsCfg import Relationship import NameDisplay import RelLib diff --git a/gramps2/src/ReadGedcom.py b/gramps2/src/ReadGedcom.py index 533211b55..5b1ab6ed8 100644 --- a/gramps2/src/ReadGedcom.py +++ b/gramps2/src/ReadGedcom.py @@ -58,7 +58,7 @@ import Utils import GrampsMime from bsddb import db from GedcomInfo import * -from QuestionDialog import ErrorDialog +from QuestionDialog import ErrorDialog, WarningDialog #------------------------------------------------------------------------- # @@ -86,8 +86,6 @@ UPDATE = 25 callback = None -_title_string = _("GEDCOM") - def nocnv(s): return unicode(s) diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index 163095171..3ece070ac 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -441,7 +441,7 @@ class SourceNote(BaseObject,NoteBase): @param source: Object used to initialize the new object @type source: SourceNote """ - + BaseObject.__init__(self) NoteBase.__init__(self,source) if source: self.source_list = [SourceRef(sref) for sref in source.source_list] @@ -3096,6 +3096,7 @@ class Location(BaseObject): def __init__(self,source=None): """creates a Location object, copying from the source object if it exists""" + BaseObject.__init__(self) if source: self.city = source.city self.parish = source.parish @@ -3196,6 +3197,7 @@ class Note(BaseObject): """ Creates a new Note object, initializing from the passed string. """ + BaseObject.__init__(self) self.text = text self.format = 0 @@ -3800,6 +3802,7 @@ class Url(BaseObject,PrivacyBase): def __init__(self,source=None): """creates a new URL instance, copying from the source if present""" + BaseObject.__init__(self) PrivacyBase.__init__(self,source) if source: self.path = source.path @@ -3853,6 +3856,7 @@ class Witness(BaseObject,PrivacyBase): the person's name. """ def __init__(self,type=Event.NAME,val="",comment=""): + BaseObject.__init__(self) PrivacyBase.__init__(self) self.set_type(type) self.set_value(val) @@ -3904,6 +3908,7 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase): def __init__(self,source=None): """creates a new SourceRef, copying from the source if present""" + BaseObject.__init__(self) DateBase.__init__(self,source) PrivacyBase.__init__(self,source) NoteBase.__init__(self,source) diff --git a/gramps2/src/ReportOptions.py b/gramps2/src/ReportOptions.py index 7323f34b6..a062f3058 100644 --- a/gramps2/src/ReportOptions.py +++ b/gramps2/src/ReportOptions.py @@ -30,7 +30,6 @@ Report option handling, including saving and parsing. # Standard Python modules # #------------------------------------------------------------------------- -import os from gettext import gettext as _ #------------------------------------------------------------------------- @@ -496,12 +495,7 @@ class ReportOptions(Options.Options): Initializes the class, performing usual house-keeping tasks. Subclasses MUST call this in their __init__() method. """ - self.set_new_options() - self.enable_options() - - if self.enable_dict: - self.options_dict.update(self.enable_dict) - self.handler = OptionHandler(name,self.options_dict,person_id) + Options.Options.__init__(self,name,person_id) def make_default_style(self,default_style): """ diff --git a/gramps2/src/SelectObject.py b/gramps2/src/SelectObject.py index 33d72cbc4..e0e99c3c9 100644 --- a/gramps2/src/SelectObject.py +++ b/gramps2/src/SelectObject.py @@ -30,7 +30,6 @@ # general modules # #------------------------------------------------------------------------- -import os import gc #------------------------------------------------------------------------- diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index 54c9a0ca2..f1de20ce1 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -50,7 +50,6 @@ import RelLib import Date import DateEdit import DateHandler -import GrampsDBCallback import GrampsDisplay import Spell diff --git a/gramps2/src/StyleEditor.py b/gramps2/src/StyleEditor.py index a283824d0..c57045627 100644 --- a/gramps2/src/StyleEditor.py +++ b/gramps2/src/StyleEditor.py @@ -40,6 +40,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------ import gtk +import gtk.glade #------------------------------------------------------------------------ #