* various: const.py changes

2007-09-07  Don Allingham  <don@gramps-project.org>
	* src/DateHandler/_Date_fr.py: fix indentation errors

2007-09-07  Don Allingham  <don@gramps-project.org>


svn: r8948
This commit is contained in:
Don Allingham 2007-09-08 05:54:02 +00:00
parent afb2bbc201
commit a65a73d1d7
104 changed files with 390 additions and 395 deletions

View File

@ -1,3 +1,9 @@
2007-09-07 Don Allingham <don@gramps-project.org>
* various: const.py changes
2007-09-07 Don Allingham <don@gramps-project.org>
* src/DateHandler/_Date_fr.py: fix indentation errors
2007-09-07 Don Allingham <don@gramps-project.org>
* src/ansel_utf8.py: pylint
* src/Date.py: pylint

View File

@ -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)

View File

@ -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):

View File

@ -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 = '<span weight="bold" size="xx-large">%s</span>'
#-------------------------------------------------------------------------

View File

@ -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):

View File

@ -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)

View File

@ -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. """

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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'),

View File

@ -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)
#-------------------------------------------------------------------------

View File

@ -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')

View File

@ -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]))

View File

@ -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]))

View File

@ -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])

View File

@ -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:

View File

@ -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]))

View File

@ -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()

View File

@ -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'))

View File

@ -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'))

View File

@ -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,

View File

@ -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())

View File

@ -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'))

View File

@ -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())

View File

@ -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'))

View File

@ -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'))

View File

@ -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'),

View File

@ -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'),

View File

@ -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"))

View File

@ -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())

View File

@ -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)

View File

@ -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'))

View File

@ -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())

View File

@ -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'),

View File

@ -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())

View File

@ -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)

View File

@ -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'),

View File

@ -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"),

View File

@ -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')

View File

@ -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'),

View File

@ -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)

View File

@ -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')

View File

@ -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'),

View File

@ -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:

View File

@ -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'))

View File

@ -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

View File

@ -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

View File

@ -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':

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

@ -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):
"""

View File

@ -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)

View File

@ -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

View File

@ -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))

View File

@ -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)

View File

@ -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)

View File

@ -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"))

View File

@ -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"))

View File

@ -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'),

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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")

View File

@ -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("")

View File

@ -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

View File

@ -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,

View File

@ -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
#------------------------------------------------------------------------
#

View File

@ -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)

View File

@ -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
#-------------------------------------------------------------------------

View File

@ -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

View File

@ -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):

View File

@ -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))

View File

@ -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 = ""

View File

@ -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):
"""

View File

@ -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,

View File

@ -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()

View File

@ -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"),

View File

@ -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')

View File

@ -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)

View File

@ -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')

View File

@ -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

View File

@ -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 = '''<ui>
@ -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

View File

@ -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:?"

View File

@ -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):

View File

@ -938,7 +938,7 @@ class ODFDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc,BaseDoc.DrawDoc):
self.meta.write('office:version="1.0">\n');
self.meta.write('<office:meta>\n')
self.meta.write('<meta:generator>')
self.meta.write(const.program_name + ' ' + const.version)
self.meta.write(const.PROGRAM_NAME + ' ' + const.VERSION)
self.meta.write('</meta:generator>\n')
self.meta.write('<dc:title>')
# It should be reasonable to have a true document title. but how ?

View File

@ -470,7 +470,7 @@ class ODSDoc(SpreadSheetDoc):
self.f.write('office:class="text" office:version="1.0">\n');
self.f.write('<office:meta>\n')
self.f.write('<meta:generator>')
self.f.write(const.program_name + ' ' + const.version)
self.f.write(const.PROGRAM_NAME + ' ' + const.VERSION)
self.f.write('</meta:generator>\n')
self.f.write('<meta:initial-creator>')
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()
self.f.close()

View File

@ -403,7 +403,7 @@ class ODSTab(TabbedDoc):
self.f.write('office:class="text" office:version="1.0">\n');
self.f.write('<office:meta>\n')
self.f.write('<meta:generator>')
self.f.write(const.program_name + ' ' + const.version)
self.f.write(const.PROGRAM_NAME + ' ' + const.VERSION)
self.f.write('</meta:generator>\n')
self.f.write('<meta:initial-creator>')
self.f.write(self.name)

View File

@ -805,7 +805,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc,BaseDoc.DrawDoc):
self.meta.write('office:version="0.9">\n');
self.meta.write('<office:meta>\n')
self.meta.write('<meta:generator>')
self.meta.write(const.program_name + ' ' + const.version)
self.meta.write(const.PROGRAM_NAME + ' ' + const.VERSION)
self.meta.write('</meta:generator>\n')
self.meta.write('<meta:initial-creator>')
self.meta.write(self.get_creator())

View File

@ -454,7 +454,7 @@ class OpenSpreadSheet(SpreadSheetDoc):
self.f.write('office:class="text" office:version="0.9">\n');
self.f.write('<office:meta>\n')
self.f.write('<meta:generator>')
self.f.write(const.program_name + ' ' + const.version)
self.f.write(const.PROGRAM_NAME + ' ' + const.VERSION)
self.f.write('</meta:generator>\n')
self.f.write('<meta:initial-creator>')
self.f.write(self.name)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -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'))

View File

@ -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,

Some files were not shown because too many files have changed in this diff Show More