diff --git a/ChangeLog b/ChangeLog index a68f50e53..9c27af92f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2004-01-12 Don Allingham + * src/docgen/AbiWord2Doc.py: pychecker fixes + * src/docgen/HtmlDoc.py: pychecker fixes + * src/docgen/KwordDoc.py: pychecker fixes + * src/docgen/LaTeXDoc.py: pychecker fixes + * src/docgen/OpenOfficeDoc.py: pychecker fixes + * src/docgen/OpenSpreadSheet.py: pychecker fixes + * src/docgen/PSDrawDoc.py: pychecker fixes + * src/docgen/PdfDoc.py: pychecker fixes + * src/docgen/SvgDrawDoc.py: pychecker fixes + * src/plugins/Ancestors.py: pychecker fixes + * src/plugins/BookReport.py: pychecker fixes + * src/plugins/CustomBookText.py: pychecker fixes + * src/plugins/DescendReport.py: pychecker fixes + * src/plugins/DetAncestralReport.py: pychecker fixes + * src/plugins/DetDescendantReport.py: pychecker fixes + * src/plugins/FtmStyleAncestors.py: pychecker fixes + * src/plugins/IndivComplete.py: pychecker fixes + * src/plugins/ReadPkg.py: pychecker fixes + * src/plugins/RelCalc.py: pychecker fixes + * src/plugins/SimpleBookTitle.py: pychecker fixes + * src/plugins/TimeLine.py: pychecker fixes + * src/plugins/WriteCD.py: pychecker fixes + * src/plugins/WriteFtree.py: pychecker fixes + * src/plugins/rel_de.py: pychecker fixes + * src/GenericFilter.py: pychecker fixes + * src/RelLib.py: pychecker fixes + * src/Report.py: pychecker fixes + * src/SelectPerson.py: pychecker fixes + * src/gramps_main.py: pychecker fixes + 2004-01-12 Alex Roitman * src/PlaceView.py (on_delete_clicked): Use list's copy to avoid modifying the real EventList (closes # 875332). diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 1c76eec83..87f72f394 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -814,7 +814,7 @@ class IsParentOfFilterMatch(Rule): return self.map.has_key(p.getId()) def init_list(self,p): - if fam in p.getMainParents(): + for fam in p.getMainParents(): for parent in [fam.getFather (), fam.getMother ()]: if parent: self.map[parent.getId()] = 1 diff --git a/src/RelLib.py b/src/RelLib.py index 51aa2d27d..4f9341807 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -2742,7 +2742,7 @@ class GrampsDB: return self.sourceTable.keys() def sortbysource(self,f,s): - return cmp(self.sourceTable[f][3],self.placTable[s][3]) + return cmp(self.sourceTable[f][3],self.sourceTable[s][3]) def sortSourceKeys(self): keys = self.sourceTable.keys() diff --git a/src/Relationship.py b/src/Relationship.py index ed56fb5b5..6f57463d9 100644 --- a/src/Relationship.py +++ b/src/Relationship.py @@ -26,6 +26,7 @@ import RelLib import GrampsCfg +from gettext import gettext as _ #------------------------------------------------------------------------- # diff --git a/src/Report.py b/src/Report.py index 48dd0c018..c6eb0b884 100644 --- a/src/Report.py +++ b/src/Report.py @@ -198,6 +198,7 @@ class BareReportDialog: # Save info about who the report is about. self.option_store = options + self.style_name = "default" self.db = database self.person = person self.output_notebook = None @@ -641,10 +642,6 @@ class BareReportDialog: """Not used in bare report dialogs. Override in the subclass.""" pass - def setup_paper_frame(self): - """Not used in bare report dialogs. Override in the subclass.""" - pass - def setup_output_notebook(self): """Not used in bare report dialogs. Override in the subclass.""" pass @@ -1388,12 +1385,12 @@ class TemplateParser(handler.ContentHandler): try: parser = make_parser() - spath = const.template_dir - parser.setContentHandler(TemplateParser(_template_map,spath)) - parser.parse("file://%s/templates.xml" % spath) + gspath = const.template_dir + parser.setContentHandler(TemplateParser(_template_map,gspath)) + parser.parse("file://%s/templates.xml" % gspath) parser = make_parser() - spath = os.path.expanduser("~/.gramps/templates") - parser.setContentHandler(TemplateParser(_template_map,spath)) - parser.parse("file://%s/templates.xml" % spath) + gspath = os.path.expanduser("~/.gramps/templates") + parser.setContentHandler(TemplateParser(_template_map,gspath)) + parser.parse("file://%s/templates.xml" % gspath) except (IOError,OSError,SAXParseException): pass diff --git a/src/SelectPerson.py b/src/SelectPerson.py index 7763220b2..52398aa86 100644 --- a/src/SelectPerson.py +++ b/src/SelectPerson.py @@ -43,8 +43,6 @@ import RelLib import const import Utils import ListModel -import GrampsCfg -from RelLib import Person #------------------------------------------------------------------------- # diff --git a/src/docgen/AbiWord2Doc.py b/src/docgen/AbiWord2Doc.py index f16bf42cc..7a35ac43e 100644 --- a/src/docgen/AbiWord2Doc.py +++ b/src/docgen/AbiWord2Doc.py @@ -37,6 +37,7 @@ import BaseDoc import Errors import Plugins import ImgManip +import grampslib from latin_utf8 import latin_to_utf8 from gettext import gettext as _ @@ -177,12 +178,10 @@ class AbiWordDoc(BaseDoc.BaseDoc): self.f.close() if self.print_req: - import grampslib - apptype = 'application/x-abiword' - prog = grampslib.default_application_command(apptype) + app = grampslib.default_application_command(apptype) os.environ["FILE"] = self.filename - os.system ('%s "$FILE" &' % prog) + os.system ('%s "$FILE" &' % app) def add_photo(self,name,pos,x_cm,y_cm): @@ -314,7 +313,6 @@ class AbiWordDoc(BaseDoc.BaseDoc): print_label = None try: - import grampslib import Utils prog = grampslib.default_application_command("application/x-abiword") diff --git a/src/docgen/HtmlDoc.py b/src/docgen/HtmlDoc.py index 78b05b9ec..bef2fe9d2 100644 --- a/src/docgen/HtmlDoc.py +++ b/src/docgen/HtmlDoc.py @@ -33,6 +33,7 @@ import const import Errors import BaseDoc import QuestionDialog +import grampslib from gettext import gettext as _ @@ -257,7 +258,7 @@ class HtmlDoc(BaseDoc.BaseDoc): msg = m[1] self.file_header = '%s%s%s\n' % (m[0],msg,m[2]) else: - self.file_header = top + self.file_header = self.top self.file_header = self.process_line(self.file_header) def build_style_declaration(self): @@ -334,12 +335,10 @@ class HtmlDoc(BaseDoc.BaseDoc): self.write_support_files() if self.print_req: - import grampslib - apptype = 'text/html' - prog = grampslib.default_application_command(apptype) + app = grampslib.default_application_command(apptype) os.environ["FILE"] = self.filename - os.system ('%s "$FILE" &' % prog) + os.system ('%s "$FILE" &' % app) def write_support_files(self): if self.map: @@ -473,7 +472,6 @@ class HtmlDoc(BaseDoc.BaseDoc): print_label = None try: - import grampslib import Utils prog = grampslib.default_application_command("text/html") diff --git a/src/docgen/KwordDoc.py b/src/docgen/KwordDoc.py index 5554b29b8..e9188730b 100644 --- a/src/docgen/KwordDoc.py +++ b/src/docgen/KwordDoc.py @@ -27,11 +27,14 @@ import time import string import cStringIO import gzip +import os import Errors from TarFile import TarFile import Plugins import ImgManip +import grampslib + from gettext import gettext as _ def points(val): @@ -260,18 +263,10 @@ class KwordDoc(BaseDoc.BaseDoc): self.m.close() if self.print_req: - import grampslib - apptype = 'application/x-kword' - prog = grampslib.default_application_command(apptype) + app = grampslib.default_application_command(apptype) os.environ["FILE"] = self.filename - os.system ('%s "$FILE" &' % prog) - - def start_page(self,orientation=None): - pass - - def end_page(self): - pass + os.system ('%s "$FILE" &' % app) def start_paragraph(self,style_name,leader=None): self.format_list = [] @@ -492,7 +487,6 @@ class KwordDoc(BaseDoc.BaseDoc): print_label = None try: - import grampslib import Utils prog = grampslib.default_application_command("application/x-kword") diff --git a/src/docgen/LaTeXDoc.py b/src/docgen/LaTeXDoc.py index 707643ff1..cce67784e 100644 --- a/src/docgen/LaTeXDoc.py +++ b/src/docgen/LaTeXDoc.py @@ -238,10 +238,6 @@ class LaTeXDoc(BaseDoc.BaseDoc): self.f.write('\n\\end{document}\n') self.f.close() - def start_page(self,orientation=None): - """Nothing needs to be done to start a page""" - pass - def end_page(self): """Issue a new page command""" self.f.write('\\newpage') diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index 17ae2d879..9025098f0 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -43,6 +43,7 @@ import const import Plugins import ImgManip import FontScale +import grampslib #------------------------------------------------------------------------- # @@ -51,6 +52,9 @@ import FontScale #------------------------------------------------------------------------- from gettext import gettext as _ + +_apptype = 'application/vnd.sun.xml.writer' + #------------------------------------------------------------------------- # # OpenOfficeDoc @@ -361,12 +365,9 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): self._write_meta_file() self._write_zip() if self.print_req: - import grampslib - - apptype = 'application/vnd.sun.xml.writer' - prog = grampslib.default_application_command(apptype) + app = grampslib.default_application_command(_apptype) os.environ["FILE"] = self.filename - os.system ('%s "$FILE" &' % prog) + os.system ('%s "$FILE" &' % app) def add_photo(self,name,pos,x_cm,y_cm): @@ -826,8 +827,6 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): self.f.write('\n\n\n') def draw_path(self,style,path): - stype = self.draw_styles[style] - minx = 9e12 miny = 9e12 maxx = 0 @@ -861,8 +860,6 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): self.f.write('"/>\n') def draw_line(self,style,x1,y1,x2,y2): - box_style = self.draw_styles[style] - self.f.write('') self.text = self.text + text.replace('\n','
') - def print_report(self): - return run_print_dialog (self.filename) - - def start_page(self,orientation=None): + def start_page(self): x = self.get_usable_width()*cm y = self.get_usable_height()*cm self.drawing = reportlab.graphics.shapes.Drawing(x,y) @@ -524,7 +520,6 @@ class PdfDoc(BaseDoc.BaseDoc): self.drawing.add(s) def center_print(self,lines,font,x,y,w,h): - l = len(lines) size = font.get_size() start_y = (y + h/2.0 + l/2.0 + l) - ((l*size) + ((l-1)*0.2))/2.0 @@ -537,7 +532,7 @@ class PdfDoc(BaseDoc.BaseDoc): for text in lines: s = reportlab.graphics.shapes.String(start_x*cm, start_y*cm, - str(line), + str(text), fontName=fnt, fontSize=size, strokeColor=sc, @@ -546,7 +541,6 @@ class PdfDoc(BaseDoc.BaseDoc): start_y = start_y - size*1.2 def left_print(self,lines,font,x,y): - l = len(lines) size = font.get_size() start_y = y start_x = x @@ -581,7 +575,6 @@ def make_color(c): print_label = None try: - import grampslib import Utils prog = grampslib.default_application_command("application/pdf") diff --git a/src/docgen/SvgDrawDoc.py b/src/docgen/SvgDrawDoc.py index d82c68c00..2e9a8b3e4 100644 --- a/src/docgen/SvgDrawDoc.py +++ b/src/docgen/SvgDrawDoc.py @@ -60,17 +60,8 @@ class SvgDrawDoc(BaseDoc.BaseDoc): def close(self): pass - - def start_paragraph(self,style_name): - pass - def end_paragraph(self): - pass - - def write_text(self,text): - pass - - def start_page(self,orientation=None): + def start_page(self): self.page = self.page + 1 if self.page != 1: name = "%s-%d.svg" % (self.root,self.page) diff --git a/src/gramps_main.py b/src/gramps_main.py index e127f23aa..02ad32932 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -434,7 +434,7 @@ class Gramps: self.back.set_sensitive(0) self.forward.set_sensitive(0) except: - self.clear_history + self.clear_history() self.gomenuitem.remove_submenu() self.gomenuitem.set_submenu(gomenu) @@ -526,7 +526,7 @@ class Gramps: self.fwdbtn.set_sensitive(1) self.forward.set_sensitive(1) except: - self.clear_history + self.clear_history() else: self.backbtn.set_sensitive(0) self.back.set_sensitive(0) @@ -552,7 +552,7 @@ class Gramps: self.backbtn.set_sensitive(1) self.back.set_sensitive(1) except: - self.clear_history + self.clear_history() else: self.fwdbtn.set_sensitive(0) self.forward.set_sensitive(0) @@ -1613,7 +1613,7 @@ class Gramps: def update_after_merge(self,person,old_id): if person: self.people_view.remove_from_person_list(person.getId(),old_id) - self.db.buildPersonDisplay(person.getId(),original_id) + self.db.buildPersonDisplay(person.getId(),old_id) self.people_view.redisplay_person_list(person) self.update_display(0) diff --git a/src/plugins/Ancestors.py b/src/plugins/Ancestors.py index 9ef9b3cd9..a61a44483 100644 --- a/src/plugins/Ancestors.py +++ b/src/plugins/Ancestors.py @@ -498,10 +498,6 @@ class ComprehensiveAncestorsReport (Report.Report): def parents_of (self, person): gender = person.getGender () - if gender == RelLib.Person.female: - childof = '. ' + _("She is the daughter of ") - else: - childof = '. ' + _("He is the son of ") family = person.getMainParents () ret = '. ' diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index bf72ccae0..636b3b2d7 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -32,7 +32,6 @@ # #------------------------------------------------------------------------- import os -import string #------------------------------------------------------------------------- # @@ -526,7 +525,6 @@ class BookListDisplay: iter = self.blist.add([name]) if iter: self.blist.selection.select_iter(iter) - path = self.blist.model.get_path(iter) def on_booklist_ok_clicked(self,obj): """Returns selected book. Saves the current list into xml file.""" @@ -901,7 +899,6 @@ class BookReportDialog(Report.ReportDialog): """ def __init__(self,database,person,book): - import BaseDoc Report.BareReportDialog.__init__(self,database,person) self.book = book self.database = database @@ -1082,9 +1079,8 @@ def get_xpm_image(): # # #------------------------------------------------------------------------ -from Plugins import register_report -register_report( +Plugins.register_report( report, _("Book Report"), category=_("Books"), diff --git a/src/plugins/CustomBookText.py b/src/plugins/CustomBookText.py index 6e17eed57..d2fb40dc5 100644 --- a/src/plugins/CustomBookText.py +++ b/src/plugins/CustomBookText.py @@ -22,15 +22,6 @@ # largely based on the SimpleBookTitle.py by Don Allingham # -#------------------------------------------------------------------------ -# -# python modules -# -#------------------------------------------------------------------------ -import os -import string -import cStringIO - #------------------------------------------------------------------------ # # gramps modules @@ -38,14 +29,11 @@ import cStringIO #------------------------------------------------------------------------ import Report import BaseDoc -import RelLib import Errors from QuestionDialog import ErrorDialog from gettext import gettext as _ import gtk -import gnome -import gnome.ui #------------------------------------------------------------------------ # diff --git a/src/plugins/DescendReport.py b/src/plugins/DescendReport.py index 7dc465837..e6c28ef9a 100644 --- a/src/plugins/DescendReport.py +++ b/src/plugins/DescendReport.py @@ -27,7 +27,6 @@ #------------------------------------------------------------------------ import os import sort -import string #------------------------------------------------------------------------ # diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index 10788f702..c2358652f 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -24,9 +24,7 @@ import RelLib import os -import sort import Errors -import string from gettext import gettext as _ from QuestionDialog import ErrorDialog diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index ad201b8d0..25a166afb 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -24,9 +24,7 @@ import RelLib import os -import sort import Errors -import string from QuestionDialog import ErrorDialog from gettext import gettext as _ diff --git a/src/plugins/FtmStyleAncestors.py b/src/plugins/FtmStyleAncestors.py index 25e0ec6b8..4d50ec9f7 100644 --- a/src/plugins/FtmStyleAncestors.py +++ b/src/plugins/FtmStyleAncestors.py @@ -26,7 +26,6 @@ # #------------------------------------------------------------------------ import os -import string import cStringIO #------------------------------------------------------------------------ diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 12fec49bd..985679cbe 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -26,7 +26,6 @@ # #------------------------------------------------------------------------ import os -import string #------------------------------------------------------------------------ # @@ -173,7 +172,7 @@ class IndivComplete(Report.Report): self.d.start_row() self.d.start_cell('IDS-NormalCell',2) format = self.person.getNoteFormat() - self.doc.write_note(note,format,'IDS-Normal') + self.d.write_note(note,format,'IDS-Normal') self.d.end_cell() self.d.end_row() @@ -644,6 +643,7 @@ def write_book_item(database,person,doc,options,newpage=0): except: import DisplayTrace DisplayTrace.DisplayTrace() + return None #------------------------------------------------------------------------ # diff --git a/src/plugins/ReadPkg.py b/src/plugins/ReadPkg.py index a3e925cb7..b1642b07c 100644 --- a/src/plugins/ReadPkg.py +++ b/src/plugins/ReadPkg.py @@ -30,7 +30,6 @@ from gettext import gettext as _ import gtk import const import os -import time from QuestionDialog import ErrorDialog, WarningDialog import TarFile diff --git a/src/plugins/RelCalc.py b/src/plugins/RelCalc.py index 90dd3f19d..b313484c5 100644 --- a/src/plugins/RelCalc.py +++ b/src/plugins/RelCalc.py @@ -34,8 +34,6 @@ import os # GNOME libraries # #------------------------------------------------------------------------- -from gtk import * -from gnome.ui import * import gtk.glade #------------------------------------------------------------------------- @@ -44,7 +42,6 @@ import gtk.glade # #------------------------------------------------------------------------- -import RelLib import Utils import ListModel import Plugins @@ -156,9 +153,8 @@ class RelCalc: # # #------------------------------------------------------------------------- -from Plugins import register_tool -register_tool( +Plugins.register_tool( runTool, _("Relationship calculator"), category=_("Utilities"), diff --git a/src/plugins/SimpleBookTitle.py b/src/plugins/SimpleBookTitle.py index 377cbe25b..297acd1a9 100644 --- a/src/plugins/SimpleBookTitle.py +++ b/src/plugins/SimpleBookTitle.py @@ -25,7 +25,6 @@ # #------------------------------------------------------------------------ import os -import string #------------------------------------------------------------------------ # @@ -34,7 +33,6 @@ import string #------------------------------------------------------------------------ import Report import BaseDoc -import RelLib import Errors from QuestionDialog import ErrorDialog from gettext import gettext as _ @@ -43,8 +41,6 @@ import Utils import AddMedia import gtk -import gnome -import gnome.ui #------------------------------------------------------------------------ # diff --git a/src/plugins/TimeLine.py b/src/plugins/TimeLine.py index 9db06696c..582acd4fe 100644 --- a/src/plugins/TimeLine.py +++ b/src/plugins/TimeLine.py @@ -46,7 +46,6 @@ import gtk import Utils import Report import BaseDoc -import BaseDoc import GenericFilter import Errors import Date diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index e64fde5ad..a924ead68 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -27,7 +27,6 @@ # standard python modules # #------------------------------------------------------------------------- -import time import os from cStringIO import StringIO @@ -50,7 +49,6 @@ import WriteXML import Utils import const import QuestionDialog -import RelImage import ImgManip from gettext import gettext as _ diff --git a/src/plugins/WriteFtree.py b/src/plugins/WriteFtree.py index 26705e9f0..03673e97e 100644 --- a/src/plugins/WriteFtree.py +++ b/src/plugins/WriteFtree.py @@ -27,7 +27,6 @@ # standard python modules # #------------------------------------------------------------------------- -import time import os from cStringIO import StringIO @@ -45,8 +44,6 @@ import gnome # GRAMPS modules # #------------------------------------------------------------------------- -import WriteXML -import TarFile import Utils import GenericFilter import Errors diff --git a/src/plugins/rel_de.py b/src/plugins/rel_de.py index fb5dc801b..71d6ae750 100644 --- a/src/plugins/rel_de.py +++ b/src/plugins/rel_de.py @@ -33,8 +33,8 @@ #------------------------------------------------------------------------- import RelLib -import GrampsCfg from Relationship import apply_filter as getallancestors +from gettext import gettext as _ #------------------------------------------------------------------------- #