* src/gramps_main.py (__init__): Catch "ErrorSchemaInvalid" exception
* src/Errors.py (GConfSchemaError): Add new exception. * src/const.py.in: Remove exception string "ErrorSchemaInvalid" (replaced by new class). * src/GrampsGconfKeys.py (get_bool,get_int,get_string): Raise exception. svn: r4204
This commit is contained in:
parent
42353719e3
commit
dac485ee26
@ -4,7 +4,7 @@
|
|||||||
* src/const.py.in: Add custom exception "ErrorSchemaInvalid"
|
* src/const.py.in: Add custom exception "ErrorSchemaInvalid"
|
||||||
* src/GrampsMime.py (mime_type_is_defined): New method that returns
|
* src/GrampsMime.py (mime_type_is_defined): New method that returns
|
||||||
True/False
|
True/False
|
||||||
* src/gramps_main.py (__init__) Catch "ErrorSchemaInvalid" exception
|
* src/gramps_main.py (__init__): Catch "ErrorSchemaInvalid" exception
|
||||||
and check for installed MIME-type. Show error because installation is
|
and check for installed MIME-type. Show error because installation is
|
||||||
incomplete.
|
incomplete.
|
||||||
|
|
||||||
@ -14,6 +14,11 @@
|
|||||||
* src/data/Makefile.am: Use defined GCONF_SCHEMA_FILE_DIR and
|
* src/data/Makefile.am: Use defined GCONF_SCHEMA_FILE_DIR and
|
||||||
SHARED_MIME_DIR, not the hardcoded paths.
|
SHARED_MIME_DIR, not the hardcoded paths.
|
||||||
|
|
||||||
|
* src/Errors.py (GConfSchemaError): Add new exception.
|
||||||
|
* src/const.py.in: Remove exception string "ErrorSchemaInvalid"
|
||||||
|
(replaced by new class).
|
||||||
|
* src/GrampsGconfKeys.py (get_bool,get_int,get_string): Raise exception.
|
||||||
|
|
||||||
2005-03-17 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2005-03-17 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/Exporter.py (build_info_page): proofreading; (build_format_page):
|
* src/Exporter.py (build_info_page): proofreading; (build_format_page):
|
||||||
shrink the size of the window by using tooltips to display the
|
shrink the size of the window by using tooltips to display the
|
||||||
|
@ -81,3 +81,12 @@ class HandleError(Exception):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
class GConfSchemaError(Exception):
|
||||||
|
"""Error used to report the absence of expected GConf schema."""
|
||||||
|
def __init__(self,value):
|
||||||
|
Exception.__init__(self)
|
||||||
|
self.value = value
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.value
|
||||||
|
@ -38,7 +38,7 @@ except ImportError:
|
|||||||
|
|
||||||
import gobject
|
import gobject
|
||||||
import os
|
import os
|
||||||
from const import ErrorSchemaInvalid
|
import Errors
|
||||||
|
|
||||||
client = gconf.client_get_default()
|
client = gconf.client_get_default()
|
||||||
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
|
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
|
||||||
@ -349,7 +349,7 @@ def get_bool(key):
|
|||||||
else:
|
else:
|
||||||
val = client.get_default_from_schema(key)
|
val = client.get_default_from_schema(key)
|
||||||
if val == None:
|
if val == None:
|
||||||
raise ErrorSchemaInvalid, "No default value for key "+key
|
raise Errors.GConfSchemaError("No default value for key "+key)
|
||||||
return val.get_bool()
|
return val.get_bool()
|
||||||
|
|
||||||
def set_bool(key,val):
|
def set_bool(key,val):
|
||||||
@ -366,7 +366,7 @@ def get_int(key,correct_tuple=None):
|
|||||||
else:
|
else:
|
||||||
val = client.get_default_from_schema(key)
|
val = client.get_default_from_schema(key)
|
||||||
if val == None:
|
if val == None:
|
||||||
raise ErrorSchemaInvalid, "No default value for key "+key
|
raise Errors.GConfSchemaError("No default value for key "+key)
|
||||||
return val.get_int()
|
return val.get_int()
|
||||||
|
|
||||||
def set_int(key,val,correct_tuple=None):
|
def set_int(key,val,correct_tuple=None):
|
||||||
@ -383,7 +383,7 @@ def get_string(key,test_func=None):
|
|||||||
else:
|
else:
|
||||||
val = client.get_default_from_schema(key)
|
val = client.get_default_from_schema(key)
|
||||||
if val == None:
|
if val == None:
|
||||||
raise ErrorSchemaInvalid, "No default value for key "+key
|
raise Errors.GConfSchemaError("No default value for key "+key)
|
||||||
return val.get_string()
|
return val.get_string()
|
||||||
|
|
||||||
def set_string(key,val,test_func=None):
|
def set_string(key,val,test_func=None):
|
||||||
|
@ -154,13 +154,6 @@ documenters = [
|
|||||||
|
|
||||||
translators = _('TRANSLATORS: Translate this to your name in your native language')
|
translators = _('TRANSLATORS: Translate this to your name in your native language')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# custom exception
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
ErrorSchemaInvalid = "GConf schema not properly installed"
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Constants
|
# Constants
|
||||||
|
Loading…
x
Reference in New Issue
Block a user