From 84f4195b3956411e89e2a49cb76948fcf5944c55 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 16 Mar 2002 17:26:58 +0000 Subject: [PATCH] Pychecker cleanup, improved icons for reports svn: r844 --- gramps/src/AutoComp.py | 1 - gramps/src/Bookmarks.py | 1 - gramps/src/ChooseParents.py | 2 +- gramps/src/EditPerson.py | 1 - gramps/src/EventEdit.py | 3 - gramps/src/Marriage.py | 1 - gramps/src/MediaView.py | 1 + gramps/src/MergeData.py | 54 ++++----- gramps/src/Plugins.py | 5 +- gramps/src/ReadXML.py | 1 + gramps/src/Report.py | 4 - gramps/src/VersionControl.py | 10 +- gramps/src/plugins/AncestorChart.py | 175 ++++++++++++++++++++-------- gramps/src/plugins/DesGraph.py | 123 +++++++++++-------- 14 files changed, 241 insertions(+), 141 deletions(-) diff --git a/gramps/src/AutoComp.py b/gramps/src/AutoComp.py index c2deef801..768d4a850 100644 --- a/gramps/src/AutoComp.py +++ b/gramps/src/AutoComp.py @@ -25,7 +25,6 @@ strings as the possible completions. import string import gtk -import GDK cnv = string.lower diff --git a/gramps/src/Bookmarks.py b/gramps/src/Bookmarks.py index 0c5d8dc7a..b90090c6f 100644 --- a/gramps/src/Bookmarks.py +++ b/gramps/src/Bookmarks.py @@ -34,7 +34,6 @@ from gnome.ui import * # Local modules # #------------------------------------------------------------------------- -import const import Utils from intl import gettext _ = gettext diff --git a/gramps/src/ChooseParents.py b/gramps/src/ChooseParents.py index 7b1f4d4d0..b06de3b8f 100644 --- a/gramps/src/ChooseParents.py +++ b/gramps/src/ChooseParents.py @@ -232,7 +232,7 @@ class ChooseParents: if self.family: self.family.setRelationship(type) self.change_family_type(self.family,mother_rel,father_rel) - self.family_update(self.family) + self.family_update(None) def add_parent_clicked(self,obj,sex): self.xml = libglade.GladeXML(const.gladeFile,"addperson") diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 587cdfa90..b0e72243d 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -1111,7 +1111,6 @@ class EditPerson: self.pmap[p.get_title()] = p self.birth.setDate(self.bdate.get_text()) - bplace = string.strip(self.bplace.get_text()) self.birth.setPlace(self.get_place(self.bplace,1)) if not self.person.getBirth().are_equal(self.birth): diff --git a/gramps/src/EventEdit.py b/gramps/src/EventEdit.py index 914406519..bf6559c93 100644 --- a/gramps/src/EventEdit.py +++ b/gramps/src/EventEdit.py @@ -171,10 +171,7 @@ class EventEditor: ename = self.name_field.get_text() self.date.set(self.date_field.get_text()) - ecause = self.cause_field.get_text() - eplace = strip(self.place_field.get_text()) - eplace_obj = self.get_place(self.place_field,1) enote = self.note_field.get_chars(0,-1) edesc = self.descr_field.get_text() diff --git a/gramps/src/Marriage.py b/gramps/src/Marriage.py index f42e3f8a4..21f2e3c63 100644 --- a/gramps/src/Marriage.py +++ b/gramps/src/Marriage.py @@ -143,7 +143,6 @@ class Marriage: self.lds_temple.set_popdown_strings(_temple_names) - plist = self.db.getPlaceMap().values() ord = self.family.getLdsSeal() if ord: if ord.getPlace(): diff --git a/gramps/src/MediaView.py b/gramps/src/MediaView.py index 232475502..7b6d1a082 100644 --- a/gramps/src/MediaView.py +++ b/gramps/src/MediaView.py @@ -287,6 +287,7 @@ class MediaView: for o in p.getPhotoList(): if o.getReference() == mobj: return 1 + return 0 def on_drag_data_get(self,w, context, selection_data, info, time): if info == 1: diff --git a/gramps/src/MergeData.py b/gramps/src/MergeData.py index 5f89f5485..3fdf006c6 100644 --- a/gramps/src/MergeData.py +++ b/gramps/src/MergeData.py @@ -496,8 +496,8 @@ def compare_people(p1,p2): name2 = p2.getPrimaryName() chance = name_match(name1,name2) - if chance == -1 : - return -1 + if chance == -1.0 : + return -1.0 birth1 = p1.getBirth() death1 = p1.getDeath() @@ -505,34 +505,34 @@ def compare_people(p1,p2): death2 = p2.getDeath() value = date_match(birth1.getDateObj(),birth2.getDateObj()) - if value == -1 : - return -1 + if value == -1.0 : + return -1.0 chance = chance + value value = date_match(death1.getDateObj(),death2.getDateObj()) - if value == -1 : - return -1 + if value == -1.0 : + return -1.0 chance = chance + value value = place_match(birth1.getPlace(),birth2.getPlace()) - if value == -1 : - return -1 + if value == -1.0 : + return -1.0 chance = chance + value value = place_match(death1.getPlace(),death2.getPlace()) - if value == -1 : - return -1 + if value == -1.0 : + return -1.0 chance = chance + value ancestors = [] ancestors_of(p1,ancestors) if p2 in ancestors: - return -1 + return -1.0 ancestors = [] ancestors_of(p2,ancestors) if p1 in ancestors: - return -1 + return -1.0 f1 = p1.getMainFamily() f2 = p2.getMainFamily() @@ -549,8 +549,8 @@ def compare_people(p1,p2): value = name_match(dad1,dad2) - if value == -1: - return -1 + if value == -1.0: + return -1.0 chance = chance + value @@ -565,8 +565,8 @@ def compare_people(p1,p2): mom2 = None value = name_match(mom1,mom2) - if value == -1: - return -1 + if value == -1.0: + return -1.0 chance = chance + value @@ -577,24 +577,24 @@ def compare_people(p1,p2): father2 = f2.getFather() if father1 and father2: if father1 == father2: - chance = chance + 1 + chance = chance + 1.0 else: fname1 = GrampsCfg.nameof(father1) fname2 = GrampsCfg.nameof(father2) value = name_match(fname1,fname2) - if value != -1: + if value != -1.0: chance = chance + value else: mother1 = f1.getMother() mother2 = f2.getMother() if mother1 and mother2: if mother1 == mother2: - chance = chance + 1 + chance = chance + 1.0 else: mname1 = GrampsCfg.nameof(mother1) mname2 = GrampsCfg.nameof(mother2) value = name_match(mname1,mname2) - if value != -1: + if value != -1.0: chance = chance + value return chance @@ -615,9 +615,9 @@ def name_compare(s1,s2): #----------------------------------------------------------------- def date_match(date1,date2): if date1.getDate() == "" or date2.getDate() == "": - return 0 + return 0.0 if date1.getDate() == date2.getDate(): - return 1 + return 1.0 if date1.isRange() or date2.isRange(): return range_compare(date1,date2) @@ -631,9 +631,9 @@ def date_match(date1,date2): if not date1.getMonthValid() or not date2.getMonthValid(): return 0.75 else: - return -1 + return -1.0 else: - return -1 + return -1.0 #----------------------------------------------------------------- # @@ -652,19 +652,19 @@ def range_compare(date1,date2): date2.get_stop_date() <= date1.get_stop_date(): return 0.5 else: - return -1 + return -1.0 elif date2.isRange(): if date1.get_start_date() >= date2.get_start_date() and \ date1.get_start_date() <= date2.get_stop_date(): return 0.5 else: - return -1 + return -1.0 else: if date2.get_start_date() >= date1.get_start_date() and \ date2.get_start_date() <= date1.get_stop_date(): return 0.5 else: - return -1 + return -1.0 def name_match(name,name1): diff --git a/gramps/src/Plugins.py b/gramps/src/Plugins.py index 0b8ba691e..827544360 100644 --- a/gramps/src/Plugins.py +++ b/gramps/src/Plugins.py @@ -242,7 +242,6 @@ class PluginStatus: if error[0:11] == "exceptions.": error = error[11:] msg = msgs[1] - trc = msgs[2] info.write("%s\n\t%s: %s\n\n" % (file,error,msg) ) info.seek(0) @@ -315,7 +314,7 @@ def reload_plugins(obj): try: reload(plugin) except: - _failmsg.append((file,sys.exc_info())) + _failmsg.append((plugin,sys.exc_info())) # attempt to load the plugins that have failed in the past @@ -323,7 +322,7 @@ def reload_plugins(obj): try: __import__(plugin) except: - _failmsg.append((file,sys.exc_info())) + _failmsg.append((plugin,sys.exc_info())) # attempt to load any new files found for dir in _loaddir: diff --git a/gramps/src/ReadXML.py b/gramps/src/ReadXML.py index 565431f93..246438eeb 100644 --- a/gramps/src/ReadXML.py +++ b/gramps/src/ReadXML.py @@ -106,6 +106,7 @@ def importData(database, filename, callback): return 0 xml_file.close() + return 1 #------------------------------------------------------------------------- # diff --git a/gramps/src/Report.py b/gramps/src/Report.py index 73d94195d..a404c43f1 100644 --- a/gramps/src/Report.py +++ b/gramps/src/Report.py @@ -23,8 +23,6 @@ import RelLib import const import os -import re -import sort import string import Utils import intl @@ -412,8 +410,6 @@ class ReportDialog: """Set up the title bar of the dialog. This function relies on the get_title() customization function for what the title should be.""" - - title = self.get_title() self.name = self.person.getPrimaryName().getRegularName() self.window.set_title(self.get_title()) diff --git a/gramps/src/VersionControl.py b/gramps/src/VersionControl.py index c7f7d68cd..779be5861 100644 --- a/gramps/src/VersionControl.py +++ b/gramps/src/VersionControl.py @@ -178,7 +178,8 @@ class RcsVersionControl(VersionControl): slog = 0 sname = 0 v = None - l = None + l = [] + o = None d = None r,w = popen2.popen2("rlog %s" % self.vfile) @@ -188,7 +189,7 @@ class RcsVersionControl(VersionControl): if sname == 1: if line[0:3] == "key": sname = 0 - continue; + continue else: s = string.split(string.strip(line),":") print "%s - %s" % (s[0],s[1]) @@ -213,7 +214,7 @@ class RcsVersionControl(VersionControl): o = g.group(2) slog = 1 l = [] - + w.close() r.close() return rlist @@ -240,8 +241,7 @@ class RcsVersionControl(VersionControl): status = proc.wait() del proc os.remove(self.tfile) - if status != 0: - return status + return status def set_tag(self,tag): """Sets the tag to the symbolic string""" diff --git a/gramps/src/plugins/AncestorChart.py b/gramps/src/plugins/AncestorChart.py index c3025f353..271d6d9ab 100644 --- a/gramps/src/plugins/AncestorChart.py +++ b/gramps/src/plugins/AncestorChart.py @@ -323,56 +323,137 @@ def report(database,person): #------------------------------------------------------------------------ def get_xpm_image(): return [ - "48 48 4 1", + "48 48 85 1", " c None", - ". c #FFFFFF", - "+ c #C0C0C0", - "@ c #000000", + ". c #887D6C", + "+ c #8C8A87", + "@ c #787775", + "# c #766D5F", + "$ c #67655F", + "% c #5E5A54", + "& c #55524C", + "* c #BBBAB8", + "= c #B7AFA2", + "- c #A9A5A0", + "; c #99948A", + "> c #FAFAFA", + ", c #F8F6F2", + "' c #F6F2EC", + ") c #E6E5E5", + "! c #D2CCBF", + "~ c #C7C6C3", + "{ c #413F3F", + "] c #DCD9D4", + "^ c #322E2B", + "/ c #4F4E4C", + "( c #908F8D", + "_ c #989897", + ": c #8A8986", + "< c #898885", + "[ c #F5EEE5", + "} c #F5F5F5", + "| c #979695", + "1 c #888784", + "2 c #8B8A87", + "3 c #1A1A1A", + "4 c #858582", + "5 c #949390", + "6 c #858480", + "7 c #92918E", + "8 c #8F8E8B", + "9 c #8E8D8A", + "0 c #797773", + "a c #7B7975", + "b c #81807C", + "c c #817F7C", + "d c #989796", + "e c #807E7B", + "f c #8C8B88", + "g c #E3CAA5", + "h c #F2EADF", + "i c #DDCDB4", + "j c #8E8E8B", + "k c #888785", + "l c #EFE4D2", + "m c #969694", + "n c #9F9F9D", + "o c #E6D4B7", + "p c #A5967E", + "q c #8A8987", + "r c #EBDCC4", + "s c #878683", + "t c #9B9995", + "u c #9A9892", + "v c #807F7B", + "w c #7E7C79", + "x c #8E8C88", + "y c #8F8E8C", + "z c #8D8B88", + "A c #B59871", + "B c #878581", + "C c #8E8B87", + "D c #848480", + "E c #898785", + "F c #8A8886", + "G c #7D7B77", + "H c #8D8C89", + "I c #8B8A86", + "J c #918F8B", + "K c #989795", + "L c #BBA382", + "M c #8D8B86", + "N c #868480", + "O c #8E8C87", + "P c #8E8B86", + "Q c #8A8985", + "R c #807F7A", + "S c #8D8A84", + "T c #898884", " ", " ", - " ", - " ++++++++++++++++++++++++++++++++++ ", - " +................................+ ", - " +....................@@@@@@......+ ", - " +.................@@@@@@@@@......+ ", - " +.................@..............+ ", - " +.............@@@@@@.............+ ", - " +...........@@@@@@@@.............+ ", - " +...........@.....@..............+ ", - " +...........@.....@@@@@@@@@......+ ", - " +...........@........@@@@@@......+ ", - " +.......@@@@@@...................+ ", - " +.....@@@@@@@@...................+ ", - " +.....@.....@........@@@@@@......+ ", - " +.....@.....@.....@@@@@@@@@......+ ", - " +.....@.....@.....@..............+ ", - " +.....@.....@@@@@@@@.............+ ", - " +.....@.......@@@@@@.............+ ", - " +.....@...........@..............+ ", - " +.....@...........@@@@@@@@@......+ ", - " +.....@..............@@@@@@......+ ", - " +.@@@@@@.........................+ ", - " +.@@@@@@.........................+ ", - " +.....@..............@@@@@@......+ ", - " +.....@...........@@@@@@@@@......+ ", - " +.....@...........@..............+ ", - " +.....@.......@@@@@@.............+ ", - " +.....@.....@@@@@@@@.............+ ", - " +.....@.....@.....@..............+ ", - " +.....@.....@.....@@@@@@@@@......+ ", - " +.....@.....@........@@@@@@......+ ", - " +.....@@@@@@@@...................+ ", - " +.......@@@@@@...................+ ", - " +...........@........@@@@@@......+ ", - " +...........@.....@@@@@@@@@......+ ", - " +...........@.....@..............+ ", - " +...........@@@@@@@@.............+ ", - " +.............@@@@@@.............+ ", - " +.................@..............+ ", - " +.................@@@@@@@@@......+ ", - " +....................@@@@@@......+ ", - " +................................+ ", - " ++++++++++++++++++++++++++++++++++ ", + " .+....@@#####$$$%$%&$@ ", + " .**************=*-;+%%@ ", + " .*>>,>>>>>>,>>>>')!*..;& ", + " .*>>>>>>>>>>>>>>>,)!=@~;{ ", + " .*,>>>>>>>>>>>>>>>,]]%)~+^ ", + " .*>>>>>>>>>>>>>>>>>))/>)~+^ ", + " .*>>>>>>>>>>>>>>>>>(_/>>)~+^ ", + " .*>>>>>>>>>>>>>>>>>:>/)>>)~+{ ", + " @*>>>>>>>>>>>>>>>>><>/]'>>)~;& ", + " @*>>>>>>>>>>>>>>>>>:>/~][>>)~;$ ", + " #*>>>>>>>>>}}|1<<2>:>/33^{{%$@$@ ", + " .*>>>>>>>>>4:<<<<<56>)~*-;+@$%{$ ", + " #*>>>>>>>>><>|<1<7>8>>)!~=-;+@&{ ", + " #*>>>>>>>>><>>>>>>>9>>,]!~*-;+${ ", + " #*>>>>>>>>><>>>>>>>8>>,))~~*-;@^ ", + " #*>>>>>>>>><>>>>>>>:>(000a!~*-@^ ", + " #*>>>>>>>>>1>>>>>>>b2<<<1c]~~*.^ ", + " #*>>>>>>>>><>>>>>>>,>de<>>>>>>>><>>>>>>,,,''[h]]ii~+^ ", + " $*>>jkkkkj><>>>>>,>'''[[hl]]ig;^ ", + " $*>>mkkkkjn<>>>>>,,'''h[hl]o!!p^ ", + " $*>>jkkkkq><>>>>,'''[)[hhll]i!p^ ", + " $*>>>>>>>>><>>>,,'),[hh)llrro!p^ ", + " $*>>>>>>>>><>>,,'''h[hhhllrriip^ ", + " $*>>>>>>>>><>,'''h[hhlllllrroip^ ", + " %*>>>>>>>>><,''''[[hh|>>>>>>>><'''hhh)tu<>>>>>>>,<''['[[hxly<<>>>>>>,,<'hh)hhlxllrrrrrroiA^ ", + " %*>>>>>>,''1[[[[hllxlrlrroooooA^ ", + " %*>>>>>,,''>>>,'''hDEF<<>>,,'''h)hJ<1>,''[[h[[hllllrlCroroooggogA^ ", + " &*>,,''[h[hlhllrlrrCroooooggggA^ ", + " &=,''[[[[hlhllllrrrMoqkk1NogggL^ ", + " &*''''h)hhlllrrrrrrOPQ c #56524E", + ", c #5E5A56", + "' c #F6EEE6", + ") c #9A968A", + "! c #66665E", + "~ c #F6F2EE", + "{ c #C6C6C1", + "] c #A6967E", + "^ c #8D8A86", + "/ c #736D62", + "( c #E6E6E6", + "_ c #FAFAF9", + ": c #DEDAD6", + "< c #AAA6A2", + "[ c #EEE6D2", + "} c #BABABA", + "| c #878680", + "1 c #8A7E6E", + "2 c #78756F", + "3 c #B89D78", + "4 c #D9CEB9", " ", " ", - " ", - " +++++++++++++++++++++++++++++++++++++ ", - " +...................................+ ", - " +..@@@@@@.......@@@@@@......@@@@@@..+ ", - " +..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..+ ", - " +..@@@@@@...@...@@@@@@...@..@@@@@@..+ ", - " +...........@............@..........+ ", - " +...........@............@..........+ ", - " +...........@............@..@@@@@@..+ ", - " +...........@............@@@@@@@@@..+ ", - " +...........@...............@@@@@@..+ ", - " +...........@.......................+ ", - " +...........@.......................+ ", - " +...........@...@@@@@@......@@@@@@..+ ", - " +...........@@@@@@@@@@@@@@@@@@@@@@..+ ", - " +...........@...@@@@@@...@..@@@@@@..+ ", - " +...........@............@..........+ ", - " +...........@............@..........+ ", - " +...........@............@..@@@@@@..+ ", - " +...........@............@@@@@@@@@..+ ", - " +...........@...............@@@@@@..+ ", - " +...........@.......................+ ", - " +...........@.......................+ ", - " +...........@...@@@@@@..............+ ", - " +...........@@@@@@@@@@..............+ ", - " +...........@...@@@@@@..............+ ", - " +...........@.......... ............+ ", - " +...........@.......................+ ", - " +...........@...@@@@@@..............+ ", - " +...........@@@@@@@@@@..............+ ", - " +...........@...@@@@@@..............+ ", - " +...........@.......................+ ", - " +...........@.......................+ ", - " +...........@...@@@@@@.....@@@@@@...+ ", - " +...........@@@@@@@@@@@@@@@@@@@@@...+ ", - " +...............@@@@@@..@..@@@@@@...+ ", - " +.......................@...........+ ", - " +.......................@...........+ ", - " +.......................@..@@@@@@...+ ", - " +.......................@@@@@@@@@...+ ", - " +..........................@@@@@@...+ ", - " +...................................+ ", - " +++++++++++++++++++++++++++++++++++++ ", + " 1^111122/////!!!,!,>!2 ", + " 1}}}}}}}}}}}}}}#}<)^,,2 ", + " 1}__~___________~(4}11)> ", + " 1}_______________~(4#+{)* ", + " 1}~_______________~::,({^& ", + " 1}_________________((;_({^& ", + " 1}__|++++___+2//2___+;__({^& ", + " 1}__++++2|||///2/|2|2;(__({^* ", + " +}__|++++_@_+2/22_^_+;:~__({)> ", + " 2}________@_______|__;{:'__({)! ", + " /}________@_______|__;..&**,!2!2 ", + " 1}________@_______|__({}<)^2!,*! ", + " /}________@_______|_|222+#<)^2>* ", + " /}________@_______^^|+22/{}<)@!* ", + " /}________@_________|++++{{}<)+& ", + " /}________@___________~'(:4{}<2& ", + " /}________@__________~~((::{{}1& ", + " /}________^_|+2++__~_~_--%:${}^& ", + " /}________+@2++++__~_~~'-::44{^& ", + " !}________@_+++++~_~~~''-=::$$)& ", + " !}________@_______~~~~-'-[:%{4]& ", + " !}________@_____~~~~'('--=[:4{]& ", + " !}________@_____~~(~'--([[==%4]& ", + " !}________@~+++++~~'++2+2===$4]& ", + " !}________2@+++++||)2+|2/[==%4]& ", + " ,}________+_2++2|''[+222+=%=%$]& ", + " ,}________+~~'~---(-[[[=[==%%4]& ", + " !}________+~~~'~''-=[[===%=%%%3& ", + " ,}_______~+~~--(--[[{=====%=%$]& ", + " ,}_______~+~|+222[[=+1222%%$%%3& ", + " ,}_____~_~++/+++/+/+/222/=%%%$3& ", + " ,}_____~~~-'+2221[2=2212/%%%$$3& ", + " ,}___~_~~~-('-[[[=+=%=%%%%%%$$3& ", + " >}___~~''-''-=[=[=2==%=%%%$$%$3& ", + " >}_~_~~'-'-[-[[===2==%$%$%$$$$3& ", + " >#_~~-'''-[-[[=[==2%22+22$$$$$3& ", + " >}~~~~-(--[[======12/2/2/$$$$$3& ", + " ;#~~-'''-(=[=[==%=%%2+2//$$$$$]& ", + " >#~~-(-=-[[[====%%%%%%$$$$$$$$3& ", + " ;#-~''--[===[==$=%%$%$$$$$$}$$3& ", + " ;#---[[[[[==%==%%$%$%$$$$$$$$$3& ", + " ;#}#######3333333333333333333]3& ", + " &&&&&&&&&*&&*&&*&*&&&&&&&&.&&.&& ", " ", " ", " "]