* src/GrampsGconfKeys.py: Add to CVS -- split off key names.
* src/Makefile.am: Ship GrampsGconfKeys. * src/ArgHandler.py: Use GrampsGconfKeys. * src/DbPrompter.py: Use GrampsGconfKeys. * src/EditPerson.py: Use GrampsGconfKeys. * src/Exporter.py: Use GrampsGconfKeys. * src/FamilyView.py: Use GrampsGconfKeys. * src/GrampsDbBase.py: Use GrampsGconfKeys. * src/ImageSelect.py: Use GrampsGconfKeys. * src/MediaView.py: Use GrampsGconfKeys. * src/Plugins.py: Use GrampsGconfKeys. * src/Report.py: Use GrampsGconfKeys. * src/StartupDialog.py: Use GrampsGconfKeys. * src/TipOfDay.py: Use GrampsGconfKeys. * src/Utils.py: Use GrampsGconfKeys. * src/DateDisplay.py: Proper capitalization for _MONS. * src/DateHandler.py: Use GrampsGconfKeys. * src/GrampsCfg.py: Use GrampsGconfKeys. * src/gramps_main.py: Use GrampsGconfKeys. svn: r3573
This commit is contained in:
@ -1,16 +1,50 @@
|
||||
import DateParser
|
||||
import DateDisplay
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2004 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Class handling language-specific selection for date parser and displayer.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
|
||||
try:
|
||||
import gconf
|
||||
except ImportError:
|
||||
import gnome.gconf
|
||||
gconf = gnome.gconf
|
||||
|
||||
client = gconf.client_get_default()
|
||||
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import GrampsGconfKeys
|
||||
import DateParser
|
||||
import DateDisplay
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_lang = os.environ.get('LANG','C')
|
||||
|
||||
|
||||
@ -24,6 +58,11 @@ _lang_to_display = {
|
||||
'en_US' : DateDisplay.DateDisplay,
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Functions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def create_parser():
|
||||
try:
|
||||
return _lang_to_parser[_lang]()
|
||||
@ -31,8 +70,8 @@ def create_parser():
|
||||
return DateParser.DateParser()
|
||||
|
||||
def create_display():
|
||||
val = client.get_int("/apps/gramps/preferences/date-format")
|
||||
try:
|
||||
val = GrampsGconfKeys.get_date_format(_lang_to_display[_lang].formats)
|
||||
return _lang_to_display[_lang](val)
|
||||
except:
|
||||
return DateDisplay.DateDisplay(3)
|
||||
@ -46,13 +85,13 @@ def get_date_formats():
|
||||
|
||||
def set_format(val):
|
||||
try:
|
||||
_lang_to_display[_lang].display_format = val
|
||||
_lang_to_display[_lang].format = val
|
||||
except:
|
||||
pass
|
||||
|
||||
def get_format():
|
||||
try:
|
||||
return _lang_to_display[_lang].display_format
|
||||
return _lang_to_display[_lang].format
|
||||
except:
|
||||
print "not found"
|
||||
return 0
|
||||
|
Reference in New Issue
Block a user