diff --git a/ChangeLog b/ChangeLog index b26d7754a..0381a9e7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ +2008-02-18 Raphael Ackermann + * src/* 143 files + * test/try_tree_model.py + * windows/nsis/gcheck.py + imports cleanup + 2008-02-18 Frederik De Richter - * src/Editors/_EditEvent.py - link to wiki manual + * src/Editors/_EditEvent.py + link to wiki manual 2008-02-18 Raphael Ackermann * src/DataViews/EventView.py diff --git a/src/ArgHandler.py b/src/ArgHandler.py index 364cc60e9..b2c18716b 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -42,7 +42,6 @@ import sys import getopt from gettext import gettext as _ import logging -import glob #------------------------------------------------------------------------- # diff --git a/src/ColumnOrder.py b/src/ColumnOrder.py index 6eb24494c..ddf7e940d 100644 --- a/src/ColumnOrder.py +++ b/src/ColumnOrder.py @@ -35,7 +35,8 @@ import logging # GTK modules # #------------------------------------------------------------------------- -import gtk.glade +import gtk +from gtk import glade import gobject #------------------------------------------------------------------------- @@ -65,7 +66,7 @@ class ColumnOrder(ManagedWindow.ManagedWindow): """ ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) - self.glade = gtk.glade.XML(const.GLADE_FILE, "columns", "gramps") + self.glade = glade.XML(const.GLADE_FILE, "columns", "gramps") self.set_window(self.glade.get_widget('columns'), None, win_name) diff --git a/src/Config/_GrampsGconfKeys.py b/src/Config/_GrampsGconfKeys.py index cc8de2750..76c236d99 100644 --- a/src/Config/_GrampsGconfKeys.py +++ b/src/Config/_GrampsGconfKeys.py @@ -37,7 +37,6 @@ except ImportError: import gnome.gconf gconf = gnome.gconf -import gobject import Errors from _GrampsConfigKeys import default_value diff --git a/src/Config/_GrampsIniKeys.py b/src/Config/_GrampsIniKeys.py index 52022e59a..e46647f34 100644 --- a/src/Config/_GrampsIniKeys.py +++ b/src/Config/_GrampsIniKeys.py @@ -23,13 +23,12 @@ """ Low-level handling of .ini keys. """ - import os import time import ConfigParser import errno import const -from _GrampsConfigKeys import * +from Config import DATE_FORMAT, NAME_FORMAT, default_value NL = "\n" # FIX: newlines on Mac/Windows, if different? diff --git a/src/Config/gen_schema_keys.py b/src/Config/gen_schema_keys.py index 389c6bdb7..9fe66ec61 100644 --- a/src/Config/gen_schema_keys.py +++ b/src/Config/gen_schema_keys.py @@ -27,7 +27,7 @@ copy = """# """ -from xml.parsers.expat import ExpatError, ParserCreate +from xml.parsers.expat import ParserCreate class SchemaHandler: diff --git a/src/DataViews/FamilyList.py b/src/DataViews/FamilyList.py index 97dbc0224..b26e19722 100644 --- a/src/DataViews/FamilyList.py +++ b/src/DataViews/FamilyList.py @@ -23,6 +23,20 @@ FamilyList View. """ +#------------------------------------------------------------------------- +# +# Standard python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +#------------------------------------------------------------------------- +# +# GNOME/GTK+ modules +# +#------------------------------------------------------------------------- +import gtk + #------------------------------------------------------------------------- # # gramps modules @@ -37,14 +51,6 @@ import Config from Filters.SideBar import FamilySidebarFilter from ReportBase import CATEGORY_QR_FAMILY -#------------------------------------------------------------------------- -# -# internationalization -# -#------------------------------------------------------------------------- -from gettext import gettext as _ -import gtk - #------------------------------------------------------------------------- # # FamilyListView diff --git a/src/DataViews/GrampletView.py b/src/DataViews/GrampletView.py index b89b4e76e..17c392a3a 100644 --- a/src/DataViews/GrampletView.py +++ b/src/DataViews/GrampletView.py @@ -24,12 +24,19 @@ GrampletView interface. """ +#------------------------------------------------------------------------- +# +# gtk modules +# +#------------------------------------------------------------------------- import gtk +from gtk import glade import gobject +import pango + import traceback import time import types -import pango import os from gettext import gettext as _ @@ -415,7 +422,7 @@ class GuiGramplet: self.pui = None # user code self.tooltips = None self.tooltips_text = None - self.xml = gtk.glade.XML(const.GLADE_FILE, 'gvgramplet', "gramps") + self.xml = glade.XML(const.GLADE_FILE, 'gvgramplet', "gramps") self.mainframe = self.xml.get_widget('gvgramplet') self.textview = self.xml.get_widget('gvtextview') self.buffer = self.textview.get_buffer() diff --git a/src/DataViews/PersonView.py b/src/DataViews/PersonView.py index deb086649..a0666db83 100644 --- a/src/DataViews/PersonView.py +++ b/src/DataViews/PersonView.py @@ -940,16 +940,13 @@ class PersonView(PageView.PersonNavView): def write_tabbed_file(self, name, type): """ - Writes a tabbed file to the specified name. The output file type is determined - by the type variable. + Write a tabbed file to the specified name. + + The output file type is determined by the type variable. """ - # Select the correct output format - if type == 0: - from CSVTab import CSVTab as tabgen - else: - from ODSTab import ODSTab as tabgen - + from docgen import CSVTab, ODSTab + ofile = None # build the active data columns, prepending 0 for the name column, then # derive the column names fromt the active data columns @@ -958,10 +955,13 @@ class PersonView(PageView.PersonNavView): if pair[0]] cnames = [column_names[i] for i in data_cols] - + # Select the correct output format + if type == 0: + ofile = CSVTab(len(cnames)) + else: + ofile = ODSTab(len(cnames)) + # create the output tabbed document, and open it - - ofile = tabgen(len(cnames)) ofile.open(name) # start the current page diff --git a/src/DateEdit.py b/src/DateEdit.py index 951e7a4ec..ef6a2a598 100644 --- a/src/DateEdit.py +++ b/src/DateEdit.py @@ -54,6 +54,7 @@ __LOG = logging.getLogger(".DateEdit") # #------------------------------------------------------------------------- import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -187,7 +188,7 @@ class DateEditorDialog(ManagedWindow.ManagedWindow): # Create self.date as a copy of the given Date object. self.date = Date(date) - self.top = gtk.glade.XML(const.GLADE_FILE, "date_edit","gramps" ) + self.top = glade.XML(const.GLADE_FILE, "date_edit","gramps" ) self.set_window( self.top.get_widget('date_edit'), diff --git a/src/DateHandler/__init__.py b/src/DateHandler/__init__.py index 9d7416f03..45161b159 100644 --- a/src/DateHandler/__init__.py +++ b/src/DateHandler/__init__.py @@ -25,8 +25,8 @@ Class handling language-specific selection for date parser and displayer. """ # import prerequisites for localized handlers -from _DateHandler import LANG, LANG_SHORT, \ - LANG_TO_PARSER, LANG_TO_DISPLAY, register_datehandler +from _DateHandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY, + register_datehandler) # Import all the localized handlers import _Date_cs @@ -37,11 +37,11 @@ import _Date_fr import _Date_lt import _Date_nb import _Date_nl -import _Date_ru -import _Date_sv -import _Date_sk import _Date_pl import _Date_pt +import _Date_ru +import _Date_sk +import _Date_sv # Initialize global parser try: diff --git a/src/DbLoader.py b/src/DbLoader.py index dfbb01050..72cb4c200 100644 --- a/src/DbLoader.py +++ b/src/DbLoader.py @@ -30,7 +30,6 @@ Handling of loading new/existing databases. # #------------------------------------------------------------------------- import os -import sys from gettext import gettext as _ import logging diff --git a/src/DbManager.py b/src/DbManager.py index 4a871a04c..db6c242cf 100644 --- a/src/DbManager.py +++ b/src/DbManager.py @@ -52,7 +52,7 @@ else: # #------------------------------------------------------------------------- import gtk -import gtk.glade +from gtk import glade from gtk.gdk import ACTION_COPY import pango @@ -267,7 +267,7 @@ class DbManager(CLIDbManager): the GTK widgets that are needed. """ CLIDbManager.__init__(self, dbstate) - self.glade = gtk.glade.XML(const.GLADE_FILE, "dbmanager", "gramps") + self.glade = glade.XML(const.GLADE_FILE, "dbmanager", "gramps") self.top = self.glade.get_widget('dbmanager') if parent: self.top.set_transient_for(parent) @@ -1018,7 +1018,7 @@ def check_in(dbase, filename, callback, cursor_func = None): init = [ "rcs", '-i', '-U', '-q', '-t-"GRAMPS database"', ] ci_cmd = [ "ci", "-q", "-f" ] - glade = gtk.glade.XML(const.GLADE_FILE, "comment", "gramps") + glade = glade.XML(const.GLADE_FILE, "comment", "gramps") top = glade.get_widget('comment') text = glade.get_widget('description') diff --git a/src/DisplayModels/_NoteModel.py b/src/DisplayModels/_NoteModel.py index 549e070ee..e48e2c7a3 100644 --- a/src/DisplayModels/_NoteModel.py +++ b/src/DisplayModels/_NoteModel.py @@ -40,9 +40,6 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------- -import const -import ToolTips -import GrampsLocale from _BaseModel import BaseModel import gen.lib diff --git a/src/DisplayModels/_PeopleModel.py b/src/DisplayModels/_PeopleModel.py index c8036f0f2..454602ecc 100644 --- a/src/DisplayModels/_PeopleModel.py +++ b/src/DisplayModels/_PeopleModel.py @@ -32,7 +32,6 @@ TreeModel for the GRAMPS Person tree. from gettext import gettext as _ import time import cgi -import sys import locale #------------------------------------------------------------------------- @@ -56,7 +55,7 @@ import gtk # #------------------------------------------------------------------------- import const -from gen.lib import * +from gen.lib import Name, EventRef, EventType, EventRoleType, MarkerType from BasicUtils import name_displayer import DateHandler import ToolTips diff --git a/src/DisplayState.py b/src/DisplayState.py index bc07992bc..869c663da 100644 --- a/src/DisplayState.py +++ b/src/DisplayState.py @@ -41,8 +41,9 @@ _LOG = logging.getLogger(".DisplayState") # GNOME python modules # #------------------------------------------------------------------------- +import gtk +from gtk import glade import gobject -import gtk.glade #------------------------------------------------------------------------- # @@ -282,7 +283,7 @@ class WarnHandler(RotateHandler): def display(self, obj): obj.hide() - xml = gtk.glade.XML(const.GLADE_FILE, 'scrollmsg') + xml = glade.XML(const.GLADE_FILE, 'scrollmsg') top = xml.get_widget('scrollmsg') msg = xml.get_widget('msg') buf = msg.get_buffer() diff --git a/src/DisplayTabs/_LdsModel.py b/src/DisplayTabs/_LdsModel.py index 01fb741fe..c9cd5930d 100644 --- a/src/DisplayTabs/_LdsModel.py +++ b/src/DisplayTabs/_LdsModel.py @@ -25,7 +25,6 @@ # python libraries # #------------------------------------------------------------------------- -from gettext import gettext as _ #------------------------------------------------------------------------- # diff --git a/src/DisplayTabs/_NoteTab.py b/src/DisplayTabs/_NoteTab.py index 51b520f7e..33035b8c7 100644 --- a/src/DisplayTabs/_NoteTab.py +++ b/src/DisplayTabs/_NoteTab.py @@ -26,24 +26,20 @@ # #------------------------------------------------------------------------- from gettext import gettext as _ -import cPickle as pickle #------------------------------------------------------------------------- # # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk #------------------------------------------------------------------------- # # GRAMPS classes # #------------------------------------------------------------------------- -import Spell import Errors import gen.lib -from DisplayTabs import log from _NoteModel import NoteModel from _EmbeddedList import EmbeddedList from DdTargets import DdTargets diff --git a/src/Editors/AddMedia.py b/src/Editors/AddMedia.py index f75687c68..3ac9df08f 100644 --- a/src/Editors/AddMedia.py +++ b/src/Editors/AddMedia.py @@ -30,7 +30,6 @@ Provides the interface to allow a person to add a media object to the database. # #------------------------------------------------------------------------- import os -import sys #------------------------------------------------------------------------- # @@ -44,8 +43,8 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -from QuestionDialog import ErrorDialog, WarningDialog -import gtk.glade +import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -55,10 +54,10 @@ import gtk.glade import const import Config import Utils -import gen.lib import Mime import GrampsDisplay import ManagedWindow +from QuestionDialog import ErrorDialog, WarningDialog #------------------------------------------------------------------------- # @@ -96,7 +95,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow): self.last_directory = Config.get(Config.ADDMEDIA_IMGDIR) self.relative_path = Config.get(Config.ADDMEDIA_RELPATH) - self.glade = gtk.glade.XML(const.GLADE_FILE, "imageSelect", "gramps") + self.glade = glade.XML(const.GLADE_FILE, "imageSelect", "gramps") self.set_window( self.glade.get_widget("imageSelect"), diff --git a/src/Editors/_EditAddress.py b/src/Editors/_EditAddress.py index b2c0212ca..458614f36 100644 --- a/src/Editors/_EditAddress.py +++ b/src/Editors/_EditAddress.py @@ -37,7 +37,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -50,7 +50,7 @@ from _EditSecondary import EditSecondary from gen.lib import NoteType from DisplayTabs import SourceEmbedList, NoteTab -from GrampsWidgets import * +from GrampsWidgets import MonitoredDate, MonitoredEntry, PrivacyButton #------------------------------------------------------------------------- # @@ -75,7 +75,7 @@ class EditAddress(EditSecondary): EditSecondary.__init__(self, dbstate, uistate, track, addr, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "addr_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "addr_edit","gramps") self.set_window(self.top.get_widget("addr_edit"), self.top.get_widget("title"), _('Address Editor')) diff --git a/src/Editors/_EditAttribute.py b/src/Editors/_EditAttribute.py index ed2f4ab4d..1f98977d2 100644 --- a/src/Editors/_EditAttribute.py +++ b/src/Editors/_EditAttribute.py @@ -37,7 +37,8 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk.glade +import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -50,7 +51,7 @@ from _EditSecondary import EditSecondary from gen.lib import NoteType from DisplayTabs import SourceEmbedList, NoteTab -from GrampsWidgets import * +from GrampsWidgets import MonitoredEntry, PrivacyButton, MonitoredDataType #------------------------------------------------------------------------- # @@ -78,7 +79,7 @@ class EditAttribute(EditSecondary): EditSecondary.__init__(self, state, uistate, track, attrib, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "attr_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "attr_edit","gramps") self.set_window(self.top.get_widget("attr_edit"), self.top.get_widget('title'), _('Attribute Editor')) diff --git a/src/Editors/_EditChildRef.py b/src/Editors/_EditChildRef.py index 2badc23df..e375cae94 100644 --- a/src/Editors/_EditChildRef.py +++ b/src/Editors/_EditChildRef.py @@ -38,6 +38,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -83,7 +84,7 @@ class EditChildRef(EditSecondary): childref, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "cref_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "cref_edit","gramps") self.set_window(self.top.get_widget("cref_edit"), self.top.get_widget("title"), self.name, diff --git a/src/Editors/_EditEventRef.py b/src/Editors/_EditEventRef.py index 76d69464f..63e7f82e0 100644 --- a/src/Editors/_EditEventRef.py +++ b/src/Editors/_EditEventRef.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -43,8 +43,10 @@ import const import Config import gen.lib -from DisplayTabs import SourceEmbedList,NoteTab,GalleryTab,EventBackRefList,AttrEmbedList -from GrampsWidgets import * +from DisplayTabs import (SourceEmbedList, NoteTab, GalleryTab, + EventBackRefList, AttrEmbedList) +from GrampsWidgets import (PrivacyButton, MonitoredEntry, PlaceEntry, + MonitoredDate, MonitoredDataType) from _EditReference import RefTab, EditReference #------------------------------------------------------------------------- @@ -71,7 +73,7 @@ class EditEventRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "event_eref_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "event_eref_edit","gramps") self.set_window(self.top.get_widget('event_eref_edit'), self.top.get_widget('eer_title'), _('Event Reference Editor')) diff --git a/src/Editors/_EditLdsOrd.py b/src/Editors/_EditLdsOrd.py index d10dbb40b..bf43e84a8 100644 --- a/src/Editors/_EditLdsOrd.py +++ b/src/Editors/_EditLdsOrd.py @@ -17,6 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +import gtk # $Id$ @@ -37,7 +38,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -53,7 +54,8 @@ import LdsUtils from _EditSecondary import EditSecondary from DisplayTabs import SourceEmbedList,NoteTab -from GrampsWidgets import * +from GrampsWidgets import (PrivacyButton, MonitoredDate, PlaceEntry, + MonitoredMenu, MonitoredStrMenu) _DATA_MAP = { gen.lib.LdsOrd.BAPTISM : [ @@ -143,7 +145,7 @@ class EditLdsOrd(EditSecondary): EditSecondary.__init__(self, state, uistate, track, attrib, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "lds_person_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "lds_person_edit","gramps") self.set_window(self.top.get_widget("lds_person_edit"), self.top.get_widget('title'), _('LDS Ordinance Editor')) @@ -329,7 +331,7 @@ class EditFamilyLdsOrd(EditSecondary): EditSecondary.__init__(self, state, uistate, track, attrib, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "lds_person_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "lds_person_edit","gramps") self.set_window(self.top.get_widget("lds_person_edit"), self.top.get_widget('title'), _('LDS Ordinance Editor')) diff --git a/src/Editors/_EditLocation.py b/src/Editors/_EditLocation.py index 6fd6c1352..e9d88ed83 100644 --- a/src/Editors/_EditLocation.py +++ b/src/Editors/_EditLocation.py @@ -25,7 +25,7 @@ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -36,7 +36,7 @@ import const import Config from _EditSecondary import EditSecondary -from GrampsWidgets import * +from GrampsWidgets import MonitoredEntry from gettext import gettext as _ #------------------------------------------------------------------------- @@ -54,7 +54,7 @@ class EditLocation(EditSecondary): location, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "loc_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "loc_edit","gramps") self.set_window(self.top.get_widget("loc_edit"), None, _('Location Editor')) diff --git a/src/Editors/_EditMedia.py b/src/Editors/_EditMedia.py index 0f5a89472..3fc4492c8 100644 --- a/src/Editors/_EditMedia.py +++ b/src/Editors/_EditMedia.py @@ -26,7 +26,6 @@ # #------------------------------------------------------------------------- from gettext import gettext as _ -import os #------------------------------------------------------------------------- # diff --git a/src/Editors/_EditMediaRef.py b/src/Editors/_EditMediaRef.py index 7db4b24d0..3dae51b68 100644 --- a/src/Editors/_EditMediaRef.py +++ b/src/Editors/_EditMediaRef.py @@ -33,6 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -46,9 +47,9 @@ import ThumbNails from Utils import media_path_full from gen.lib import NoteType -from DisplayTabs import \ - SourceEmbedList,AttrEmbedList,MediaBackRefList,NoteTab -from GrampsWidgets import * +from DisplayTabs import (SourceEmbedList, AttrEmbedList, MediaBackRefList, + NoteTab) +from GrampsWidgets import MonitoredSpinButton, MonitoredEntry, PrivacyButton from _EditReference import RefTab, EditReference from AddMedia import AddMediaObject @@ -72,7 +73,7 @@ class EditMediaRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, + self.top = glade.XML(const.GLADE_FILE, "change_description","gramps") self.set_window(self.top.get_widget('change_description'), diff --git a/src/Editors/_EditName.py b/src/Editors/_EditName.py index 1f60e1313..a4a2d9cd3 100644 --- a/src/Editors/_EditName.py +++ b/src/Editors/_EditName.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -41,13 +41,12 @@ import gtk.glade #------------------------------------------------------------------------- import const import Config -import Utils from BasicUtils import name_displayer from _EditSecondary import EditSecondary from gen.lib import NoteType - from DisplayTabs import GrampsTab,SourceEmbedList,NoteTab -from GrampsWidgets import * +from GrampsWidgets import (MonitoredEntry, MonitoredMenu, MonitoredDate, + MonitoredDataType, PrivacyButton) #------------------------------------------------------------------------- @@ -110,7 +109,7 @@ class EditName(EditSecondary): def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "name_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "name_edit","gramps") self.set_window(self.top.get_widget("name_edit"), self.top.get_widget("title"), _("Name Editor")) diff --git a/src/Editors/_EditPersonRef.py b/src/Editors/_EditPersonRef.py index 5daf70d15..03c7ef441 100644 --- a/src/Editors/_EditPersonRef.py +++ b/src/Editors/_EditPersonRef.py @@ -37,7 +37,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -49,9 +49,8 @@ import Config from BasicUtils import name_displayer from _EditSecondary import EditSecondary from gen.lib import NoteType - +from GrampsWidgets import MonitoredEntry, PrivacyButton from DisplayTabs import SourceEmbedList, NoteTab -from GrampsWidgets import * #------------------------------------------------------------------------- # @@ -76,7 +75,7 @@ class EditPersonRef(EditSecondary): EditSecondary.__init__(self, dbstate, uistate, track, addr, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "pref_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "pref_edit","gramps") self.set_window(self.top.get_widget("pref_edit"), self.top.get_widget("title"), _('Person Reference Editor')) diff --git a/src/Editors/_EditReference.py b/src/Editors/_EditReference.py index 31a4cebbd..9200f8302 100644 --- a/src/Editors/_EditReference.py +++ b/src/Editors/_EditReference.py @@ -20,13 +20,19 @@ # $Id$ +#------------------------------------------------------------------------- +# +# GTK/Gnome modules +# +#------------------------------------------------------------------------- +import gtk + #------------------------------------------------------------------------- # # gramps modules # #------------------------------------------------------------------------- import ManagedWindow -from GrampsWidgets import * from DisplayTabs import GrampsTab import Config diff --git a/src/Editors/_EditRepoRef.py b/src/Editors/_EditRepoRef.py index 277f3cb5d..8b47388b9 100644 --- a/src/Editors/_EditRepoRef.py +++ b/src/Editors/_EditRepoRef.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -45,7 +45,7 @@ import Config from gen.lib import NoteType from DisplayTabs import NoteTab,AddrEmbedList,WebEmbedList,SourceBackRefList -from GrampsWidgets import * +from GrampsWidgets import MonitoredEntry, PrivacyButton, MonitoredDataType from _EditReference import RefTab, EditReference #------------------------------------------------------------------------- @@ -65,7 +65,7 @@ class EditRepoRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "repository_ref_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "repository_ref_edit","gramps") self.set_window(self.top.get_widget('repository_ref_edit'), self.top.get_widget('repo_title'), diff --git a/src/Editors/_EditSourceRef.py b/src/Editors/_EditSourceRef.py index 44df634b9..41bbbe2c6 100644 --- a/src/Editors/_EditSourceRef.py +++ b/src/Editors/_EditSourceRef.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -42,9 +42,10 @@ import gtk import const import gen.lib -from DisplayTabs import \ - NoteTab,GalleryTab,SourceBackRefList,DataEmbedList,RepoEmbedList -from GrampsWidgets import * +from DisplayTabs import (NoteTab, GalleryTab, SourceBackRefList, + DataEmbedList, RepoEmbedList) +from GrampsWidgets import (PrivacyButton, MonitoredEntry, MonitoredMenu, + MonitoredDate) from _EditReference import RefTab, EditReference #------------------------------------------------------------------------- @@ -60,7 +61,7 @@ class EditSourceRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "source_ref_edit","gramps") + self.top = glade.XML(const.GLADE_FILE, "source_ref_edit","gramps") self.set_window(self.top.get_widget('source_ref_edit'), self.top.get_widget('source_title'), diff --git a/src/Editors/_EditUrl.py b/src/Editors/_EditUrl.py index f60dd145a..6d55bc845 100644 --- a/src/Editors/_EditUrl.py +++ b/src/Editors/_EditUrl.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -42,8 +42,7 @@ import gtk.glade import const import Config from _EditSecondary import EditSecondary - -from GrampsWidgets import * +from GrampsWidgets import MonitoredEntry, PrivacyButton, MonitoredDataType #------------------------------------------------------------------------- # @@ -61,7 +60,7 @@ class EditUrl(EditSecondary): url, callback) def _local_init(self): - self.top = gtk.glade.XML(const.GLADE_FILE, "url_edit", "gramps") + self.top = glade.XML(const.GLADE_FILE, "url_edit", "gramps") self.jump = self.top.get_widget('jump') self.set_window(self.top.get_widget("url_edit"), @@ -80,26 +79,20 @@ class EditUrl(EditSecondary): GrampsDisplay.url(self.obj.get_path()) def _setup_fields(self): - self.des = MonitoredEntry( - self.top.get_widget("url_des"), - self.obj.set_description, - self.obj.get_description, - self.db.readonly) + self.des = MonitoredEntry(self.top.get_widget("url_des"), + self.obj.set_description, + self.obj.get_description, self.db.readonly) - self.addr = MonitoredEntry( - self.top.get_widget("url_addr"), - self.obj.set_path, - self.obj.get_path, - self.db.readonly) + self.addr = MonitoredEntry(self.top.get_widget("url_addr"), + self.obj.set_path, self.obj.get_path, + self.db.readonly) self.priv = PrivacyButton(self.top.get_widget("priv"), self.obj, self.db.readonly) - self.type_sel = MonitoredDataType( - self.top.get_widget("type"), - self.obj.set_type, - self.obj.get_type, - self.db.readonly) + self.type_sel = MonitoredDataType(self.top.get_widget("type"), + self.obj.set_type, + self.obj.get_type, self.db.readonly) def build_menu_names(self,obj): etitle =_('Internet Address Editor') diff --git a/src/ExportAssistant.py b/src/ExportAssistant.py index 5f42bfcec..e51bdcaea 100644 --- a/src/ExportAssistant.py +++ b/src/ExportAssistant.py @@ -43,7 +43,6 @@ log = logging.getLogger(".ExportAssistant") # #------------------------------------------------------------------------- import gtk - #------------------------------------------------------------------------- # # gramps modules diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 562345afd..c4bf9253e 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -27,6 +27,7 @@ #------------------------------------------------------------------------- import random from gettext import gettext as _ +import os from xml.sax.saxutils import escape #------------------------------------------------------------------------- @@ -35,6 +36,8 @@ from xml.sax.saxutils import escape # #------------------------------------------------------------------------- import gtk +from gtk import glade +import gobject #------------------------------------------------------------------------- # @@ -48,7 +51,7 @@ from BasicUtils import name_displayer as _nd import Utils from gen.lib import Name import ManagedWindow -from GrampsWidgets import * +from GrampsWidgets import MarkupLabel, BasicLabel from QuestionDialog import ErrorDialog, QuestionDialog2 from Errors import NameDisplayError @@ -884,7 +887,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): return (_('Preferences'), None) # FIXME: is this needed? - def _set_button(stock): + def _set_button(self, stock): button = gtk.Button() image = gtk.Image() image.set_from_stock(stock, gtk.ICON_SIZE_BUTTON) @@ -903,7 +906,7 @@ class NameFormatEditDlg: self.name = name self.valid = True - self.top = gtk.glade.XML(const.GLADE_FILE, 'namefmt_edit', 'gramps') + self.top = glade.XML(const.GLADE_FILE, 'namefmt_edit', 'gramps') self.dlg = self.top.get_widget('namefmt_edit') ManagedWindow.set_titles(self.dlg, None, _('Name Format Editor')) diff --git a/src/GrampsDbUtils/_GedcomLex.py b/src/GrampsDbUtils/_GedcomLex.py index d19d109b7..ec596de89 100644 --- a/src/GrampsDbUtils/_GedcomLex.py +++ b/src/GrampsDbUtils/_GedcomLex.py @@ -34,7 +34,8 @@ import re # #------------------------------------------------------------------------- -from _GedcomInfo import * +from GrampsDbUtils import (personalConstantEvents, personalConstantAttributes, + familyConstantEvents) import _GedcomTokens as GedcomTokens import gen.lib from DateHandler._DateParser import DateParser diff --git a/src/GrampsDbUtils/_GrampsBSDDB.py b/src/GrampsDbUtils/_GrampsBSDDB.py index 887baa9d7..dc9471deb 100644 --- a/src/GrampsDbUtils/_GrampsBSDDB.py +++ b/src/GrampsDbUtils/_GrampsBSDDB.py @@ -33,7 +33,6 @@ to version 2.2.x #------------------------------------------------------------------------- import cPickle as pickle import os -import shutil import time from gettext import gettext as _ from bsddb import dbshelve, db @@ -45,14 +44,20 @@ __LOG = logging.getLogger(".GrampsDb") # Gramps modules # #------------------------------------------------------------------------- -from gen.lib import * -from gen.db.base import * +from gen.lib import (GenderStats, Source, Person, Family, Event, Place, + MediaObject, Repository, Note, Attribute, AttributeType, + NoteType) +from gen.db.base import (GrampsDbBase, KEY_TO_CLASS_MAP, CLASS_TO_KEY_MAP, + Transaction) +from gen.db.cursor import GrampsCursor +from gen.db.dbconst import (REFERENCE_KEY, PERSON_COL_KEY, EVENT_COL_KEY, + EVENT_KEY, FAMILY_KEY, SOURCE_KEY, PLACE_KEY, + MEDIA_KEY, REPOSITORY_KEY, PERSON_KEY, NOTE_KEY) +from gen.db.exceptions import FileVersionError from gen.utils import db_copy import const -from gen.db.exceptions import FileVersionError from BasicUtils import UpdateCallback -from gen.db.cursor import GrampsCursor _MINVERSION = 9 _DBVERSION = 13 diff --git a/src/GrampsDbUtils/_ReadGedcom.py b/src/GrampsDbUtils/_ReadGedcom.py index 960b47d8b..ccb652f7b 100644 --- a/src/GrampsDbUtils/_ReadGedcom.py +++ b/src/GrampsDbUtils/_ReadGedcom.py @@ -29,7 +29,7 @@ #------------------------------------------------------------------------ import os from gettext import gettext as _ -import gtk +from gtk import glade #------------------------------------------------------------------------ # @@ -84,7 +84,7 @@ def importData(database, filename, callback=None, use_trans=False): if not gramps and ansel: glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__) - top = gtk.glade.XML(glade_file, 'encoding', 'gramps') + top = glade.XML(glade_file, 'encoding','gramps') code = top.get_widget('codeset') code.set_active(0) dialog = top.get_widget('encoding') diff --git a/src/GrampsDbUtils/_ReadXML.py b/src/GrampsDbUtils/_ReadXML.py index 2300fa9fe..86f50f0dc 100644 --- a/src/GrampsDbUtils/_ReadXML.py +++ b/src/GrampsDbUtils/_ReadXML.py @@ -28,7 +28,6 @@ import os import sys import sets -import shutil from xml.parsers.expat import ExpatError, ParserCreate from gettext import gettext as _ import re @@ -41,13 +40,11 @@ import re from QuestionDialog import ErrorDialog import Mime import gen.lib -import const import Utils import DateHandler from BasicUtils import name_displayer -from gen.db.dbconst import \ - PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY, \ - MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY +from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY, + MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY) from BasicUtils import UpdateCallback #------------------------------------------------------------------------- diff --git a/src/GrampsDbUtils/__init__.py b/src/GrampsDbUtils/__init__.py index fb3df23a2..07a4396cc 100644 --- a/src/GrampsDbUtils/__init__.py +++ b/src/GrampsDbUtils/__init__.py @@ -35,10 +35,10 @@ on using these factories see the _GrampsDbUtilsFactories.py file comments. """ -from _GrampsDbWRFactories import \ - gramps_db_reader_factory +from _GedcomInfo import (personalConstantEvents, familyConstantEvents, + personalConstantAttributes) +from _GrampsDbWRFactories import gramps_db_reader_factory - from _GedcomParse import GedcomParser from _WriteGedcom import GedcomWriter diff --git a/src/GrampsDbUtils/test/GR_test.py b/src/GrampsDbUtils/test/GR_test.py index 69ee4c5b1..86d65e9c0 100644 --- a/src/GrampsDbUtils/test/GR_test.py +++ b/src/GrampsDbUtils/test/GR_test.py @@ -18,7 +18,7 @@ A controlling principle for such structures is that they should be designed for maximum ease (and intuitiveness) of data declaration """ -import sys, os, os.path as op +import os.path as op import unittest as U import re diff --git a/src/GrampsDbUtils/test/_GedcomChar_test.py b/src/GrampsDbUtils/test/_GedcomChar_test.py index d5d1979f7..8910345ab 100644 --- a/src/GrampsDbUtils/test/_GedcomChar_test.py +++ b/src/GrampsDbUtils/test/_GedcomChar_test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import unittest -import os, os.path +import os.path import codecs import struct diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index 12d76c80f..433652f63 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -38,6 +38,7 @@ from cStringIO import StringIO # #------------------------------------------------------------------------- import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -395,7 +396,7 @@ class ManagedWindow: def define_glade(self, top_module, glade_file=None): if glade_file == None: glade_file = const.GLADE_FILE - self._gladeobj = gtk.glade.XML(glade_file, top_module, "gramps") + self._gladeobj = glade.XML(glade_file, top_module, "gramps") return self._gladeobj def get_widget(self, name): diff --git a/src/Merge/_MergePerson.py b/src/Merge/_MergePerson.py index 11a658a2e..2a709181d 100644 --- a/src/Merge/_MergePerson.py +++ b/src/Merge/_MergePerson.py @@ -33,6 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk +from gtk import glade import pango #------------------------------------------------------------------------- @@ -58,7 +59,7 @@ class PersonCompare(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__) - self.glade = gtk.glade.XML(const.MERGE_GLADE, "merge") + self.glade = glade.XML(const.MERGE_GLADE, "merge") window = self.glade.get_widget('merge') self.text1 = self.glade.get_widget('text1') self.text2 = self.glade.get_widget('text2') @@ -276,7 +277,7 @@ class MergePeopleUI(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__) - glade = gtk.glade.XML(const.MERGE_GLADE, 'merge_people') + glade = glade.XML(const.MERGE_GLADE, 'merge_people') window = glade.get_widget('merge_people') self.set_window(window, glade.get_widget('title'), _("Merge People")) diff --git a/src/Merge/_MergePlace.py b/src/Merge/_MergePlace.py index fa3637fcb..f404458fd 100644 --- a/src/Merge/_MergePlace.py +++ b/src/Merge/_MergePlace.py @@ -32,8 +32,7 @@ from gettext import gettext as _ # GNOME # #------------------------------------------------------------------------- -import gtk - +from gtk import glade #------------------------------------------------------------------------- # # GRAMPS modules @@ -63,7 +62,7 @@ class MergePlaces(ManagedWindow.ManagedWindow): self.p1 = self.db.get_place_from_handle(self.new_handle) self.p2 = self.db.get_place_from_handle(self.old_handle) - self.glade = gtk.glade.XML(const.MERGE_GLADE,"merge_places","gramps") + self.glade = glade.XML(const.MERGE_GLADE,"merge_places","gramps") self.set_window(self.glade.get_widget("merge_places"), self.glade.get_widget('title'), _("Merge Places")) diff --git a/src/Merge/_MergeSource.py b/src/Merge/_MergeSource.py index 84a26724c..5a1c4e50b 100644 --- a/src/Merge/_MergeSource.py +++ b/src/Merge/_MergeSource.py @@ -32,7 +32,7 @@ from gettext import gettext as _ # GNOME # #------------------------------------------------------------------------- -import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -64,7 +64,7 @@ class MergeSources(ManagedWindow.ManagedWindow): self.s1 = self.db.get_source_from_handle(self.new_handle) self.s2 = self.db.get_source_from_handle(self.old_handle) - self.glade = gtk.glade.XML(const.MERGE_GLADE,"merge_sources","gramps") + self.glade = glade.XML(const.MERGE_GLADE,"merge_sources","gramps") self.set_window(self.glade.get_widget("merge_sources"), self.glade.get_widget('title'), diff --git a/src/Models/_FastFilterModel.py b/src/Models/_FastFilterModel.py index 3ee424174..a0449194b 100644 --- a/src/Models/_FastFilterModel.py +++ b/src/Models/_FastFilterModel.py @@ -1,6 +1,5 @@ import gtk -import time import logging log = logging.getLogger(".") diff --git a/src/Models/_FastModel.py b/src/Models/_FastModel.py index ae1f06aa7..9f0188ee5 100644 --- a/src/Models/_FastModel.py +++ b/src/Models/_FastModel.py @@ -1,6 +1,5 @@ import gtk -import time import logging log = logging.getLogger(".") diff --git a/src/Models/_PersonFilterModel.py b/src/Models/_PersonFilterModel.py index f5d05a55f..691470a5c 100644 --- a/src/Models/_PersonFilterModel.py +++ b/src/Models/_PersonFilterModel.py @@ -1,14 +1,4 @@ -import gtk -import time -import bsddb -import cPickle -import logging -log = logging.getLogger(".") - -from _PathCursor import PathCursor -from _ListCursor import ListCursor - from _FastFilterModel import FastFilterModel import gen.lib diff --git a/src/Models/_PersonListModel.py b/src/Models/_PersonListModel.py index 3f7d15361..5c21a6e4a 100644 --- a/src/Models/_PersonListModel.py +++ b/src/Models/_PersonListModel.py @@ -1,12 +1,8 @@ import gtk -import time -import bsddb -import cPickle import logging log = logging.getLogger(".") -from _PathCursor import PathCursor from _ListCursor import ListCursor from _FastModel import FastModel diff --git a/src/Models/_PersonTreeModel.py b/src/Models/_PersonTreeModel.py index 2dae95d5e..8333abc37 100644 --- a/src/Models/_PersonTreeModel.py +++ b/src/Models/_PersonTreeModel.py @@ -1,13 +1,8 @@ -import gtk -import time -import bsddb -import cPickle import logging log = logging.getLogger(".") from _PathCursor import PathCursor -from _ListCursor import ListCursor from _FastModel import FastModel import gen.lib diff --git a/src/PageView.py b/src/PageView.py index 58d2fdf0f..f616c84fc 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -1033,30 +1033,33 @@ class ListView(BookMarkView): self.write_tabbed_file(fn, fl) def write_tabbed_file(self, name, type): - - if type == 0: - from CSVTab import CSVTab as tabgen - else: - from ODSTab import ODSTab as tabgen - + """ + Write a tabbed file to the specified name. + + The output file type is determined by the type variable. + """ + from docgen import CSVTab, ODSTab + ofile = None data_cols = [pair[1] for pair in self.column_order() if pair[0]] column_names = [self.colinfo[i] for i in data_cols] - - o = tabgen(len(column_names)) + if type == 0: + ofile = CSVTab(len(column_names)) + else: + ofile = ODSTab(len(column_names)) - o.open(name) - o.start_page() - o.start_row() + ofile.open(name) + ofile.start_page() + ofile.start_row() for name in column_names: - o.write_cell(name) - o.end_row() + ofile.write_cell(name) + ofile.end_row() for row in self.model: - o.start_row() + ofile.start_row() for index in data_cols: - o.write_cell(row[index]) - o.end_row() - o.end_page() - o.close() + ofile.write_cell(row[index]) + ofile.end_row() + ofile.end_page() + ofile.close() diff --git a/src/PluginUtils/_PluginWindows.py b/src/PluginUtils/_PluginWindows.py index ec76e4739..4400deb2c 100644 --- a/src/PluginUtils/_PluginWindows.py +++ b/src/PluginUtils/_PluginWindows.py @@ -46,7 +46,6 @@ import ManagedWindow import Errors import _PluginMgr as PluginMgr import _Tool as Tool -from BasicUtils import name_displayer #------------------------------------------------------------------------- # diff --git a/src/PluginUtils/_Plugins.py b/src/PluginUtils/_Plugins.py index f78cbb36d..7597b6b68 100644 --- a/src/PluginUtils/_Plugins.py +++ b/src/PluginUtils/_Plugins.py @@ -34,6 +34,7 @@ importers, exporters, and document generators. # #------------------------------------------------------------------------- import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -94,7 +95,7 @@ class PluginDialog(ManagedWindow.ManagedWindow): self.state = state self.uistate = uistate - self.dialog = gtk.glade.XML(const.PLUGINS_GLADE,"report","gramps") + self.dialog = glade.XML(const.PLUGINS_GLADE,"report","gramps") self.dialog.signal_autoconnect({ "on_report_apply_clicked" : self.on_apply_clicked, "destroy_passed_object" : self.close, diff --git a/src/PluginUtils/_Tool.py b/src/PluginUtils/_Tool.py index af01c561d..4b60fb8db 100644 --- a/src/PluginUtils/_Tool.py +++ b/src/PluginUtils/_Tool.py @@ -39,11 +39,10 @@ log = logging.getLogger(".") #------------------------------------------------------------------------- import const import Utils -from Filters import CustomFilters from BasicUtils import name_displayer import Errors -from _Options import * - +from PluginUtils import (Options, OptionHandler, OptionList, + OptionListCollection) #------------------------------------------------------------------------- # # Constants diff --git a/src/PluginUtils/__init__.py b/src/PluginUtils/__init__.py index c485a4b06..139c556a6 100644 --- a/src/PluginUtils/__init__.py +++ b/src/PluginUtils/__init__.py @@ -43,6 +43,8 @@ from _PluginMgr import (register_export, register_import, register_tool, register_draw_doc, register_book_doc, register_quick_report) +from _Options import Options, OptionListCollection, OptionList, OptionHandler + import _Tool as Tool import _Plugins as Plugins import _PluginWindows as PluginWindows diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index 171795d3d..29b1d1036 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -33,6 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk +from gtk import glade from gtk.gdk import pixbuf_new_from_file #------------------------------------------------------------------------- @@ -50,7 +51,7 @@ except: class SaveDialog: def __init__(self,msg1,msg2,task1,task2,parent=None): - self.xml = gtk.glade.XML(const.GLADE_FILE,"savedialog","gramps") + self.xml = glade.XML(const.GLADE_FILE,"savedialog","gramps") self.top = self.xml.get_widget('savedialog') self.top.set_icon(ICON) self.top.set_title("%s - GRAMPS" % msg1) @@ -80,7 +81,7 @@ class SaveDialog: class QuestionDialog: def __init__(self,msg1,msg2,label,task,parent=None): - self.xml = gtk.glade.XML(const.GLADE_FILE,"questiondialog","gramps") + self.xml = glade.XML(const.GLADE_FILE,"questiondialog","gramps") self.top = self.xml.get_widget('questiondialog') self.top.set_icon(ICON) self.top.set_title("%s - GRAMPS" % msg1) @@ -105,7 +106,7 @@ class QuestionDialog: class QuestionDialog2: def __init__(self,msg1,msg2,label_msg1,label_msg2,parent=None): - self.xml = gtk.glade.XML(const.GLADE_FILE,"questiondialog","gramps") + self.xml = glade.XML(const.GLADE_FILE,"questiondialog","gramps") self.top = self.xml.get_widget('questiondialog') self.top.set_icon(ICON) self.top.set_title("%s - GRAMPS" % msg1) @@ -133,7 +134,7 @@ class QuestionDialog2: class OptionDialog: def __init__(self,msg1,msg2,btnmsg1,task1,btnmsg2,task2,parent=None): - self.xml = gtk.glade.XML(const.GLADE_FILE,"optiondialog","gramps") + self.xml = glade.XML(const.GLADE_FILE,"optiondialog","gramps") self.top = self.xml.get_widget('optiondialog') self.top.set_icon(ICON) self.top.set_title("%s - GRAMPS" % msg1) @@ -231,7 +232,7 @@ class OkDialog(gtk.MessageDialog): class MissingMediaDialog: def __init__(self,msg1,msg2,task1,task2,task3,parent=None): - self.xml = gtk.glade.XML(const.GLADE_FILE,"missmediadialog","gramps") + self.xml = glade.XML(const.GLADE_FILE,"missmediadialog","gramps") self.top = self.xml.get_widget('missmediadialog') self.top.set_icon(ICON) self.top.set_title("%s - GRAMPS" % msg1) @@ -286,7 +287,7 @@ class MessageHideDialog: def __init__(self, title, message, key, parent=None): - glade_xml = gtk.glade.XML(const.GLADE_FILE, "hide_dialog", "gramps") + glade_xml = glade.XML(const.GLADE_FILE, "hide_dialog", "gramps") top = glade_xml.get_widget('hide_dialog') top.set_icon(ICON) top.set_title("%s - GRAMPS" % title) diff --git a/src/QuickReports.py b/src/QuickReports.py index dc9f8750f..9b331967f 100644 --- a/src/QuickReports.py +++ b/src/QuickReports.py @@ -53,11 +53,10 @@ import gtk # #------------------------------------------------------------------------- -from PluginUtils import Plugins -from ReportBase import CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,\ - CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE,\ - CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY, \ - CATEGORY_QR_NOTE, CATEGORY_QR_DATE +#from PluginUtils import Plugins +from ReportBase import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY, + CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE, + CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY) def create_quickreport_menu(category,dbstate,uistate,handle) : @@ -125,7 +124,7 @@ def run_quick_report_by_name(dbstate, uistate, report_name, handle): run_report(dbstate, uistate, report[2], handle, report[0]) def run_report(dbstate, uistate, category,handle,func): - from TextBufDoc import TextBufDoc + from docgen import TextBufDoc from Simple import make_basic_stylesheet if dbstate.active and handle: diff --git a/src/Relationship.py b/src/Relationship.py index b141a2902..69736bbb0 100644 --- a/src/Relationship.py +++ b/src/Relationship.py @@ -27,7 +27,6 @@ #------------------------------------------------------------------------- import gen.lib -import types from TransUtils import sgettext as _ diff --git a/src/Reorder.py b/src/Reorder.py index 4d8d8fe4c..599c36ce8 100644 --- a/src/Reorder.py +++ b/src/Reorder.py @@ -20,8 +20,9 @@ from gettext import gettext as _ +from gtk import glade + import const -import gtk from BasicUtils import name_displayer import ListModel @@ -34,7 +35,7 @@ FAMILY_TITLES = [(_('Spouse'), -1, 200), (_('Relationship'), -1, 200), ('', -1, class Reorder(ManagedWindow.ManagedWindow): def __init__(self, state, uistate, track, handle): - xml = gtk.glade.XML(const.GLADE_FILE, "reorder", "gramps") + xml = glade.XML(const.GLADE_FILE, "reorder", "gramps") top = xml.get_widget('reorder') self.dbstate = state diff --git a/src/ReportBase/_CommandLineReport.py b/src/ReportBase/_CommandLineReport.py index 62ba9f58d..c032db094 100644 --- a/src/ReportBase/_CommandLineReport.py +++ b/src/ReportBase/_CommandLineReport.py @@ -31,7 +31,6 @@ from _Constants import CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK from _PaperMenu import paper_sizes import os import const -from Filters import CustomFilters #------------------------------------------------------------------------ # diff --git a/src/ReportBase/_GraphvizReportDialog.py b/src/ReportBase/_GraphvizReportDialog.py index 9760316f8..522e77b1e 100644 --- a/src/ReportBase/_GraphvizReportDialog.py +++ b/src/ReportBase/_GraphvizReportDialog.py @@ -50,8 +50,7 @@ import Config from _Constants import CATEGORY_GRAPHVIZ from _ReportDialog import ReportDialog from _PaperMenu import PaperFrame -from PluginUtils import NumberOption, EnumeratedListOption, \ - TextOption, BooleanOption +from PluginUtils import NumberOption, EnumeratedListOption, TextOption #------------------------------------------------------------------------------- # diff --git a/src/ReportBase/_PaperMenu.py b/src/ReportBase/_PaperMenu.py index afb5e865f..3a6941f13 100644 --- a/src/ReportBase/_PaperMenu.py +++ b/src/ReportBase/_PaperMenu.py @@ -34,6 +34,7 @@ import os # #------------------------------------------------------------------------- import gtk +from gtk import glade import gobject #------------------------------------------------------------------------- @@ -147,7 +148,7 @@ class PaperFrame(gtk.HBox): margins=[2.54,2.54,2.54,2.54], custom=[29.7,21.0]): gtk.HBox.__init__(self) glade_file = os.path.join(const.GLADE_DIR, "paper_settings.glade") - glade_xml = gtk.glade.XML(glade_file, "paper_table", "gramps") + glade_xml = glade.XML(glade_file, "paper_table", "gramps") self.paper_table = glade_xml.get_widget('paper_table') diff --git a/src/ReportBase/_Report.py b/src/ReportBase/_Report.py index f6faf94e5..e9e8d2bbe 100644 --- a/src/ReportBase/_Report.py +++ b/src/ReportBase/_Report.py @@ -22,21 +22,6 @@ # $Id$ -#------------------------------------------------------------------------- -# -# python -# -#------------------------------------------------------------------------- -from gettext import gettext as _ -import gtk - -#------------------------------------------------------------------------- -# -# Gramps modules -# -#------------------------------------------------------------------------- -import Utils - #------------------------------------------------------------------------- # # Report diff --git a/src/ReportBase/_ReportDialog.py b/src/ReportBase/_ReportDialog.py index f2d3bf2c4..8bee423ec 100644 --- a/src/ReportBase/_ReportDialog.py +++ b/src/ReportBase/_ReportDialog.py @@ -46,19 +46,12 @@ import gtk #------------------------------------------------------------------------- import Config import Errors -import Utils -import const - -from QuestionDialog import ErrorDialog, OptionDialog, RunDatabaseRepair - -from _Constants import CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK, \ - CATEGORY_VIEW, CATEGORY_CODE, CATEGORY_WEB, CATEGORY_GRAPHVIZ, \ - standalone_categories +from QuestionDialog import ErrorDialog, OptionDialog +from _Constants import (CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK, + CATEGORY_VIEW, CATEGORY_CODE, CATEGORY_WEB, + CATEGORY_GRAPHVIZ, standalone_categories) from _BareReportDialog import BareReportDialog from _FileEntry import FileEntry -from _PaperMenu import PaperComboBox, OrientationComboBox, paper_sizes -from _TemplateParser import _template_map, _default_template, _user_template -from BaseDoc import PaperStyle #------------------------------------------------------------------------- # diff --git a/src/ReportBase/_StyleEditor.py b/src/ReportBase/_StyleEditor.py index 769523ee3..04bf4aca0 100644 --- a/src/ReportBase/_StyleEditor.py +++ b/src/ReportBase/_StyleEditor.py @@ -75,7 +75,7 @@ class StyleListDisplay: self.callback = callback self.sheetlist = stylesheetlist - self.top = gtk.glade.XML(const.GLADE_FILE, "styles", "gramps") + self.top = glade.XML(const.GLADE_FILE, "styles", "gramps") self.window = self.top.get_widget('styles') ManagedWindow.set_titles( self.window, @@ -187,7 +187,7 @@ class StyleEditor: self.style = BaseDoc.StyleSheet(style) self.parent = parent - self.top = gtk.glade.XML(const.GLADE_FILE, "editor", "gramps") + self.top = glade.XML(const.GLADE_FILE, "editor", "gramps") self.top.signal_autoconnect({ "on_save_style_clicked" : self.on_save_style_clicked, diff --git a/src/ScratchPad.py b/src/ScratchPad.py index 0c9923659..d40ab9bdb 100644 --- a/src/ScratchPad.py +++ b/src/ScratchPad.py @@ -44,6 +44,7 @@ except: #------------------------------------------------------------------------- import gtk from gtk.gdk import ACTION_COPY, BUTTON1_MASK, ACTION_MOVE +from gtk import glade #------------------------------------------------------------------------- # @@ -1178,7 +1179,7 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow): self.glade_file = os.path.join(const.GLADE_DIR, "scratchpad.glade") - self.top = gtk.glade.XML(self.glade_file,"scratch_pad","gramps") + self.top = glade.XML(self.glade_file,"scratch_pad","gramps") self.set_window(self.top.get_widget("scratch_pad"), None, None, msg=_("Clipboard")) diff --git a/src/Selectors/_BaseSelector.py b/src/Selectors/_BaseSelector.py index bf20f593f..45f732451 100644 --- a/src/Selectors/_BaseSelector.py +++ b/src/Selectors/_BaseSelector.py @@ -27,6 +27,7 @@ #------------------------------------------------------------------------- import gtk import pango +from gtk import glade #------------------------------------------------------------------------- # @@ -67,7 +68,7 @@ class BaseSelector(ManagedWindow.ManagedWindow): self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END) self.db = dbstate.db - self.glade = gtk.glade.XML(const.GLADE_FILE,"select_person","gramps") + self.glade = glade.XML(const.GLADE_FILE,"select_person","gramps") window = self.glade.get_widget('select_person') title_label = self.glade.get_widget('title') vbox = self.glade.get_widget('select_person_vbox') diff --git a/src/Selectors/_SelectPerson.py b/src/Selectors/_SelectPerson.py index 38bab47ae..8c25786e4 100644 --- a/src/Selectors/_SelectPerson.py +++ b/src/Selectors/_SelectPerson.py @@ -33,6 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk +from gtk import glade import pango #------------------------------------------------------------------------- @@ -75,7 +76,7 @@ class SelectPerson(ManagedWindow.ManagedWindow): self.renderer = gtk.CellRendererText() self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END) self.dbstate = dbstate - self.glade = gtk.glade.XML(const.GLADE_FILE,"select_person","gramps") + self.glade = glade.XML(const.GLADE_FILE,"select_person","gramps") self.plist = self.glade.get_widget('plist') self.showall = self.glade.get_widget('showall') self.notebook = self.glade.get_widget('notebook') diff --git a/src/TipOfDay.py b/src/TipOfDay.py index 8e3a3b7be..a8299e2c4 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -39,7 +39,7 @@ import os # GTK/GNOME modules # #------------------------------------------------------------------------- -import gtk +from gtk import glade #------------------------------------------------------------------------- # @@ -61,7 +61,7 @@ class TipOfDay(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) - xml = gtk.glade.XML(const.GLADE_FILE, "tod_window", "gramps") + xml = glade.XML(const.GLADE_FILE, "tod_window", "gramps") window = xml.get_widget("tod_window") self.set_window(window, xml.get_widget("title"), diff --git a/src/Utils.py b/src/Utils.py index 5de0fba32..02a373ee4 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -1122,7 +1122,7 @@ def launch(prog_str, path): os.spawnvpe(os.P_NOWAIT, prog, prog_list, os.environ) def profile(func, *args): - import hotshot, hotshot.stats + import hotshot.stats prf = hotshot.Profile('mystats.profile') print "Start" diff --git a/src/date_test.py b/src/date_test.py index 380683c61..e73c7344a 100644 --- a/src/date_test.py +++ b/src/date_test.py @@ -30,8 +30,6 @@ import traceback import locale import gettext -import gtk - if os.environ.has_key("GRAMPSI18N"): loc = os.environ["GRAMPSI18N"] else: diff --git a/src/docgen/CSVTab.py b/src/docgen/CSVTab.py index 873cf33ec..e533f1256 100644 --- a/src/docgen/CSVTab.py +++ b/src/docgen/CSVTab.py @@ -18,20 +18,26 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# $Id: $ +# $Id$ -import os +#------------------------------------------------------------------------- +# +# Standard Python modules +# +#------------------------------------------------------------------------- import csv -import codecs -from gettext import gettext as _ +#------------------------------------------------------------------------- +# +# gramps modules +# +#------------------------------------------------------------------------- +from docgen import TabbedDoc -import TabbedDoc - -class CSVTab(TabbedDoc.TabbedDoc): +class CSVTab(TabbedDoc): def __init__(self, columns): - TabbedDoc.TabbedDoc.__init__(self, columns) + TabbedDoc.__init__(self, columns) self.filename = None self.f = None self.dlist = [] diff --git a/src/docgen/CairoDoc.py b/src/docgen/CairoDoc.py index 140dfc403..caf374913 100644 --- a/src/docgen/CairoDoc.py +++ b/src/docgen/CairoDoc.py @@ -28,7 +28,6 @@ # Python modules # #------------------------------------------------------------------------ -from gettext import gettext as _ from math import radians #------------------------------------------------------------------------ @@ -38,7 +37,6 @@ from math import radians #------------------------------------------------------------------------ import BaseDoc from ReportBase import ReportUtils -##rgb_color = ReportUtils.rgb_color #------------------------------------------------------------------------ # @@ -54,7 +52,6 @@ log = logging.getLogger(".CairoDoc") # #------------------------------------------------------------------------- import gtk -import cairo import pango import pangocairo diff --git a/src/docgen/GtkPrint.py b/src/docgen/GtkPrint.py index be31eac26..07f70c250 100644 --- a/src/docgen/GtkPrint.py +++ b/src/docgen/GtkPrint.py @@ -60,6 +60,7 @@ log = logging.getLogger(".GtkPrint") # #------------------------------------------------------------------------- import gtk +from gtk import glade import cairo if gtk.pygtk_version < (2, 10, 0): @@ -200,7 +201,7 @@ class PrintPreview: glade_file = os.path.join(os.path.dirname(__file__), 'gtkprintpreview.glade') - glade_xml = gtk.glade.XML(glade_file, 'window', 'gramps') + glade_xml = glade.XML(glade_file, 'window', 'gramps') self._window = glade_xml.get_widget('window') #self._window.set_transient_for(parent) diff --git a/src/docgen/Makefile.am b/src/docgen/Makefile.am index 90e41d505..2a8bc1fb0 100644 --- a/src/docgen/Makefile.am +++ b/src/docgen/Makefile.am @@ -5,8 +5,9 @@ docgendir=$(prefix)/share/gramps/docgen docgen_PYTHON = \ + __init__.py\ AsciiDoc.py\ - CairoDoc.py\ + CairoDoc.py\ CSVTab.py\ HtmlDoc.py\ LaTeXDoc.py\ diff --git a/src/docgen/ODSDoc.py b/src/docgen/ODSDoc.py index c4c40661a..913897834 100644 --- a/src/docgen/ODSDoc.py +++ b/src/docgen/ODSDoc.py @@ -36,7 +36,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import BaseDoc -from SpreadSheetDoc import * +from docgen import SpreadSheetDoc import const diff --git a/src/docgen/PSDrawDoc.py b/src/docgen/PSDrawDoc.py index 9a95c84fd..96dd5a784 100644 --- a/src/docgen/PSDrawDoc.py +++ b/src/docgen/PSDrawDoc.py @@ -26,7 +26,6 @@ # python modules # #------------------------------------------------------------------------- -from math import pi, cos, sin from gettext import gettext as _ #------------------------------------------------------------------------- diff --git a/src/docgen/PdfDoc.py b/src/docgen/PdfDoc.py index a36dc0607..f8531cceb 100644 --- a/src/docgen/PdfDoc.py +++ b/src/docgen/PdfDoc.py @@ -29,7 +29,6 @@ # #------------------------------------------------------------------------ from gettext import gettext as _ -import os #------------------------------------------------------------------------ # diff --git a/src/docgen/TextBufDoc.py b/src/docgen/TextBufDoc.py index e3dcf6b1c..e03466a91 100644 --- a/src/docgen/TextBufDoc.py +++ b/src/docgen/TextBufDoc.py @@ -37,9 +37,6 @@ import pango #------------------------------------------------------------------------ import BaseDoc from PluginUtils import register_text_doc -import const -import Errors -import Utils import ManagedWindow try: diff --git a/src/docgen/__init__.py b/src/docgen/__init__.py new file mode 100644 index 000000000..0c4d4eef9 --- /dev/null +++ b/src/docgen/__init__.py @@ -0,0 +1,27 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2008 Donald N. Allingham +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# $Id$ + +from TabbedDoc import TabbedDoc +from ODSTab import ODSTab +from TextBufDoc import TextBufDoc +from CSVTab import CSVTab +from SpreadSheetDoc import SpreadSheetDoc \ No newline at end of file diff --git a/src/gen/db/base.py b/src/gen/db/base.py index 95572776b..0a863baa2 100644 --- a/src/gen/db/base.py +++ b/src/gen/db/base.py @@ -47,7 +47,8 @@ LOG = logging.getLogger(".GrampsDb") # GRAMPS libraries # #------------------------------------------------------------------------- -from gen.lib import * +from gen.lib import (MediaObject, Person, Family, Source, Event, Place, + Repository, Note, GenderStats, Researcher) from gen.utils.callback import GrampsDBCallback from iterator import CursorIterator @@ -56,8 +57,12 @@ from iterator import CursorIterator # constants # #------------------------------------------------------------------------- -from dbconst import * -from cursor import GrampsCursor +from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY, + MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY, + REFERENCE_KEY, PERSON_COL_KEY, FAMILY_COL_KEY, + CHILD_COL_KEY, PLACE_COL_KEY, SOURCE_COL_KEY, + MEDIA_COL_KEY, EVENT_COL_KEY, REPOSITORY_COL_KEY, + NOTE_COL_KEY) _UNDO_SIZE = 1000 diff --git a/src/gen/db/dbconst.py b/src/gen/db/dbconst.py index 69c6f2867..fd99186c4 100644 --- a/src/gen/db/dbconst.py +++ b/src/gen/db/dbconst.py @@ -25,7 +25,6 @@ # standard python modules # #------------------------------------------------------------------------- -import os #------------------------------------------------------------------------- # diff --git a/src/gen/db/dbdir.py b/src/gen/db/dbdir.py index 2b482754b..43515c29b 100644 --- a/src/gen/db/dbdir.py +++ b/src/gen/db/dbdir.py @@ -33,7 +33,6 @@ This is used since GRAMPS version 3.0 #------------------------------------------------------------------------- import cPickle as pickle import os -import shutil import time from types import InstanceType @@ -48,9 +47,10 @@ log = logging.getLogger(".GrampsDb") # Gramps modules # #------------------------------------------------------------------------- -from gen.lib import * -from base import * -import dbconst as const +from gen.lib import (GenderStats, Person, Family, Event, Place, Source, + MediaObject, Repository, Note) +from gen.db import (GrampsDbBase, KEY_TO_CLASS_MAP, CLASS_TO_KEY_MAP, + REFERENCE_KEY, Transaction) from exceptions import FileVersionError from BasicUtils import UpdateCallback from cursor import GrampsCursor @@ -612,7 +612,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): def load_from(self, other_database, filename, callback): try: self.load(filename,callback) - from GrampsDb import db_copy + from gen.utils import db_copy db_copy(other_database,self,callback) return 1 except DBERRS, msg: @@ -1764,7 +1764,6 @@ def write_lock_file(name): if os.name == 'nt': text = os.environ['USERNAME'] else: - import pwd host = os.uname()[1] # An ugly workaround for os.getlogin() issue with Konsole try: diff --git a/src/gen/lib/__init__.py b/src/gen/lib/__init__.py index 3215d0a6a..709d08764 100644 --- a/src/gen/lib/__init__.py +++ b/src/gen/lib/__init__.py @@ -34,7 +34,6 @@ from eventref import EventRef from ldsord import LdsOrd from mediaref import MediaRef from name import Name -from note import Note from reporef import RepoRef from srcref import SourceRef from url import Url @@ -51,6 +50,7 @@ from place import Place from src import Source from mediaobj import MediaObject from repo import Repository +from note import Note # These are actually metadata from genderstats import GenderStats diff --git a/src/gen/lib/date.py b/src/gen/lib/date.py index 5334afa59..67f9840a5 100644 --- a/src/gen/lib/date.py +++ b/src/gen/lib/date.py @@ -50,7 +50,10 @@ log = logging.getLogger(".Date") # Gramps modules # #------------------------------------------------------------------------ -from gen.lib.calendar import * +from gen.lib.calendar import (gregorian_sdn, julian_sdn, hebrew_sdn, + french_sdn, persian_sdn, islamic_sdn, + gregorian_ymd, julian_ymd, hebrew_ymd, + french_ymd, persian_ymd, islamic_ymd) import Config #------------------------------------------------------------------------- diff --git a/src/gen/lib/test/date_test.py b/src/gen/lib/test/date_test.py index 61a694864..d4bed89b0 100644 --- a/src/gen/lib/test/date_test.py +++ b/src/gen/lib/test/date_test.py @@ -27,8 +27,6 @@ from test import test_util test_util.path_append_parent() import Config -from gen.lib import date -##import date from DateHandler import parser as df class Tester(unittest.TestCase): diff --git a/src/gen/proxy/living.py b/src/gen/proxy/living.py index 5d7f9cf35..588a46c2f 100644 --- a/src/gen/proxy/living.py +++ b/src/gen/proxy/living.py @@ -30,7 +30,7 @@ Proxy class for the GRAMPS databases. Filter out all living people. # #------------------------------------------------------------------------- from proxybase import ProxyDbBase -from gen.lib import * +from gen.lib import Date, Person, Name from Utils import probably_alive #------------------------------------------------------------------------- diff --git a/src/gen/proxy/private.py b/src/gen/proxy/private.py index a21a1aa03..430ad3787 100644 --- a/src/gen/proxy/private.py +++ b/src/gen/proxy/private.py @@ -29,7 +29,9 @@ Proxy class for the GRAMPS databases. Filter out all data marked private. # GRAMPS libraries # #------------------------------------------------------------------------- -from gen.lib import * +from gen.lib import (MediaRef, SourceRef, Attribute, Address, EventRef, + Person, Name, Source, RepoRef, MediaObject, Place, Event, + Family, ChildRef, Repository) from proxybase import ProxyDbBase class PrivateProxyDb(ProxyDbBase): diff --git a/src/gen/utils/callback.py b/src/gen/utils/callback.py index 3a2f32441..698f6b00b 100644 --- a/src/gen/utils/callback.py +++ b/src/gen/utils/callback.py @@ -40,9 +40,6 @@ import os import types import traceback import inspect -from gettext import gettext as _ - -import Errors log = sys.stderr.write diff --git a/src/gen/utils/test/callback_test.py b/src/gen/utils/test/callback_test.py index 9c1d501f8..d4ef60daf 100644 --- a/src/gen/utils/test/callback_test.py +++ b/src/gen/utils/test/callback_test.py @@ -3,9 +3,7 @@ import unittest from test import test_util as tu tu.path_append_parent() -import sys - -from callback import GrampsDBCallback, log +from gen.utils import GrampsDBCallback class TestGrampsDBCallback(unittest.TestCase): diff --git a/src/gramps.py b/src/gramps.py index 8340ce47e..8afec8162 100644 --- a/src/gramps.py +++ b/src/gramps.py @@ -51,7 +51,8 @@ except ImportError: # Miscellaneous initialization # #------------------------------------------------------------------------- -import gtk.glade +import gtk +from gtk import glade import gobject gobject.threads_init() @@ -77,10 +78,10 @@ except ValueError: pass gettext.bindtextdomain("gramps",loc) -gtk.glade.bindtextdomain("gramps",loc) +glade.bindtextdomain("gramps",loc) try: - gtk.glade.textdomain("gramps") + glade.textdomain("gramps") except: pass @@ -109,8 +110,6 @@ if not sys.version_info >= MIN_PYTHON_VERSION : # gramps libraries # #------------------------------------------------------------------------- -import gobject - try: signal.signal(signal.SIGCHLD, signal.SIG_DFL) except: @@ -121,7 +120,6 @@ args = sys.argv def setup_logging(): """Setup basic logging support.""" - import logging from GrampsLogger import RotateHandler, GtkHandler # Setup a formatter diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index abe701c88..6979ccd5c 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -55,8 +55,9 @@ except: # GTK/Gnome modules # #------------------------------------------------------------------------- +import gtk +from gtk import glade from gtk import RESPONSE_OK -import gtk.glade #------------------------------------------------------------------------- # @@ -589,7 +590,7 @@ class BookListDisplay: self.dosave = dosave base = os.path.dirname(__file__) glade_file = os.path.join(base,"book.glade") - self.xml = gtk.glade.XML(glade_file, "booklist", "gramps") + self.xml = glade.XML(glade_file, "booklist", "gramps") self.top = self.xml.get_widget('booklist') ManagedWindow.set_titles(self.top, @@ -703,7 +704,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = os.path.join(base,"book.glade") - self.xml = gtk.glade.XML(glade_file, "top", "gramps") + self.xml = glade.XML(glade_file, "top", "gramps") window = self.xml.get_widget("top") title_label = self.xml.get_widget('title') self.set_window(window, title_label, self.title) diff --git a/src/plugins/Calendar.py b/src/plugins/Calendar.py index 7a3d82093..865282618 100644 --- a/src/plugins/Calendar.py +++ b/src/plugins/Calendar.py @@ -37,17 +37,16 @@ import os #------------------------------------------------------------------------ import BaseDoc from BasicUtils import name_displayer -from DateHandler import displayer from PluginUtils import register_report, relationship_class -from ReportBase import Report, ReportUtils, MenuReportOptions, \ - CATEGORY_DRAW, CATEGORY_TEXT, \ - MODE_GUI, MODE_BKI, MODE_CLI -from PluginUtils import NumberOption, BooleanOption, StringOption, \ - FilterOption, EnumeratedListOption, PersonOption +from ReportBase import (Report, ReportUtils, MenuReportOptions, + CATEGORY_DRAW, CATEGORY_TEXT, + MODE_GUI, MODE_BKI, MODE_CLI) +from PluginUtils import (NumberOption, BooleanOption, StringOption, + FilterOption, EnumeratedListOption, PersonOption) import GrampsLocale import gen.lib from Utils import probably_alive, ProgressMeter -from FontScale import string_trim, string_width +from FontScale import string_trim pt2cm = ReportUtils.pt2cm cm2pt = ReportUtils.cm2pt diff --git a/src/plugins/ChangeNames.py b/src/plugins/ChangeNames.py index c26e9887a..7eeb7498d 100644 --- a/src/plugins/ChangeNames.py +++ b/src/plugins/ChangeNames.py @@ -37,7 +37,7 @@ from gettext import gettext as _ #------------------------------------------------------------------------- import gobject import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -178,7 +178,7 @@ class ChangeNames(Tool.BatchTool, ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = os.path.join(base,"changenames.glade") - self.top = gtk.glade.XML(glade_file,"top","gramps") + self.top = glade.XML(glade_file,"top","gramps") window = self.top.get_widget('top') self.top.signal_autoconnect({ "destroy_passed_object" : self.close, diff --git a/src/plugins/ChangeTypes.py b/src/plugins/ChangeTypes.py index 3f4142f7f..889adbe53 100644 --- a/src/plugins/ChangeTypes.py +++ b/src/plugins/ChangeTypes.py @@ -35,15 +35,13 @@ from gettext import gettext as _ # GNOME/GTK modules # #------------------------------------------------------------------------ -import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------ # # GRAMPS modules # #------------------------------------------------------------------------ -import const import Utils import locale import ManagedWindow @@ -78,7 +76,7 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = "%s/%s" % (base,"changetype.glade") - self.glade = gtk.glade.XML(glade_file,"top","gramps") + self.glade = glade.XML(glade_file,"top","gramps") self.auto1 = self.glade.get_widget("original") self.auto2 = self.glade.get_widget("new") diff --git a/src/plugins/Check.py b/src/plugins/Check.py index 7609298bd..3efda069f 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -47,7 +47,7 @@ log = logging.getLogger(".CheckRepair") # #------------------------------------------------------------------------- import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -56,7 +56,7 @@ import gtk.glade #------------------------------------------------------------------------- import gen.lib import Utils -import const +#import const import ManagedWindow from PluginUtils import Tool, register_tool @@ -109,8 +109,9 @@ def _table_low_level(db,table): print " No dupes found for this table" return True - import gen.db - table_cursor = gen.db.GrampsDBDirDupCursor(table) +# import gen.db + from gen.db import GrampsDBDirDupCursor + table_cursor = GrampsDBDirDupCursor(table) for handle in dup_handles: print " Duplicates found for handle: %s" % handle try: @@ -1472,7 +1473,7 @@ class Report(ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = base + os.sep + "summary.glade" - topDialog = gtk.glade.XML(glade_file,"summary","gramps") + topDialog = glade.XML(glade_file,"summary","gramps") topDialog.get_widget("close").connect('clicked',self.close) window = topDialog.get_widget("summary") diff --git a/src/plugins/CmdRef.py b/src/plugins/CmdRef.py index e956687bc..78f7f18cb 100644 --- a/src/plugins/CmdRef.py +++ b/src/plugins/CmdRef.py @@ -38,7 +38,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- from PluginUtils import Tool, cl_list, cli_tool_list, register_tool -from ReportBase import CATEGORY_BOOK, CATEGORY_CODE, CATEGORY_WEB +from ReportBase import CATEGORY_BOOK, CATEGORY_WEB from ReportBase._CommandLineReport import CommandLineReport #------------------------------------------------------------------------- diff --git a/src/plugins/CountAncestors.py b/src/plugins/CountAncestors.py index 78bcaa84e..e5c3dd94f 100644 --- a/src/plugins/CountAncestors.py +++ b/src/plugins/CountAncestors.py @@ -38,7 +38,7 @@ from math import pow # GNOME/GTK modules # #------------------------------------------------------------------------ -import gtk.glade +from gtk import glade #------------------------------------------------------------------------ # @@ -65,7 +65,7 @@ class CountAncestors(ManagedWindow.ManagedWindow): database = dbstate.db text = "" glade_file = "%s/summary.glade" % os.path.dirname(__file__) - topDialog = gtk.glade.XML(glade_file,"summary","gramps") + topDialog = glade.XML(glade_file,"summary","gramps") topDialog.signal_autoconnect({ "destroy_passed_object" : self.close, }) diff --git a/src/plugins/CustomBookText.py b/src/plugins/CustomBookText.py index 57d1c4662..823206ebd 100644 --- a/src/plugins/CustomBookText.py +++ b/src/plugins/CustomBookText.py @@ -34,7 +34,6 @@ from gettext import gettext as _ # gtk # #------------------------------------------------------------------------ -import gtk #------------------------------------------------------------------------ # diff --git a/src/plugins/DateParserDisplayTest.py b/src/plugins/DateParserDisplayTest.py index 1c3c17e29..ca2807050 100644 --- a/src/plugins/DateParserDisplayTest.py +++ b/src/plugins/DateParserDisplayTest.py @@ -39,11 +39,10 @@ import sys # GRAMPS modules # #------------------------------------------------------------------------- -import Errors import gen.lib from PluginUtils import Tool, register_tool import Utils -from QuestionDialog import QuestionDialog,ErrorDialog +from QuestionDialog import QuestionDialog from DateHandler import parser as _dp from DateHandler import displayer as _dd diff --git a/src/plugins/DefaultGramplets.py b/src/plugins/DefaultGramplets.py index 9f15b0f21..04cdf0c8f 100644 --- a/src/plugins/DefaultGramplets.py +++ b/src/plugins/DefaultGramplets.py @@ -17,9 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import sys -import os import re -import time import urllib import gen.lib diff --git a/src/plugins/Desbrowser.py b/src/plugins/Desbrowser.py index 8401b9e4e..aff8b9aef 100644 --- a/src/plugins/Desbrowser.py +++ b/src/plugins/Desbrowser.py @@ -36,7 +36,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------ import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------ # @@ -72,7 +72,7 @@ class DesBrowse(Tool.ActivePersonTool, ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = base + os.sep + "desbrowse.glade" - self.glade = gtk.glade.XML(glade_file,"top","gramps") + self.glade = glade.XML(glade_file,"top","gramps") self.glade.signal_autoconnect({ "destroy_passed_object" : self.close, "on_help_clicked" : self.on_help_clicked, diff --git a/src/plugins/Eval.py b/src/plugins/Eval.py index 6bd08c9d1..da3d6894d 100644 --- a/src/plugins/Eval.py +++ b/src/plugins/Eval.py @@ -38,8 +38,7 @@ from gettext import gettext as _ # GNOME/GTK modules # #------------------------------------------------------------------------ -import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------ # @@ -62,7 +61,7 @@ class Eval(Tool.Tool,ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) glade_file = "%s/%s" % (os.path.dirname(__file__),"eval.glade") - self.glade = gtk.glade.XML(glade_file,"top","gramps") + self.glade = glade.XML(glade_file,"top","gramps") window = self.glade.get_widget("top") self.dbuf = self.glade.get_widget("display").get_buffer() diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index 5597b62ac..72d576d76 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -36,7 +36,8 @@ from gettext import gettext as _ # GNOME/GTK modules # #------------------------------------------------------------------------ -import gtk.glade +import gtk +from gtk import glade #------------------------------------------------------------------------ # @@ -46,7 +47,7 @@ import gtk.glade from Filters import GenericFilter, build_filter_menu, Rules import Sort import Utils -from ODSTab import ODSTab +from docgen import ODSTab import const import Errors import DateHandler @@ -114,7 +115,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow): self.glade_file = base + os.sep + "eventcmp.glade" self.qual = 0 - self.filterDialog = gtk.glade.XML(self.glade_file,"filters","gramps") + self.filterDialog = glade.XML(self.glade_file,"filters","gramps") self.filterDialog.signal_autoconnect({ "on_apply_clicked" : self.on_apply_clicked, "on_editor_clicked" : self.filter_editor_clicked, @@ -217,7 +218,7 @@ class DisplayChart(ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) self.glade_file = base + os.sep + "eventcmp.glade" - self.topDialog = gtk.glade.XML(self.glade_file,"view","gramps") + self.topDialog = glade.XML(self.glade_file,"view","gramps") self.topDialog.signal_autoconnect({ "on_write_table" : self.on_write_table, "destroy_passed_object" : self.close, diff --git a/src/plugins/ExportCSV.py b/src/plugins/ExportCSV.py index 71c413dcc..5cb3b363d 100644 --- a/src/plugins/ExportCSV.py +++ b/src/plugins/ExportCSV.py @@ -38,8 +38,7 @@ import codecs # GNOME/GTK modules # #------------------------------------------------------------------------- -import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------ # @@ -56,7 +55,6 @@ log = logging.getLogger(".ExportCSV") #------------------------------------------------------------------------- import gen.lib from Filters import GenericFilter, Rules, build_filter_menu -import const import Utils import Errors from QuestionDialog import ErrorDialog @@ -177,7 +175,7 @@ class CSVWriterOptionBox: if not os.path.isfile(glade_file): glade_file = "plugins/csvexport.glade" - self.topDialog = gtk.glade.XML(glade_file,"csvExport","gramps") + self.topDialog = glade.XML(glade_file,"csvExport","gramps") filter_obj = self.topDialog.get_widget("filter") all = GenericFilter() diff --git a/src/plugins/ExportVCalendar.py b/src/plugins/ExportVCalendar.py index 7b0dbe445..8c368876c 100644 --- a/src/plugins/ExportVCalendar.py +++ b/src/plugins/ExportVCalendar.py @@ -37,8 +37,8 @@ from gettext import gettext as _ # GNOME/GTK modules # #------------------------------------------------------------------------- -from gtk import glade import gtk +from gtk import glade #------------------------------------------------------------------------ # @@ -54,7 +54,6 @@ log = logging.getLogger(".ExportVCal") # #------------------------------------------------------------------------- from Filters import GenericFilter, Rules, build_filter_menu -#import const import Utils from gen.lib import Date, EventType import Errors diff --git a/src/plugins/ExportVCard.py b/src/plugins/ExportVCard.py index 1def61751..9609e8e3f 100644 --- a/src/plugins/ExportVCard.py +++ b/src/plugins/ExportVCard.py @@ -44,7 +44,7 @@ log = logging.getLogger(".ExportVCard") # GNOME/GTK modules # #------------------------------------------------------------------------- -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -77,7 +77,7 @@ class CardWriterOptionBox: if not os.path.isfile(glade_file): glade_file = "plugins/vcardexport.glade" - self.topDialog = gtk.glade.XML(glade_file,"vcardExport","gramps") + self.topDialog = glade.XML(glade_file,"vcardExport","gramps") filter_obj = self.topDialog.get_widget("filter") self.copy = 0 diff --git a/src/plugins/ExtractCity.py b/src/plugins/ExtractCity.py index 552c7c858..2de748b79 100644 --- a/src/plugins/ExtractCity.py +++ b/src/plugins/ExtractCity.py @@ -38,7 +38,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk -import gtk.glade +from gtk import glade import gobject #------------------------------------------------------------------------- @@ -458,7 +458,7 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = os.path.join(base, "changenames.glade") - self.top = gtk.glade.XML(glade_file, "top", "gramps") + self.top = glade.XML(glade_file, "top", "gramps") window = self.top.get_widget('top') self.top.signal_autoconnect({ "destroy_passed_object" : self.close, diff --git a/src/plugins/FamilyLines.py b/src/plugins/FamilyLines.py index 6c63240ca..5182ce83d 100644 --- a/src/plugins/FamilyLines.py +++ b/src/plugins/FamilyLines.py @@ -65,15 +65,15 @@ import DateHandler import GrampsWidgets import ManagedWindow from PluginUtils import register_report -from ReportBase import Report, ReportUtils, ReportOptions, CATEGORY_CODE, MODE_GUI, MODE_CLI +from ReportBase import (Report, ReportUtils, ReportOptions, CATEGORY_CODE, + MODE_GUI) from ReportBase._ReportDialog import ReportDialog -from QuestionDialog import ErrorDialog, WarningDialog +from QuestionDialog import ErrorDialog #from NameDisplay import displayer as _nd # Gramps version < 3.0 from BasicUtils import name_displayer as _nd # Gramps version >= 3.0 from DateHandler import displayer as _dd -from DateHandler import parser from Selectors import selector_factory #------------------------------------------------------------------------ diff --git a/src/plugins/FindDupes.py b/src/plugins/FindDupes.py index f8030ea27..7faba2e64 100644 --- a/src/plugins/FindDupes.py +++ b/src/plugins/FindDupes.py @@ -35,7 +35,7 @@ from gettext import gettext as _ # GNOME libraries # #------------------------------------------------------------------------- -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -104,7 +104,7 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) self.glade_file = "%s/%s" % (base,"merge.glade") - top = gtk.glade.XML(self.glade_file,"dialog","gramps") + top = glade.XML(self.glade_file,"dialog","gramps") # retrieve options threshold = self.options.handler.options_dict['threshold'] @@ -556,7 +556,7 @@ class ShowMatches(ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) self.glade_file = "%s/%s" % (base,"merge.glade") - top = gtk.glade.XML(self.glade_file,"mergelist","gramps") + top = glade.XML(self.glade_file,"mergelist","gramps") window = top.get_widget("mergelist") self.set_window(window, top.get_widget('title'), _('Potential Merges')) diff --git a/src/plugins/ImportCSV.py b/src/plugins/ImportCSV.py index 2bd685ae8..7ebbf04ff 100644 --- a/src/plugins/ImportCSV.py +++ b/src/plugins/ImportCSV.py @@ -55,15 +55,12 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------- -import Errors import gen.lib -import const from QuestionDialog import ErrorDialog from DateHandler import parser as _dp from PluginUtils import register_import from Utils import gender as gender_map from Utils import ProgressMeter -from htmlentitydefs import name2codepoint #------------------------------------------------------------------------- # diff --git a/src/plugins/ImportGeneWeb.py b/src/plugins/ImportGeneWeb.py index 05b9dd041..dd2805949 100644 --- a/src/plugins/ImportGeneWeb.py +++ b/src/plugins/ImportGeneWeb.py @@ -45,7 +45,6 @@ log = logging.getLogger(".ImportGeneWeb") # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # @@ -56,7 +55,6 @@ import Errors import gen.lib import const from QuestionDialog import ErrorDialog -from DateHandler import parser as _dp from PluginUtils import register_import from htmlentitydefs import name2codepoint diff --git a/src/plugins/ImportvCard.py b/src/plugins/ImportvCard.py index 2b6197a6f..9366b9aab 100644 --- a/src/plugins/ImportvCard.py +++ b/src/plugins/ImportvCard.py @@ -45,7 +45,6 @@ log = logging.getLogger(".ImportVCard") # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # diff --git a/src/plugins/Leak.py b/src/plugins/Leak.py index 1580ddfa4..11290b6bb 100644 --- a/src/plugins/Leak.py +++ b/src/plugins/Leak.py @@ -38,8 +38,7 @@ from bsddb.db import DBError # GNOME/GTK modules # #------------------------------------------------------------------------ -import gtk -import gtk.glade +from gtk import glade import gc #------------------------------------------------------------------------ @@ -47,7 +46,6 @@ import gc # GRAMPS modules # #------------------------------------------------------------------------ -import Utils from PluginUtils import Tool, register_tool import ManagedWindow @@ -64,7 +62,7 @@ class Leak(Tool.Tool,ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) glade_file = os.path.dirname(__file__) + os.sep + "leak.glade" - self.glade = gtk.glade.XML(glade_file,"top","gramps") + self.glade = glade.XML(glade_file,"top","gramps") window = self.glade.get_widget("top") self.eval = self.glade.get_widget("eval") diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index c1c836dac..aa7a02440 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -61,13 +61,12 @@ import gen.lib import const from GrampsCfg import get_researcher import Sort -from PluginUtils import register_report -from PluginUtils import FilterOption, EnumeratedListOption, PersonOption, \ - BooleanOption, NumberOption, StringOption, DestinationOption, NoteOption, \ - MediaOption -from ReportBase import Report, ReportUtils, MenuReportOptions, \ - CATEGORY_WEB, MODE_GUI, MODE_CLI -from ReportBase import Bibliography +from PluginUtils import (register_report, FilterOption, EnumeratedListOption, + PersonOption, BooleanOption, NumberOption, + StringOption, DestinationOption, NoteOption, + MediaOption) +from ReportBase import (Report, ReportUtils, MenuReportOptions, CATEGORY_WEB, + MODE_GUI, MODE_CLI, Bibliography) import Utils import ThumbNails import ImgManip @@ -76,8 +75,7 @@ from QuestionDialog import ErrorDialog, WarningDialog from BasicUtils import name_displayer as _nd from DateHandler import displayer as _dd from DateHandler import parser as _dp -from gen.proxy import PrivateProxyDb -from gen.proxy import LivingProxyDb +from gen.proxy import PrivateProxyDb, LivingProxyDb from gen.lib.eventroletype import EventRoleType #------------------------------------------------------------------------ diff --git a/src/plugins/OwnerEditor.py b/src/plugins/OwnerEditor.py index 64d21ebb7..27b76a347 100644 --- a/src/plugins/OwnerEditor.py +++ b/src/plugins/OwnerEditor.py @@ -36,7 +36,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -89,7 +89,7 @@ class OwnerEditor(Tool.Tool, ManagedWindow.ManagedWindow): glade_file = os.path.join(base, "ownereditor.glade") # get the main window from glade - top_xml = gtk.glade.XML(glade_file, "top", "gramps") + top_xml = glade.XML(glade_file, "top", "gramps") # set gramps style title for the window window = top_xml.get_widget("top") @@ -111,7 +111,7 @@ class OwnerEditor(Tool.Tool, ManagedWindow.ManagedWindow): }) # fetch the popup menu - popup_xml = gtk.glade.XML(glade_file, "popup-menu", "gramps") + popup_xml = glade.XML(glade_file, "popup-menu", "gramps") self.menu = popup_xml.get_widget("popup-menu") popup_xml.signal_connect("on_menu_activate", self.on_menu_activate) diff --git a/src/plugins/PHPGedViewConnector.py b/src/plugins/PHPGedViewConnector.py index 7a76a8a05..f1e06eef1 100644 --- a/src/plugins/PHPGedViewConnector.py +++ b/src/plugins/PHPGedViewConnector.py @@ -26,13 +26,10 @@ import httplib import urllib2 import gtk -import gtk.glade +from gtk import glade import os -from random import randint -from tempfile import NamedTemporaryFile from tempfile import mkstemp from gettext import gettext as _ -from PluginUtils import register_tool # # Interface to phpGedView # @@ -284,7 +281,7 @@ class phpGedViewImporter: self.connector = None glade_file = "%s/phpgedview.glade" % os.path.dirname(__file__) - top = gtk.glade.XML(glade_file,'importer','gramps') + top = glade.XML(glade_file,'importer','gramps') self.url_entry = top.get_widget('url_entry') self.version_label = top.get_widget('version_label') self.version_label.set_text("") @@ -319,7 +316,7 @@ class phpGedViewImporter: gtk.main_iteration() def on_next_pressed_cb(self, widget, event=None, data=None): - import GedcomParser + from GrampsDbUtils import GedcomParser if event: print event.type diff --git a/src/plugins/PatchNames.py b/src/plugins/PatchNames.py index f6c1f353d..ae33a11db 100644 --- a/src/plugins/PatchNames.py +++ b/src/plugins/PatchNames.py @@ -37,7 +37,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk -import gtk.glade +from gtk import glade import gobject #------------------------------------------------------------------------- @@ -180,7 +180,7 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = os.path.join(base,"patchnames.glade") - self.top = gtk.glade.XML(glade_file,"top","gramps") + self.top = glade.XML(glade_file,"top","gramps") window = self.top.get_widget('top') self.top.signal_autoconnect({ "destroy_passed_object" : self.close, diff --git a/src/plugins/Rebuild.py b/src/plugins/Rebuild.py index 0ca813274..3c3e44094 100644 --- a/src/plugins/Rebuild.py +++ b/src/plugins/Rebuild.py @@ -27,8 +27,6 @@ # python modules # #------------------------------------------------------------------------- -import os -import cStringIO from gettext import gettext as _ #------------------------------------------------------------------------ @@ -44,16 +42,12 @@ log = logging.getLogger(".Rebuild") # gtk modules # #------------------------------------------------------------------------- -import gtk -import gtk.glade #------------------------------------------------------------------------- # # GRAMPS modules # #------------------------------------------------------------------------- -import gen.lib -import const from PluginUtils import Tool, register_tool from QuestionDialog import OkDialog from BasicUtils import UpdateCallback diff --git a/src/plugins/RebuildRefMap.py b/src/plugins/RebuildRefMap.py index 077d83ae9..654dfec79 100644 --- a/src/plugins/RebuildRefMap.py +++ b/src/plugins/RebuildRefMap.py @@ -29,8 +29,6 @@ # python modules # #------------------------------------------------------------------------- -import os -import cStringIO from gettext import gettext as _ #------------------------------------------------------------------------ @@ -46,16 +44,12 @@ log = logging.getLogger(".RebuildRefMap") # gtk modules # #------------------------------------------------------------------------- -import gtk -import gtk.glade #------------------------------------------------------------------------- # # GRAMPS modules # #------------------------------------------------------------------------- -import gen.lib -import const from PluginUtils import Tool, register_tool from QuestionDialog import OkDialog from BasicUtils import UpdateCallback diff --git a/src/plugins/References.py b/src/plugins/References.py index 8e7d6b62f..07863640b 100644 --- a/src/plugins/References.py +++ b/src/plugins/References.py @@ -22,11 +22,13 @@ """ Display references for any object """ +from ReportBase import (CATEGORY_QR_SOURCE, CATEGORY_QR_PERSON, + CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT, + CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY) from Simple import SimpleAccess, SimpleDoc, SimpleTable from gettext import gettext as _ from PluginUtils import register_quick_report -from ReportBase import * def get_ref(db, objclass, handle): """ diff --git a/src/plugins/RelCalc.py b/src/plugins/RelCalc.py index 58e54d807..aaa11e4f1 100644 --- a/src/plugins/RelCalc.py +++ b/src/plugins/RelCalc.py @@ -35,19 +35,16 @@ from gettext import gettext as _ # GNOME libraries # #------------------------------------------------------------------------- -import gtk.glade -from gtk import TextBuffer +from gtk import glade +import gtk #------------------------------------------------------------------------- # # GRAMPS modules # #------------------------------------------------------------------------- -import gen.lib from BasicUtils import name_displayer import ManagedWindow -import ListModel -import DateHandler from DisplayModels import PeopleModel from QuestionDialog import ErrorDialog @@ -87,7 +84,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = base + os.sep + "relcalc.glade" - self.glade = gtk.glade.XML(glade_file, "relcalc", "gramps") + self.glade = glade.XML(glade_file, "relcalc", "gramps") name = '' if self.person: @@ -103,7 +100,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow): self.tree = self.glade.get_widget("peopleList") self.text = self.glade.get_widget("text1") - self.textbuffer = TextBuffer() + self.textbuffer = gtk.TextBuffer() self.text.set_buffer(self.textbuffer) self.model = PeopleModel(self.db,None) diff --git a/src/plugins/RemoveUnused.py b/src/plugins/RemoveUnused.py index 45c4da811..4fda66232 100644 --- a/src/plugins/RemoveUnused.py +++ b/src/plugins/RemoveUnused.py @@ -44,7 +44,7 @@ log = logging.getLogger(".RemoveUnused") # #------------------------------------------------------------------------- import gtk -import gtk.glade +from gtk import glade import gobject #------------------------------------------------------------------------- @@ -117,7 +117,7 @@ class RemoveUnused(Tool.Tool,ManagedWindow.ManagedWindow,UpdateCallback): base = os.path.dirname(__file__) self.glade_file = base + os.sep + "unused.glade" - self.top = gtk.glade.XML(self.glade_file,"unused","gramps") + self.top = glade.XML(self.glade_file,"unused","gramps") window = self.top.get_widget("unused") self.set_window(window,self.top.get_widget('title'),self.title) diff --git a/src/plugins/SameSurnames.py b/src/plugins/SameSurnames.py index dda26e1a3..315d81f14 100644 --- a/src/plugins/SameSurnames.py +++ b/src/plugins/SameSurnames.py @@ -28,7 +28,7 @@ from gettext import gettext as _ from PluginUtils import register_quick_report from ReportBase import CATEGORY_QR_PERSON from Filters.Rules import Rule -from Filters import GenericFilterFactory, Rules +from Filters import GenericFilterFactory class IncompleteSurname(Rule): """People with incomplete surnames""" diff --git a/src/plugins/SimpleBookTitle.py b/src/plugins/SimpleBookTitle.py index 3b93739e8..4f584ab0c 100644 --- a/src/plugins/SimpleBookTitle.py +++ b/src/plugins/SimpleBookTitle.py @@ -24,7 +24,6 @@ # python modules # #------------------------------------------------------------------------ -import os import time from TransUtils import sgettext as _ diff --git a/src/plugins/SoundGen.py b/src/plugins/SoundGen.py index dc31dd804..43af82c9d 100644 --- a/src/plugins/SoundGen.py +++ b/src/plugins/SoundGen.py @@ -35,7 +35,6 @@ from gettext import gettext as _ # GNOME/GTK modules # #------------------------------------------------------------------------ -import gtk from gtk import glade #------------------------------------------------------------------------ # diff --git a/src/plugins/Summary.py b/src/plugins/Summary.py index 71026b7d6..7aa901a3d 100644 --- a/src/plugins/Summary.py +++ b/src/plugins/Summary.py @@ -36,7 +36,7 @@ from gettext import gettext as _ # GNOME/GTK modules # #------------------------------------------------------------------------ -import gtk.glade +from gtk import glade #------------------------------------------------------------------------ # @@ -157,7 +157,7 @@ class SummaryReport(ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = "%s/summary.glade" % base - topDialog = gtk.glade.XML(glade_file,"summary","gramps") + topDialog = glade.XML(glade_file,"summary","gramps") topDialog.signal_autoconnect({ "destroy_passed_object" : self.close, }) diff --git a/src/plugins/TestcaseGenerator.py b/src/plugins/TestcaseGenerator.py index 63a71edc3..0f28c3d28 100644 --- a/src/plugins/TestcaseGenerator.py +++ b/src/plugins/TestcaseGenerator.py @@ -28,8 +28,6 @@ # standard python modules # #------------------------------------------------------------------------- -import traceback -import sys from random import randint,choice,random from gettext import gettext as _ @@ -39,20 +37,16 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # # GRAMPS modules # #------------------------------------------------------------------------- -import Errors import gen.lib from PluginUtils import Tool, register_tool -import const import Utils import LdsUtils -from QuestionDialog import ErrorDialog #------------------------------------------------------------------------- # diff --git a/src/plugins/Verify.py b/src/plugins/Verify.py index 2d3fc9173..2e18ccdf4 100644 --- a/src/plugins/Verify.py +++ b/src/plugins/Verify.py @@ -42,7 +42,7 @@ import Errors # #------------------------------------------------------------------------ import gtk -import gtk.glade +from gtk import glade import gobject #------------------------------------------------------------------------ @@ -236,7 +236,7 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback): self.glade_file = base + os.sep + "verify.glade" self.vr = None - self.top = gtk.glade.XML(self.glade_file,"verify_settings","gramps") + self.top = glade.XML(self.glade_file,"verify_settings","gramps") self.top.signal_autoconnect({ "destroy_passed_object" : self.close, "on_help_clicked" : self.on_help_clicked, @@ -462,7 +462,7 @@ class VerifyResults(ManagedWindow): base = os.path.dirname(__file__) self.glade_file = base + os.sep + "verify.glade" - self.top = gtk.glade.XML(self.glade_file,"verify_result","gramps") + self.top = glade.XML(self.glade_file,"verify_result","gramps") window = self.top.get_widget("verify_result") self.set_window(window,self.top.get_widget('title'),self.title) diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index 95ab12218..728ffd9c3 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -45,7 +45,6 @@ log = logging.getLogger(".WriteCD") # #------------------------------------------------------------------------- import gtk -import gtk.glade import Errors #This is a GNOME only plugin @@ -62,11 +61,11 @@ except ImportError: "for GNOME are not installed")) try: - from gnomevfs import URI, create, OPEN_WRITE, make_directory, \ - FileExistsError + from gnomevfs import (URI, create, OPEN_WRITE, make_directory, + FileExistsError) except: - from gnome.vfs import URI, create, OPEN_WRITE, make_directory, \ - FileExistsError + from gnome.vfs import (URI, create, OPEN_WRITE, make_directory, + FileExistsError) #------------------------------------------------------------------------- # diff --git a/src/plugins/WriteFtree.py b/src/plugins/WriteFtree.py index ba4e4f761..b153bf8ac 100644 --- a/src/plugins/WriteFtree.py +++ b/src/plugins/WriteFtree.py @@ -44,8 +44,7 @@ log = logging.getLogger(".WriteFtree") # GNOME/GTK modules # #------------------------------------------------------------------------- -import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------- # @@ -80,7 +79,7 @@ class FtreeWriterOptionBox: base = os.path.dirname(__file__) glade_file = "%s/%s" % (base,"writeftree.glade") - self.top = gtk.glade.XML(glade_file, "top", "gramps") + self.top = glade.XML(glade_file, "top", "gramps") filter_obj = self.top.get_widget("filter") diff --git a/src/plugins/WriteGeneWeb.py b/src/plugins/WriteGeneWeb.py index e92e0e8cb..9780585ca 100644 --- a/src/plugins/WriteGeneWeb.py +++ b/src/plugins/WriteGeneWeb.py @@ -35,8 +35,7 @@ from gettext import gettext as _ # GNOME/GTK modules # #------------------------------------------------------------------------- -import gtk -import gtk.glade +from gtk import glade #------------------------------------------------------------------------ # @@ -81,7 +80,7 @@ class GeneWebWriterOptionBox: if not os.path.isfile(glade_file): glade_file = "plugins/genewebexport.glade" - self.topDialog = gtk.glade.XML(glade_file, "genewebExport", "gramps") + self.topDialog = glade.XML(glade_file, "genewebExport", "gramps") self.topDialog.signal_autoconnect({ "on_restrict_toggled": self.on_restrict_toggled }) diff --git a/src/plugins/WritePkg.py b/src/plugins/WritePkg.py index 1674bde6a..4725ceca9 100644 --- a/src/plugins/WritePkg.py +++ b/src/plugins/WritePkg.py @@ -51,7 +51,6 @@ log = logging.getLogger(".WritePkg") # #------------------------------------------------------------------------- import gtk -import gtk.glade #------------------------------------------------------------------------- # @@ -59,8 +58,6 @@ import gtk.glade # #------------------------------------------------------------------------- from GrampsDbUtils import XmlWriter -import Utils -#from QuestionDialog import MissingMediaDialog from PluginUtils import register_export #------------------------------------------------------------------------- diff --git a/src/plugins/rel_da.py b/src/plugins/rel_da.py index 3c6b69e82..197d99178 100644 --- a/src/plugins/rel_da.py +++ b/src/plugins/rel_da.py @@ -33,7 +33,6 @@ import gen.lib import Relationship import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/plugins/rel_de.py b/src/plugins/rel_de.py index 5eba24882..7f0d81070 100644 --- a/src/plugins/rel_de.py +++ b/src/plugins/rel_de.py @@ -35,7 +35,6 @@ import gen.lib import Relationship import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/plugins/rel_es.py b/src/plugins/rel_es.py index 949a3c0d7..0e33ce095 100644 --- a/src/plugins/rel_es.py +++ b/src/plugins/rel_es.py @@ -32,7 +32,6 @@ import gen.lib import Relationship import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/plugins/rel_fi.py b/src/plugins/rel_fi.py index 0d4dfac66..7aa3dd4a5 100644 --- a/src/plugins/rel_fi.py +++ b/src/plugins/rel_fi.py @@ -33,7 +33,6 @@ import gen.lib import Relationship import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/plugins/rel_fr.py b/src/plugins/rel_fr.py index 991b1dd6c..c48e6bfad 100644 --- a/src/plugins/rel_fr.py +++ b/src/plugins/rel_fr.py @@ -29,8 +29,6 @@ import gen.lib import Relationship -import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/plugins/rel_hu.py b/src/plugins/rel_hu.py index b82c25acc..30467adc5 100644 --- a/src/plugins/rel_hu.py +++ b/src/plugins/rel_hu.py @@ -34,7 +34,6 @@ import gen.lib import Relationship from PluginUtils import register_relcalc import types -from gettext import gettext as _ #------------------------------------------------------------------------- # diff --git a/src/plugins/rel_nl.py b/src/plugins/rel_nl.py index c1247f45e..376fc0faf 100644 --- a/src/plugins/rel_nl.py +++ b/src/plugins/rel_nl.py @@ -29,8 +29,6 @@ import gen.lib import Relationship -import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/plugins/rel_no.py b/src/plugins/rel_no.py index 4559bb257..eb0d1e081 100644 --- a/src/plugins/rel_no.py +++ b/src/plugins/rel_no.py @@ -33,7 +33,6 @@ import gen.lib import Relationship import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/plugins/rel_sv.py b/src/plugins/rel_sv.py index d8ac3e64b..49d125651 100644 --- a/src/plugins/rel_sv.py +++ b/src/plugins/rel_sv.py @@ -33,8 +33,6 @@ import gen.lib import Relationship -import types -from gettext import gettext as _ from PluginUtils import register_relcalc #------------------------------------------------------------------------- diff --git a/src/test/gedread_util.py b/src/test/gedread_util.py index f6ee1cd7f..6d6062f50 100644 --- a/src/test/gedread_util.py +++ b/src/test/gedread_util.py @@ -9,8 +9,6 @@ import shutil from test import test_util as tu from GrampsDbUtils import _ReadGedcom as RG -from GrampsDbUtils import _GedcomStageOne as S1 -from GrampsDbUtils import _GedcomParse as GP import DbState import gen.db import Config diff --git a/test/try_tree_model.py b/test/try_tree_model.py index 64321c6d9..917edb2d7 100644 --- a/test/try_tree_model.py +++ b/test/try_tree_model.py @@ -6,7 +6,6 @@ import sys, os sys.path.append("../src") #from Models import PersonModel,PersonFilterModel -from TreeViews import PersonTreeView import GenericFilter ## class ProxyPerson(object): diff --git a/windows/nsis/gcheck.py b/windows/nsis/gcheck.py index cf2f6b1cf..4d55f0920 100644 --- a/windows/nsis/gcheck.py +++ b/windows/nsis/gcheck.py @@ -18,7 +18,7 @@ except ImportError: f.write('pygtkver=no\n') try: - import gtk.glade + from gtk import glade f.write('glade=yes\n') except ImportError: f.write('glade=no\n')