From 051f992afb97ab67a57f1de4f3cbc346d5715418 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 4 Jul 2006 23:38:51 +0000 Subject: [PATCH] 2006-07-04 Don Allingham * various: pyflakes fixes svn: r6992 --- ChangeLog | 3 +++ src/DateEdit.py | 2 -- src/DateHandler/_DateDisplay.py | 7 ------- src/GrampsDb/_GedcomInfo.py | 11 +++++++++++ src/GrampsDb/_ReadGedcom.py | 1 - src/GrampsDb/_ReadXML.py | 16 ++++------------ src/GrampsDb/_WriteGedcom.py | 1 - src/GrampsDb/_WriteXML.py | 7 ------- src/GrampsDisplay.py | 2 -- src/ListModel.py | 12 +++++++++++- src/ManagedWindow.py | 1 - src/Merge/_MergePerson.py | 1 - src/PluginUtils/_Options.py | 1 - src/PluginUtils/_PluginMgr.py | 1 - src/PluginUtils/_Plugins.py | 7 +------ src/QuestionDialog.py | 1 - src/ReportBase/_BareReportDialog.py | 3 +++ src/ReportBase/_PrintTools.py | 1 - src/ReportBase/_Report.py | 13 +++++++++++++ src/ReportBase/_ReportDialog.py | 6 ++++++ src/ReportBase/_ReportOptions.py | 7 +++---- src/ReportBase/_StyleComboBox.py | 2 ++ src/ReportBase/_StyleEditor.py | 2 -- src/ScratchPad.py | 3 +-- src/Selectors/_BaseSelector.py | 1 - src/Selectors/_SelectPerson.py | 1 - src/StartupDialog.py | 3 ++- src/TipOfDay.py | 1 - src/Utils.py | 2 -- src/ViewManager.py | 1 - src/docgen/AbiWord2Doc.py | 1 - src/docgen/AsciiDoc.py | 1 - src/docgen/ODFDoc.py | 2 +- src/docgen/OpenOfficeDoc.py | 2 +- src/docgen/PSDrawDoc.py | 4 +++- src/docgen/RTFDoc.py | 1 - src/docgen/SvgDrawDoc.py | 1 - src/plugins/NarrativeWeb.py | 21 ++++++++++----------- 38 files changed, 75 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cb2c8071..d4585d6b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-07-04 Don Allingham + * various: pyflakes fixes + 2006-07-04 Alex Roitman * src/GrampsWidgets.py (hand_cursor): Use HAND2 instead of HAND1. diff --git a/src/DateEdit.py b/src/DateEdit.py index 7c0ef63ad..be5fdd8c2 100644 --- a/src/DateEdit.py +++ b/src/DateEdit.py @@ -57,8 +57,6 @@ log = logging.getLogger(".DateEdit") # #------------------------------------------------------------------------- import gtk -import gtk.gdk -import gtk.glade #------------------------------------------------------------------------- # diff --git a/src/DateHandler/_DateDisplay.py b/src/DateHandler/_DateDisplay.py index 37d54446f..3e31fb95b 100644 --- a/src/DateHandler/_DateDisplay.py +++ b/src/DateHandler/_DateDisplay.py @@ -28,13 +28,6 @@ localized tasks. __author__ = "Donald N. Allingham" __version__ = "$Revision$" -#------------------------------------------------------------------------- -# -# python modules -# -#------------------------------------------------------------------------- -from gettext import gettext as _ - #------------------------------------------------------------------------- # # set up logging diff --git a/src/GrampsDb/_GedcomInfo.py b/src/GrampsDb/_GedcomInfo.py index 4c0c81e7e..da58497ff 100644 --- a/src/GrampsDb/_GedcomInfo.py +++ b/src/GrampsDb/_GedcomInfo.py @@ -20,6 +20,17 @@ # $Id$ +#------------------------------------------------------------------------- +# +# python modules +# +#------------------------------------------------------------------------- +import os +#------------------------------------------------------------------------- +# +# Gramps modules +# +#------------------------------------------------------------------------- import const import RelLib diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index 297630eff..d32a466b2 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -207,7 +207,6 @@ def importData(database, filename, callback=None, use_trans=False): if not gramps and ansel: import gtk - import gtk.glade glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__) top = gtk.glade.XML(glade_file,'encoding','gramps') diff --git a/src/GrampsDb/_ReadXML.py b/src/GrampsDb/_ReadXML.py index 06bb5a7b3..207ac35bb 100644 --- a/src/GrampsDb/_ReadXML.py +++ b/src/GrampsDb/_ReadXML.py @@ -40,19 +40,12 @@ import re import logging log = logging.getLogger(".ReadXML") -#------------------------------------------------------------------------- -# -# GTK+ Modules -# -#------------------------------------------------------------------------- -import gtk - #------------------------------------------------------------------------- # # Gramps Modules # #------------------------------------------------------------------------- -from QuestionDialog import ErrorDialog, WarningDialog, MissingMediaDialog +from QuestionDialog import ErrorDialog import Mime import RelLib import const @@ -1483,11 +1476,11 @@ class GrampsParser(UpdateCallback): elif self.alt_name: # former aka tag -- alternate name if self.name.get_type() == "": - self.name.set_type(NameType.AKA) + self.name.set_type(RelLib.NameType.AKA) self.person.add_alternate_name(self.name) else: if self.name.get_type() == "": - self.name.set_type(NameType.BIRTH) + self.name.set_type(RelLib.NameType.BIRTH) self.person.set_primary_name (self.name) self.name = None @@ -1774,8 +1767,7 @@ def build_place_title(loc): if __name__ == "__main__": import sys import hotshot#, hotshot.stats - import const - from GrampsDb import gramps_db_factory, gramps_db_reader_factory + from GrampsDb import gramps_db_factory def callback(val): print val diff --git a/src/GrampsDb/_WriteGedcom.py b/src/GrampsDb/_WriteGedcom.py index d8aef4b96..ccfa2821d 100644 --- a/src/GrampsDb/_WriteGedcom.py +++ b/src/GrampsDb/_WriteGedcom.py @@ -45,7 +45,6 @@ log = logging.getLogger(".WriteGedcom") # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # diff --git a/src/GrampsDb/_WriteXML.py b/src/GrampsDb/_WriteXML.py index 486654931..2183c1ef8 100644 --- a/src/GrampsDb/_WriteXML.py +++ b/src/GrampsDb/_WriteXML.py @@ -44,13 +44,6 @@ from gettext import gettext as _ import logging log = logging.getLogger(".WriteXML") -#------------------------------------------------------------------------- -# -# load gtk libraries -# -#------------------------------------------------------------------------- -import gtk - #------------------------------------------------------------------------- # # load GRAMPS libraries diff --git a/src/GrampsDisplay.py b/src/GrampsDisplay.py index 67dfdcdf1..b9767eba8 100644 --- a/src/GrampsDisplay.py +++ b/src/GrampsDisplay.py @@ -18,8 +18,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -from QuestionDialog import ErrorDialog - def help(target): try: import gnome diff --git a/src/ListModel.py b/src/ListModel.py index 9b77c3553..60f44ef4a 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -18,12 +18,21 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +#------------------------------------------------------------------------- +# +# GTK +# +#------------------------------------------------------------------------- import gtk -import gtk.gdk import pango import const gtk26 = gtk.pygtk_version >= (2,6,0) +#------------------------------------------------------------------------- +# +# constants +# +#------------------------------------------------------------------------- TEXT = 0 TOGGLE = 1 COMBO = 2 @@ -31,6 +40,7 @@ IMAGE = 3 INTEGER = 4 NOSORT = -1 + #------------------------------------------------------------------------- # # ListModel diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index 97d1824b6..f71e042cc 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -33,7 +33,6 @@ from cStringIO import StringIO # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # diff --git a/src/Merge/_MergePerson.py b/src/Merge/_MergePerson.py index f76fa97de..4e5965320 100644 --- a/src/Merge/_MergePerson.py +++ b/src/Merge/_MergePerson.py @@ -49,7 +49,6 @@ import DateHandler import QuestionDialog import GrampsDisplay import ManagedWindow -import Utils import GrampsDb sex = ( _("female"), _("male"), _("unknown")) diff --git a/src/PluginUtils/_Options.py b/src/PluginUtils/_Options.py index 8ea252766..a58e875d6 100644 --- a/src/PluginUtils/_Options.py +++ b/src/PluginUtils/_Options.py @@ -31,7 +31,6 @@ General option handling, including saving and parsing. # #------------------------------------------------------------------------- import os -from gettext import gettext as _ #------------------------------------------------------------------------- # diff --git a/src/PluginUtils/_PluginMgr.py b/src/PluginUtils/_PluginMgr.py index d65250076..72c538f23 100644 --- a/src/PluginUtils/_PluginMgr.py +++ b/src/PluginUtils/_PluginMgr.py @@ -44,7 +44,6 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- from ReportBase import MODE_GUI, MODE_CLI, MODE_BKI, book_categories -import Errors #------------------------------------------------------------------------- # diff --git a/src/PluginUtils/_Plugins.py b/src/PluginUtils/_Plugins.py index 072785a76..04f9d6900 100644 --- a/src/PluginUtils/_Plugins.py +++ b/src/PluginUtils/_Plugins.py @@ -33,16 +33,13 @@ importers, exporters, and document generators. # GTK libraries # #------------------------------------------------------------------------- -import gobject import gtk -import gtk.glade #------------------------------------------------------------------------- # # Standard Python modules # #------------------------------------------------------------------------- -import traceback import os import sys import re @@ -54,14 +51,12 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import const -import Utils import Config import Errors from ReportBase import report, standalone_categories import _Tool import _PluginMgr import _PluginStatus -import GrampsDisplay import ManagedWindow #------------------------------------------------------------------------- @@ -111,7 +106,7 @@ class PluginDialog(ManagedWindow.ManagedWindow): self.set_window(window, self.title, msg ) - self.store = gtk.TreeStore(gobject.TYPE_STRING) + self.store = gtk.TreeStore(str) self.selection = self.tree.get_selection() self.selection.connect('changed', self.on_node_selected) col = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0) diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index 918a85b12..bdb051b04 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -33,7 +33,6 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk -import gtk.glade from gtk.gdk import pixbuf_new_from_file #------------------------------------------------------------------------- diff --git a/src/ReportBase/_BareReportDialog.py b/src/ReportBase/_BareReportDialog.py index 395547c16..cbc0ccef1 100644 --- a/src/ReportBase/_BareReportDialog.py +++ b/src/ReportBase/_BareReportDialog.py @@ -26,6 +26,7 @@ # #------------------------------------------------------------------------- from types import ClassType, InstanceType +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -41,6 +42,8 @@ import gtk #------------------------------------------------------------------------- import NameDisplay import BaseDoc +import Utils + import ManagedWindow from Filters import FilterComboBox,Rules from _StyleComboBox import StyleComboBox diff --git a/src/ReportBase/_PrintTools.py b/src/ReportBase/_PrintTools.py index 00c808e41..6f69ea3cf 100644 --- a/src/ReportBase/_PrintTools.py +++ b/src/ReportBase/_PrintTools.py @@ -28,7 +28,6 @@ # #------------------------------------------------------------------------- import os -from gettext import gettext as _ #------------------------------------------------------------------------- # diff --git a/src/ReportBase/_Report.py b/src/ReportBase/_Report.py index ce8a28d2e..5c21f55a7 100644 --- a/src/ReportBase/_Report.py +++ b/src/ReportBase/_Report.py @@ -21,6 +21,19 @@ # $Id$ +#------------------------------------------------------------------------- +# +# python +# +#------------------------------------------------------------------------- +from gettext import gettext as _ +import gtk + +#------------------------------------------------------------------------- +# +# Gramps modules +# +#------------------------------------------------------------------------- import Utils #------------------------------------------------------------------------- diff --git a/src/ReportBase/_ReportDialog.py b/src/ReportBase/_ReportDialog.py index ccdd13f5c..ea861e65a 100644 --- a/src/ReportBase/_ReportDialog.py +++ b/src/ReportBase/_ReportDialog.py @@ -26,7 +26,10 @@ # #------------------------------------------------------------------------- import os +from gettext import gettext as _ + import logging + log = logging.getLogger(".") #------------------------------------------------------------------------- @@ -43,6 +46,9 @@ import gtk #------------------------------------------------------------------------- import Config import Errors +import Utils +import const + from QuestionDialog import ErrorDialog, OptionDialog from _Constants import CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK, \ diff --git a/src/ReportBase/_ReportOptions.py b/src/ReportBase/_ReportOptions.py index 98298bcac..e860446a1 100644 --- a/src/ReportBase/_ReportOptions.py +++ b/src/ReportBase/_ReportOptions.py @@ -30,17 +30,17 @@ Report option handling, including saving and parsing. # Standard Python modules # #------------------------------------------------------------------------- -from gettext import gettext as _ import os + #------------------------------------------------------------------------- # # SAX interface # #------------------------------------------------------------------------- try: - from xml.sax import make_parser,handler,SAXParseException + from xml.sax import make_parser, SAXParseException except: - from _xmlplus.sax import make_parser,handler,SAXParseException + from _xmlplus.sax import make_parser, SAXParseException #------------------------------------------------------------------------- # @@ -49,7 +49,6 @@ except: #------------------------------------------------------------------------- import const import Config -import Utils import BaseDoc from PluginUtils import _Options diff --git a/src/ReportBase/_StyleComboBox.py b/src/ReportBase/_StyleComboBox.py index ff705c0b4..0478ec025 100644 --- a/src/ReportBase/_StyleComboBox.py +++ b/src/ReportBase/_StyleComboBox.py @@ -20,6 +20,8 @@ # $Id$ +from gettext import gettext as _ + import gtk #------------------------------------------------------------------------- diff --git a/src/ReportBase/_StyleEditor.py b/src/ReportBase/_StyleEditor.py index e12c11b6e..2df59b6bf 100644 --- a/src/ReportBase/_StyleEditor.py +++ b/src/ReportBase/_StyleEditor.py @@ -36,7 +36,6 @@ from gettext import gettext as _ import logging log = logging.getLogger(".") - #------------------------------------------------------------------------ # # GNOME/GTK modules @@ -44,7 +43,6 @@ log = logging.getLogger(".") #------------------------------------------------------------------------ import gtk from gtk.gdk import Color -import gtk.glade #------------------------------------------------------------------------ # diff --git a/src/ScratchPad.py b/src/ScratchPad.py index c2442a52e..0fda32994 100644 --- a/src/ScratchPad.py +++ b/src/ScratchPad.py @@ -37,7 +37,6 @@ from time import strftime as strftime # #------------------------------------------------------------------------- import gtk -import gtk.glade from gtk.gdk import ACTION_COPY, BUTTON1_MASK #------------------------------------------------------------------------- @@ -247,7 +246,7 @@ class ScratchPadEvent(ScratchPadWrapper): # _("Name"), # escape(short(psrc.get_title()))) - return s +# return s class ScratchPadFamilyEvent(ScratchPadGrampsTypeWrapper): diff --git a/src/Selectors/_BaseSelector.py b/src/Selectors/_BaseSelector.py index 7d2228045..7ccaaf250 100644 --- a/src/Selectors/_BaseSelector.py +++ b/src/Selectors/_BaseSelector.py @@ -31,7 +31,6 @@ except: # #------------------------------------------------------------------------- import gtk -import gtk.glade import pango #------------------------------------------------------------------------- diff --git a/src/Selectors/_SelectPerson.py b/src/Selectors/_SelectPerson.py index ba63954c1..7e3e63550 100644 --- a/src/Selectors/_SelectPerson.py +++ b/src/Selectors/_SelectPerson.py @@ -33,7 +33,6 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk -import gtk.glade import pango #------------------------------------------------------------------------- diff --git a/src/StartupDialog.py b/src/StartupDialog.py index 2b3d651d5..c8ca31402 100644 --- a/src/StartupDialog.py +++ b/src/StartupDialog.py @@ -33,7 +33,6 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # @@ -65,6 +64,8 @@ def upgrade_prefs(): On failure, print message and return False. """ try: + import gconf + client = gconf.client_get_default() client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE) diff --git a/src/TipOfDay.py b/src/TipOfDay.py index 6292b23a4..096eb8c68 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -36,7 +36,6 @@ import os # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # diff --git a/src/Utils.py b/src/Utils.py index 656cf7531..9faa5d6cc 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -44,7 +44,6 @@ except: # #------------------------------------------------------------------------- import gtk -import gtk.gdk #------------------------------------------------------------------------- # @@ -426,7 +425,6 @@ def set_title_label(xmlobj,t): title_label.set_text('%s' % t) title_label.set_use_markup(True) -from ManagedWindow import set_titles as _set_titles from warnings import warn def set_titles(window,title,t,msg=None): warn('The Utils.set_titles is deprecated. Use ManagedWindow methods') diff --git a/src/ViewManager.py b/src/ViewManager.py index cec043e8b..fd5b7a227 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -35,7 +35,6 @@ __revision__ = "$Revision$" import os from gettext import gettext as _ -from bsddb import db from cStringIO import StringIO #------------------------------------------------------------------------- diff --git a/src/docgen/AbiWord2Doc.py b/src/docgen/AbiWord2Doc.py index 5e89dad45..d776b0edd 100644 --- a/src/docgen/AbiWord2Doc.py +++ b/src/docgen/AbiWord2Doc.py @@ -30,7 +30,6 @@ Provides a BaseDoc based interface to the AbiWord document format. # #------------------------------------------------------------------------- import base64 -import os from gettext import gettext as _ #------------------------------------------------------------------------- diff --git a/src/docgen/AsciiDoc.py b/src/docgen/AsciiDoc.py index 9b57d37f4..0ff64bfef 100644 --- a/src/docgen/AsciiDoc.py +++ b/src/docgen/AsciiDoc.py @@ -25,7 +25,6 @@ # python modules # #------------------------------------------------------------------------ -import os from gettext import gettext as _ #------------------------------------------------------------------------ diff --git a/src/docgen/ODFDoc.py b/src/docgen/ODFDoc.py index bcd3fe848..7c1d2285a 100644 --- a/src/docgen/ODFDoc.py +++ b/src/docgen/ODFDoc.py @@ -31,7 +31,7 @@ import zipfile import time import locale from cStringIO import StringIO -from math import pi, cos, sin, fabs +from math import pi, cos, sin #------------------------------------------------------------------------- # diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index 9dde9a9b4..50e133181 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -29,7 +29,7 @@ import os import zipfile import time from cStringIO import StringIO -from math import pi, cos, sin, fabs +from math import pi, cos, sin from gettext import gettext as _ from xml.sax.saxutils import escape diff --git a/src/docgen/PSDrawDoc.py b/src/docgen/PSDrawDoc.py index aae0da0b3..63af657ea 100644 --- a/src/docgen/PSDrawDoc.py +++ b/src/docgen/PSDrawDoc.py @@ -31,9 +31,11 @@ from gettext import gettext as _ #------------------------------------------------------------------------- #Gramps modules #------------------------------------------------------------------------- -from ReportBase import ReportUtils +from ReportBase import ReportUtils, Report from PluginUtils import register_draw_doc import BaseDoc +import Errors + from Utils import gformat def lrgb(grp): diff --git a/src/docgen/RTFDoc.py b/src/docgen/RTFDoc.py index 933ea8d2e..5d94fe6fc 100644 --- a/src/docgen/RTFDoc.py +++ b/src/docgen/RTFDoc.py @@ -25,7 +25,6 @@ # python modules # #------------------------------------------------------------------------ -import os from gettext import gettext as _ #------------------------------------------------------------------------ diff --git a/src/docgen/SvgDrawDoc.py b/src/docgen/SvgDrawDoc.py index 007ff5a34..7f46f3a0d 100644 --- a/src/docgen/SvgDrawDoc.py +++ b/src/docgen/SvgDrawDoc.py @@ -25,7 +25,6 @@ # python modules # #------------------------------------------------------------------------- -from math import pi, cos, sin, fabs from gettext import gettext as _ #------------------------------------------------------------------------- diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index c19b08a6e..9643a5acb 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -341,9 +341,9 @@ class BasePage: def show_link(self,of,lpath,title,path): if path: - of.write(' %s\n' % (path,lpath,self.ext,title)) + of.write('%s\n' % (path,lpath,self.ext,title)) else: - of.write(' %s\n' % (lpath,self.ext,title)) + of.write('%s\n' % (lpath,self.ext,title)) def display_first_image_as_thumbnail( self, of, db, photolist=None): @@ -741,7 +741,7 @@ class PlacePage(BasePage): self.display_first_image_as_thumbnail(of, db, media_list) of.write('
\n') - of.write('

%s

\n' % self.page_title) + of.write('

%s

\n' % self.page_title.strip()) of.write('\n') if not self.noid: @@ -812,7 +812,7 @@ class MediaPage(BasePage): get_researcher().get_name(),up=True) of.write('
\n') - of.write('

%s

\n' % self.page_title) + of.write('

%s

\n' % self.page_title.strip()) # gallery navigation of.write('
') @@ -1163,20 +1163,19 @@ class SourcePage(BasePage): self.display_first_image_as_thumbnail(of, db, media_list) of.write('
\n') - of.write('

%s

\n' % self.page_title) - of.write('
\n') + of.write('

%s

\n' % self.page_title.strip()) + of.write('
') for (label,val) in [(_('GRAMPS ID'),source.gramps_id), (_('Author'),source.author), (_('Publication information'),source.pubinfo), (_('Abbreviation'),source.abbrev)]: if val: - of.write('\n' % label) + of.write('\n' % label) of.write('\n' % val) - of.write('\n') + of.write('') - of.write('
%s
%s%s
\n') - of.write('
\n') + of.write('') self.display_additional_images_as_gallery(of, db, media_list) self.display_note_object(of, source.get_note_object()) @@ -1585,7 +1584,7 @@ class IndividualPage(BasePage): self.person.get_media_list()) of.write('
\n') - of.write('

%s

\n' % self.sort_name) + of.write('

%s

\n' % self.sort_name.strip()) of.write('\n')