3272: Proposal for updating config settings

svn: r13346
This commit is contained in:
Doug Blank
2009-10-08 01:12:51 +00:00
parent 3959b59d40
commit 99282aa715
94 changed files with 1220 additions and 1230 deletions

View File

@@ -56,7 +56,7 @@ import gobject
#-------------------------------------------------------------------------
from cli.grampscli import CLIDbLoader
import const
import Config
import config
import gen.db
import Utils
from gen.plug import PluginManager
@@ -139,7 +139,7 @@ class DbLoader(CLIDbLoader):
# Suggested folder: try last open file, import, then last export,
# then home.
default_dir = Config.get(Config.RECENT_IMPORT_DIR)
default_dir = config.get('paths.recent-import-dir')
if len(default_dir)<=1:
default_dir = get_default_dir()
@@ -155,7 +155,7 @@ class DbLoader(CLIDbLoader):
continue
(the_path, the_file) = os.path.split(filename)
Config.set(Config.RECENT_IMPORT_DIR, the_path)
config.set('paths.recent-import-dir', the_path)
extension = type_selector.get_value()
if extension == 'auto':
@@ -232,7 +232,7 @@ class DbLoader(CLIDbLoader):
self.import_info = importer(self.dbstate.db, filename,
self.uistate.pulse_progressbar)
dirname = os.path.dirname(filename) + os.path.sep
Config.set(Config.RECENT_IMPORT_DIR, dirname)
config.set('paths.recent-import-dir', dirname)
except UnicodeError, msg:
ErrorDialog(
_("Could not import file: %s") % filename,
@@ -260,13 +260,13 @@ class DbLoader(CLIDbLoader):
def get_default_dir():
# Suggested folder: try last open file, last import, last export,
# then home.
default_dir = os.path.dirname(Config.get(Config.RECENT_FILE))
default_dir = os.path.dirname(config.get('paths.recent-file'))
if default_dir:
default_dir += os.path.sep
if len(default_dir)<=1:
default_dir = Config.get(Config.RECENT_IMPORT_DIR)
default_dir = config.get('paths.recent-import-dir')
if len(default_dir)<=1:
default_dir = Config.get(Config.RECENT_EXPORT_DIR)
default_dir = config.get('paths.recent-export-dir')
if len(default_dir)<=1:
default_dir = '~/'
else:

View File

@@ -60,7 +60,7 @@ import gobject
#
#-------------------------------------------------------------------------
from QuestionDialog import ErrorDialog
import Config
import config
#-------------------------------------------------------------------------
#
@@ -198,7 +198,7 @@ def _display_welcome_message():
"""
Display a welcome message to the user.
"""
if not Config.get(Config.BETAWARN):
if not config.get('behavior.betawarn'):
from QuestionDialog import WarningDialog
WarningDialog(
_('Danger: This is unstable code!'),
@@ -217,9 +217,9 @@ def _display_welcome_message():
"<b>BACKUP</b> your existing databases before opening "
"them with this version, and make sure to export your "
"data to XML every now and then."))
Config.set(Config.AUTOLOAD, False)
# Config.set(Config.BETAWARN, True)
Config.set(Config.BETAWARN, Config.get(Config.BETAWARN))
config.set('behavior.autoload', False)
# config.set('behavior.betawarn', True)
config.set('behavior.betawarn', config.get('behavior.betawarn'))
#-------------------------------------------------------------------------
#
@@ -257,9 +257,9 @@ class Gramps(object):
if ah.open or ah.imp_db_path:
# if we opened or imported something, only show the interface
self.vm.post_init_interface(show_manager=False)
elif Config.get(Config.RECENT_FILE) and Config.get(Config.AUTOLOAD):
elif config.get('paths.recent-file') and config.get('behavior.autoload'):
# if we need to autoload last seen file, do so
filename = Config.get(Config.RECENT_FILE)
filename = config.get('paths.recent-file')
if os.path.isdir(filename) and \
os.path.isfile(os.path.join(filename, "name.txt")) and \
ah.check_db(filename):
@@ -271,7 +271,7 @@ class Gramps(object):
# open without fam tree loaded
self.vm.post_init_interface()
if Config.get(Config.USE_TIPS):
if config.get('behavior.use-tips'):
TipOfDay.TipOfDay(self.vm.uistate)
def argerrorfunc(self, string):

View File

@@ -62,7 +62,7 @@ from PluginUtils import Tool, PluginWindows, \
import ReportBase
import DisplayState
import const
import Config
import config
import GrampsCfg
import Errors
from QuestionDialog import (ErrorDialog, WarningDialog, QuestionDialog2,
@@ -223,10 +223,10 @@ class ViewManager(CLIManager):
self.merge_ids = []
self._key = None
self.show_sidebar = Config.get(Config.VIEW)
self.show_toolbar = Config.get(Config.TOOLBAR_ON)
self.show_filter = Config.get(Config.FILTER)
self.fullscreen = Config.get(Config.FULLSCREEN)
self.show_sidebar = config.get('interface.view')
self.show_toolbar = config.get('interface.toolbar-on')
self.show_filter = config.get('interface.filter')
self.fullscreen = config.get('interface.fullscreen')
self.__build_main_window()
self.__connect_signals()
@@ -244,8 +244,8 @@ class ViewManager(CLIManager):
"""
Builds the GTK interface
"""
width = Config.get(Config.WIDTH)
height = Config.get(Config.HEIGHT)
width = config.get('interface.width')
height = config.get('interface.height')
self.window = gtk.Window()
self.window.set_icon_from_file(const.ICON)
@@ -553,10 +553,10 @@ class ViewManager(CLIManager):
self.__rebuild_report_and_tool_menus)
self.fileactions.set_sensitive(True)
self.uistate.widget.set_sensitive(True)
Config.client.notify_add("/apps/gramps/interface/statusbar",
self.__statusbar_key_update)
Config.client.notify_add("/apps/gramps/interface/filter",
self.__filter_signal)
config.connect("interface.statusbar",
self.__statusbar_key_update)
config.connect("interface.filter",
self.__filter_signal)
def __statusbar_key_update(self, client, cnxn_id, entry, data):
"""
@@ -568,8 +568,8 @@ class ViewManager(CLIManager):
"""
Callback function for statusbar key update
"""
if self.filter_menu.get_active() != Config.get(Config.FILTER):
self.filter_menu.set_active(Config.get(Config.FILTER))
if self.filter_menu.get_active() != config.get('interface.filter'):
self.filter_menu.set_active(config.get('interface.filter'))
def post_init_interface(self, show_manager=True):
"""
@@ -601,7 +601,7 @@ class ViewManager(CLIManager):
error = CLIManager.do_load_plugins(self)
# get to see if we need to open the plugin status window
if error and Config.get(Config.POP_PLUGIN_STATUS):
if error and config.get('behavior.pop-plugin-status'):
self.__plugin_status()
self.uistate.push_message(self.dbstate, _('Ready'))
@@ -622,9 +622,9 @@ class ViewManager(CLIManager):
# save the current window size
(width, height) = self.window.get_size()
Config.set(Config.WIDTH, width)
Config.set(Config.HEIGHT, height)
Config.sync()
config.set('interface.width', width)
config.set('interface.height', height)
config.save()
gtk.main_quit()
def __backup(self):
@@ -742,14 +742,14 @@ class ViewManager(CLIManager):
if obj.get_active():
self.ebox.show()
self.notebook.set_show_tabs(False)
Config.set(Config.VIEW, True)
config.set('interface.view', True)
self.show_sidebar = True
else:
self.ebox.hide()
self.notebook.set_show_tabs(True)
Config.set(Config.VIEW, False)
config.set('interface.view', False)
self.show_sidebar = False
Config.sync()
config.save()
def toolbar_toggle(self, obj):
"""
@@ -758,11 +758,11 @@ class ViewManager(CLIManager):
"""
if obj.get_active():
self.toolbar.show()
Config.set(Config.TOOLBAR_ON, True)
config.set('interface.toolbar-on', True)
else:
self.toolbar.hide()
Config.set(Config.TOOLBAR_ON, False)
Config.sync()
config.set('interface.toolbar-on', False)
config.save()
def fullscreen_toggle(self, obj):
"""
@@ -771,11 +771,11 @@ class ViewManager(CLIManager):
"""
if obj.get_active():
self.window.fullscreen()
Config.set(Config.FULLSCREEN, True)
config.set('interface.fullscreen', True)
else:
self.window.unfullscreen()
Config.set(Config.FULLSCREEN, False)
Config.sync()
config.set('interface.fullscreen', False)
config.save()
def register_view(self, view):
"""
@@ -806,7 +806,7 @@ class ViewManager(CLIManager):
self.pages = []
self.prev_nav = PageView.NAVIGATION_NONE
use_text = Config.get(Config.SIDEBAR_TEXT)
use_text = config.get('interface.sidebar-text')
index = 0
for page_def in self.views:
@@ -846,9 +846,9 @@ class ViewManager(CLIManager):
button.drag_dest_set(0, [], 0)
button.connect('drag_motion', self.__switch_page_on_dnd, page_no)
use_current = Config.get(Config.USE_LAST_VIEW)
use_current = config.get('preferences.use-last-view')
if use_current:
current_page = Config.get(Config.LAST_VIEW)
current_page = config.get('preferences.last-view')
if current_page >= len(self.pages):
current_page = 0
else:
@@ -905,7 +905,7 @@ class ViewManager(CLIManager):
"""
Called when the button causes a page change
"""
if Config.get(Config.VIEW):
if config.get('interface.view'):
self.__vb_handlers_block()
self.notebook.set_current_page(index)
@@ -1007,8 +1007,8 @@ class ViewManager(CLIManager):
if len(self.pages) > 0:
self.active_page = self.pages[num]
self.active_page.set_active()
Config.set(Config.LAST_VIEW, num)
Config.sync()
config.set('preferences.last-view', num)
config.save()
self.__setup_navigation()
self.__connect_active_page()
@@ -1368,8 +1368,8 @@ def filter_toggle(obj):
"""
Save the filter state to the config settings on change
"""
Config.set(Config.FILTER, obj.get_active())
Config.sync()
config.set('interface.filter', obj.get_active())
config.save()
def key_bindings(obj):
"""

View File

@@ -48,7 +48,7 @@ import pango
#
#----------------------------------------------------------------
from gui.views.navigationview import NavigationView
import Config
import config
import TreeTips
import Errors
from Filters import SearchBar
@@ -217,7 +217,7 @@ class ListView(NavigationView):
def build_tree(self):
if self.active:
cput = time.clock()
if Config.get(Config.FILTER):
if config.get('interface.filter'):
filter_info = (True, self.generic_filter)
else:
filter_info = (False, self.search_bar.get_value())
@@ -271,7 +271,7 @@ class ListView(NavigationView):
return hpaned
def filter_toggle(self, client, cnxn_id, entry, data):
if Config.get(Config.FILTER):
if config.get('interface.filter'):
self.search_bar.hide()
self.filter_pane.show()
else:
@@ -280,7 +280,7 @@ class ListView(NavigationView):
def post(self):
if self.filter_class:
if Config.get(Config.FILTER):
if config.get('interface.filter'):
self.search_bar.hide()
self.filter_pane.show()
else:
@@ -300,7 +300,7 @@ class ListView(NavigationView):
self.search_bar.show()
self.filter_pane.hide()
active = False
Config.set(Config.FILTER, active)
config.set('interface.filter', active)
self.build_tree()
def filter_editor(self, obj):
@@ -524,7 +524,7 @@ class ListView(NavigationView):
self.sort_order = order
handle = self.first_selected()
if Config.get(Config.FILTER):
if config.get('interface.filter'):
search = (True, self.generic_filter)
else:
search = (False, self.search_bar.get_value())

View File

@@ -73,7 +73,7 @@ import gtk
#
#-------------------------------------------------------------------------
from Filters import SearchFilter
import Config
import config
from Utils import conv_unicode_tosrtkey_ongtk
#-------------------------------------------------------------------------
@@ -394,16 +394,16 @@ class FlatBaseModel(gtk.GenericTreeModel):
self._reverse = (order == gtk.SORT_DESCENDING)
self.tooltip_column = tooltip_column
Config.client.notify_add("/apps/gramps/preferences/todo-color",
self.__update_todo)
Config.client.notify_add("/apps/gramps/preferences/custom-marker-color",
self.__update_custom)
Config.client.notify_add("/apps/gramps/preferences/complete-color",
self.__update_complete)
config.connect("preferences.todo-color",
self.__update_todo)
config.connect("preferences.custom-marker-color",
self.__update_custom)
config.connect("preferences.complete-color",
self.__update_complete)
self.complete_color = Config.get(Config.COMPLETE_COLOR)
self.todo_color = Config.get(Config.TODO_COLOR)
self.custom_color = Config.get(Config.CUSTOM_MARKER_COLOR)
self.complete_color = config.get('preferences.complete-color')
self.todo_color = config.get('preferences.todo-color')
self.custom_color = config.get('preferences.custom-marker-color')
self.rebuild_data()
_LOG.debug(self.__class__.__name__ + ' __init__ ' +
str(time.clock() - cput) + ' sec')
@@ -441,19 +441,19 @@ class FlatBaseModel(gtk.GenericTreeModel):
"""
Callback if preferences todo color changes
"""
self.todo_color = Config.get(Config.TODO_COLOR)
self.todo_color = config.get('preferences.todo-color')
def __update_custom(self, client, cnxn_id, entry, data):
"""
Callback if preferences todo color changes
"""
self.custom_color = Config.get(Config.CUSTOM_MARKER_COLOR)
self.custom_color = config.get('preferences.custom-marker-color')
def __update_complete(self, client, cnxn_id, entry, data):
"""
Callback if preferences todo color changes
"""
self.complete_color = Config.get(Config.COMPLETE_COLOR)
self.complete_color = config.get('preferences.complete-color')
def total(self):
"""

View File

@@ -48,7 +48,7 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Config
import config
from gen.utils.longop import LongOpStatus
from Filters import SearchFilter
# from Filters import ExactSearchFilter
@@ -361,16 +361,16 @@ class TreeBaseModel(gtk.GenericTreeModel):
self.lru_data = LRU(TreeBaseModel._CACHE_SIZE)
Config.client.notify_add("/apps/gramps/preferences/todo-color",
self.__update_todo)
Config.client.notify_add("/apps/gramps/preferences/custom-marker-color",
self.__update_custom)
Config.client.notify_add("/apps/gramps/preferences/complete-color",
self.__update_complete)
config.connect("preferences.todo-color",
self.__update_todo)
config.connect("preferences.custom-marker-color",
self.__update_custom)
config.connect("preferences.complete-color",
self.__update_complete)
self.complete_color = Config.get(Config.COMPLETE_COLOR)
self.todo_color = Config.get(Config.TODO_COLOR)
self.custom_color = Config.get(Config.CUSTOM_MARKER_COLOR)
self.complete_color = config.get('preferences.complete-color')
self.todo_color = config.get('preferences.todo-color')
self.custom_color = config.get('preferences.custom-marker-color')
self.mapper = TreeNodeMap()
self.set_search(search)
@@ -388,13 +388,13 @@ class TreeBaseModel(gtk.GenericTreeModel):
def __update_todo(self, *args):
self.todo_color = Config.get(Config.TODO_COLOR)
self.todo_color = config.get('preferences.todo-color')
def __update_custom(self, *args):
self.custom_color = Config.get(Config.CUSTOM_MARKER_COLOR)
self.custom_color = config.get('preferences.custom-marker-color')
def __update_complete(self, *args):
self.complete_color = Config.get(Config.COMPLETE_COLOR)
self.complete_color = config.get('preferences.complete-color')
def displayed(self):
return self.__displayed