diff --git a/ChangeLog b/ChangeLog index 7bfe0744d..a62d502c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-09-07 Don Allingham + * various: const.py changes + +2007-09-07 Don Allingham + * src/DateHandler/_Date_fr.py: fix indentation errors + 2007-09-07 Don Allingham * src/ansel_utf8.py: pylint * src/Date.py: pylint diff --git a/src/AddMedia.py b/src/AddMedia.py index 2692d3823..c74c59e4d 100644 --- a/src/AddMedia.py +++ b/src/AddMedia.py @@ -82,7 +82,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self, uistate, track, self) self.dbase = dbstate.db - self.glade = gtk.glade.XML(const.gladeFile, "imageSelect", "gramps") + self.glade = gtk.glade.XML(const.GLADE_FILE, "imageSelect", "gramps") self.set_window( self.glade.get_widget("imageSelect"), @@ -192,7 +192,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow): if filename: mtype = Mime.get_type(filename) if mtype and mtype.startswith("image"): - image = scale_image(filename, const.thumbScale) + image = scale_image(filename, const.THUMBSCALE) else: image = Mime.find_mime_type_pixbuf(mtype) self.image.set_from_pixbuf(image) @@ -239,5 +239,5 @@ def scale_image(path, size): gtk.gdk.INTERP_BILINEAR) except: WarningDialog(title_msg, detail_msg) - return gtk.gdk.pixbuf_new_from_file(const.icon) + return gtk.gdk.pixbuf_new_from_file(const.ICON) diff --git a/src/ArgHandler.py b/src/ArgHandler.py index 064716d13..6da6a4943 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -119,7 +119,7 @@ class ArgHandler: try: options,leftargs = getopt.getopt(self.args[1:], - const.shortopts,const.longopts) + const.SHORTOPTS,const.LONGOPTS) except getopt.GetoptError: # return without filling anything if we could not parse the args print "Error parsing arguments: %s " % self.args[1:] @@ -149,13 +149,13 @@ class ArgHandler: print "Invalid format: %s" % format print "Ignoring input file: %s" % fname continue - elif ftype == const.app_gedcom: + elif ftype == const.APP_GEDCOM: format = 'gedcom' - elif ftype == const.app_gramps_xml: + elif ftype == const.APP_GRAMPS_XML: format = 'gramps-xml' - elif ftype == const.app_gramps: + elif ftype == const.APP_GRAMPS: format = 'grdb' - elif ftype in [const.app_gramps_package,const.app_geneweb]: + elif ftype in [const.APP_GRAMPS_PKG,const.APP_GENEWEB]: print 'Unsupported type: "%s" for input file: %s' \ % (ftype,fname) print 'Please create a new GRAMPS database and import the file.' @@ -185,15 +185,15 @@ class ArgHandler: print "Invalid format: %s" % format print "Ignoring input file: %s" % fname continue - elif ftype == const.app_gedcom: + elif ftype == const.APP_GEDCOM: format = 'gedcom' - elif ftype == const.app_gramps_package: + elif ftype == const.APP_GRAMPS_PKG: format = 'gramps-pkg' - elif ftype == const.app_gramps_xml: + elif ftype == const.APP_GRAMPS_XML: format = 'gramps-xml' - elif ftype == const.app_gramps: + elif ftype == const.APP_GRAMPS: format = 'grdb' - elif ftype == const.app_geneweb: + elif ftype == const.APP_GENEWEB: format = 'geneweb' else: print 'Unrecognized type: "%s" for input file: %s' \ @@ -298,14 +298,14 @@ class ArgHandler: success = False filename = os.path.abspath(os.path.expanduser(self.open_gui)) filetype = Mime.get_type(filename) - if filetype in (const.app_gramps,const.app_gedcom, - const.app_gramps_xml, 'x-directory/normal'): + if filetype in (const.APP_GRAMPS,const.APP_GEDCOM, + const.APP_GRAMPS_XML, 'x-directory/normal'): # Say the type outloud - if filetype == const.app_gramps: + if filetype == const.APP_GRAMPS: print "Type: GRAMPS database" - elif filetype == const.app_gedcom: + elif filetype == const.APP_GEDCOM: print "Type: GEDCOM file" - elif filetype == const.app_gramps_xml: + elif filetype == const.APP_GRAMPS_XML: print "Type: GRAMPS XML database" try: @@ -315,7 +315,7 @@ class ArgHandler: except: print "Cannot open %s. Exiting..." - elif filetype in (const.app_gramps_package,): + elif filetype in (const.APP_GRAMPS_PKG,): QuestionDialog.OkDialog( _("Opening non-native format"), _("New GRAMPS database has to be set up " "when opening non-native formats. The " @@ -330,7 +330,7 @@ class ArgHandler: 'without setting up new GRAMPS database.')) print "Cannot continue without native database. Exiting..." sys.exit(1) - elif filetype == const.app_gramps_package: + elif filetype == const.APP_GRAMPS_PKG: print "Type: GRAMPS package" self.vm.import_pkg(filename) success = True @@ -363,13 +363,13 @@ class ArgHandler: filename = os.path.abspath(os.path.expanduser(name)) if format == 'grdb': - filetype = const.app_gramps + filetype = const.APP_GRAMPS print "Type: GRAMPS database" elif format == 'gedcom': - filetype = const.app_gedcom + filetype = const.APP_GEDCOM print "Type: GEDCOM" elif format == 'gramps-xml': - filetype = const.app_gramps_xml + filetype = const.APP_GRAMPS_XML print "Type: GRAMPS XML" elif format == 'x-directory/normal': filetype = 'x-directory/normal' @@ -392,7 +392,7 @@ class ArgHandler: self.cl = bool(self.exports or self.actions or self.cl) # Create dir for imported database(s) - self.impdir_path = os.path.join(const.home_dir,"import") + self.impdir_path = os.path.join(const.HOME_DIR,"import") self.imp_db_path = os.path.join(self.impdir_path,"import_db.grdb") if not os.path.isdir(self.impdir_path): try: @@ -411,7 +411,7 @@ class ArgHandler: if os.path.isfile(os.path.join(self.impdir_path,fn)): os.remove(os.path.join(self.impdir_path,fn)) - self.vm.db_loader.read_file(self.imp_db_path,const.app_gramps) + self.vm.db_loader.read_file(self.imp_db_path,const.APP_GRAMPS) for imp in self.imports: print "Importing: file %s, format %s." % imp @@ -466,7 +466,7 @@ class ArgHandler: if format == 'grdb': filename = os.path.normpath(os.path.abspath(filename)) try: - GrampsDbUtils.gramps_db_reader_factory(const.app_gramps)( + GrampsDbUtils.gramps_db_reader_factory(const.APP_GRAMPS)( self.state.db,filename,empty) except: print "Error importing %s" % filename @@ -482,7 +482,7 @@ class ArgHandler: sys.exit(1) elif format == 'gramps-xml': try: - GrampsDbUtils.gramps_db_reader_factory(const.app_gramps_xml)( + GrampsDbUtils.gramps_db_reader_factory(const.APP_GRAMPS_XML)( self.state.db,filename,None,self.cl) except: print "Error importing %s" % filename @@ -497,7 +497,7 @@ class ArgHandler: sys.exit(1) elif format == 'gramps-pkg': # Create tempdir, if it does not exist, then check for writability - tmpdir_path = os.path.join(const.home_dir,"tmp") + tmpdir_path = os.path.join(const.HOME_DIR,"tmp") if not os.path.isdir(tmpdir_path): try: os.mkdir(tmpdir_path,0700) @@ -529,10 +529,10 @@ class ArgHandler: print "Error extracting into %s" % tmpdir_path sys.exit(1) - dbname = os.path.join(tmpdir_path,const.xmlFile) + dbname = os.path.join(tmpdir_path,const.XMLFILE) try: - GrampsDbUtils.gramps_db_reader_factory(const.app_gramps_xml)( + GrampsDbUtils.gramps_db_reader_factory(const.APP_GRAMPS_XML)( self.state.db,dbname,None) except: print "Error importing %s" % filename @@ -565,7 +565,7 @@ class ArgHandler: filename = os.path.abspath(os.path.expanduser(filename)) if format == 'grdb': try: - GrampsDbUtils.gramps_db_writer_factory(const.app_gramps)( + GrampsDbUtils.gramps_db_writer_factory(const.APP_GRAMPS)( self.state.db,filename) except: print "Error exporting %s" % filename @@ -764,13 +764,13 @@ class NewNativeDbPrompter: if os.path.splitext(filename)[1] != ".grdb": filename = filename + ".grdb" choose.destroy() - self.state.db = GrampsDb.gramps_db_factory(const.app_gramps)( + self.state.db = GrampsDb.gramps_db_factory(const.APP_GRAMPS)( Config.TRANSACTIONS) - self.vm.db_loader.read_file(filename, const.app_gramps) + self.vm.db_loader.read_file(filename, const.APP_GRAMPS) self.state.signal_change() #self.change_page(None, None) # Add the file to the recent items - RecentFiles.recent_files(filename,const.app_gramps) + RecentFiles.recent_files(filename,const.APP_GRAMPS) return True else: choose.destroy() @@ -793,7 +793,7 @@ def add_grdb_filter(chooser): """ mime_filter = gtk.FileFilter() mime_filter.set_name(_('GRAMPS databases')) - mime_filter.add_mime_type(const.app_gramps) + mime_filter.add_mime_type(const.APP_GRAMPS) chooser.add_filter(mime_filter) def read_pkg(filename): diff --git a/src/Assistant.py b/src/Assistant.py index b96ea7374..2ef1f4f9f 100644 --- a/src/Assistant.py +++ b/src/Assistant.py @@ -49,8 +49,8 @@ import ManagedWindow # Constants # #------------------------------------------------------------------------- -_gramps_png = os.path.join(const.image_dir, "gramps.png") -_splash_jpg = os.path.join(const.image_dir, "splash.jpg") +_gramps_png = os.path.join(const.IMAGE_DIR, "gramps.png") +_splash_jpg = os.path.join(const.IMAGE_DIR, "splash.jpg") _format = '%s' #------------------------------------------------------------------------- diff --git a/src/BaseDoc.py b/src/BaseDoc.py index f337825cf..8276073be 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -892,7 +892,7 @@ class StyleSheetList: """ defstyle.set_name('default') self.map = { "default" : defstyle } - self.file = os.path.join(const.home_dir, filename) + self.file = os.path.join(const.HOME_DIR, filename) self.parse() def delete_style_sheet(self, name): diff --git a/src/ColumnOrder.py b/src/ColumnOrder.py index a3b92894d..8082be3d4 100644 --- a/src/ColumnOrder.py +++ b/src/ColumnOrder.py @@ -64,7 +64,7 @@ class ColumnOrder(ManagedWindow.ManagedWindow): """ ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) - self.glade = gtk.glade.XML(const.gladeFile, "columns", "gramps") + self.glade = gtk.glade.XML(const.GLADE_FILE, "columns", "gramps") self.set_window(self.glade.get_widget('columns'), None, win_name) diff --git a/src/Config/_GrampsIniKeys.py b/src/Config/_GrampsIniKeys.py index 237175755..52022e59a 100644 --- a/src/Config/_GrampsIniKeys.py +++ b/src/Config/_GrampsIniKeys.py @@ -33,7 +33,7 @@ from _GrampsConfigKeys import * NL = "\n" # FIX: newlines on Mac/Windows, if different? -INIFILE = os.path.join(const.home_dir,"keys.ini") +INIFILE = os.path.join(const.HOME_DIR,"keys.ini") def make_bool(val): """ Function to turn strings into booleans. """ diff --git a/src/DataViews/_MapView.py b/src/DataViews/_MapView.py index e009070ad..d09eee2c6 100644 --- a/src/DataViews/_MapView.py +++ b/src/DataViews/_MapView.py @@ -155,7 +155,7 @@ class GuideMap(gtk.DrawingArea): class MapTile: def __init__( self, filename, x, y, w, h, pw, ph): self.filename = filename - self.full_path = os.path.join(const.image_dir,filename) + self.full_path = os.path.join(const.IMAGE_DIR,filename) self.map_x = float(x) self.map_y = float(y) self.map_width = float(w) @@ -179,7 +179,7 @@ class MapTile: h = y-ymin if w > 0.0 and h > 0.0: - # crop source tile to not scale the whole image_dir + # crop source tile to not scale the whole IMAGE_DIR xoffset = max(0,math.floor((x - self.map_x) * self.source_scale)) xmax = max(0,math.ceil((x+w - self.map_x) * self.source_scale)) yoffset = min(self.map_pixel_width,math.floor(-(y - self.map_y) * self.source_scale)) @@ -712,8 +712,8 @@ class MapView(PageView.PageView): no = gtk.Image() # The large zoomable map self.zoom_map = ZoomMap( - gtk.gdk.pixbuf_new_from_file(os.path.join(const.image_dir,"bad.png")), - gtk.gdk.pixbuf_new_from_file(os.path.join(const.image_dir,"good.png"))) + gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"bad.png")), + gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"good.png"))) if not use_online_map: self.zoom_map.add_map_source('world.topo.200407.3x3200x1600_tile_0_0.jpg', -180,90, 45,45, 400,400) self.zoom_map.add_map_source('world.topo.200407.3x3200x1600_tile_0_1.jpg', -135,90, 45,45, 400,400) @@ -768,7 +768,7 @@ class MapView(PageView.PageView): # The small guide map self.guide_map = GuideMap( - gtk.gdk.pixbuf_new_from_file(os.path.join(const.image_dir,"world.topo.200407.3x128x60.jpg"))) + gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"world.topo.200407.3x128x60.jpg"))) self.guide_map.set_size_request(128,64) vbox.pack_start( self.guide_map, False, True, 0) diff --git a/src/DataViews/_MediaView.py b/src/DataViews/_MediaView.py index 93d855ebc..02bceec61 100644 --- a/src/DataViews/_MediaView.py +++ b/src/DataViews/_MediaView.py @@ -241,8 +241,8 @@ class MediaView(PageView.ListView): vbox.set_spacing(4) self.image = gtk.Image() - self.image.set_size_request(int(const.thumbScale), - int(const.thumbScale)) + self.image.set_size_request(int(const.THUMBSCALE), + int(const.THUMBSCALE)) ebox = gtk.EventBox() ebox.add(self.image) ebox.connect('button-press-event', self.button_press_event) diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index e1d091412..a63a774b5 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -534,7 +534,7 @@ class PersonView(PageView.PersonNavView): active = self.dbstate.active self.tree.set_model(self.model) - if const.use_tips and self.model.tooltip_column != None: + if const.USE_TIPS and self.model.tooltip_column != None: self.tooltips = TreeTips.TreeTips(self.tree, self.model.tooltip_column, True) diff --git a/src/DateEdit.py b/src/DateEdit.py index 77971f711..b83a4e785 100644 --- a/src/DateEdit.py +++ b/src/DateEdit.py @@ -188,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.gladeFile, "date_edit","gramps" ) + self.top = gtk.glade.XML(const.GLADE_FILE, "date_edit","gramps" ) self.set_window( self.top.get_widget('date_edit'), diff --git a/src/DbLoader.py b/src/DbLoader.py index f6c3d5bd4..4a8852969 100644 --- a/src/DbLoader.py +++ b/src/DbLoader.py @@ -69,12 +69,12 @@ import Errors # #------------------------------------------------------------------------- _KNOWN_FORMATS = { - const.app_gramps : _('GRAMPS (grdb)'), - const.app_gramps_xml : _('GRAMPS XML'), - const.app_gedcom : _('GEDCOM'), + const.APP_GRAMPS : _('GRAMPS (grdb)'), + const.APP_GRAMPS_XML : _('GRAMPS XML'), + const.APP_GEDCOM : _('GEDCOM'), } -OPEN_FORMATS = [const.app_gramps_xml, const.app_gedcom] +OPEN_FORMATS = [const.APP_GRAMPS_XML, const.APP_GEDCOM] #------------------------------------------------------------------------- # @@ -123,7 +123,7 @@ class DbLoader: except: return ('', '') return (filename, filetype) - elif filetype in [const.app_gramps_package, const.app_geneweb]: + elif filetype in [const.APP_GRAMPS_PKG, const.APP_GENEWEB]: QuestionDialog.ErrorDialog( _("Could not open file: %s") % filename, _('Files of type "%s" cannot be opened directly.\n\n' @@ -168,14 +168,14 @@ class DbLoader: ext = os.path.splitext(filename)[1].lower() if ext == ".ged": - filetype = const.app_gedcom + filetype = const.APP_GEDCOM elif ext == ".gramps": - filetype = const.app_gramps_xml + filetype = const.APP_GRAMPS_XML elif ext == ".grdb": - filetype = const.app_gramps + filetype = const.APP_GRAMPS else: filename = filename + ".grdb" - filetype = const.app_gramps + filetype = const.APP_GRAMPS choose.destroy() try: @@ -552,7 +552,7 @@ def add_grdb_filter(chooser): """ mime_filter = gtk.FileFilter() mime_filter.set_name(_('GRAMPS databases')) - mime_filter.add_mime_type(const.app_gramps) + mime_filter.add_mime_type(const.APP_GRAMPS) chooser.add_filter(mime_filter) def add_xml_filter(chooser): @@ -561,7 +561,7 @@ def add_xml_filter(chooser): """ mime_filter = gtk.FileFilter() mime_filter.set_name(_('GRAMPS XML databases')) - mime_filter.add_mime_type(const.app_gramps_xml) + mime_filter.add_mime_type(const.APP_GRAMPS_XML) chooser.add_filter(mime_filter) def add_gedcom_filter(chooser): @@ -570,7 +570,7 @@ def add_gedcom_filter(chooser): """ mime_filter = gtk.FileFilter() mime_filter.set_name(_('GEDCOM files')) - mime_filter.add_mime_type(const.app_gedcom) + mime_filter.add_mime_type(const.APP_GEDCOM) chooser.add_filter(mime_filter) #------------------------------------------------------------------------- diff --git a/src/DbManager.py b/src/DbManager.py index 9e43f76ce..939117e22 100644 --- a/src/DbManager.py +++ b/src/DbManager.py @@ -72,9 +72,9 @@ import Config import Mime from DdTargets import DdTargets -IMPORT_TYPES = (const.app_gramps_xml, const.app_gedcom, - const.app_gramps_package, const.app_geneweb, - const.app_gramps) +IMPORT_TYPES = (const.APP_GRAMPS_XML, const.APP_GEDCOM, + const.APP_GRAMPS_PKG, const.APP_GENEWEB, + const.APP_GRAMPS) #------------------------------------------------------------------------- # @@ -108,7 +108,7 @@ class DbManager: Creates the top level window from the glade description, and extracts the GTK widgets that are needed. """ - self.glade = gtk.glade.XML(const.gladeFile, "dbmanager", "gramps") + self.glade = gtk.glade.XML(const.GLADE_FILE, "dbmanager", "gramps") self.top = self.glade.get_widget('dbmanager') if parent: self.top.set_transient_for(parent) @@ -844,7 +844,7 @@ def check_out(dbase, rev, path, callback): ) return - rdr = GrampsDbUtils.gramps_db_reader_factory(const.app_gramps_xml) + rdr = GrampsDbUtils.gramps_db_reader_factory(const.APP_GRAMPS_XML) xml_file = os.path.join(path, ARCHIVE) rdr(dbase, xml_file, callback) os.unlink(xml_file) @@ -856,7 +856,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.gladeFile, "comment", "gramps") + glade = gtk.glade.XML(const.GLADE_FILE, "comment", "gramps") top = glade.get_widget('comment') text = glade.get_widget('description') diff --git a/src/DisplayModels/_FamilyModel.py b/src/DisplayModels/_FamilyModel.py index c97c5dde9..6d7db380f 100644 --- a/src/DisplayModels/_FamilyModel.py +++ b/src/DisplayModels/_FamilyModel.py @@ -176,7 +176,7 @@ class FamilyModel(BaseModel): return None def column_tooltip(self,data): - if const.use_tips: + if const.USE_TIPS: try: t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_family_from_handle(data[0])) diff --git a/src/DisplayModels/_MediaModel.py b/src/DisplayModels/_MediaModel.py index 4cfe7ef0e..7f42082f2 100644 --- a/src/DisplayModels/_MediaModel.py +++ b/src/DisplayModels/_MediaModel.py @@ -134,7 +134,7 @@ class MediaModel(BaseModel): GrampsLocale.codeset) def column_tooltip(self,data): - if const.use_tips: + if const.USE_TIPS: try: t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_object_from_handle(data[0])) diff --git a/src/DisplayModels/_PeopleModel.py b/src/DisplayModels/_PeopleModel.py index b5c675ece..3f16b068e 100644 --- a/src/DisplayModels/_PeopleModel.py +++ b/src/DisplayModels/_PeopleModel.py @@ -697,7 +697,7 @@ class PeopleModel(gtk.GenericTreeModel): return None def column_tooltip(self, data, node): - if const.use_tips: + if const.USE_TIPS: return ToolTips.TipFromFunction( self.db, lambda: self.db.get_person_from_handle(data[0]) diff --git a/src/DisplayModels/_PlaceModel.py b/src/DisplayModels/_PlaceModel.py index 889a9fc94..4f65464ac 100644 --- a/src/DisplayModels/_PlaceModel.py +++ b/src/DisplayModels/_PlaceModel.py @@ -160,7 +160,7 @@ class PlaceModel(BaseModel): GrampsLocale.codeset) def column_tooltip(self,data): - if const.use_tips: + if const.USE_TIPS: try: t = ToolTips.TipFromFunction( self.db, lambda: diff --git a/src/DisplayModels/_SourceModel.py b/src/DisplayModels/_SourceModel.py index 7fbff78b2..05b42c179 100644 --- a/src/DisplayModels/_SourceModel.py +++ b/src/DisplayModels/_SourceModel.py @@ -106,7 +106,7 @@ class SourceModel(BaseModel): return "%012x" % data[8] def column_tooltip(self,data): - if const.use_tips: + if const.USE_TIPS: try: t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_source_from_handle(data[0])) diff --git a/src/DisplayState.py b/src/DisplayState.py index c3e256f31..dfa05a1de 100644 --- a/src/DisplayState.py +++ b/src/DisplayState.py @@ -244,7 +244,7 @@ class WarnHandler(RotateHandler): def display(self, obj): obj.hide() - xml = gtk.glade.XML(const.gladeFile, 'scrollmsg') + xml = gtk.glade.XML(const.GLADE_FILE, 'scrollmsg') top = xml.get_widget('scrollmsg') msg = xml.get_widget('msg') buf = msg.get_buffer() diff --git a/src/Editors/_EditAddress.py b/src/Editors/_EditAddress.py index 36402dcd8..edbc650d1 100644 --- a/src/Editors/_EditAddress.py +++ b/src/Editors/_EditAddress.py @@ -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.gladeFile, "addr_edit","gramps") + self.top = gtk.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 c576d2ca2..d269ccb92 100644 --- a/src/Editors/_EditAttribute.py +++ b/src/Editors/_EditAttribute.py @@ -81,7 +81,7 @@ class EditAttribute(EditSecondary): EditSecondary.__init__(self, state, uistate, track, attrib, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "attr_edit","gramps") + self.top = gtk.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 cf11fad87..d282c8e63 100644 --- a/src/Editors/_EditChildRef.py +++ b/src/Editors/_EditChildRef.py @@ -72,7 +72,7 @@ class EditChildRef(EditSecondary): childref, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "cref_edit","gramps") + self.top = gtk.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/_EditEvent.py b/src/Editors/_EditEvent.py index ad96a6c6a..c86ebe800 100644 --- a/src/Editors/_EditEvent.py +++ b/src/Editors/_EditEvent.py @@ -90,7 +90,7 @@ class EditEvent(EditPrimary): self.dbstate.db.get_family_event_types() def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "event_edit","gramps") + self.top = gtk.glade.XML(const.GLADE_FILE, "event_edit","gramps") self.set_window(self.top.get_widget("event_edit"), None, self.get_menu_title()) diff --git a/src/Editors/_EditEventRef.py b/src/Editors/_EditEventRef.py index ab5beba63..e5e8bf0fb 100644 --- a/src/Editors/_EditEventRef.py +++ b/src/Editors/_EditEventRef.py @@ -70,7 +70,7 @@ class EditEventRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "event_eref_edit","gramps") + self.top = gtk.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/_EditFamily.py b/src/Editors/_EditFamily.py index a2ab7653b..7ff8c2bfa 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -472,7 +472,7 @@ class EditFamily(EditPrimary): def build_interface(self): - self.top = gtk.glade.XML(const.gladeFile,"family_editor","gramps") + self.top = gtk.glade.XML(const.GLADE_FILE,"family_editor","gramps") self.set_window(self.top.get_widget("family_editor"), None, self.get_menu_title()) diff --git a/src/Editors/_EditLdsOrd.py b/src/Editors/_EditLdsOrd.py index 06666f4df..51c54397b 100644 --- a/src/Editors/_EditLdsOrd.py +++ b/src/Editors/_EditLdsOrd.py @@ -146,7 +146,7 @@ class EditLdsOrd(EditSecondary): EditSecondary.__init__(self, state, uistate, track, attrib, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "lds_person_edit","gramps") + self.top = gtk.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')) @@ -332,7 +332,7 @@ class EditFamilyLdsOrd(EditSecondary): EditSecondary.__init__(self, state, uistate, track, attrib, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "lds_person_edit","gramps") + self.top = gtk.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 cce480ca8..9816dc1a5 100644 --- a/src/Editors/_EditLocation.py +++ b/src/Editors/_EditLocation.py @@ -54,7 +54,7 @@ class EditLocation(EditSecondary): location, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "loc_edit","gramps") + self.top = gtk.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 c9a471f21..bae1be5fe 100644 --- a/src/Editors/_EditMedia.py +++ b/src/Editors/_EditMedia.py @@ -82,7 +82,7 @@ class EditMedia(EditPrimary): def _local_init(self): assert(self.obj) - self.glade = gtk.glade.XML(const.gladeFile, + self.glade = gtk.glade.XML(const.GLADE_FILE, "change_global","gramps") self.set_window(self.glade.get_widget('change_global'), diff --git a/src/Editors/_EditMediaRef.py b/src/Editors/_EditMediaRef.py index 534c31339..4cf67a805 100644 --- a/src/Editors/_EditMediaRef.py +++ b/src/Editors/_EditMediaRef.py @@ -67,7 +67,7 @@ class EditMediaRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, + self.top = gtk.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 8d712d79c..c949ee6ef 100644 --- a/src/Editors/_EditName.py +++ b/src/Editors/_EditName.py @@ -66,7 +66,7 @@ class EditName(EditSecondary): def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "name_edit","gramps") + self.top = gtk.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/_EditNote.py b/src/Editors/_EditNote.py index d7318c7c9..495b4ebbf 100644 --- a/src/Editors/_EditNote.py +++ b/src/Editors/_EditNote.py @@ -127,7 +127,7 @@ class EditNote(EditPrimary): and overridden here. """ - self.top = gtk.glade.XML(const.gladeFile, "edit_note", "gramps") + self.top = gtk.glade.XML(const.GLADE_FILE, "edit_note", "gramps") win = self.top.get_widget("edit_note") self.set_window(win, None, self.get_menu_title()) diff --git a/src/Editors/_EditPerson.py b/src/Editors/_EditPerson.py index 1689fd7b5..cf4ee0fde 100644 --- a/src/Editors/_EditPerson.py +++ b/src/Editors/_EditPerson.py @@ -123,7 +123,7 @@ class EditPerson(EditPrimary): RelLib.Person.UNKNOWN) self.load_obj = None - self.top = gtk.glade.XML(const.person_glade, "edit_person", "gramps") + self.top = gtk.glade.XML(const.PERSON_GLADE, "edit_person", "gramps") self.set_window(self.top.get_widget("edit_person"), None, self.get_menu_title()) width = Config.get(Config.PERSON_WIDTH) diff --git a/src/Editors/_EditPersonRef.py b/src/Editors/_EditPersonRef.py index 5ef9c6240..49e6cffcc 100644 --- a/src/Editors/_EditPersonRef.py +++ b/src/Editors/_EditPersonRef.py @@ -76,7 +76,7 @@ class EditPersonRef(EditSecondary): EditSecondary.__init__(self, dbstate, uistate, track, addr, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "pref_edit","gramps") + self.top = gtk.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/_EditPlace.py b/src/Editors/_EditPlace.py index da56a82f2..525e8c0f3 100644 --- a/src/Editors/_EditPlace.py +++ b/src/Editors/_EditPlace.py @@ -66,7 +66,7 @@ class EditPlace(EditPrimary): return RelLib.Place() def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile,"place_editor","gramps") + self.top = gtk.glade.XML(const.GLADE_FILE,"place_editor","gramps") self.set_window(self.top.get_widget("place_editor"), None, self.get_menu_title()) diff --git a/src/Editors/_EditRepoRef.py b/src/Editors/_EditRepoRef.py index 3291726e0..1380d37d5 100644 --- a/src/Editors/_EditRepoRef.py +++ b/src/Editors/_EditRepoRef.py @@ -65,7 +65,7 @@ class EditRepoRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "repository_ref_edit","gramps") + self.top = gtk.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/_EditRepository.py b/src/Editors/_EditRepository.py index fe868cf1d..941c4cdd1 100644 --- a/src/Editors/_EditRepository.py +++ b/src/Editors/_EditRepository.py @@ -69,7 +69,7 @@ class EditRepository(EditPrimary): return title def _local_init(self): - self.glade = gtk.glade.XML(const.gladeFile,"repository_editor","gramps") + self.glade = gtk.glade.XML(const.GLADE_FILE,"repository_editor","gramps") self.set_window(self.glade.get_widget("repository_editor"), None, self.get_menu_title()) diff --git a/src/Editors/_EditSource.py b/src/Editors/_EditSource.py index e9dc4574e..f8df6034f 100644 --- a/src/Editors/_EditSource.py +++ b/src/Editors/_EditSource.py @@ -77,7 +77,7 @@ class EditSource(EditPrimary): def _local_init(self): assert(self.obj) - self.glade = gtk.glade.XML(const.gladeFile,"source_editor","gramps") + self.glade = gtk.glade.XML(const.GLADE_FILE,"source_editor","gramps") self.set_window(self.glade.get_widget("source_editor"), None, self.get_menu_title()) width = Config.get(Config.SOURCE_WIDTH) diff --git a/src/Editors/_EditSourceRef.py b/src/Editors/_EditSourceRef.py index 64fd947a5..8a9afef76 100644 --- a/src/Editors/_EditSourceRef.py +++ b/src/Editors/_EditSourceRef.py @@ -60,7 +60,7 @@ class EditSourceRef(EditReference): def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "source_ref_edit","gramps") + self.top = gtk.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 88d31be26..f60dd145a 100644 --- a/src/Editors/_EditUrl.py +++ b/src/Editors/_EditUrl.py @@ -61,7 +61,7 @@ class EditUrl(EditSecondary): url, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "url_edit", "gramps") + self.top = gtk.glade.XML(const.GLADE_FILE, "url_edit", "gramps") self.jump = self.top.get_widget('jump') self.set_window(self.top.get_widget("url_edit"), diff --git a/src/ExportAssistant.py b/src/ExportAssistant.py index 02040e1a1..04ab48644 100644 --- a/src/ExportAssistant.py +++ b/src/ExportAssistant.py @@ -61,8 +61,8 @@ import ManagedWindow # Constants # #------------------------------------------------------------------------- -_gramps_png = os.path.join(const.image_dir,"gramps.png") -_splash_jpg = os.path.join(const.image_dir,"splash.jpg") +_gramps_png = os.path.join(const.IMAGE_DIR,"gramps.png") +_splash_jpg = os.path.join(const.IMAGE_DIR,"splash.jpg") #------------------------------------------------------------------------- # @@ -516,7 +516,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) : if len(default_dir)<=1: default_dir = Config.get(Config.RECENT_IMPORT_DIR) if len(default_dir)<=1: - default_dir = const.user_home + default_dir = const.USER_HOME if ext == 'gramps': new_filename = os.path.join(default_dir,'data.gramps') diff --git a/src/FilterEditor/_EditFilter.py b/src/FilterEditor/_EditFilter.py index 5f5d879fa..2579558de 100644 --- a/src/FilterEditor/_EditFilter.py +++ b/src/FilterEditor/_EditFilter.py @@ -71,7 +71,7 @@ class EditFilter(ManagedWindow.ManagedWindow): self.filter = gfilter self.filterdb = filterdb - self.define_glade('define_filter', const.rule_glade) + self.define_glade('define_filter', const.RULE_GLADE) self.set_window( self.get_widget('define_filter'), diff --git a/src/FilterEditor/_EditRule.py b/src/FilterEditor/_EditRule.py index 4da007651..a1423120f 100644 --- a/src/FilterEditor/_EditRule.py +++ b/src/FilterEditor/_EditRule.py @@ -392,7 +392,7 @@ class EditRule(ManagedWindow.ManagedWindow): self.filter_name = filter_name self.active_rule = val - self.define_glade('rule_editor', const.rule_glade) + self.define_glade('rule_editor', const.RULE_GLADE) self.set_window(self.get_widget('rule_editor'), self.get_widget('title'),label) diff --git a/src/FilterEditor/_FilterEditor.py b/src/FilterEditor/_FilterEditor.py index e653eefe1..25003e08c 100644 --- a/src/FilterEditor/_FilterEditor.py +++ b/src/FilterEditor/_FilterEditor.py @@ -77,7 +77,7 @@ class FilterEditor(ManagedWindow.ManagedWindow): self.filterdb.load() self.space = space - self.define_glade('filter_list', const.rule_glade) + self.define_glade('filter_list', const.RULE_GLADE) self.filter_list = self.get_widget('filters') self.edit = self.get_widget('edit') self.clone = self.get_widget('clone') diff --git a/src/FilterEditor/_ShowResults.py b/src/FilterEditor/_ShowResults.py index 7fb4a0034..088bdc175 100644 --- a/src/FilterEditor/_ShowResults.py +++ b/src/FilterEditor/_ShowResults.py @@ -72,7 +72,7 @@ class ShowResults(ManagedWindow.ManagedWindow): self.db = db self.filtname = filtname self.space = space - self.define_glade('test', const.rule_glade,) + self.define_glade('test', const.RULE_GLADE,) self.set_window( self.get_widget('test'), self.get_widget('title'), diff --git a/src/Filters/__init__.py b/src/Filters/__init__.py index 48fe22417..52de5ffa3 100644 --- a/src/Filters/__init__.py +++ b/src/Filters/__init__.py @@ -29,19 +29,19 @@ __author__ = "Don Allingham" SystemFilters = None CustomFilters = None -from const import system_filters, custom_filters +from const import SYSTEM_FILTERS, CUSTOM_FILTERS from _FilterList import FilterList from _GenericFilter import GenericFilter, GenericFilterFactory from _ParamFilter import ParamFilter def reload_system_filters(): global SystemFilters - SystemFilters = FilterList(system_filters) + SystemFilters = FilterList(SYSTEM_FILTERS) SystemFilters.load() def reload_custom_filters(): global CustomFilters - CustomFilters = FilterList(custom_filters) + CustomFilters = FilterList(CUSTOM_FILTERS) CustomFilters.load() if not SystemFilters: diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 8612dbbbb..bd179e1bb 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -594,7 +594,7 @@ class NameFormatEditDlg: self.name = name self.valid = True - self.top = gtk.glade.XML(const.gladeFile, 'namefmt_edit', 'gramps') + self.top = gtk.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/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index b0675caea..a80406824 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -501,7 +501,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback): # Environment name is now based on the filename drive, tmp_name = os.path.splitdrive(full_name) tmp_name = tmp_name.lstrip(os.sep) - env_name = os.path.join(os.path.expanduser(const.env_dir),tmp_name) + env_name = os.path.join(os.path.expanduser(const.ENV_DIR),tmp_name) else: env_name = os.path.expanduser('~') return env_name diff --git a/src/GrampsDb/_GrampsDbConst.py b/src/GrampsDb/_GrampsDbConst.py index d4c9cb4e9..481d24774 100644 --- a/src/GrampsDb/_GrampsDbConst.py +++ b/src/GrampsDb/_GrampsDbConst.py @@ -34,22 +34,21 @@ import os #------------------------------------------------------------------------- if os.environ.has_key('USERPROFILE'): - user_home = os.environ['USERPROFILE'] - home_dir = os.path.join(user_home,'gramps') + USER_HOME = os.environ['USERPROFILE'] + HOME_DIR = os.path.join(USER_HOME,'gramps') else: - user_home = os.environ['HOME'] - home_dir = os.path.join(user_home,'.gramps') + USER_HOME = os.environ['HOME'] + HOME_DIR = os.path.join(USER_HOME,'.gramps') -env_dir = os.path.join(home_dir,"env") +env_dir = os.path.join(HOME_DIR,"env") -app_gramps = "application/x-gramps" -app_gramps_xml = "application/x-gramps-xml" -app_gedcom = "application/x-gedcom" -app_gramps_package = "application/x-gramps-package" -app_geneweb = "application/x-geneweb" -app_vcard = ["text/x-vcard","text/x-vcalendar"] - +APP_GRAMPS = "application/x-gramps" +APP_GRAMPS_XML = "application/x-gramps-xml" +APP_GEDCOM = "application/x-gedcom" +APP_GRAMPS_PKG = "application/x-gramps-package" +APP_GENEWEB = "application/x-geneweb" +APP_VCARD = ["text/x-vcard","text/x-vcalendar"] PERSON_KEY = 0 FAMILY_KEY = 1 diff --git a/src/GrampsDb/_GrampsDbFactories.py b/src/GrampsDb/_GrampsDbFactories.py index 3af272e75..caf0b1735 100644 --- a/src/GrampsDb/_GrampsDbFactories.py +++ b/src/GrampsDb/_GrampsDbFactories.py @@ -29,13 +29,13 @@ The app_* constants in const.py can be used to indicate which backend is required e.g.: > # To get the class for the grdb backend -> db_class = GrampsDb.gramps_db_factory(db_type = const.app_gramps) +> db_class = GrampsDb.gramps_db_factory(db_type = const.APP_GRAMPS) > > # To get a XML writer -> GrampsDb.gramps_db_writer_factory(db_type = const.app_gramps_xml) +> GrampsDb.gramps_db_writer_factory(db_type = const.APP_GRAMPS_XML) > > # To get a Gedcom reader -> GrampsDb.gramps_db_reader_factory(db_type = const.app_gedcom) +> GrampsDb.gramps_db_reader_factory(db_type = const.APP_GEDCOM) """ import _GrampsDbConst as const @@ -61,13 +61,13 @@ def gramps_db_factory(db_type): Raises GrampsDbException if the db_type is not recognised. """ - if db_type == const.app_gramps: + if db_type == const.APP_GRAMPS: from _GrampsBSDDB import GrampsBSDDB cls = GrampsBSDDB -# elif db_type == const.app_gramps_xml: +# elif db_type == const.APP_GRAMPS_XML: # from _GrampsXMLDB import GrampsXMLDB # cls = GrampsXMLDB - elif db_type == const.app_gedcom: + elif db_type == const.APP_GEDCOM: from _GrampsGEDDB import GrampsGEDDB cls = GrampsGEDDB elif db_type == 'x-directory/normal': diff --git a/src/GrampsDbUtils/_GedcomInfo.py b/src/GrampsDbUtils/_GedcomInfo.py index da58497ff..72a682ee5 100644 --- a/src/GrampsDbUtils/_GedcomInfo.py +++ b/src/GrampsDbUtils/_GedcomInfo.py @@ -254,7 +254,7 @@ class GedcomInfoDB: self.standard.set_dest("GEDCOM 5.5") try: - filepath = os.path.join(const.data_dir,"gedcom.xml") + filepath = os.path.join(const.DATA_DIR,"gedcom.xml") f = open(filepath.encode('iso8859-1'),"r") except: return diff --git a/src/GrampsDbUtils/_GrampsDbWRFactories.py b/src/GrampsDbUtils/_GrampsDbWRFactories.py index af48137a4..f5b32b8c6 100644 --- a/src/GrampsDbUtils/_GrampsDbWRFactories.py +++ b/src/GrampsDbUtils/_GrampsDbWRFactories.py @@ -29,10 +29,10 @@ The app_* constants in const.py can be used to indicate which backend is required e.g.: > # To get a XML writer -> GrampsDb.gramps_db_writer_factory(db_type = const.app_gramps_xml) +> GrampsDb.gramps_db_writer_factory(db_type = const.APP_GRAMPS_XML) > > # To get a Gedcom reader -> GrampsDb.gramps_db_reader_factory(db_type = const.app_gedcom) +> GrampsDb.gramps_db_reader_factory(db_type = const.APP_GEDCOM) """ import const @@ -54,13 +54,13 @@ def gramps_db_writer_factory(db_type): Raises GrampsDbException if the db_type is not recognised. """ - if db_type == const.app_gramps: + if db_type == const.APP_GRAMPS: import _WriteGrdb as WriteGrdb md = WriteGrdb.exportData - elif db_type == const.app_gramps_xml: + elif db_type == const.APP_GRAMPS_XML: import _WriteXML as WriteXML md = WriteXML.exportData - elif db_type == const.app_gedcom: + elif db_type == const.APP_GEDCOM: import _WriteGedcom as WriteGedcom md = WriteGedcom.exportData else: @@ -79,10 +79,10 @@ def gramps_db_reader_factory(db_type): Raises GrampsDbException if the db_type is not recognised. """ - if db_type == const.app_gramps_xml: + if db_type == const.APP_GRAMPS_XML: import _ReadXML as ReadXML md = ReadXML.importData - elif db_type == const.app_gedcom: + elif db_type == const.APP_GEDCOM: import _ReadGedcom as ReadGedcom md = ReadGedcom.importData else: diff --git a/src/GrampsDbUtils/_WriteGedcom.py b/src/GrampsDbUtils/_WriteGedcom.py index 68784e5b4..71ec8c0e7 100644 --- a/src/GrampsDbUtils/_WriteGedcom.py +++ b/src/GrampsDbUtils/_WriteGedcom.py @@ -394,7 +394,7 @@ class GedcomWriter(BasicUtils.UpdateCallback): self.__writeln(0, "HEAD") self.__writeln(1, "SOUR", "GRAMPS") - self.__writeln(2, "VERS", const.version) + self.__writeln(2, "VERS", const.VERSION) self.__writeln(2, "NAME", "GRAMPS") self.__writeln(1, "DATE", date_str) self.__writeln(2, "TIME", time_str) diff --git a/src/GrampsDbUtils/_WriteXML.py b/src/GrampsDbUtils/_WriteXML.py index da5b7d9bf..a26023524 100644 --- a/src/GrampsDbUtils/_WriteXML.py +++ b/src/GrampsDbUtils/_WriteXML.py @@ -53,7 +53,7 @@ def export_data(database, filename, person, option_box, callback=None): Calls the XML writer with the syntax expected by the export plugin """ return GrampsDb.exportData(database, filename, person, option_box, - callback, const.version) + callback, const.VERSION) #------------------------------------------------------------------------- # @@ -67,7 +67,7 @@ class XmlWriter(GrampsDb.GrampsDbXmlWriter): def __init__(self, dbase, callback, strip_photos, compress=1): GrampsDb.GrampsDbXmlWriter.__init__( - self, dbase, strip_photos, compress, const.version, callback) + self, dbase, strip_photos, compress, const.VERSION, callback) def write(self, filename): """ diff --git a/src/GrampsLogger/_ErrorReportAssistant.py b/src/GrampsLogger/_ErrorReportAssistant.py index 74bc573e0..7f777d213 100644 --- a/src/GrampsLogger/_ErrorReportAssistant.py +++ b/src/GrampsLogger/_ErrorReportAssistant.py @@ -96,7 +96,7 @@ class ErrorReportAssistant: "Distribution: %s\n"\ % (str(sys.version).replace('\n',''), str(bsddb.__version__), - str(const.version), + str(const.VERSION), os.environ.get('LANG',''), operatingsystem, distribution) diff --git a/src/ImgManip.py b/src/ImgManip.py index acf032cfc..12cc0cb3a 100644 --- a/src/ImgManip.py +++ b/src/ImgManip.py @@ -113,10 +113,10 @@ class ImgManip: def _build_thumb_path(path): m = md5.md5(path) - return os.path.join(const.thumb_dir, m.hexdigest()+'.png') + return os.path.join(const.THUMB_DIR, m.hexdigest()+'.png') -def run_thumbnailer(mtype, frm, to, size=const.thumbScale): - if const.use_thumbnailer and os.path.isfile(frm): +def run_thumbnailer(mtype, frm, to, size=const.THUMBSCALE): + if const.USE_THUMBNAILER and os.path.isfile(frm): sublist = { '%s' : "%dx%d" % (int(size),int(size)), '%u' : frm, @@ -144,7 +144,7 @@ def set_thumbnail_image(path, mtype=None): pixbuf = gtk.gdk.pixbuf_new_from_file(path) w = pixbuf.get_width() h = pixbuf.get_height() - scale = const.thumbScale / (float(max(w,h))) + scale = const.THUMBSCALE / (float(max(w,h))) pw = int(w*scale) ph = int(h*scale) @@ -169,7 +169,7 @@ def get_thumbnail_image(path, mtype=None): return Mime.find_mime_type_pixbuf(mtype) else: return gtk.gdk.pixbuf_new_from_file(os.path.join( - const.image_dir,"document.png")) + const.IMAGE_DIR,"document.png")) def get_thumbnail_path(path, mtype=None): filename = _build_thumb_path(path) @@ -184,5 +184,5 @@ def get_thumb_from_obj(obj): else: image = Mime.find_mime_type_pixbuf(mtype) if not image: - image = gtk.gdk.pixbuf_new_from_file(const.icon) + image = gtk.gdk.pixbuf_new_from_file(const.ICON) return image diff --git a/src/LdsUtils.py b/src/LdsUtils.py index cfbd177d1..2a5355933 100644 --- a/src/LdsUtils.py +++ b/src/LdsUtils.py @@ -48,7 +48,7 @@ class LdsTemples: self.__current_temple = "" self.__tlist = [] - lds_filename = os.path.join(const.data_dir, "lds.xml") + lds_filename = os.path.join(const.DATA_DIR, "lds.xml") try: xml_file = open(os.path.expanduser(lds_filename)) diff --git a/src/ListModel.py b/src/ListModel.py index 9a9a01348..b4f52c8b0 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -114,7 +114,7 @@ class ListModel: renderer = gtk.CellRendererPixbuf() column = gtk.TreeViewColumn(name[0], renderer) column.add_attribute(renderer, 'pixbuf', cnum) - renderer.set_property('height', const.thumbScale/2) + renderer.set_property('height', const.THUMBSCALE/2) else: renderer = gtk.CellRendererText() renderer.set_fixed_height_from_font(True) diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index 2d15e93a5..c2fa385d6 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -394,7 +394,7 @@ class ManagedWindow: def define_glade(self, top_module, glade_file=None): if glade_file == None: - glade_file = const.gladeFile + glade_file = const.GLADE_FILE self._gladeobj = gtk.glade.XML(glade_file, top_module, "gramps") return self._gladeobj @@ -451,4 +451,4 @@ def set_titles(window, title, text, msg=None): window.set_title('%s - GRAMPS' % msg) else: window.set_title('%s - GRAMPS' % text) - window.set_icon_from_file(const.icon) + window.set_icon_from_file(const.ICON) diff --git a/src/Merge/_MergePerson.py b/src/Merge/_MergePerson.py index 8919687f2..7e42ca4f1 100644 --- a/src/Merge/_MergePerson.py +++ b/src/Merge/_MergePerson.py @@ -59,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 = gtk.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') @@ -277,7 +277,7 @@ class MergePeopleUI(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) - glade = gtk.glade.XML(const.merge_glade, 'merge_people') + glade = gtk.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 8ae5a5959..fa3637fcb 100644 --- a/src/Merge/_MergePlace.py +++ b/src/Merge/_MergePlace.py @@ -63,7 +63,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 = gtk.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 4941e1b5c..7a4ff3dba 100644 --- a/src/Merge/_MergeSource.py +++ b/src/Merge/_MergeSource.py @@ -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 = gtk.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/Mime/_GnomeMime.py b/src/Mime/_GnomeMime.py index b37cc4c97..1425df7ac 100644 --- a/src/Mime/_GnomeMime.py +++ b/src/Mime/_GnomeMime.py @@ -97,7 +97,7 @@ def find_mime_type_pixbuf(mime_type): newicon = "gnome-mime-%s" % icontmp return _icon_theme.load_icon(newicon,48,0) except: - return gtk.gdk.pixbuf_new_from_file(const.icon) + return gtk.gdk.pixbuf_new_from_file(const.ICON) except: - return gtk.gdk.pixbuf_new_from_file(const.icon) + return gtk.gdk.pixbuf_new_from_file(const.ICON) diff --git a/src/Mime/_PythonMime.py b/src/Mime/_PythonMime.py index 7e5ca2602..ee81f4662 100644 --- a/src/Mime/_PythonMime.py +++ b/src/Mime/_PythonMime.py @@ -67,4 +67,4 @@ def mime_type_is_defined(mime_type): return _type_map.has_key(mime_type) def find_mime_type_pixbuf(mime_type): - return gtk.gdk.pixbuf_new_from_file(const.icon) + return gtk.gdk.pixbuf_new_from_file(const.ICON) diff --git a/src/ObjectSelector/_FamilyPreviewFrame.py b/src/ObjectSelector/_FamilyPreviewFrame.py index 0ff90840b..5a9117216 100644 --- a/src/ObjectSelector/_FamilyPreviewFrame.py +++ b/src/ObjectSelector/_FamilyPreviewFrame.py @@ -105,16 +105,16 @@ class FamilyPreviewFrame(PreviewFrameBase): image[image_no].set_from_pixbuf(pixbuf) image_no += 1 else: - self._image_l.set_from_file(os.path.join(const.image_dir,"person.svg")) - self._image_r.set_from_file(os.path.join(const.image_dir,"person.svg")) + self._image_l.set_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) + self._image_r.set_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) except: log.warn("Failed to generate preview for family", exc_info=True) self.clear_object() def clear_object(self): - self._image_l.set_from_file(os.path.join(const.image_dir,"person.svg")) - self._image_r.set_from_file(os.path.join(const.image_dir,"person.svg")) + self._image_l.set_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) + self._image_r.set_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) if gtk.pygtk_version < (2,8,0): diff --git a/src/ObjectSelector/_ObjectSelectorWindow.py b/src/ObjectSelector/_ObjectSelectorWindow.py index 9129fb6ac..de7b45c66 100644 --- a/src/ObjectSelector/_ObjectSelectorWindow.py +++ b/src/ObjectSelector/_ObjectSelectorWindow.py @@ -157,8 +157,8 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow): try: - person_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.image_dir,"person.svg")) - flist_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.image_dir,"flist.svg")) + person_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) + flist_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"flist.svg")) self._tool_list = gtk.ListStore(gtk.gdk.Pixbuf, str,int) @@ -370,7 +370,7 @@ if __name__ == "__main__": state = GrampsDb.DbState() vm = ViewManager.ViewManager(state) - db = GrampsDb.gramps_db_factory(const.app_gramps)() + db = GrampsDb.gramps_db_factory(const.APP_GRAMPS)() db.load(os.path.realpath(sys.argv[1]), cb, # callback "w") diff --git a/src/ObjectSelector/_PersonPreviewFrame.py b/src/ObjectSelector/_PersonPreviewFrame.py index 443a0ac4e..7d3da62dd 100644 --- a/src/ObjectSelector/_PersonPreviewFrame.py +++ b/src/ObjectSelector/_PersonPreviewFrame.py @@ -63,7 +63,7 @@ class PersonPreviewFrame(PreviewFrameBase): self._image = gtk.Image() # test image - self._image.set_from_file(os.path.join(const.image_dir,"person.svg")) + self._image.set_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) # Text label = gtk.Label() @@ -143,7 +143,7 @@ class PersonPreviewFrame(PreviewFrameBase): pixbuf = ImgManip.get_thumbnail_image(mobj.get_path()) self._image.set_from_pixbuf(pixbuf) else: - self._image.set_from_file(os.path.join(const.image_dir,"person.svg")) + self._image.set_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) self._label.set_markup(self._get_text_preview(person)) @@ -158,7 +158,7 @@ class PersonPreviewFrame(PreviewFrameBase): def clear_object(self): - self._image.set_from_file(os.path.join(const.image_dir,"person.svg")) + self._image.set_from_file(os.path.join(const.IMAGE_DIR,"person.svg")) self._label.set_markup("") diff --git a/src/PageView.py b/src/PageView.py index 267d04cbd..cf96da3b0 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -376,7 +376,7 @@ class PersonNavView(BookMarkView): from FilterEditor import FilterEditor try: - FilterEditor('Person',const.custom_filters, + FilterEditor('Person',const.CUSTOM_FILTERS, self.dbstate,self.uistate) except Errors.WindowActiveError: pass @@ -739,7 +739,7 @@ class ListView(BookMarkView): search=filter_info) self.list.set_model(self.model) - if const.use_tips and self.model.tooltip_column != None: + if const.USE_TIPS and self.model.tooltip_column != None: self.tooltips = TreeTips.TreeTips( self.list, self.model.tooltip_column, True) self.dirty = False @@ -765,7 +765,7 @@ class ListView(BookMarkView): from FilterEditor import FilterEditor try: - FilterEditor(self.FILTER_TYPE ,const.custom_filters, + FilterEditor(self.FILTER_TYPE ,const.CUSTOM_FILTERS, self.dbstate, self.uistate) except Errors.WindowActiveError: pass diff --git a/src/PluginUtils/_Plugins.py b/src/PluginUtils/_Plugins.py index 79623eb17..09b3db974 100644 --- a/src/PluginUtils/_Plugins.py +++ b/src/PluginUtils/_Plugins.py @@ -94,7 +94,7 @@ class PluginDialog(ManagedWindow.ManagedWindow): self.state = state self.uistate = uistate - self.dialog = gtk.glade.XML(const.plugins_glade,"report","gramps") + self.dialog = gtk.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 d09761e12..284dde7e9 100644 --- a/src/PluginUtils/_Tool.py +++ b/src/PluginUtils/_Tool.py @@ -288,7 +288,7 @@ class ToolOptionHandler(OptionHandler): def init_subclass(self): self.collection_class = OptionListCollection self.list_class = OptionList - self.filename = const.tool_options + self.filename = const.TOOL_OPTIONS #------------------------------------------------------------------------ # diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index 9f5c69efa..171795d3d 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -44,13 +44,13 @@ import const import Config try: - ICON = pixbuf_new_from_file(const.icon) + ICON = pixbuf_new_from_file(const.ICON) except: ICON = None class SaveDialog: def __init__(self,msg1,msg2,task1,task2,parent=None): - self.xml = gtk.glade.XML(const.gladeFile,"savedialog","gramps") + self.xml = gtk.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 +80,7 @@ class SaveDialog: class QuestionDialog: def __init__(self,msg1,msg2,label,task,parent=None): - self.xml = gtk.glade.XML(const.gladeFile,"questiondialog","gramps") + self.xml = gtk.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 +105,7 @@ class QuestionDialog: class QuestionDialog2: def __init__(self,msg1,msg2,label_msg1,label_msg2,parent=None): - self.xml = gtk.glade.XML(const.gladeFile,"questiondialog","gramps") + self.xml = gtk.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 +133,7 @@ class QuestionDialog2: class OptionDialog: def __init__(self,msg1,msg2,btnmsg1,task1,btnmsg2,task2,parent=None): - self.xml = gtk.glade.XML(const.gladeFile,"optiondialog","gramps") + self.xml = gtk.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 +231,7 @@ class OkDialog(gtk.MessageDialog): class MissingMediaDialog: def __init__(self,msg1,msg2,task1,task2,task3,parent=None): - self.xml = gtk.glade.XML(const.gladeFile,"missmediadialog","gramps") + self.xml = gtk.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 +286,7 @@ class MessageHideDialog: def __init__(self, title, message, key, parent=None): - glade_xml = gtk.glade.XML(const.gladeFile, "hide_dialog", "gramps") + glade_xml = gtk.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/RecentFiles.py b/src/RecentFiles.py index 725404724..d761279dd 100644 --- a/src/RecentFiles.py +++ b/src/RecentFiles.py @@ -44,7 +44,7 @@ import const # Constants # #------------------------------------------------------------------------- -GRAMPS_FILENAME = os.path.join(const.home_dir,"recent-files.xml") +GRAMPS_FILENAME = os.path.join(const.HOME_DIR,"recent-files.xml") MAX_GRAMPS_ITEMS = 10 #------------------------------------------------------------------------- diff --git a/src/Reorder.py b/src/Reorder.py index 93279e609..1e45b9bf1 100644 --- a/src/Reorder.py +++ b/src/Reorder.py @@ -36,7 +36,7 @@ _family_titles = [(_('Spouse'),-1,200),(_('Relationship'),-1,200),('',-1,0)] class Reorder(ManagedWindow.ManagedWindow): def __init__(self, state, uistate, track, handle): - xml = gtk.glade.XML(const.gladeFile, "reorder", "gramps") + xml = gtk.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 b39031b62..ab1bb86a8 100644 --- a/src/ReportBase/_CommandLineReport.py +++ b/src/ReportBase/_CommandLineReport.py @@ -115,7 +115,7 @@ class CommandLineReport: self.options_help['id'].append(False) self.option_class.handler.output = self.options_dict['of'] - self.options_help['of'].append(os.path.join(const.user_home, + self.options_help['of'].append(os.path.join(const.USER_HOME, "whatever_name")) if self.category == CATEGORY_TEXT: @@ -161,7 +161,7 @@ class CommandLineReport: self.options_help['papero'].append(False) self.template_name = self.options_dict['template'] - self.options_help['template'].append(os.path.join(const.user_home, + self.options_help['template'].append(os.path.join(const.USER_HOME, "whatever_name")) if self.category in (CATEGORY_TEXT,CATEGORY_DRAW): diff --git a/src/ReportBase/_PaperMenu.py b/src/ReportBase/_PaperMenu.py index 123cb2bca..ec2c03440 100644 --- a/src/ReportBase/_PaperMenu.py +++ b/src/ReportBase/_PaperMenu.py @@ -175,7 +175,7 @@ class PageSizeParser(handler.ContentHandler): try: parser = make_parser() parser.setContentHandler(PageSizeParser(paper_sizes)) - the_file = open(const.papersize) + the_file = open(const.PAPERSIZE) parser.parse(the_file) the_file.close() paper_sizes.append(BaseDoc.PaperSize(_("Custom Size"),-1,-1)) diff --git a/src/ReportBase/_ReportDialog.py b/src/ReportBase/_ReportDialog.py index 64e92598b..54e4d6ac9 100644 --- a/src/ReportBase/_ReportDialog.py +++ b/src/ReportBase/_ReportDialog.py @@ -576,7 +576,7 @@ class ReportDialog(BareReportDialog): if text == _user_template: self.template_name = self.html_fileentry.get_full_path(0) else: - self.template_name = "%s%s%s" % (const.template_dir,os.path.sep, + self.template_name = "%s%s%s" % (const.TEMPLATE_DIR,os.path.sep, _template_map[text]) else: self.template_name = "" diff --git a/src/ReportBase/_ReportOptions.py b/src/ReportBase/_ReportOptions.py index 2a05507b3..ede734e5a 100644 --- a/src/ReportBase/_ReportOptions.py +++ b/src/ReportBase/_ReportOptions.py @@ -363,7 +363,7 @@ class OptionHandler(_Options.OptionHandler): def init_subclass(self): self.collection_class = OptionListCollection self.list_class = OptionList - self.filename = const.report_options + self.filename = const.REPORT_OPTIONS def init_common(self): """ diff --git a/src/ReportBase/_StyleEditor.py b/src/ReportBase/_StyleEditor.py index 75abc3f4d..217e868ce 100644 --- a/src/ReportBase/_StyleEditor.py +++ b/src/ReportBase/_StyleEditor.py @@ -78,7 +78,7 @@ class StyleListDisplay: self.callback = callback self.sheetlist = stylesheetlist - self.top = gtk.glade.XML(const.gladeFile, "styles", "gramps") + self.top = gtk.glade.XML(const.GLADE_FILE, "styles", "gramps") self.window = self.top.get_widget('styles') ManagedWindow.set_titles( self.window, @@ -190,7 +190,7 @@ class StyleEditor: self.style = BaseDoc.StyleSheet(style) self.parent = parent - self.top = gtk.glade.XML(const.gladeFile, "editor", "gramps") + self.top = gtk.glade.XML(const.GLADE_FILE, "editor", "gramps") self.top.signal_autoconnect({ "on_save_style_clicked" : self.on_save_style_clicked, diff --git a/src/ReportBase/_TemplateParser.py b/src/ReportBase/_TemplateParser.py index 9ae6208a9..8859e1586 100644 --- a/src/ReportBase/_TemplateParser.py +++ b/src/ReportBase/_TemplateParser.py @@ -92,8 +92,8 @@ _template_map = { _user_template : "" } try: - template_path = const.template_dir - xmlfile = os.path.join(const.template_dir,"templates.xml") + template_path = const.TEMPLATE_DIR + xmlfile = os.path.join(const.TEMPLATE_DIR,"templates.xml") if os.path.isfile(xmlfile): parser = make_parser() @@ -102,7 +102,7 @@ try: parser.parse(the_file) the_file.close() - template_path = os.path.join(const.home_dir,"templates") + template_path = os.path.join(const.HOME_DIR,"templates") xmlfile = os.path.join(template_path,"templates.xml") if os.path.isfile(xmlfile): parser = make_parser() diff --git a/src/ScratchPad.py b/src/ScratchPad.py index 06c2bdba9..476b8f0e1 100644 --- a/src/ScratchPad.py +++ b/src/ScratchPad.py @@ -60,7 +60,7 @@ from DdTargets import DdTargets # #------------------------------------------------------------------------- -_stock_image = os.path.join(const.image_dir,'stock_link.png') +_stock_image = os.path.join(const.IMAGE_DIR,'stock_link.png') LINK_PIC = gtk.gdk.pixbuf_new_from_file(_stock_image) BLANK_PIC = gtk.gdk.Pixbuf(0,0,8,1,1) @@ -1160,7 +1160,7 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow): self.database_changed(self.dbstate.db) self.dbstate.connect('database-changed', self.database_changed) - self.glade_file = os.path.join(const.glade_dir,"scratchpad.glade") + self.glade_file = os.path.join(const.GLADE_DIR, "scratchpad.glade") self.top = gtk.glade.XML(self.glade_file,"scratch_pad","gramps") self.set_window(self.top.get_widget("scratch_pad"), diff --git a/src/Selectors/_BaseSelector.py b/src/Selectors/_BaseSelector.py index 38a3c429e..d772421ab 100644 --- a/src/Selectors/_BaseSelector.py +++ b/src/Selectors/_BaseSelector.py @@ -56,7 +56,7 @@ class BaseSelector(ManagedWindow.ManagedWindow): self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END) self.db = dbstate.db - self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps") + self.glade = gtk.glade.XML(const.GLADE_FILE,"select_person","gramps") window = self.glade.get_widget('select_person') title_label = self.glade.get_widget('title') self.tree = self.glade.get_widget('plist') diff --git a/src/Selectors/_SelectObject.py b/src/Selectors/_SelectObject.py index 10ac4fd40..490d298c6 100644 --- a/src/Selectors/_SelectObject.py +++ b/src/Selectors/_SelectObject.py @@ -76,8 +76,8 @@ class SelectObject(BaseSelector): def _local_init(self): self.preview = gtk.Image() - self.preview.set_size_request(int(const.thumbScale), - int(const.thumbScale)) + self.preview.set_size_request(int(const.THUMBSCALE), + int(const.THUMBSCALE)) vbox = self.glade.get_widget('select_person_vbox') vbox.pack_start(self.preview,False) vbox.reorder_child(self.preview,1) diff --git a/src/Selectors/_SelectPerson.py b/src/Selectors/_SelectPerson.py index 57034a253..e35ab926d 100644 --- a/src/Selectors/_SelectPerson.py +++ b/src/Selectors/_SelectPerson.py @@ -75,7 +75,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.gladeFile,"select_person","gramps") + self.glade = gtk.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 78fd6fbff..0a438a2f0 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -56,7 +56,7 @@ class TipOfDay(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) - xml = gtk.glade.XML(const.gladeFile, "tod_window", "gramps") + xml = gtk.glade.XML(const.GLADE_FILE, "tod_window", "gramps") window = xml.get_widget("tod_window") self.set_window(window, xml.get_widget("title"), @@ -67,7 +67,7 @@ class TipOfDay(ManagedWindow.ManagedWindow): self.use = xml.get_widget('usetips') self.use.set_active(Config.get(Config.USE_TIPS)) image = xml.get_widget('image') - image.set_from_file(os.path.join(const.image_dir,'splash.jpg')) + image.set_from_file(os.path.join(const.IMAGE_DIR,'splash.jpg')) next = xml.get_widget('next') next.connect("clicked",self.next_tip_cb) @@ -126,7 +126,7 @@ class TipParser: """ self.mylist = [] - xml_file = open(const.tipdata) + xml_file = open(const.TIP_DATA) self.tlist = [] p = ParserCreate() p.StartElementHandler = self.startElement diff --git a/src/ViewManager.py b/src/ViewManager.py index 029fed26f..20022a9bf 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -96,9 +96,9 @@ gtk.about_dialog_set_url_hook(show_url, None) # #------------------------------------------------------------------------- _KNOWN_FORMATS = { - const.app_gramps : _('GRAMPS (grdb)'), - const.app_gramps_xml : _('GRAMPS XML'), - const.app_gedcom : _('GEDCOM'), + const.APP_GRAMPS : _('GRAMPS (grdb)'), + const.APP_GRAMPS_XML : _('GRAMPS XML'), + const.APP_GEDCOM : _('GEDCOM'), } UIDEFAULT = ''' @@ -215,7 +215,7 @@ class ViewManager: height = Config.get(Config.HEIGHT) self.window = gtk.Window() - self.window.set_icon_from_file(const.icon) + self.window.set_icon_from_file(const.ICON) self.window.set_default_size(width, height) self.statusbar = GrampsWidgets.Statusbar() @@ -497,11 +497,11 @@ class ViewManager: def do_load_plugins(self): self.uistate.status_text(_('Loading document formats...')) - error = load_plugins(const.docgenDir) - error |= load_plugins(os.path.join(const.home_dir, "docgen")) + error = load_plugins(const.DOCGEN_DIR) + error |= load_plugins(os.path.join(const.HOME_DIR, "docgen")) self.uistate.status_text(_('Loading plugins...')) - error |= load_plugins(const.pluginsDir) - error |= load_plugins(os.path.join(const.home_dir, "plugins")) + error |= load_plugins(const.PLUGINS_DIR) + error |= load_plugins(os.path.join(const.HOME_DIR, "plugins")) if Config.get(Config.POP_PLUGIN_STATUS) and error: try: PluginStatus.PluginStatus(self.state, self.uistate, []) @@ -602,10 +602,10 @@ class ViewManager: self.uimanager.ensure_update() def home_page_activate(self, obj): - GrampsDisplay.url(const.url_homepage) + GrampsDisplay.url(const.URL_HOMEPAGE) def mailing_lists_activate(self, obj): - GrampsDisplay.url( const.url_mailinglist) + GrampsDisplay.url( const.URL_MAILINGLIST) def preferences_activate(self, obj): try: @@ -616,7 +616,7 @@ class ViewManager: pass def report_bug_activate(self, obj): - GrampsDisplay.url( const.url_bugtracker) + GrampsDisplay.url( const.URL_BUGTRACKER) def manual_activate(self, obj): """Display the GRAMPS manual""" @@ -655,9 +655,9 @@ class ViewManager: def about(self, obj): about = gtk.AboutDialog() - about.set_name(const.program_name) - about.set_version(const.version) - about.set_copyright(const.copyright_msg) + about.set_name(const.PROGRAM_NAME) + about.set_version(const.VERSION) + about.set_copyright(const.COPYRIGHT_MSG) about.set_artists([ _("Much of GRAMPS' artwork is either from\n" "the Tango Project or derived from the Tango\n" @@ -666,23 +666,23 @@ class ViewManager: "license.") ]) try: - ifile = open(const.license_file, "r") + ifile = open(const.LICENSE_FILE, "r") about.set_license(ifile.read().replace('\x0c', '')) ifile.close() except: about.set_license("License file is missing") - about.set_comments(_(const.comments)) + about.set_comments(_(const.COMMENTS)) about.set_website_label(_('GRAMPS Homepage')) - about.set_website(const.url_homepage) - about.set_authors(const.authors) + about.set_website(const.URL_HOMEPAGE) + about.set_authors(const.AUTHORS) # Only set translation credits if they are translated - trans_credits = _(const.translators) - if trans_credits != const.translators: + trans_credits = _(const.TRANSLATORS) + if trans_credits != const.TRANSLATORS: about.set_translator_credits(trans_credits) - about.set_documenters(const.documenters) - about.set_logo(gtk.gdk.pixbuf_new_from_file(const.splash)) + about.set_documenters(const.DOCUMENTERS) + about.set_logo(gtk.gdk.pixbuf_new_from_file(const.SPLASH)) about.set_modal(True) about.show() about.run() @@ -1293,7 +1293,7 @@ def check_for_portability_problems(filetype): # check for a GRDB type and if transactions are enabled. If not, # then we do not have any issues - if filetype == const.app_gramps and Config.get(Config.TRANSACTIONS): + if filetype == const.APP_GRAMPS and Config.get(Config.TRANSACTIONS): import sys diff --git a/src/const.py.in b/src/const.py.in index 215a4495b..ffc173a37 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -1,5 +1,5 @@ # -*- python -*- -# -*- coding: utf-8 -*- +# -*- coding: iso-8859-1 -*- # # Gramps - a GTK+/GNOME based genealogy program # @@ -10,7 +10,7 @@ # 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, +# 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. @@ -22,6 +22,10 @@ # $Id$ +""" +Provides constants for other modules +""" + #------------------------------------------------------------------------- # # Standard python modules @@ -35,43 +39,30 @@ from gettext import gettext as _ # Standard GRAMPS Websites # #------------------------------------------------------------------------- -url_homepage = "http://gramps-project.org/" -url_mailinglist = "http://sourceforge.net/mail/?group_id=25770" -url_bugtracker = "http://bugs.gramps-project.org/bug_report_advanced_page.php" -url_manual = "http://gramps-project.org/gramps-manual/2.2/" +URL_HOMEPAGE = "http://gramps-project.org/" +URL_MAILINGLIST = "http://sourceforge.net/mail/?group_id=25770" +URL_BUGTRACKER = "http://bugs.gramps-project.org/bug_report_advanced_page.php" +URL_MANUAL = "http://gramps-project.org/gramps-manual/2.2/" #------------------------------------------------------------------------- # # Mime Types # #------------------------------------------------------------------------- -app_gramps = "application/x-gramps" -app_gramps_xml = "application/x-gramps-xml" -app_gedcom = "application/x-gedcom" -app_gramps_package = "application/x-gramps-package" -app_geneweb = "application/x-geneweb" -app_vcard = ["text/x-vcard","text/x-vcalendar"] +APP_GRAMPS = "application/x-gramps" +APP_GRAMPS_XML = "application/x-gramps-xml" +APP_GEDCOM = "application/x-gedcom" +APP_GRAMPS_PKG = "application/x-gramps-package" +APP_GENEWEB = "application/x-geneweb" +APP_VCARD = ["text/x-vcard", "text/x-vcalendar"] #------------------------------------------------------------------------- # -# Paths to external programs +# system paths # #------------------------------------------------------------------------- -editor = "gimp" -convert = "convert" - -pixdir = "/usr/share/pixmaps" -nautdir = "/usr/share/pixmaps/nautilus" - -prefixdir = "@prefix@" -sysconfdir = "@sysconfdir@" - -#------------------------------------------------------------------------- -# -# Configuration database options - True means drop down to .INI files -# -#------------------------------------------------------------------------- -no_gconf = False +PREFIXDIR = "@prefix@" +SYSCONFDIR = "@sysconfdir@" #------------------------------------------------------------------------- # @@ -81,11 +72,11 @@ no_gconf = False # #------------------------------------------------------------------------- if os.environ.has_key('USERPROFILE'): - user_home = os.environ['USERPROFILE'] - home_dir = os.path.join(user_home,'gramps') + USER_HOME = os.environ['USERPROFILE'] + HOME_DIR = os.path.join(USER_HOME, 'gramps') else: - user_home = os.environ['HOME'] - home_dir = os.path.join(user_home,'.gramps') + USER_HOME = os.environ['HOME'] + HOME_DIR = os.path.join(USER_HOME, '.gramps') #------------------------------------------------------------------------- # @@ -93,85 +84,84 @@ else: # this one, and that the plugins directory is in a directory below this. # #------------------------------------------------------------------------- -root_dir = os.path.abspath(os.path.dirname(__file__)) -image_dir = os.path.join(root_dir,"images") +ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) +IMAGE_DIR = os.path.join(ROOT_DIR, "images") -custom_filters = os.path.join(home_dir,"custom_filters.xml") -report_options = os.path.join(home_dir,"report_options.xml") -tool_options = os.path.join(home_dir,"tool_options.xml") -thumb_dir = os.path.join(home_dir,"thumb") -env_dir = os.path.join(home_dir,"env") +CUSTOM_FILTERS = os.path.join(HOME_DIR, "custom_filters.xml") +REPORT_OPTIONS = os.path.join(HOME_DIR, "report_options.xml") +TOOL_OPTIONS = os.path.join(HOME_DIR, "tool_options.xml") +THUMB_DIR = os.path.join(HOME_DIR, "thumb") +ENV_DIR = os.path.join(HOME_DIR, "env") -icon = os.path.join(root_dir,"images","gramps.png") -logo = os.path.join(root_dir,"images","logo.png") -splash = os.path.join(root_dir,"images","splash.jpg") -license_file = os.path.join(root_dir,"COPYING") +ICON = os.path.join(ROOT_DIR, "images", "gramps.png") +LOGO = os.path.join(ROOT_DIR, "images", "logo.png") +SPLASH = os.path.join(ROOT_DIR, "images", "splash.jpg") +LICENSE_FILE = os.path.join(ROOT_DIR, "COPYING") # # Glade files # -glade_dir = os.path.join(root_dir,"glade") -gladeFile = os.path.join(glade_dir,"gramps.glade") -person_glade = os.path.join(glade_dir,"edit_person.glade") -plugins_glade = os.path.join(glade_dir,"plugins.glade") -merge_glade = os.path.join(glade_dir,"mergedata.glade") -rule_glade = os.path.join(glade_dir,"rule.glade") +GLADE_DIR = os.path.join(ROOT_DIR, "glade") +GLADE_FILE = os.path.join(GLADE_DIR, "gramps.glade") +PERSON_GLADE = os.path.join(GLADE_DIR, "edit_person.glade") +PLUGINS_GLADE = os.path.join(GLADE_DIR, "plugins.glade") +MERGE_GLADE = os.path.join(GLADE_DIR, "mergedata.glade") +RULE_GLADE = os.path.join(GLADE_DIR, "rule.glade") -pluginsDir = os.path.join(root_dir,"plugins") -docgenDir = os.path.join(root_dir,"docgen") -data_dir = os.path.join(root_dir,"data") -system_filters = os.path.join(data_dir,"system_filters.xml") -template_dir = os.path.join(data_dir,"templates") -tipdata = os.path.join(data_dir,"tips.xml") -fdl = os.path.join(data_dir,"fdl.txt") +PLUGINS_DIR = os.path.join(ROOT_DIR, "plugins") +DOCGEN_DIR = os.path.join(ROOT_DIR, "docgen") +DATA_DIR = os.path.join(ROOT_DIR, "data") +SYSTEM_FILTERS = os.path.join(DATA_DIR, "system_filters.xml") +TEMPLATE_DIR = os.path.join(DATA_DIR, "templates") +TIP_DATA = os.path.join(DATA_DIR, "tips.xml") -papersize = "file:%s/papersize.xml" % data_dir +PAPERSIZE = "file:%s/papersize.xml" % DATA_DIR + +USE_TIPS = False -startup = 1 -dnd_images = 1 -use_tips = False if os.sys.platform == "win32": - use_thumbnailer = False + USE_THUMBNAILER = False else: - use_thumbnailer= True + USE_THUMBNAILER = True #------------------------------------------------------------------------- # # About box information # #------------------------------------------------------------------------- -program_name = "GRAMPS" -version = "@VERSIONSTRING@" -copyright_msg = unicode("© 2001-2006 Donald N. Allingham","iso-8859-1") -comments = _("GRAMPS (Genealogical Research and Analysis " +PROGRAM_NAME = "GRAMPS" +VERSION = "@VERSIONSTRING@" +COPYRIGHT_MSG = unicode("© 2001-2006 Donald N. Allingham", "iso-8859-1") +COMMENTS = _("GRAMPS (Genealogical Research and Analysis " "Management Programming System) is a personal " "genealogy program.") -authors = [ - "Donald N. Allingham", - "Alexander Roitman", - "Richard Taylor", - "Martin Hawlisch", - "Brian Matherly", - "Tim Waugh", +AUTHORS = [ + "Donald N. Allingham", + "Alexander Roitman", + "Richard Taylor", + "Martin Hawlisch", + "Brian Matherly", + "Tim Waugh", "Donald A. Peterson", - "David Hampton", + "David Hampton", ] -documenters = [ - 'Alexander Roitman', +DOCUMENTERS = [ + 'Alexander Roitman', ] -translators = _('TRANSLATORS: Translate this to your name in your native language') +TRANSLATORS = _('TRANSLATORS: Translate this to your ' + 'name in your native language') #------------------------------------------------------------------------- # # Constants # #------------------------------------------------------------------------- -thumbScale = 96.0 -xmlFile = "data.gramps" +THUMBSCALE = 96.0 +XMLFILE = "data.gramps" #------------------------------------------------------------------------- # @@ -180,53 +170,53 @@ xmlFile = "data.gramps" #------------------------------------------------------------------------- # (longName, shortName, type , default, flags, descrip , argDescrip) -popt_table = [ - ("open", 'O', str, None, 0, "Open file", "FILENAME"), - ("import", 'i', str, None, 0, "Import file", "FILENAME"), - ("output", 'o', str, None, 0, "Write file", "FILENAME"), - ("format", 'f', str, None, 0, 'Specify format', "FORMAT"), - ("action", 'a', str, None, 0, 'Specify action', "ACTION"), - ("options", 'p', str, None, 0, 'Specify options', "OPTIONS_STRING"), - ("debug", 'd', str, None, 0, 'Enable debug logs', "LOGGER_NAME"), +POPT_TABLE = [ + ("open", 'O', str, None, 0, "Open file", "FILENAME"), + ("import", 'i', str, None, 0, "Import file", "FILENAME"), + ("output", 'o', str, None, 0, "Write file", "FILENAME"), + ("format", 'f', str, None, 0, 'Specify format', "FORMAT"), + ("action", 'a', str, None, 0, 'Specify action', "ACTION"), + ("options", 'p', str, None, 0, 'Specify options', "OPTIONS_STRING"), + ("debug", 'd', str, None, 0, 'Enable debug logs', "LOGGER_NAME"), ] -longopts = [ - "load-modules=", - "help", - "usage", - "oaf-ior-fd=", - "oaf-activate-iid=", - "oaf-private", - "disable-sound", - "enable-sound", - "espeaker=", - "version", +LONGOPTS = [ + "load-modules=", + "help", + "usage", + "oaf-ior-fd=", + "oaf-activate-iid=", + "oaf-private", + "disable-sound", + "enable-sound", + "espeaker=", + "version", "gdk-debug=", - "gdk-no-debug=", - "display=", - "screen=", - "sync", - "name=", - "class=", + "gdk-no-debug=", + "display=", + "screen=", + "sync", + "name=", + "class=", "gtk-debug=", - "gtk-no-debug=", - "g-fatal-warnings", - "gtk-module=", - "sm-client-id=", - "sm-config-prefix=", - "sm-disable", - "disable-crash-dialog", - "disable-sound", - "enable-sound", - "espeaker=", - "open=", - "import=", - "output=", - "format=", - "action=", - "options=", - "debug=", + "gtk-no-debug=", + "g-fatal-warnings", + "gtk-module=", + "sm-client-id=", + "sm-config-prefix=", + "sm-disable", + "disable-crash-dialog", + "disable-sound", + "enable-sound", + "espeaker=", + "open=", + "import=", + "output=", + "format=", + "action=", + "options=", + "debug=", ] -shortopts = "O:i:o:f:a:p:d:?" +SHORTOPTS = "O:i:o:f:a:p:d:?" diff --git a/src/docgen/HtmlDoc.py b/src/docgen/HtmlDoc.py index 243660653..6d86fdc09 100644 --- a/src/docgen/HtmlDoc.py +++ b/src/docgen/HtmlDoc.py @@ -207,7 +207,7 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc): self.top = _top def process_line(self,line): - l = line.replace('$VERSION',const.version) + l = line.replace('$VERSION',const.VERSION) return l.replace('$COPYRIGHT',self.copyright) def open(self,filename): diff --git a/src/docgen/ODFDoc.py b/src/docgen/ODFDoc.py index 75adc3a30..e086ef253 100644 --- a/src/docgen/ODFDoc.py +++ b/src/docgen/ODFDoc.py @@ -938,7 +938,7 @@ class ODFDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc,BaseDoc.DrawDoc): self.meta.write('office:version="1.0">\n'); self.meta.write('\n') self.meta.write('') - self.meta.write(const.program_name + ' ' + const.version) + self.meta.write(const.PROGRAM_NAME + ' ' + const.VERSION) self.meta.write('\n') self.meta.write('') # It should be reasonable to have a true document title. but how ? diff --git a/src/docgen/ODSDoc.py b/src/docgen/ODSDoc.py index 358eecb1b..53e1932a7 100644 --- a/src/docgen/ODSDoc.py +++ b/src/docgen/ODSDoc.py @@ -470,7 +470,7 @@ class ODSDoc(SpreadSheetDoc): self.f.write('office:class="text" office:version="1.0">\n'); self.f.write('\n') self.f.write('') - self.f.write(const.program_name + ' ' + const.version) + self.f.write(const.PROGRAM_NAME + ' ' + const.VERSION) self.f.write('\n') self.f.write('') self.f.write(self.name) @@ -510,4 +510,4 @@ class ODSDoc(SpreadSheetDoc): self.f = open(self.mimetype,"w") self.f.write('application/vnd.oasis.opendocument.spreadsheet') - self.f.close() \ No newline at end of file + self.f.close() diff --git a/src/docgen/ODSTab.py b/src/docgen/ODSTab.py index 14c7370bc..13632226a 100644 --- a/src/docgen/ODSTab.py +++ b/src/docgen/ODSTab.py @@ -403,7 +403,7 @@ class ODSTab(TabbedDoc): self.f.write('office:class="text" office:version="1.0">\n'); self.f.write('\n') self.f.write('') - self.f.write(const.program_name + ' ' + const.version) + self.f.write(const.PROGRAM_NAME + ' ' + const.VERSION) self.f.write('\n') self.f.write('') self.f.write(self.name) diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index 3dbfb1290..6fb1f3f80 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -805,7 +805,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc,BaseDoc.DrawDoc): self.meta.write('office:version="0.9">\n'); self.meta.write('\n') self.meta.write('') - self.meta.write(const.program_name + ' ' + const.version) + self.meta.write(const.PROGRAM_NAME + ' ' + const.VERSION) self.meta.write('\n') self.meta.write('') self.meta.write(self.get_creator()) diff --git a/src/docgen/OpenSpreadSheet.py b/src/docgen/OpenSpreadSheet.py index 31bccbedf..c6d3de4b7 100644 --- a/src/docgen/OpenSpreadSheet.py +++ b/src/docgen/OpenSpreadSheet.py @@ -454,7 +454,7 @@ class OpenSpreadSheet(SpreadSheetDoc): self.f.write('office:class="text" office:version="0.9">\n'); self.f.write('\n') self.f.write('') - self.f.write(const.program_name + ' ' + const.version) + self.f.write(const.PROGRAM_NAME + ' ' + const.VERSION) self.f.write('\n') self.f.write('') self.f.write(self.name) diff --git a/src/docgen/TextBufDoc.py b/src/docgen/TextBufDoc.py index 232b2634b..9e9124af6 100644 --- a/src/docgen/TextBufDoc.py +++ b/src/docgen/TextBufDoc.py @@ -63,7 +63,7 @@ _WIDTH_IN_CHARS = 72 class DisplayBuf: def __init__(self, title, buffer): - g = gtk.glade.XML(const.gladeFile,'scrollmsg') + g = gtk.glade.XML(const.GLADE_FILE,'scrollmsg') self.top = g.get_widget('scrollmsg') msg = g.get_widget('msg') msg.set_buffer(buffer) diff --git a/src/gramps.py b/src/gramps.py index b1c942e57..a105b4ec0 100644 --- a/src/gramps.py +++ b/src/gramps.py @@ -65,8 +65,8 @@ sys.path.append(os.path.abspath(os.path.basename(__file__))) #------------------------------------------------------------------------- if os.environ.has_key("GRAMPSI18N"): loc = os.environ["GRAMPSI18N"] -elif os.path.exists( os.path.join(const.root_dir,"lang") ): - loc = os.path.join(const.root_dir,"lang") +elif os.path.exists( os.path.join(const.ROOT_DIR, "lang") ): + loc = os.path.join(const.ROOT_DIR, "lang") else: loc = "/usr/share/locale" @@ -155,16 +155,16 @@ def run(): try: import gnome - program = gnome.program_init('gramps',const.version, + program = gnome.program_init('gramps',const.VERSION, gnome.libgnome_module_info_get(), - args, const.popt_table) + args, const.POPT_TABLE) program.set_property('app-libdir', - '%s/lib' % const.prefixdir) + '%s/lib' % const.PREFIXDIR) program.set_property('app-datadir', - '%s/share' % const.prefixdir) - program.set_property('app-sysconfdir',const.sysconfdir) - program.set_property('app-prefix', const.prefixdir) + '%s/share' % const.PREFIXDIR) + program.set_property('app-sysconfdir',const.SYSCONFDIR) + program.set_property('app-prefix', const.PREFIXDIR) except: pass diff --git a/src/gramps_main.py b/src/gramps_main.py index 2d2411f5b..f0dfa2c28 100644 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -72,24 +72,24 @@ def register_stock_icons (): #iconpath to the base image. The front of the list has highest priority if platform.system() == "Windows": iconpaths = [ - (os.path.join(const.image_dir,'48x48'),'.png'), - (const.image_dir,'.png'), + (os.path.join(const.IMAGE_DIR,'48x48'),'.png'), + (const.IMAGE_DIR,'.png'), ] else : iconpaths = [ - (os.path.join(const.image_dir,'scalable'),'.svg'), - (const.image_dir,'.svg'), (const.image_dir,'.png'), + (os.path.join(const.IMAGE_DIR,'scalable'),'.svg'), + (const.IMAGE_DIR,'.svg'), (const.IMAGE_DIR,'.png'), ] #sizes: menu=16, small_toolbar=18, large_toolbar=24, # button=20, dnd=32, dialog=48 #add to the back of this list to overrule images set at beginning of list extraiconsize = [ - (os.path.join(const.image_dir, '22x22'), + (os.path.join(const.IMAGE_DIR, '22x22'), gtk.ICON_SIZE_LARGE_TOOLBAR), - (os.path.join(const.image_dir, '16x16'), + (os.path.join(const.IMAGE_DIR, '16x16'), gtk.ICON_SIZE_MENU), - (os.path.join(const.image_dir, '22x22'), + (os.path.join(const.IMAGE_DIR, '22x22'), gtk.ICON_SIZE_BUTTON), ] @@ -157,7 +157,7 @@ def register_stock_icons (): pass if not pixbuf : - icon_file = os.path.join(const.image_dir,'gramps.png') + icon_file = os.path.join(const.IMAGE_DIR,'gramps.png') pixbuf = gtk.gdk.pixbuf_new_from_file (icon_file) pixbuf = pixbuf.add_alpha(True, chr(0xff), chr(0xff), chr(0xff)) @@ -184,12 +184,12 @@ def register_stock_icons (): def build_user_paths(): - user_paths = [const.home_dir, - os.path.join(const.home_dir,"filters"), - os.path.join(const.home_dir,"plugins"), - os.path.join(const.home_dir,"docgen"), - os.path.join(const.home_dir,"templates"), - os.path.join(const.home_dir,"thumb")] + user_paths = [const.HOME_DIR, + os.path.join(const.HOME_DIR,"filters"), + os.path.join(const.HOME_DIR,"plugins"), + os.path.join(const.HOME_DIR,"docgen"), + os.path.join(const.HOME_DIR,"templates"), + os.path.join(const.HOME_DIR,"thumb")] for path in user_paths: if not os.path.isdir(path): @@ -226,13 +226,13 @@ class Gramps: log.error("Error reading configuration.", exc_info=True) return - if not mime_type_is_defined(const.app_gramps): + if not mime_type_is_defined(const.APP_GRAMPS): ErrorDialog(_("Configuration error"), _("A definition for the MIME-type %s could not " "be found \n\nPossibly the installation of GRAMPS " "was incomplete. Make sure the MIME-types " "of GRAMPS are properly installed.") - % const.app_gramps) + % const.APP_GRAMPS) gtk.main_quit() return diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index e51599362..63f047eda 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -316,7 +316,7 @@ class BookList: """ self.bookmap = {} - self.file = os.path.join(const.home_dir,filename) + self.file = os.path.join(const.HOME_DIR,filename) self.parse() def delete_book(self,name): diff --git a/src/plugins/Calendar.py b/src/plugins/Calendar.py index f7be4ad88..0658f24a9 100644 --- a/src/plugins/Calendar.py +++ b/src/plugins/Calendar.py @@ -157,8 +157,8 @@ class Calendar(Report): def get_holidays(self, year, country = "United States"): """ Looks in multiple places for holidays.xml files """ - locations = [const.pluginsDir, - os.path.join(const.home_dir,"plugins")] + locations = [const.PLUGINS_DIR, + os.path.join(const.HOME_DIR,"plugins")] holiday_file = 'holidays.xml' for dir in locations: holiday_full_path = os.path.join(dir, holiday_file) @@ -1152,8 +1152,8 @@ class Holidays: def get_countries(): """ Looks in multiple places for holidays.xml files """ - locations = [const.pluginsDir, - os.path.join(const.home_dir,"plugins")] + locations = [const.PLUGINS_DIR, + os.path.join(const.HOME_DIR,"plugins")] holiday_file = 'holidays.xml' country_list = [] for dir in locations: diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index d34583d4a..a4f817702 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -156,7 +156,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow): def filter_editor_clicked(self,obj): import FilterEditor try: - FilterEditor.FilterEditor('Person',const.custom_filters, + FilterEditor.FilterEditor('Person',const.CUSTOM_FILTERS, self.dbstate,self.uistate) except Errors.WindowActiveError: pass diff --git a/src/plugins/ImportGeneWeb.py b/src/plugins/ImportGeneWeb.py index fc4fae1d0..d49d15b98 100644 --- a/src/plugins/ImportGeneWeb.py +++ b/src/plugins/ImportGeneWeb.py @@ -930,7 +930,7 @@ class GeneWebParser: # # #------------------------------------------------------------------------- -_mime_type = const.app_geneweb +_mime_type = const.APP_GENEWEB _filter = gtk.FileFilter() _filter.set_name(_('GeneWeb files')) _filter.add_mime_type(_mime_type) diff --git a/src/plugins/ImportvCard.py b/src/plugins/ImportvCard.py index 07d6879bd..bc6ed37d1 100644 --- a/src/plugins/ImportvCard.py +++ b/src/plugins/ImportvCard.py @@ -220,7 +220,7 @@ class VCardParser: # # #------------------------------------------------------------------------- -_mime_type = const.app_vcard +_mime_type = const.APP_VCARD for mime in _mime_type: _filter = gtk.FileFilter() _filter.set_name(_('vCard files')) diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index ad3240b3f..0d257db28 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -1192,9 +1192,9 @@ class MediaPage(BasePage): if photo.get_mime_type(): from_path = ImgManip.get_thumbnail_path(photo.get_path(),photo.get_mime_type()) if not os.path.isfile(from_path): - from_path = os.path.join(const.image_dir,"document.png") + from_path = os.path.join(const.IMAGE_DIR,"document.png") else: - from_path = os.path.join(const.image_dir,"document.png") + from_path = os.path.join(const.IMAGE_DIR,"document.png") if self.archive: self.archive.add(from_path,to_path) @@ -2469,10 +2469,10 @@ class WebReport(Report): Copy the CSS file to the destination. """ if archive: - fname = os.path.join(const.data_dir,css_file) + fname = os.path.join(const.DATA_DIR, css_file) archive.add(fname,_NARRATIVE) else: - shutil.copyfile(os.path.join(const.data_dir,css_file), + shutil.copyfile(os.path.join(const.DATA_DIR, css_file), os.path.join(html_dir,_NARRATIVE)) def person_pages(self, ind_list, place_list, source_list, archive): @@ -2631,7 +2631,7 @@ class WebReportOptions(ReportOptions): 'NWEBarchive' : 0, 'NWEBgraph' : 1, 'NWEBgraphgens' : 4, - 'NWEBod' : os.path.join(const.user_home,"NWEB"), + 'NWEBod' : os.path.join(const.USER_HOME,"NWEB"), 'NWEBcopyright' : 0, 'NWEBlivinginfo' : 2, 'NWEByearsafterdeath' : 30, diff --git a/src/plugins/ReadPkg.py b/src/plugins/ReadPkg.py index 8db6f91fe..a45bba34b 100644 --- a/src/plugins/ReadPkg.py +++ b/src/plugins/ReadPkg.py @@ -93,9 +93,9 @@ def impData(database, name,cb=None,cl=0): ErrorDialog(_("Error extracting into %s") % tmpdir_path) return - imp_db_name = os.path.join(tmpdir_path,const.xmlFile) + imp_db_name = os.path.join(tmpdir_path,const.XMLFILE) - importer = gramps_db_reader_factory(const.app_gramps_xml) + importer = gramps_db_reader_factory(const.APP_GRAMPS_XML) importer(database,imp_db_name,cb) # Clean up tempdir after ourselves diff --git a/src/plugins/Verify.py b/src/plugins/Verify.py index 411919fc4..cf05e69a7 100644 --- a/src/plugins/Verify.py +++ b/src/plugins/Verify.py @@ -531,7 +531,7 @@ class VerifyResults(ManagedWindow): def load_ignored(self,db_filename): md5sum = md5.md5(db_filename) self.ignores_filename = os.path.join( - const.home_dir,md5sum.hexdigest() + os.path.extsep + 'vfm') + const.HOME_DIR,md5sum.hexdigest() + os.path.extsep + 'vfm') if not self._load_ignored(self.ignores_filename): self.ignores = {} diff --git a/src/plugins/WebCal.py b/src/plugins/WebCal.py index cfa2943d4..421b26a93 100644 --- a/src/plugins/WebCal.py +++ b/src/plugins/WebCal.py @@ -229,8 +229,8 @@ class WebReport(Report): def get_holidays(self, year, country = "United States"): """ Looks in multiple places for holidays.xml files """ - locations = [const.pluginsDir, - os.path.join(const.home_dir,"plugins")] + locations = [const.PLUGINS_DIR, + os.path.join(const.HOME_DIR,"plugins")] holiday_file = 'holidays.xml' for dir in locations: holiday_full_path = os.path.join(dir, holiday_file) @@ -663,7 +663,7 @@ class WebReportOptions(ReportOptions): # Options specific for this report self.options_dict = { 'WCfilter' : 0, - 'WCod' : os.path.join(const.user_home,"WEBCAL"), + 'WCod' : os.path.join(const.USER_HOME,"WEBCAL"), 'WCcopyright' : 0, 'WCtitle' : _('My Family Calendar'), 'WCext' : 'html', @@ -1304,8 +1304,8 @@ class Holidays: def get_countries(): """ Looks in multiple places for holidays.xml files """ - locations = [const.pluginsDir, - os.path.join(const.home_dir,"plugins")] + locations = [const.PLUGINS_DIR, + os.path.join(const.HOME_DIR,"plugins")] holiday_file = 'holidays.xml' country_list = [] for dir in locations: diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index 60d0a3c8a..55f8c237d 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -309,7 +309,7 @@ class PackageWriter: def make_thumbnail(self,dbname,root,path): img = ImgManip.ImgManip(path) - data = img.jpg_scale_data(const.thumbScale,const.thumbScale) + data = img.jpg_scale_data(const.THUMBSCALE,const.THUMBSCALE) uri = URI('burn:///%s/.thumb/%s.jpg' % (dbname,root)) th = create(uri,OPEN_WRITE)