add USER_xxx constants to const, use them
svn: r9407
This commit is contained in:
parent
88f23700a0
commit
ecfa4aa0c0
@ -1,3 +1,12 @@
|
||||
2007-11-25 Jim Sack <jgsack@san.rr.com>
|
||||
* src/const.py.in : add USER_xxx for more centralization
|
||||
* src/ViewManager.py : use const.USER_DOCGEN
|
||||
* src/ReportBase/_TemplateParser.py : use const.USER_TEMPLATES
|
||||
* src/plugins/WebCal.py : use const.USER_PLUGINS
|
||||
* src/plugins/Calendar.py : use const.USER_PLUGINS
|
||||
* src/gramps_main.py : use const.USER_DIRLIST
|
||||
const,py.in also includes TEMP_DIR (for upcoming change)
|
||||
|
||||
2007-11-25 Jim Sack <jgsack@san.rr.com>
|
||||
* src/ArgHandler.py : #1397 add except clause for GrampsDbException
|
||||
applies to CLI (not) handling of grdb imports
|
||||
|
@ -93,7 +93,7 @@ _template_map = {
|
||||
}
|
||||
try:
|
||||
template_path = const.TEMPLATE_DIR
|
||||
xmlfile = os.path.join(const.TEMPLATE_DIR,"templates.xml")
|
||||
xmlfile = os.path.join(template_path, "templates.xml")
|
||||
|
||||
if os.path.isfile(xmlfile):
|
||||
parser = make_parser()
|
||||
@ -102,8 +102,8 @@ try:
|
||||
parser.parse(the_file)
|
||||
the_file.close()
|
||||
|
||||
template_path = os.path.join(const.HOME_DIR,"templates")
|
||||
xmlfile = os.path.join(template_path,"templates.xml")
|
||||
template_path = const.USER_TEMPLATES
|
||||
xmlfile = os.path.join(template_path, "templates.xml")
|
||||
if os.path.isfile(xmlfile):
|
||||
parser = make_parser()
|
||||
parser.setContentHandler(TemplateParser(_template_map,template_path))
|
||||
|
@ -585,12 +585,12 @@ class ViewManager:
|
||||
# load document generators
|
||||
self.uistate.status_text(_('Loading document formats...'))
|
||||
error = load_plugins(const.DOCGEN_DIR)
|
||||
error |= load_plugins(os.path.join(const.HOME_DIR, "docgen"))
|
||||
error |= load_plugins(const.USER_DOCGEN)
|
||||
|
||||
# load plugins
|
||||
self.uistate.status_text(_('Loading plugins...'))
|
||||
error |= load_plugins(const.PLUGINS_DIR)
|
||||
error |= load_plugins(os.path.join(const.HOME_DIR, "plugins"))
|
||||
error |= load_plugins(const.USER_PLUGINS)
|
||||
|
||||
# get to ssee if we need to open the plugin status window
|
||||
if Config.get(Config.POP_PLUGIN_STATUS) and error:
|
||||
|
@ -90,8 +90,16 @@ 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")
|
||||
TEMP_DIR = os.path.join(HOME_DIR, "temp")
|
||||
THUMB_DIR = os.path.join(HOME_DIR, "thumb")
|
||||
USER_DOCGEN = os.path.join(HOME_DIR, "docgen")
|
||||
USER_PLUGINS = os.path.join(HOME_DIR, "plugins")
|
||||
USER_TEMPLATES = os.path.join(HOME_DIR, "templates")
|
||||
# dirs checked/made for each Gramps session
|
||||
USER_DIRLIST = (HOME_DIR, ENV_DIR, TEMP_DIR, THUMB_DIR,
|
||||
USER_DOCGEN, USER_PLUGINS, USER_TEMPLATES)
|
||||
|
||||
ICON = os.path.join(ROOT_DIR, "images", "gramps.png")
|
||||
LOGO = os.path.join(ROOT_DIR, "images", "logo.png")
|
||||
|
@ -185,13 +185,8 @@ def register_stock_icons ():
|
||||
|
||||
|
||||
def build_user_paths():
|
||||
user_paths = [const.HOME_DIR,
|
||||
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:
|
||||
""" check/make user-dirs on each Gramps session"""
|
||||
for path in const.USER_DIRLIST:
|
||||
if not os.path.isdir(path):
|
||||
os.mkdir(path)
|
||||
|
||||
@ -256,6 +251,13 @@ class Gramps:
|
||||
ah.handle_args()
|
||||
self.vm.post_init_interface()
|
||||
else:
|
||||
#jgs:
|
||||
from GrampsLogger import GtkHandler
|
||||
for h in log.parent.handlers:
|
||||
if isinstance(h,GtkHandler):
|
||||
log.parent.removeHandler(h)
|
||||
break
|
||||
#jgs:------------------------------
|
||||
ah.handle_args()
|
||||
self.vm.post_init_interface()
|
||||
|
||||
|
@ -182,8 +182,7 @@ class Calendar(Report):
|
||||
|
||||
def get_holidays(self, year, country = "United States"):
|
||||
""" Looks in multiple places for holidays.xml files """
|
||||
locations = [const.PLUGINS_DIR,
|
||||
os.path.join(const.HOME_DIR,"plugins")]
|
||||
locations = [const.PLUGINS_DIR, const.USER_PLUGINS]
|
||||
holiday_file = 'holidays.xml'
|
||||
for dir in locations:
|
||||
holiday_full_path = os.path.join(dir, holiday_file)
|
||||
@ -834,8 +833,7 @@ class Holidays:
|
||||
|
||||
def get_countries():
|
||||
""" Looks in multiple places for holidays.xml files """
|
||||
locations = [const.PLUGINS_DIR,
|
||||
os.path.join(const.HOME_DIR,"plugins")]
|
||||
locations = [const.PLUGINS_DIR, const.USER_PLUGINS]
|
||||
holiday_file = 'holidays.xml'
|
||||
country_list = []
|
||||
for dir in locations:
|
||||
|
@ -228,8 +228,7 @@ class WebReport(Report):
|
||||
|
||||
def get_holidays(self, year, country = "United States"):
|
||||
""" Looks in multiple places for holidays.xml files """
|
||||
locations = [const.PLUGINS_DIR,
|
||||
os.path.join(const.HOME_DIR,"plugins")]
|
||||
locations = [const.PLUGINS_DIR, const.USER_PLUGINS]
|
||||
holiday_file = 'holidays.xml'
|
||||
for dir in locations:
|
||||
holiday_full_path = os.path.join(dir, holiday_file)
|
||||
@ -1315,8 +1314,7 @@ class Holidays:
|
||||
|
||||
def get_countries():
|
||||
""" Looks in multiple places for holidays.xml files """
|
||||
locations = [const.PLUGINS_DIR,
|
||||
os.path.join(const.HOME_DIR,"plugins")]
|
||||
locations = [const.PLUGINS_DIR, const.USER_PLUGINS]
|
||||
holiday_file = 'holidays.xml'
|
||||
country_list = []
|
||||
for dir in locations:
|
||||
|
Loading…
Reference in New Issue
Block a user