GEPS008: Move const module

svn: r19928
This commit is contained in:
Nick Hall 2012-06-27 17:30:30 +00:00
parent f381a707b0
commit ae1585df82
130 changed files with 326 additions and 341 deletions

View File

@ -90,11 +90,11 @@ po/Makefile.in
m4/Makefile
Makefile
gramps.sh
src/const.py
src/Makefile
src/cli/Makefile
src/cli/plug/Makefile
src/gen/Makefile
src/gen/const.py
src/gen/datehandler/Makefile
src/gen/db/Makefile
src/gen/display/Makefile

View File

@ -2,7 +2,6 @@
#
# Python files
#
src/const.py
src/gramps.py
# cli
@ -13,6 +12,7 @@ src/cli/grampscli.py
src/cli/plug/__init__.py
# gen
src/gen/const.py
src/gen/relationship.py
# gen db API

View File

@ -11,9 +11,7 @@ SUBDIRS = \
gdirdir=$(prefix)/share/gramps
gdir_PYTHON = \
const.py\
gramps.py
gdir_PYTHON = gramps.py
# Clean up all the byte-compiled files
MOSTLYCLEANFILES = *pyc *pyo

View File

@ -46,7 +46,7 @@ import logging
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import LONGOPTS, SHORTOPTS
from gen.config import config
from gen.utils.configmanager import safe_eval
from gen.utils.file import get_unicode_path_from_env_var
@ -218,7 +218,7 @@ class ArgParser(object):
for arg in range(len(self.args) - 1):
self.args[arg+1] = get_unicode_path_from_env_var(self.args[arg + 1])
options, leftargs = getopt.getopt(self.args[1:],
const.SHORTOPTS, const.LONGOPTS)
SHORTOPTS, LONGOPTS)
except getopt.GetoptError, msg:
# Extract the arguments in the list.
# The % operator replaces the list elements with repr() of the list elemements

View File

@ -47,7 +47,7 @@ LOG = logging.getLogger(".grampscli")
#-------------------------------------------------------------------------
from gen.display.name import displayer as name_displayer
from gen.config import config
import const
from gen.const import PLUGINS_DIR, USER_PLUGINS
from gen.errors import DbError
from gen.dbstate import DbState
from gen.db import DbBsddb
@ -280,8 +280,8 @@ class CLIManager(object):
"""
Register the plugins at initialization time.
"""
self._pmgr.reg_plugins(const.PLUGINS_DIR, dbstate, uistate)
self._pmgr.reg_plugins(const.USER_PLUGINS, dbstate, uistate,
self._pmgr.reg_plugins(PLUGINS_DIR, dbstate, uistate)
self._pmgr.reg_plugins(USER_PLUGINS, dbstate, uistate,
append=False, load_on_reg=True)
def startcli(errors, argparser):

View File

@ -58,7 +58,7 @@ from gen.errors import ReportError
from gen.plug.report import (CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK,
CATEGORY_GRAPHVIZ, CATEGORY_CODE)
from gen.plug.report._paper import paper_sizes
import const
from gen.const import USER_HOME
from gen.dbstate import DbState
from cli.grampscli import CLIManager
import cli.user
@ -274,7 +274,7 @@ class CommandLineReport(object):
if noopt:
return
self.options_help['of'][2] = os.path.join(const.USER_HOME,
self.options_help['of'][2] = os.path.join(USER_HOME,
"whatever_name")
if self.category == CATEGORY_TEXT:
@ -304,7 +304,7 @@ class CommandLineReport(object):
"%d\tPortrait" % PAPER_PORTRAIT,
"%d\tLandscape" % PAPER_LANDSCAPE ]
self.options_help['css'][2] = os.path.join(const.USER_HOME,
self.options_help['css'][2] = os.path.join(USER_HOME,
"whatever_name.css")
if self.category in (CATEGORY_TEXT, CATEGORY_DRAW):

View File

@ -22,6 +22,7 @@ pkgpythondir = $(datadir)/@PACKAGE@/gen
pkgpython_PYTHON = \
__init__.py \
config.py \
const.py \
constfunc.py \
dbstate.py \
errors.py \

View File

@ -41,7 +41,7 @@ from gen.ggettext import gettext as _
# Gramps imports
#
#---------------------------------------------------------------
import const
from gen.const import HOME_DIR, USER_HOME, VERSION_DIR
from gen.utils.configmanager import ConfigManager
#---------------------------------------------------------------
@ -49,7 +49,7 @@ from gen.utils.configmanager import ConfigManager
# Constants
#
#---------------------------------------------------------------
INIFILE = os.path.join(const.VERSION_DIR, "gramps.ini")
INIFILE = os.path.join(VERSION_DIR, "gramps.ini")
#---------------------------------------------------------------
#
@ -133,7 +133,7 @@ register('behavior.check-for-update-types', ["new"])
register('behavior.last-check-for-updates', "1970/01/01")
register('behavior.previously-seen-updates', [])
register('behavior.do-not-show-previously-seen-updates', True)
register('behavior.database-path', os.path.join( const.HOME_DIR, 'grampsdb'))
register('behavior.database-path', os.path.join( HOME_DIR, 'grampsdb'))
register('behavior.date-about-range', 50)
register('behavior.date-after-range', 50)
register('behavior.date-before-range', 50)
@ -267,9 +267,9 @@ register('interface.surname-box-height', 150)
register('paths.recent-export-dir', '')
register('paths.recent-file', '')
register('paths.recent-import-dir', '')
register('paths.report-directory', const.USER_HOME)
register('paths.website-directory', const.USER_HOME)
register('paths.quick-backup-directory', const.USER_HOME)
register('paths.report-directory', USER_HOME)
register('paths.website-directory', USER_HOME)
register('paths.quick-backup-directory', USER_HOME)
register('paths.quick-backup-filename',
"%(filename)s_%(year)d-%(month)02d-%(day)02d.%(extension)s")
@ -329,10 +329,10 @@ register('plugin.addonplugins', [])
# we can tell by seeing if there is a key file for this version:
if not os.path.exists(CONFIGMAN.filename):
# If not, let's read old if there:
if os.path.exists(os.path.join(const.HOME_DIR, "keys.ini")):
if os.path.exists(os.path.join(HOME_DIR, "keys.ini")):
# read it in old style:
print >> sys.stderr, "Importing old key file 'keys.ini'..."
CONFIGMAN.load(os.path.join(const.HOME_DIR, "keys.ini"),
CONFIGMAN.load(os.path.join(HOME_DIR, "keys.ini"),
oldstyle=True)
print >> sys.stderr, "Done importing old key file 'keys.ini'"
# other version upgrades here...

View File

@ -86,7 +86,7 @@ if sys.platform == "win32":
PREFIXDIR = sys.prefix
SYSCONFDIR = os.path.join(sys.prefix, "etc")
else:
PREFIXDIR = os.path.dirname(__file__)
PREFIXDIR = os.path.join(os.path.dirname(__file__), os.pardir)
SYSCONFDIR = os.path.join(PREFIXDIR, "etc")
elif sys.platform == "darwin" and sys.prefix != sys.exec_prefix:
PREFIXDIR = sys.prefix
@ -142,8 +142,8 @@ if hasattr(sys, "frozen"):
ROOT_DIR = os.path.abspath(os.path.dirname(
unicode(sys.executable, sys.getfilesystemencoding())))
else:
ROOT_DIR = os.path.abspath(os.path.dirname(
unicode(__file__, sys.getfilesystemencoding())))
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(
unicode(__file__, sys.getfilesystemencoding())), os.pardir))
IMAGE_DIR = os.path.join(ROOT_DIR, "images")
VERSION_DIR = os.path.join(

View File

@ -40,7 +40,7 @@ import sys
# Gramps modules
#
#-------------------------------------------------------------------------
from const import WINDOWS, MACOS, LINUX
from gen.const import WINDOWS, MACOS, LINUX
#-------------------------------------------------------------------------
#

View File

@ -27,7 +27,7 @@ Package providing filtering framework for GRAMPS.
#SystemFilters = None
CustomFilters = None
from const import CUSTOM_FILTERS
from gen.const import CUSTOM_FILTERS
from _filterlist import FilterList
from _genericfilter import GenericFilter, GenericFilterFactory
from _paramfilter import ParamFilter

View File

@ -36,7 +36,7 @@ import libxml2
import libxslt
from libgrampsxml import GRAMPS_XML_VERSION
from const import ROOT_DIR, VERSION, USER_PLUGINS
from gen.const import ROOT_DIR, VERSION, USER_PLUGINS
import gen.lib
from gen.ggettext import sgettext as _

View File

@ -40,8 +40,8 @@ import traceback
# GRAMPS modules
#
#-------------------------------------------------------------------------
from const import VERSION as GRAMPSVERSION, VERSION_TUPLE
from const import IMAGE_DIR
from gen.const import VERSION as GRAMPSVERSION, VERSION_TUPLE
from gen.const import IMAGE_DIR
from gen.utils.trans import get_addon_translator
from gen.ggettext import gettext as _

View File

@ -37,7 +37,6 @@ import os
# Constants
#
#-------------------------------------------------------------------------
import const
# Report categories
from gen.plug import CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_CODE, CATEGORY_WEB,\

View File

@ -57,7 +57,7 @@ except:
# (do not import anything from 'gui' as this is in 'gen')
#
#-------------------------------------------------------------------------
import const
from gen.const import HOME_DIR, REPORT_OPTIONS
from gen.config import config
from gen.plug.docgen import PAPER_PORTRAIT
from gen.plug import _options
@ -577,7 +577,7 @@ class OptionHandler(_options.OptionHandler):
def init_subclass(self):
self.collection_class = OptionListCollection
self.list_class = OptionList
self.filename = const.REPORT_OPTIONS
self.filename = REPORT_OPTIONS
def init_common(self):
"""
@ -658,7 +658,7 @@ class OptionHandler(_options.OptionHandler):
def get_stylesheet_savefile(self):
"""Where to save user defined styles for this report."""
filename = "%s.xml" % self.module_name
return os.path.join(const.HOME_DIR, filename)
return os.path.join(HOME_DIR, filename)
def get_default_stylesheet_name(self):
return self.style_name

View File

@ -35,7 +35,7 @@ from gen.ggettext import sgettext as _
#-------------------------------------------------------------------------
from gen.plug.utils import gfloat
from gen.plug.docgen import PaperSize
import const
from gen.const import PAPERSIZE
#-------------------------------------------------------------------------
#
@ -85,7 +85,7 @@ class PageSizeParser(handler.ContentHandler):
try:
parser = make_parser()
parser.setContentHandler(PageSizeParser(paper_sizes))
the_file = open(const.PAPERSIZE)
the_file = open(PAPERSIZE)
parser.parse(the_file)
the_file.close()
paper_sizes.append(PaperSize(_("Custom Size"), -1, -1))

View File

@ -39,7 +39,7 @@ import os
#
#-------------------------------------------------------------------------
from gen.plug._pluginreg import make_environment
import const
from gen.const import USER_PLUGINS, VERSION_TUPLE
from gen.utils.file import get_unicode_path_from_file_chooser
from gen.ggettext import gettext as _
@ -259,7 +259,7 @@ def load_addon_file(path, callback=None):
if gramps_target_version:
vtup = version_str_to_tup(gramps_target_version, 2)
# Is it for the right version of gramps?
if vtup == const.VERSION_TUPLE[0:2]:
if vtup == VERSION_TUPLE[0:2]:
# If this version is not installed, or > installed, install it
good_gpr.add(gpr_file)
if callback:
@ -281,10 +281,10 @@ def load_addon_file(path, callback=None):
callback(" " + (_("Error: missing gramps_target_version in '%s'...") % gpr_file) + "\n")
if len(good_gpr) > 0:
# Now, install the ok ones
file_obj.extractall(const.USER_PLUGINS)
file_obj.extractall(USER_PLUGINS)
if callback:
callback((_("Installing '%s'...") % path) + "\n")
gpr_files = set([os.path.split(os.path.join(const.USER_PLUGINS, name))[0]
gpr_files = set([os.path.split(os.path.join(USER_PLUGINS, name))[0]
for name in good_gpr])
for gpr_file in gpr_files:
u_gpr_file = get_unicode_path_from_file_chooser(gpr_file)

View File

@ -37,14 +37,14 @@ try:
except:
use_lock = False
import const
from gen.const import HOME_DIR
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
GRAMPS_FILENAME = os.path.join(const.HOME_DIR,"recent-files-gramps.xml")
GRAMPS_FILENAME = os.path.join(HOME_DIR,"recent-files-gramps.xml")
MAX_GRAMPS_ITEMS = 10
#-------------------------------------------------------------------------

View File

@ -37,7 +37,7 @@ from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
from TabbedDoc import *
import const
from gen.const import PROGRAM_NAME, VERSION
from gen.errors import ReportError
@ -485,8 +485,8 @@ class ODSTab(TabbedDoc):
self.f = open(self.meta_xml,"w")
self.f.write(_META %
{'program': const.PROGRAM_NAME,
'version': const.VERSION,
{'program': PROGRAM_NAME,
'version': VERSION,
'name' : self.name,
'time' : self.time,
}

View File

@ -44,7 +44,7 @@ LOG = logging.getLogger(".gen.utils.file")
#
#-------------------------------------------------------------------------
from gen.constfunc import win, mac
from const import TEMP_DIR, USER_HOME
from gen.const import TEMP_DIR, USER_HOME
#-------------------------------------------------------------------------
#

View File

@ -41,7 +41,7 @@ import uuid
# Gramps modules
#
#-------------------------------------------------------------------------
from const import GRAMPS_UUID
from gen.const import GRAMPS_UUID
#-------------------------------------------------------------------------
#

View File

@ -24,7 +24,7 @@
Parses the lds.xml file to build the temple/code maps
"""
import const
from gen.const import DATA_DIR
import os
import logging
@ -48,7 +48,7 @@ class LdsTemples(object):
self.__current_temple = ""
self.__tlist = []
lds_filename = os.path.join(const.DATA_DIR, "lds.xml")
lds_filename = os.path.join(DATA_DIR, "lds.xml")
try:
xml_file = open(os.path.expanduser(lds_filename))

View File

@ -40,7 +40,7 @@ import locale
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import PREFIXDIR, ROOT_DIR
from gen.constfunc import mac
#-------------------------------------------------------------------------
#
@ -49,16 +49,16 @@ from gen.constfunc import mac
#-------------------------------------------------------------------------
if "GRAMPSI18N" in os.environ:
LOCALEDIR = os.environ["GRAMPSI18N"]
elif os.path.exists( os.path.join(const.ROOT_DIR, "lang") ):
LOCALEDIR = os.path.join(const.ROOT_DIR, "lang")
elif os.path.exists(os.path.join(const.PREFIXDIR, "share/locale")):
LOCALEDIR = os.path.join(const.PREFIXDIR, "share/locale")
elif os.path.exists( os.path.join(ROOT_DIR, "lang") ):
LOCALEDIR = os.path.join(ROOT_DIR, "lang")
elif os.path.exists(os.path.join(PREFIXDIR, "share/locale")):
LOCALEDIR = os.path.join(PREFIXDIR, "share/locale")
else:
lang = os.environ.get('LANG', 'en')
if lang and lang[:2] == 'en':
pass # No need to display warning, we're in English
else:
print 'Locale dir does not exist at ' + os.path.join(const.PREFIXDIR, "share/locale")
print 'Locale dir does not exist at ' + os.path.join(PREFIXDIR, "share/locale")
print 'Running ./configure --prefix=YourPrefixDir might fix the problem'
LOCALEDIR = None

View File

@ -40,7 +40,7 @@ import time
#-------------------------------------------------------------------------
import gen.lib
from gen.utils.id import create_id
from const import IMAGE_DIR
from gen.const import IMAGE_DIR
from gen.ggettext import sgettext as _
#-------------------------------------------------------------------------

View File

@ -31,7 +31,7 @@
#-------------------------------------------------------------------------
import sys
import os
import const
from gen.const import APP_GRAMPS, USER_DIRLIST
import signal
import gettext
_ = gettext.gettext
@ -181,7 +181,7 @@ def setup_logging():
def build_user_paths():
""" check/make user-dirs on each Gramps session"""
for path in const.USER_DIRLIST:
for path in USER_DIRLIST:
if os.path.islink(path):
pass # ok
elif not os.path.isdir(path):
@ -265,8 +265,8 @@ def show_settings():
bsddb_db_str = 'not found'
try:
import const
gramps_str = const.VERSION
from gen.const import VERSION
gramps_str = VERSION
except:
gramps_str = 'not found'
@ -357,13 +357,13 @@ def run():
LOG.error("Error reading configuration.", exc_info=True)
return [(_("Error reading configuration"), str(msg))]
if not mime_type_is_defined(const.APP_GRAMPS):
if not mime_type_is_defined(APP_GRAMPS):
error += [(_("Configuration error:"),
_("A definition for the MIME-type %s could not "
"be found \n\n Possibly the installation of Gramps "
"was incomplete. Make sure the MIME-types "
"of Gramps are properly installed.")
% const.APP_GRAMPS)]
% APP_GRAMPS)]
#we start with parsing the arguments to determine if we have a cli or a
# gui session

View File

@ -51,7 +51,9 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import (AUTHORS, AUTHORS_FILE, COMMENTS, COPYRIGHT_MSG,
DOCUMENTERS, LICENSE_FILE, PROGRAM_NAME, SPLASH,
TRANSLATORS, URL_HOMEPAGE, VERSION)
from gui.display import display_url
from gen.config import config
@ -81,9 +83,9 @@ class GrampsAboutDialog(gtk.AboutDialog):
self.set_transient_for(parent)
self.set_modal(True)
self.set_name(const.PROGRAM_NAME)
self.set_version(const.VERSION)
self.set_copyright(const.COPYRIGHT_MSG)
self.set_name(PROGRAM_NAME)
self.set_version(VERSION)
self.set_copyright(COPYRIGHT_MSG)
self.set_artists([
_("Much of Gramps' artwork is either from\n"
"the Tango Project or derived from the Tango\n"
@ -93,25 +95,25 @@ class GrampsAboutDialog(gtk.AboutDialog):
])
try:
ifile = open(const.LICENSE_FILE, "r")
ifile = open(LICENSE_FILE, "r")
self.set_license(ifile.read().replace('\x0c', ''))
ifile.close()
except IOError:
self.set_license("License file is missing")
self.set_comments(_(const.COMMENTS) + self.get_versions())
self.set_comments(_(COMMENTS) + self.get_versions())
self.set_website_label(_('Gramps Homepage'))
self.set_website(const.URL_HOMEPAGE)
self.set_website(URL_HOMEPAGE)
self.set_authors(_get_authors())
# Only set translation credits if they are translated
trans_credits = _(const.TRANSLATORS)
if trans_credits != const.TRANSLATORS:
trans_credits = _(TRANSLATORS)
if trans_credits != TRANSLATORS:
self.set_translator_credits(trans_credits)
self.set_documenters(const.DOCUMENTERS)
self.set_logo(gtk.gdk.pixbuf_new_from_file(const.SPLASH))
self.set_documenters(DOCUMENTERS)
self.set_logo(gtk.gdk.pixbuf_new_from_file(SPLASH))
def get_versions(self):
"""
@ -131,7 +133,7 @@ class GrampsAboutDialog(gtk.AboutDialog):
"LANG: %s\n" +
"OS: %s\n" +
"Distribution: %s")
% (ellipses(str(const.VERSION)),
% (ellipses(str(VERSION)),
ellipses(str(sys.version).replace('\n','')),
ellipses(str(bsddb.__version__) + " " + str(bsddb.db.version())),
ellipses(os.environ.get('LANG','')),
@ -220,7 +222,7 @@ def _get_authors():
parser = make_parser()
parser.setContentHandler(AuthorParser(authors, contributors))
authors_file = open(const.AUTHORS_FILE)
authors_file = open(AUTHORS_FILE)
parser.parse(authors_file)
authors_file.close()
@ -228,7 +230,7 @@ def _get_authors():
[CONTRIB_HEADER] + contributors)
except (IOError, OSError, SAXParseException):
authors_text = const.AUTHORS
authors_text = AUTHORS
return authors_text

View File

@ -44,7 +44,7 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK, ACTION_MOVE
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import IMAGE_DIR, URL_MANUAL_PAGE
from gen.config import config
import gen.lib
import gen.datehandler
@ -63,7 +63,7 @@ import gui.utils
# Constants
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Navigation' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE = '%s_-_Navigation' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Using_the_Clipboard')
#-------------------------------------------------------------------------
@ -72,7 +72,7 @@ WIKI_HELP_SEC = _('manual|Using_the_Clipboard')
#
#-------------------------------------------------------------------------
_stock_image = os.path.join(const.IMAGE_DIR,'stock_link.png')
_stock_image = os.path.join(IMAGE_DIR,'stock_link.png')
LINK_PIC = gtk.gdk.pixbuf_new_from_file(_stock_image)
ICONS = {}
for (name, file) in (
@ -93,7 +93,7 @@ for (name, file) in (
('text', 'gramps-font.png'),
('url', 'gramps-geo.png'),
):
_image = os.path.join(const.IMAGE_DIR, '16x16', file)
_image = os.path.join(IMAGE_DIR, '16x16', file)
ICONS[name] = gtk.gdk.pixbuf_new_from_file(_image)
#-------------------------------------------------------------------------

View File

@ -48,7 +48,6 @@ import gobject
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gui.managedwindow import ManagedWindow
from gui.glade import Glade

View File

@ -47,7 +47,7 @@ import gobject
#
#-------------------------------------------------------------------------
from gen.config import config
import const
from gen.const import HOME_DIR
import gen.datehandler
from gen.display.name import displayer as _nd
from gen.display.name import NameDisplayError
@ -1192,7 +1192,7 @@ class GrampsPreferences(ConfigureDialog):
gtk.RESPONSE_OK))
mpath = self.dbstate.db.get_mediapath()
if not mpath:
mpath = const.HOME_DIR
mpath = HOME_DIR
f.set_current_folder(os.path.dirname(mpath))
status = f.run()

View File

@ -40,13 +40,13 @@ from gtk.gdk import pixbuf_new_from_file
# Gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import ICON
from gen.config import config
from gui.glade import Glade
from gen.ggettext import gettext as _
try:
ICON = pixbuf_new_from_file(const.ICON)
ICON = pixbuf_new_from_file(ICON)
except:
ICON = None

View File

@ -20,7 +20,7 @@
# $Id$
import const
from gen.const import URL_MANUAL_PAGE, URL_WIKISTRING
from gen.constfunc import is_quartz
from gen.config import config
import locale
@ -68,9 +68,9 @@ def display_help(webpage='', section=''):
Display the specified webpage and section from the Gramps 3.0 wiki.
"""
if not webpage:
link = const.URL_WIKISTRING + const.URL_MANUAL_PAGE + EXTENSION
link = URL_WIKISTRING + URL_MANUAL_PAGE + EXTENSION
else:
link = const.URL_WIKISTRING + webpage + EXTENSION
link = URL_WIKISTRING + webpage + EXTENSION
if section:
link = link + '#' + section
display_url(link)

View File

@ -50,7 +50,7 @@ import gtk
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import ICON, THUMBSCALE, USER_HOME
from gen.config import config
from gen.utils.file import (media_path_full, media_path, relative_path,
find_file, get_unicode_path_from_file_chooser)
@ -99,7 +99,7 @@ class AddMediaObject(ManagedWindow):
self.image = self.glade.get_object("image")
self.file_text = self.glade.get_object("fname")
if not(self.last_directory and os.path.isdir(self.last_directory)):
self.last_directory = const.USER_HOME
self.last_directory = USER_HOME
#if existing path, use dir of path
if not self.obj.get_path() == "":
fullname = media_path_full(self.dbase, self.obj.get_path())
@ -200,7 +200,7 @@ class AddMediaObject(ManagedWindow):
if filename:
mtype = gen.mime.get_type(filename)
if mtype and mtype.startswith("image"):
image = scale_image(filename, const.THUMBSCALE)
image = scale_image(filename, THUMBSCALE)
else:
image = find_mime_type_pixbuf(mtype)
self.image.set_from_pixbuf(image)
@ -234,5 +234,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(ICON)

View File

@ -60,7 +60,7 @@ import gen.mime
from gui.ddtargets import DdTargets
from buttontab import ButtonTab
from gen.constfunc import win
import const
from gen.const import THUMBSCALE
#-------------------------------------------------------------------------
#
#
@ -192,11 +192,11 @@ class GalleryTab(ButtonTab, DbGUIElement):
# build the icon view
self.iconlist.set_pixbuf_column(0)
self.iconlist.set_item_width(int(const.THUMBSCALE) + padding * 2)
self.iconlist.set_item_width(int(THUMBSCALE) + padding * 2)
# set custom text cell renderer for better control
text_renderer = gtk.CellRendererText()
text_renderer.set_property('wrap-mode', pango.WRAP_WORD_CHAR)
text_renderer.set_property('wrap-width', const.THUMBSCALE)
text_renderer.set_property('wrap-width', THUMBSCALE)
text_renderer.set_property('alignment', pango.ALIGN_CENTER)
self.iconlist.pack_end(text_renderer)
self.iconlist.set_attributes(text_renderer, text=1)

View File

@ -64,7 +64,7 @@ import gtk
from gen.ggettext import sgettext as _
from gen.lib.date import Date
import gen.datehandler
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
from gui.glade import Glade
@ -97,7 +97,7 @@ CAL_TO_MONTHS_NAMES = {
Date.CAL_ISLAMIC : gen.datehandler.displayer.islamic,
Date.CAL_SWEDISH : gen.datehandler.displayer.swedish }
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_1' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_1' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Editing_Dates')
#-------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@ import gtk
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import URL_MANUAL_PAGE
import gen.lib
from gen.db import DbTxn
from gui.display import display_help
@ -60,7 +60,7 @@ from gen.utils.db import get_participant_from_event
# Constants
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_2' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_2' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Editing_Information_About_Events')
#-------------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ import gtk
#
#-------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
import const
from gen.const import THUMBSCALE
import gen.mime
from gui.thumbnails import get_thumbnail_image, find_mime_type_pixbuf
from gen.utils.file import (media_path_full, find_file,
@ -412,7 +412,7 @@ class EditMediaRef(EditReference):
width = sub_width
height = sub_height
ratio = float(max(height, width))
scale = const.THUMBSCALE / ratio
scale = THUMBSCALE / ratio
x = int(scale * width)
y = int(scale * height)
pixbuf = pixbuf.scale_simple(x, y, gtk.gdk.INTERP_BILINEAR)
@ -458,9 +458,9 @@ class EditMediaRef(EditReference):
def motion_notify_event_ref(self, widget, event):
# get the image size and calculate the X and Y offsets
# (image is centered *horizontally* when smaller than const.THUMBSCALE)
# (image is centered *horizontally* when smaller than THUMBSCALE)
w, h = self.rect_pixbuf.get_width(), self.rect_pixbuf.get_height()
offset_x = (const.THUMBSCALE - w) / 2
offset_x = (THUMBSCALE - w) / 2
offset_y = 0
self.rect_pixmap.draw_pixbuf(self.rect_gc, self.rect_pixbuf, 0, 0, 0, 0)
@ -512,10 +512,10 @@ class EditMediaRef(EditReference):
if new_x2 - new_x1 >= 5 and new_y2 - new_y1 >= 5:
# get the image size and calculate the X and Y offsets
# (image is centered *horizontally* when smaller than const.THUMBSCALE)
# (image is centered *horizontally* when smaller than THUMBSCALE)
w = self.rect_pixbuf.get_width()
h = self.rect_pixbuf.get_height()
x = (const.THUMBSCALE - w) / 2
x = (THUMBSCALE - w) / 2
y = 0
# if the click was outside of the image,

View File

@ -48,7 +48,6 @@ import pango
#
#-------------------------------------------------------------------------
from gen.config import config
import const
from editprimary import EditPrimary
from displaytabs import GrampsTab, NoteBackRefList
from gui.widgets import (MonitoredDataType, MonitoredCheckbox,

View File

@ -35,7 +35,7 @@ import gtk
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
from gui.managedwindow import ManagedWindow
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.listmodel import ListModel, TOGGLE
@ -45,7 +45,7 @@ from gui.listmodel import ListModel, TOGGLE
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Tags')
#-------------------------------------------------------------------------

View File

@ -59,7 +59,7 @@ from gen.filters.rules._matchesfilterbase import MatchesFilterBase
from gui.listmodel import ListModel
from gui.managedwindow import ManagedWindow
from gui.dialog import QuestionDialog
import const
from gen.const import RULE_GLADE, URL_MANUAL_PAGE
from gui.display import display_help
from gen.errors import WindowActiveError
from gen.ggettext import sgettext as _
@ -76,7 +76,7 @@ from gen.utils.string import confidence
# Constants
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = WIKI_HELP_PAGE = '%s_-_Filters' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE = WIKI_HELP_PAGE = '%s_-_Filters' % URL_MANUAL_PAGE
# dictionary mapping FILTER_TYPE of views to Filter window name
_TITLES = {
@ -442,7 +442,7 @@ class EditRule(ManagedWindow):
self.filter_name = filter_name
self.active_rule = val
self.define_glade('rule_editor', const.RULE_GLADE)
self.define_glade('rule_editor', RULE_GLADE)
self.set_window(self.get_widget('rule_editor'),
self.get_widget('rule_editor_title'),label)
@ -731,7 +731,7 @@ class EditFilter(ManagedWindow):
self.filterdb = filterdb
self.selection_callback = selection_callback
self.define_glade('define_filter', const.RULE_GLADE)
self.define_glade('define_filter', RULE_GLADE)
self.set_window(
self.get_widget('define_filter'),
@ -881,7 +881,7 @@ class ShowResults(ManagedWindow):
self.db = db
self.filtname = filtname
self.namespace = namespace
self.define_glade('test', const.RULE_GLADE,)
self.define_glade('test', RULE_GLADE,)
self.set_window(
self.get_widget('test'),
self.get_widget('test_title'),
@ -994,7 +994,7 @@ class FilterEditor(ManagedWindow):
self.height_key = "interface.filter-editor-height"
self.namespace = namespace
self.define_glade('filter_list', const.RULE_GLADE)
self.define_glade('filter_list', RULE_GLADE)
self.filter_list = self.get_widget('filters')
self.edit = self.get_widget('filter_list_edit')
self.clone = self.get_widget('filter_list_clone')

View File

@ -228,9 +228,9 @@ class SidebarFilter(DbGUIElement):
"""
from gui.editors import EditFilter
from gen.filters import FilterList, GenericFilterFactory
import const
from gen.const import CUSTOM_FILTERS
the_filter = None
filterdb = FilterList(const.CUSTOM_FILTERS)
filterdb = FilterList(CUSTOM_FILTERS)
filterdb.load()
if self.generic.get_active() != 0:
model = self.generic.get_model()

View File

@ -47,7 +47,7 @@ import gtk
# gramps modules
#
#------------------------------------------------------------------------
import const
from gen.const import GLADE_DIR
from gen.utils.trans import LOCALEDOMAIN
#------------------------------------------------------------------------
@ -105,7 +105,7 @@ class Glade(gtk.Builder):
path = os.path.join(dirname, filename)
elif filename_given: # try default directory first
path = os.path.join(const.GLADE_DIR, filename)
path = os.path.join(GLADE_DIR, filename)
if not os.path.exists(path): # then module directory
path = os.path.join(dirname, filename)
@ -117,7 +117,7 @@ class Glade(gtk.Builder):
# 2. derived filename in module directory
else:
path = os.path.join(const.GLADE_DIR, filename)
path = os.path.join(GLADE_DIR, filename)
if not os.path.exists(path):
path = os.path.join(dirname, filename)

View File

@ -46,7 +46,7 @@ import gtk
#
#-------------------------------------------------------------------------
import ConfigParser
import const
from gen.const import URL_MANUAL_PAGE, VERSION_DIR
from gui.managedwindow import ManagedWindow
from gui.display import display_help, display_url
from gui.widgets.grampletpane import (AVAILABLE_GRAMPLETS,
@ -65,7 +65,7 @@ from gui.dialog import QuestionDialog
# Constants
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = const.URL_MANUAL_PAGE + '_-_Gramplets'
WIKI_HELP_PAGE = URL_MANUAL_PAGE + '_-_Gramplets'
NL = "\n"
#-------------------------------------------------------------------------
@ -83,7 +83,7 @@ class GrampsBar(gtk.Notebook):
self.dbstate = dbstate
self.uistate = uistate
self.pageview = pageview
self.configfile = os.path.join(const.VERSION_DIR, "%s.ini" % configfile)
self.configfile = os.path.join(VERSION_DIR, "%s.ini" % configfile)
self.defaults = defaults
self.detached_gramplets = []
self.empty = False

View File

@ -57,7 +57,7 @@ import gobject
#
#-------------------------------------------------------------------------
from gen.config import config
import const
from gen.const import DATA_DIR, IMAGE_DIR
from gen.constfunc import has_display, win
#-------------------------------------------------------------------------
@ -76,24 +76,24 @@ def register_stock_icons ():
#iconpath to the base image. The front of the list has highest priority
if win():
iconpaths = [
(os.path.join(const.IMAGE_DIR, '48x48'), '.png'),
(const.IMAGE_DIR, '.png'),
(os.path.join(IMAGE_DIR, '48x48'), '.png'),
(IMAGE_DIR, '.png'),
]
else :
iconpaths = [
(os.path.join(const.IMAGE_DIR, 'scalable'), '.svg'),
(const.IMAGE_DIR, '.svg'), (const.IMAGE_DIR, '.png'),
(os.path.join(IMAGE_DIR, 'scalable'), '.svg'),
(IMAGE_DIR, '.svg'), (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(IMAGE_DIR, '22x22'),
gtk.ICON_SIZE_LARGE_TOOLBAR),
(os.path.join(const.IMAGE_DIR, '16x16'),
(os.path.join(IMAGE_DIR, '16x16'),
gtk.ICON_SIZE_MENU),
(os.path.join(const.IMAGE_DIR, '22x22'),
(os.path.join(IMAGE_DIR, '22x22'),
gtk.ICON_SIZE_BUTTON),
]
@ -328,6 +328,6 @@ def startgtkloop(errors, argparser):
gobject.threads_init()
gobject.timeout_add(100, __startgramps, errors, argparser, priority=100)
if os.path.exists(os.path.join(const.DATA_DIR, "gramps.accel")):
gtk.accel_map_load(os.path.join(const.DATA_DIR, "gramps.accel"))
if os.path.exists(os.path.join(DATA_DIR, "gramps.accel")):
gtk.accel_map_load(os.path.join(DATA_DIR, "gramps.accel"))
gtk.main()

View File

@ -31,7 +31,7 @@ Provide the basic functionality for a list view
#-------------------------------------------------------------------------
import gtk
import pango
import const
from gen.const import THUMBSCALE
#-------------------------------------------------------------------------
#
@ -135,7 +135,7 @@ class ListModel(object):
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', THUMBSCALE / 2)
return renderer, column
def __build_columns(self, dlist):

View File

@ -43,7 +43,7 @@ else:
# Gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import IMAGE_DIR, VERSION
from gui.display import display_help, display_url
#-------------------------------------------------------------------------
@ -51,8 +51,8 @@ from gui.display import display_help, display_url
# 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(IMAGE_DIR, "gramps.png")
SPLASH_JPG = os.path.join(IMAGE_DIR, "splash.jpg")
#-------------------------------------------------------------------------
#
@ -167,7 +167,7 @@ class ErrorReportAssistant(gtk.Assistant):
"cairo version : %s"\
% (str(sys.version).replace('\n',''),
str(bsddb.__version__) + " " + str(bsddb.db.version()),
str(const.VERSION),
str(VERSION),
os.environ.get('LANG',''),
operatingsystem,
distribution,

View File

@ -32,7 +32,7 @@ import gtk
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import URL_MANUAL_PAGE
from gen.ggettext import sgettext as _
from _errorreportassistant import ErrorReportAssistant
from gui.display import display_help
@ -42,7 +42,7 @@ from gui.display import display_help
# Constants
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_FAQ' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE = '%s_-_FAQ' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|General')
class ErrorView(object):

View File

@ -23,7 +23,7 @@
import time
import gen.filters
from gui.editors import EditFilter
import const
from gen.const import CUSTOM_FILTERS
from gen.filters import reload_custom_filters
from gen.ggettext import sgettext as _
@ -49,7 +49,7 @@ def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
'day': struct_time.tm_mday})
re = "|".join(["^%s$" % gid for gid in sorted(gramps_ids)])
filter.add_rule(rule([re]))
filterdb = gen.filters.FilterList(const.CUSTOM_FILTERS)
filterdb = gen.filters.FilterList(CUSTOM_FILTERS)
filterdb.load()
EditFilter(objclass, dbstate, uistate, [],
filter, filterdb,

View File

@ -46,7 +46,7 @@ import gtk
# Gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import GLADE_FILE, ICON
from gen.errors import WindowActiveError
from gen.config import config
from gui.glade import Glade
@ -433,7 +433,7 @@ class ManagedWindow(object):
def define_glade(self, top_module, glade_file=None):
if glade_file is None:
raise TypeError, "ManagedWindow.define_glade: no glade file"
glade_file = const.GLADE_FILE
glade_file = GLADE_FILE
self._gladeobj = Glade(glade_file, None, top_module)
return self._gladeobj
@ -570,4 +570,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(ICON)

View File

@ -31,7 +31,7 @@ Provide merge capabilities for citations.
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
import gen.datehandler
@ -44,7 +44,7 @@ from gen.merge import MergeCitationQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Citations')
_GLADE_FILE = 'mergecitation.glade'

View File

@ -30,7 +30,7 @@ Provide merge capabilities for events.
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
import gen.datehandler
@ -43,7 +43,7 @@ from gen.merge import MergeEventQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Events')
_GLADE_FILE = 'mergeevent.glade'

View File

@ -31,7 +31,7 @@ Provide merge capabilities for families.
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
from gen.display.name import displayer as name_displayer
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gen.errors import MergeError
from gui.dialog import ErrorDialog
@ -44,7 +44,7 @@ from gen.merge import MergePersonQuery, MergeFamilyQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Families')
_GLADE_FILE = 'mergefamily.glade'

View File

@ -30,7 +30,7 @@ Provide merge capabilities for media objects.
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
import gen.datehandler
@ -42,7 +42,7 @@ from gen.merge import MergeMediaQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Media_Objects')
_GLADE_FILE = 'mergemedia.glade'

View File

@ -30,7 +30,7 @@ Provide merge capabilities for notes.
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
from gui.widgets.styledtextbuffer import StyledTextBuffer
@ -42,7 +42,7 @@ from gen.merge import MergeNoteQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Notes')
_GLADE_FILE = 'mergenote.glade'

View File

@ -41,7 +41,7 @@ import pango
from gen.ggettext import sgettext as _
from gen.plug.report import utils as ReportUtils
from gen.display.name import displayer as name_displayer
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
import gen.datehandler
from gen.errors import MergeError
@ -55,7 +55,7 @@ from gen.merge import MergePersonQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = "%s_-_Entering_and_Editing_Data:_Detailed_-_part_3" % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _("manual|Merge_People")
_GLADE_FILE = "mergeperson.glade"

View File

@ -38,7 +38,7 @@ import gtk
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
from gen.merge import MergePlaceQuery
@ -49,7 +49,7 @@ from gen.merge import MergePlaceQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Places')
_GLADE_FILE = 'mergeplace.glade'

View File

@ -30,7 +30,7 @@ Provide merge capabilities for repositories.
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
from gen.merge import MergeRepositoryQuery
@ -41,7 +41,7 @@ from gen.merge import MergeRepositoryQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Repositories')
_GLADE_FILE = 'mergerepository.glade'

View File

@ -32,7 +32,7 @@ Provide merge capabilities for sources.
#
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
from gen.merge import MergeSourceQuery
@ -43,7 +43,7 @@ from gen.merge import MergeSourceQuery
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Merge_Sources')
_GLADE_FILE = 'mergesource.glade'

View File

@ -41,7 +41,7 @@ from collections import defaultdict
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import PLUGINS_GLADE
from gen.plug.report._constants import standalone_categories
from gui.plug import tool
from gen.plug import REPORT
@ -89,7 +89,7 @@ class PluginDialog(ManagedWindow):
self.uistate = uistate
self.dialog = gtk.Builder()
self.dialog.add_from_file(const.PLUGINS_GLADE)
self.dialog.add_from_file(PLUGINS_GLADE)
self.dialog.connect_signals({
"on_report_apply_clicked" : self.on_apply_clicked,
"destroy_passed_object" : self.close,

View File

@ -57,7 +57,7 @@ from _guioptions import add_gui_options
from gui.dialog import InfoDialog
from gui.editors import EditPerson
from gen.utils.file import get_unicode_path_from_file_chooser
import const
from gen.const import URL_WIKISTRING, USER_HOME, WIKI_EXTRAPLUGINS_RAWDATA
from gen.config import config
def display_message(message):
@ -291,7 +291,7 @@ class PluginStatus(ManagedWindow):
"""
import urllib
from gui.utils import ProgressMeter
URL = "%s%s" % (const.URL_WIKISTRING, const.WIKI_EXTRAPLUGINS_RAWDATA)
URL = "%s%s" % (URL_WIKISTRING, WIKI_EXTRAPLUGINS_RAWDATA)
try:
fp = urllib.urlopen(URL)
except:
@ -347,7 +347,7 @@ class PluginStatus(ManagedWindow):
if "|" in url:
url, text = url.split("|", 1)
# need to get a page that says where it is:
fp = urllib.urlopen("%s%s%s" % (const.URL_WIKISTRING, url,
fp = urllib.urlopen("%s%s%s" % (URL_WIKISTRING, url,
"&action=edit&externaledit=true&mode=file"))
for line in fp:
if line.startswith("URL="):
@ -422,7 +422,7 @@ class PluginStatus(ManagedWindow):
name = self.install_addon_path.get_text()
dir = os.path.dirname(name)
if not os.path.isdir(dir):
dir = const.USER_HOME
dir = USER_HOME
name = ''
elif not os.path.isfile(name):
name = ''

View File

@ -55,7 +55,7 @@ import gtk
#
#-------------------------------------------------------------------------
import const
from gen.const import IMAGE_DIR, USER_HOME
from gen.config import config
from gui.pluginmanager import GuiPluginManager
from gen.utils.file import (find_folder, get_new_filename,
@ -69,8 +69,8 @@ from gui.user import User
# 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(IMAGE_DIR,"gramps.png")
_splash_jpg = os.path.join(IMAGE_DIR,"splash.jpg")
#-------------------------------------------------------------------------
#
@ -605,7 +605,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow) :
if len(default_dir)<=1:
default_dir = config.get('paths.recent-import-dir')
if len(default_dir)<=1:
default_dir = const.USER_HOME
default_dir = USER_HOME
if ext == 'gramps':
new_filename = os.path.join(default_dir,'data.gramps')

View File

@ -621,9 +621,9 @@ class WriterOptionBox(object):
"""
from gui.editors import EditFilter
from gen.filters import FilterList, GenericFilterFactory
import const
from gen.const import CUSTOM_FILTERS
the_filter = None
filterdb = FilterList(const.CUSTOM_FILTERS)
filterdb = FilterList(CUSTOM_FILTERS)
filterdb.load()
if filter_obj.get_active() != 0:
model = filter_obj.get_model()

View File

@ -41,7 +41,6 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.config import config
from _reportdialog import ReportDialog
from _papermenu import PaperFrame

View File

@ -63,7 +63,7 @@ from gui.managedwindow import ManagedWindow
from _stylecombobox import StyleComboBox
from _styleeditor import StyleListDisplay
from _fileentry import FileEntry
from const import URL_MANUAL_PAGE
from gen.const import URL_MANUAL_PAGE
from gen.utils.file import get_unicode_path_from_file_chooser
#-------------------------------------------------------------------------
#

View File

@ -49,7 +49,6 @@ from gtk.gdk import Color
# GRAMPS modules
#
#------------------------------------------------------------------------
import const
from gen.plug.docgen import (StyleSheet, FONT_SERIF, FONT_SANS_SERIF,
PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
PARA_ALIGN_JUSTIFY)

View File

@ -38,7 +38,7 @@ log = logging.getLogger(".")
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import TOOL_OPTIONS
from gen.display.name import displayer as name_displayer
from gen.errors import WindowActiveError
from gen.plug._options import (Options, OptionHandler, OptionList,
@ -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 = TOOL_OPTIONS
#------------------------------------------------------------------------
#

View File

@ -46,7 +46,7 @@ from gen.utils.callback import Callback
from gen.plug import BasePluginManager, PluginRegister
from gen.constfunc import win
from gen.config import config
import const
from gen.const import IMAGE_DIR
#-------------------------------------------------------------------------
#
@ -59,10 +59,10 @@ def base_reg_stock_icons(iconpaths, extraiconsize, items):
Reusable base to register stock icons in Gramps
..attribute iconpaths: list of main directory of the base icon, and
extension, eg:
[(os.path.join(const.IMAGE_DIR, 'scalable'), '.svg')]
[(os.path.join(IMAGE_DIR, 'scalable'), '.svg')]
..attribute extraiconsize: list of dir with extra prepared icon sizes and
the gtk size to use them for, eg:
[(os.path.join(const.IMAGE_DIR, '22x22'), gtk.ICON_SIZE_LARGE_TOOLBAR)]
[(os.path.join(IMAGE_DIR, '22x22'), gtk.ICON_SIZE_LARGE_TOOLBAR)]
..attribute items: list of icons to register, eg:
[('gramps-db', _('Family Trees'), gtk.gdk.CONTROL_MASK, 0, '')]
"""
@ -86,7 +86,7 @@ def base_reg_stock_icons(iconpaths, extraiconsize, items):
pass
if not pixbuf :
icon_file = os.path.join(const.IMAGE_DIR, 'gramps.png')
icon_file = os.path.join(IMAGE_DIR, 'gramps.png')
pixbuf = gtk.gdk.pixbuf_new_from_file (icon_file)
## FIXME from gtk 2.17.3/2.15.2 change this to

View File

@ -44,7 +44,7 @@ import gtk
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import THUMBSCALE
from gen.utils.file import media_path_full
from gui.thumbnails import get_thumbnail_image
from gui.views.treemodels import MediaModel
@ -83,8 +83,8 @@ class SelectObject(BaseSelector):
self.width_key = 'interface.media-sel-width'
self.height_key = 'interface.media-sel-height'
self.preview = gtk.Image()
self.preview.set_size_request(int(const.THUMBSCALE),
int(const.THUMBSCALE))
self.preview.set_size_request(int(THUMBSCALE),
int(THUMBSCALE))
vbox = self.glade.get_object('select_person_vbox')
vbox.pack_start(self.preview,False)
vbox.reorder_child(self.preview,1)

View File

@ -49,7 +49,8 @@ import gobject
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import (ICON, IMAGE_DIR, THUMB_LARGE, THUMB_NORMAL, THUMBSCALE,
THUMBSCALE_LARGE, USE_THUMBNAILER)
#-------------------------------------------------------------------------
#
@ -139,9 +140,9 @@ def __build_thumb_path(path, rectangle=None, size=SIZE_NORMAL):
extra = "?" + str(rectangle)
md5_hash = md5(path+extra)
if size == SIZE_LARGE:
base_dir = const.THUMB_LARGE
base_dir = THUMB_LARGE
else:
base_dir = const.THUMB_NORMAL
base_dir = THUMB_NORMAL
return os.path.join(base_dir, md5_hash.hexdigest()+'.png')
#-------------------------------------------------------------------------
@ -194,9 +195,9 @@ def __create_thumbnail_image(src_file, mtype=None, rectangle=None,
height = sub_height
if size == SIZE_LARGE:
thumbscale = const.THUMBSCALE_LARGE
thumbscale = THUMBSCALE_LARGE
else:
thumbscale = const.THUMBSCALE
thumbscale = THUMBSCALE
scale = thumbscale / (float(max(width, height)))
scaled_width = int(width * scale)
@ -229,9 +230,9 @@ 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(ICON)
except:
return gtk.gdk.pixbuf_new_from_file(const.ICON)
return gtk.gdk.pixbuf_new_from_file(ICON)
#-------------------------------------------------------------------------
#
@ -259,7 +260,7 @@ def run_thumbnailer(mime_type, src_file, dest_file, size=SIZE_NORMAL):
"""
# only try this if GCONF is present, the thumbnailer has not been
# disabled, and if the src_file actually exists
if GCONF and const.USE_THUMBNAILER and os.path.isfile(src_file):
if GCONF and USE_THUMBNAILER and os.path.isfile(src_file):
# find the command and enable for the associated mime types by
# querying the gconf database
@ -271,9 +272,9 @@ def run_thumbnailer(mime_type, src_file, dest_file, size=SIZE_NORMAL):
# of the command to build the thumbnail
if cmd and enable:
if size == SIZE_LARGE:
thumbscale = const.THUMBSCALE_LARGE
thumbscale = THUMBSCALE_LARGE
else:
thumbscale = const.THUMBSCALE
thumbscale = THUMBSCALE
sublist = {
'%s' : "%d" % int(thumbscale),
'%u' : src_file,
@ -314,7 +315,7 @@ def get_thumbnail_image(src_file, mtype=None, rectangle=None, size=SIZE_NORMAL):
if mtype:
return find_mime_type_pixbuf(mtype)
else:
default = os.path.join(const.IMAGE_DIR, "document.png")
default = os.path.join(IMAGE_DIR, "document.png")
return gtk.gdk.pixbuf_new_from_file(default)
#-------------------------------------------------------------------------
@ -339,10 +340,10 @@ def get_thumbnail_path(src_file, mtype=None, rectangle=None, size=SIZE_NORMAL):
"""
filename = __build_thumb_path(src_file, rectangle, size)
if not os.path.isfile(src_file):
return os.path.join(const.IMAGE_DIR, "image-missing.png")
return os.path.join(IMAGE_DIR, "image-missing.png")
else:
if (not os.path.isfile(filename)) or (
os.path.getmtime(src_file) > os.path.getmtime(filename)):
if not __create_thumbnail_image(src_file, mtype, rectangle, size):
return os.path.join(const.IMAGE_DIR, "document.png")
return os.path.join(IMAGE_DIR, "document.png")
return os.path.abspath(filename)

View File

@ -45,7 +45,7 @@ import os
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import IMAGE_DIR, TIP_DATA
from gen.config import config
from gui.managedwindow import ManagedWindow
from gui.dialog import ErrorDialog
@ -72,7 +72,7 @@ class TipOfDay(ManagedWindow):
self.use = xml.get_object('usetips')
self.use.set_active(config.get('behavior.use-tips'))
image = xml.get_object('image')
image.set_from_file(os.path.join(const.IMAGE_DIR, 'splash.jpg'))
image.set_from_file(os.path.join(IMAGE_DIR, 'splash.jpg'))
next = xml.get_object('next')
next.connect("clicked", self.next_tip_cb)
@ -139,7 +139,7 @@ class TipParser(object):
self.mylist = []
self.skip = False
xml_file = open(const.TIP_DATA)
xml_file = open(TIP_DATA)
self.tlist = []
parser = ParserCreate()
parser.StartElementHandler = self.startElement

View File

@ -78,7 +78,9 @@ from gen.plug.utils import version_str_to_tup, load_addon_file
from gui.pluginmanager import GuiPluginManager
from gen.relationship import get_relationship_calculator
from gui.displaystate import DisplayState, RecentDocsMenu
import const
from gen.const import (HOME_DIR, ICON, URL_BUGTRACKER, URL_HOMEPAGE,
URL_MAILINGLIST, URL_MANUAL_PAGE, URL_WIKISTRING,
WIKI_EXTRAPLUGINS)
from gen.constfunc import is_quartz
from gen.config import config
from gen.errors import WindowActiveError
@ -226,9 +228,9 @@ UIDEFAULT = '''<ui>
</ui>
'''
WIKI_HELP_PAGE_FAQ = '%s_-_FAQ' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE_KEY = '%s_-_Keybindings' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE_MAN = '%s' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE_FAQ = '%s_-_FAQ' % URL_MANUAL_PAGE
WIKI_HELP_PAGE_KEY = '%s_-_Keybindings' % URL_MANUAL_PAGE
WIKI_HELP_PAGE_MAN = '%s' % URL_MANUAL_PAGE
ADDONS_URL = "http://gramps-addons.svn.sourceforge.net/viewvc/gramps-addons/trunk"
#-------------------------------------------------------------------------
@ -595,7 +597,7 @@ class ViewManager(CLIManager):
height = config.get('interface.height')
self.window = gtk.Window()
self.window.set_icon_from_file(const.ICON)
self.window.set_icon_from_file(ICON)
self.window.set_default_size(width, height)
vbox = gtk.VBox()
@ -1618,7 +1620,7 @@ class ViewManager(CLIManager):
gtk.RESPONSE_OK))
mpath = path_entry.get_text()
if not mpath:
mpath = const.HOME_DIR
mpath = HOME_DIR
f.set_current_folder(os.path.dirname(mpath))
f.set_filename(os.path.join(mpath, "."))
status = f.run()
@ -1832,25 +1834,25 @@ def report_bug_activate(obj):
"""
Display the bug tracker web site
"""
display_url(const.URL_BUGTRACKER)
display_url(URL_BUGTRACKER)
def home_page_activate(obj):
"""
Display the GRAMPS home page
"""
display_url(const.URL_HOMEPAGE)
display_url(URL_HOMEPAGE)
def mailing_lists_activate(obj):
"""
Display the mailing list web page
"""
display_url(const.URL_MAILINGLIST)
display_url(URL_MAILINGLIST)
def extra_plugins_activate(obj):
"""
Display the wiki page with extra plugins
"""
display_url(const.URL_WIKISTRING+const.WIKI_EXTRAPLUGINS)
display_url(URL_WIKISTRING+WIKI_EXTRAPLUGINS)
def faq_activate(obj):
"""

View File

@ -54,7 +54,7 @@ import gtk
from gui.display import display_help
from gui.listmodel import ListModel
from gen.utils.db import navigation_label
import const
from gen.const import URL_MANUAL_PAGE
from gen.ggettext import sgettext as _
#-------------------------------------------------------------------------
@ -62,7 +62,7 @@ from gen.ggettext import sgettext as _
# Constants
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = '%s_-_Navigation' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE = '%s_-_Navigation' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Bookmarks')
#-------------------------------------------------------------------------

View File

@ -57,7 +57,7 @@ from gen.config import config
from gen.errors import WindowActiveError
from gui.filters import SearchBar
from gui.utils import add_menuitem
import const
from gen.const import CUSTOM_FILTERS, USE_TIPS
from gen.utils.debug import profile
from gen.utils.string import data_recover_msg
from gen.utils.file import get_unicode_path_from_file_chooser
@ -297,7 +297,7 @@ class ListView(NavigationView):
self.__display_column_sort()
self.goto_active(None)
if const.USE_TIPS and self.model.tooltip_column() is not None:
if USE_TIPS and self.model.tooltip_column() is not None:
self.list.set_tooltip_column(self.model.tooltip_column())
self.dirty = False
@ -332,7 +332,7 @@ class ListView(NavigationView):
def filter_editor(self, obj):
try:
FilterEditor(self.FILTER_TYPE , const.CUSTOM_FILTERS,
FilterEditor(self.FILTER_TYPE , CUSTOM_FILTERS,
self.dbstate, self.uistate)
except WindowActiveError:
return

View File

@ -46,7 +46,7 @@ from gen.lib import Tag
from gen.db import DbTxn
from gui.dbguielement import DbGUIElement
from gui.listmodel import ListModel, NOSORT, COLOR, INTEGER
import const
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.dialog import ErrorDialog, QuestionDialog2
import gui.widgets.progressdialog as progressdlg
@ -81,7 +81,7 @@ TAG_3 = '''
</ui>'''
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % \
const.URL_MANUAL_PAGE
URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Tags')
#-------------------------------------------------------------------------

View File

@ -42,7 +42,7 @@ from gen.ggettext import gettext as _
#
#-------------------------------------------------------------------------
from gen.errors import WindowActiveError
import const
from gen.const import URL_MANUAL_PAGE, VERSION_DIR
from gui.editors import EditPerson, EditFamily
from gui.managedwindow import ManagedWindow
import ConfigParser
@ -58,7 +58,7 @@ from gui.widgets.undoablebuffer import UndoableBuffer
# Constants
#
#-------------------------------------------------------------------------
WIKI_HELP_PAGE = const.URL_MANUAL_PAGE + '_-_Gramplets'
WIKI_HELP_PAGE = URL_MANUAL_PAGE + '_-_Gramplets'
#-------------------------------------------------------------------------
#
@ -939,7 +939,7 @@ class GrampletPane(gtk.ScrolledWindow):
self._config = Configuration(self)
self.track = []
gtk.ScrolledWindow.__init__(self)
self.configfile = os.path.join(const.VERSION_DIR, "%s.ini" % configfile)
self.configfile = os.path.join(VERSION_DIR, "%s.ini" % configfile)
# default for new user; may be overridden in config:
self.column_count = kwargs.get("column_count", 2)
# width of window, if sidebar; may be overridden in config:

View File

@ -61,7 +61,7 @@ from PySide import QtOpenGL
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import ROOT_DIR
from cli.grampscli import CLIManager, CLIDbLoader
from gen.ggettext import gettext as _
from guiQML.views.dbman import DbManager
@ -100,7 +100,7 @@ class ViewManager(CLIManager):
self.mainview.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
self.engine = self.mainview.engine()
self.engine.rootContext().setBaseUrl(QtCore.QUrl.fromLocalFile(
os.path.join(const.ROOT_DIR, "guiQML")))
os.path.join(ROOT_DIR, "guiQML")))
#set up the family tree list to select from
self.dbman = DbManager(self.dbstate, self.engine, self.load_db)

View File

@ -61,7 +61,7 @@ from PySide import QtOpenGL
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import ROOT_DIR
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
@ -149,7 +149,7 @@ class CentralView(QtCore.QObject):
#create a Component to show
self.centralview = QtDeclarative.QDeclarativeComponent(engine)
self.centralview.loadUrl(QtCore.QUrl.fromLocalFile(
os.path.join(const.ROOT_DIR, "guiQML", 'views', 'centralview.qml')))
os.path.join(ROOT_DIR, "guiQML", 'views', 'centralview.qml')))
#and obtain the QObject of it
self.Qcentralview = self.centralview.create(self.centralviewcontext)

View File

@ -61,7 +61,7 @@ from PySide import QtOpenGL
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import IMAGE_DIR, ROOT_DIR
from cli.clidbman import CLIDbManager, NAME_FILE, time_val
from gen.ggettext import gettext as _
@ -72,7 +72,7 @@ from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#open_icon = QtGui.QIcon.fromTheme('open')
FAMTREE_ICONPATH = os.path.join(const.IMAGE_DIR, '22x22', 'gramps.png')
FAMTREE_ICONPATH = os.path.join(IMAGE_DIR, '22x22', 'gramps.png')
class FamTreeWrapper(QtCore.QObject):
"""
@ -182,7 +182,7 @@ class DbManager(CLIDbManager, QtCore.QObject):
#create a Component to show
self.famtreeview = QtDeclarative.QDeclarativeComponent(engine)
self.famtreeview.loadUrl(QtCore.QUrl.fromLocalFile(
os.path.join(const.ROOT_DIR, "guiQML", 'views', 'dbman.qml')))
os.path.join(ROOT_DIR, "guiQML", 'views', 'dbman.qml')))
#and obtain the QObject of it
self.Qfamtreeview = self.famtreeview.create(self.famtreecontext)

View File

@ -54,7 +54,7 @@ from PySide import QtOpenGL
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import ROOT_DIR
from gui.views.treemodels import conv_unicode_tosrtkey_ongtk
from gen.ggettext import gettext as _
from gen.display.name import displayer as name_displayer
@ -192,7 +192,7 @@ class QMLPersonList(QtCore.QObject):
#create a Component to show
self.qmlpersonlist = QtDeclarative.QDeclarativeComponent(engine)
self.qmlpersonlist.loadUrl(QtCore.QUrl.fromLocalFile(
os.path.join(const.ROOT_DIR, "guiQML", 'views', 'peopleview.qml')))
os.path.join(ROOT_DIR, "guiQML", 'views', 'peopleview.qml')))
#and obtain the QObject of it
self.Qpersonlist = self.qmlpersonlist.create(self.qmlpersonlistcontext)

View File

@ -67,7 +67,7 @@ import gobject
# gramps modules
#
#-------------------------------------------------------------------------
import const
from gen.const import HOME_DIR
from gen.utils.cast import get_type_converter_by_name, type_name
from gui.listmodel import ListModel
from gen.errors import FilterError, ReportError
@ -402,7 +402,7 @@ class BookList(object):
"""
self.dbase = dbase
self.bookmap = {}
self.file = os.path.join(const.HOME_DIR, filename)
self.file = os.path.join(HOME_DIR, filename)
self.parse()
def delete_book(self, name):

View File

@ -47,7 +47,7 @@ from gen.ggettext import gettext as _
#
#------------------------------------------------------------------------
from gen.utils.image import resize_to_jpeg
import const
from gen.const import DATA_DIR, IMAGE_DIR, PROGRAM_NAME, URL_HOMEPAGE, VERSION
from gen.plug.docgen import BaseDoc, TextDoc, FONT_SANS_SERIF, URL_PATTERN
from libhtmlbackend import HtmlBackend, process_spaces
from libhtml import Html
@ -136,8 +136,8 @@ class HtmlDoc(BaseDoc, TextDoc):
"""
# add additional meta tags and stylesheet links to head section
# create additional meta tags
_meta1 = 'name="generator" content="%s %s %s"' % (const.PROGRAM_NAME,
const.VERSION, const.URL_HOMEPAGE)
_meta1 = 'name="generator" content="%s %s %s"' % (PROGRAM_NAME,
VERSION, URL_HOMEPAGE)
meta = Html('meta', attr = _meta1)
#set styles of the report as inline css
@ -292,11 +292,11 @@ class HtmlDoc(BaseDoc, TextDoc):
#css file
if self.css_filename:
#we do an extra check in case file does not exist, eg cli call
fullpath = os.path.join(const.DATA_DIR, self.css_filename)
fullpath = os.path.join(DATA_DIR, self.css_filename)
if os.path.exists(fullpath):
self.copy_file(fullpath, _HTMLSCREEN)
#favicon
self.copy_file(os.path.join(const.IMAGE_DIR, 'favicon.ico'),
self.copy_file(os.path.join(IMAGE_DIR, 'favicon.ico'),
'favicon.ico')
def __reduce_list(self):

View File

@ -86,7 +86,7 @@ from gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc, graphicstyle,
LOCAL_HYPERLINK, LOCAL_TARGET)
from gen.plug.docgen.fontscale import string_width
from libodfbackend import OdfBackend
import const
from gen.const import PROGRAM_NAME, VERSION
from gen.plug.report import utils as ReportUtils
from gen.utils.image import image_size, image_dpi, image_actual_size
from gen.errors import ReportError
@ -1754,7 +1754,7 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
create the meta.xml file
"""
self.meta = StringIO()
generator = const.PROGRAM_NAME + ' ' + const.VERSION
generator = PROGRAM_NAME + ' ' + VERSION
creator = self.get_creator()
date = self.time
lang = self.lang

View File

@ -43,7 +43,7 @@ import time
#
#-------------------------------------------------------------------------
import gen.lib
import const
from gen.const import VERSION
import libgedcom
from gen.errors import DatabaseError
from gui.plug.export import WriterOptionBox
@ -329,7 +329,7 @@ class GedcomWriter(UpdateCallback):
self._writeln(0, "HEAD")
self._writeln(1, "SOUR", "Gramps")
self._writeln(2, "VERS", const.VERSION)
self._writeln(2, "VERS", VERSION)
self._writeln(2, "NAME", "Gramps")
self._writeln(1, "DATE", date_str)
self._writeln(2, "TIME", time_str)

View File

@ -48,7 +48,6 @@ log = logging.getLogger(".WriteGeneWeb")
#-------------------------------------------------------------------------
import gen.lib
from gui.plug.export import WriterOptionBox
#import const
from gen.utils.alive import probably_alive
from gui.glade import Glade
from gen.config import config

View File

@ -48,7 +48,7 @@ log = logging.getLogger(".ExportVCard")
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
from gui.plug.export import WriterOptionBox
import const
from gen.const import PROGRAM_NAME, VERSION
from gen.lib import Date
from gen.lib.urltype import UrlType
from gen.lib.eventtype import EventType
@ -180,7 +180,7 @@ class VCardWriter(object):
self.writeln("BEGIN:VCARD")
self.writeln("VERSION:3.0")
self.writeln("PRODID:-//Gramps//NONSGML %s %s//EN" %
(const.PROGRAM_NAME, const.VERSION))
(PROGRAM_NAME, VERSION))
def write_footer(self):
"""Write the closing lines of a VCard."""

View File

@ -60,7 +60,7 @@ LOG = logging.getLogger(".WriteXML")
import gen.lib
from gen.updatecallback import UpdateCallback
from gen.db.exceptions import DbWriteFailure
import const
from gen.const import VERSION
from gen.constfunc import win
from gui.plug.export import WriterOptionBox
import libgrampsxml
@ -1279,7 +1279,7 @@ class XmlWriter(GrampsXmlWriter):
def __init__(self, dbase, user, strip_photos, compress=1):
GrampsXmlWriter.__init__(
self, dbase, strip_photos, compress, const.VERSION, user)
self, dbase, strip_photos, compress, VERSION, user)
self.user = user
def write(self, filename):

View File

@ -37,7 +37,7 @@ import subprocess
import libxml2
from libgrampsxml import GRAMPS_XML_VERSION
from const import VERSION
from gen.const import VERSION
import exportvcard
class VCardCheck(unittest.TestCase):

View File

@ -25,7 +25,7 @@
#------------------------------------------------------------------------
from gen.plug import Gramplet
from gen.ggettext import sgettext as _
import const
from gen.const import URL_MANUAL_PAGE
#------------------------------------------------------------------------
#
@ -36,7 +36,7 @@ class FAQGramplet(Gramplet):
def init(self):
self.set_use_markup(True)
self.clear_text()
WIKI = const.URL_MANUAL_PAGE
WIKI = URL_MANUAL_PAGE
self.render_text(_("<b><a wiki='%s_-_FAQ'>Frequently Asked Questions</a></b>\n(needs a connection to the internet)\n") % WIKI)
self.render_text("\n<b>%s</b>\n\n" % _("Editing Spouses"))

View File

@ -46,7 +46,7 @@ log = logging.getLogger(".ReadPkg")
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
from gen.const import XMLFILE
import importxml
from gen.utils.file import media_path
@ -89,7 +89,7 @@ def impData(database, name, user):
user.notify_error(_("Error extracting into %s") % tmpdir_path)
return
imp_db_name = os.path.join(tmpdir_path, const.XMLFILE)
imp_db_name = os.path.join(tmpdir_path, XMLFILE)
importer = ImportXml.importData
info = importer(database, imp_db_name, user)

View File

@ -57,7 +57,7 @@ from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY,
MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY,
TAG_KEY, CITATION_KEY)
from gen.updatecallback import UpdateCallback
import const
from gen.const import VERSION
import libgrampsxml
#-------------------------------------------------------------------------
@ -967,7 +967,7 @@ class GrampsParser(UpdateCallback):
"Gramps, while you are running an older version %(older)s. "
"The file will not be imported. Please upgrade to the "
"latest version of Gramps and try again." ) % {
'newer' : self.__gramps_version, 'older' : const.VERSION }
'newer' : self.__gramps_version, 'older' : VERSION }
raise GrampsImportError('', msg)
if self.__xml_version < '1.0.0':
msg = _("The .gramps file you are importing was made by version "
@ -979,7 +979,7 @@ class GrampsParser(UpdateCallback):
"http://gramps-project.org/wiki/index.php?title=GRAMPS_XML"
"\n for more info."
) % {'oldgramps': self.__gramps_version,
'newgramps': const.VERSION,
'newgramps': VERSION,
'xmlversion': self.__xml_version,
}
raise GrampsImportError(_('The file will not be imported'), msg)
@ -994,7 +994,7 @@ class GrampsParser(UpdateCallback):
"http://gramps-project.org/wiki/index.php?title=GRAMPS_XML"
"\nfor more info."
) % {'oldgramps': self.__gramps_version,
'newgramps': const.VERSION,
'newgramps': VERSION,
'xmlversion': self.__xml_version,
}
self.user.warn(_('Old xml file'), msg)

View File

@ -41,7 +41,7 @@ import libxslt
from libgrampsxml import GRAMPS_XML_VERSION
from const import ROOT_DIR, VERSION
from gen.const import ROOT_DIR, VERSION
import importvcard
from importvcard import VCardParser

View File

@ -113,7 +113,7 @@ LOG = logging.getLogger(".libgedcom")
#
#-------------------------------------------------------------------------
from gen.errors import GedcomError
import const
from gen.const import DATA_DIR
import gen.lib
from gen.db import DbTxn
from gen.updatecallback import UpdateCallback
@ -1080,7 +1080,7 @@ class GedcomInfoDB(object):
self.standard.set_dest("GEDCOM 5.5")
try:
filepath = os.path.join(const.DATA_DIR,"gedcom.xml")
filepath = os.path.join(DATA_DIR,"gedcom.xml")
ged_file = open(filepath.encode('iso8859-1'),"r")
except:
return

View File

@ -30,7 +30,7 @@ from xml.parsers import expat
from gen.lib.calendar import (gregorian_ymd, hebrew_sdn)
import datetime
import math
import const
from gen.const import PLUGINS_DIR, USER_PLUGINS
import os
#------------------------------------------------------------------------
@ -151,14 +151,14 @@ class HolidayTable(object):
# Look for holiday files in the user plugins directory and all
# subdirectories.
for (dirpath, dirnames, filenames) in os.walk(const.USER_PLUGINS):
for (dirpath, dirnames, filenames) in os.walk(USER_PLUGINS):
holiday_full_path = os.path.join(dirpath, holiday_file)
if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path)
# Look for holiday files in the installation plugins directory and all
# subdirectories.
for (dirpath, dirnames, filenames) in os.walk(const.PLUGINS_DIR):
for (dirpath, dirnames, filenames) in os.walk(PLUGINS_DIR):
holiday_full_path = os.path.join(dirpath, holiday_file)
if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path)

View File

@ -29,7 +29,7 @@
#-------------------------------------------------------------------------
import gen.lib
import os
import const
from gen.const import HOME_DIR
import osmgpsmap
#-------------------------------------------------------------------------
@ -37,7 +37,7 @@ import osmgpsmap
# Constants
#
#-------------------------------------------------------------------------
GEOGRAPHY_PATH = os.path.join(const.HOME_DIR, "maps")
GEOGRAPHY_PATH = os.path.join(HOME_DIR, "maps")
ICONS = {
gen.lib.EventType.BIRTH : 'gramps-geo-birth',

View File

@ -52,7 +52,6 @@ import gtk
# Gramps Modules
#
#-------------------------------------------------------------------------
import const
import cairo
#-------------------------------------------------------------------------

View File

@ -43,7 +43,6 @@ _LOG = logging.getLogger("maps.dummylayer")
# Gramps Modules
#
#-------------------------------------------------------------------------
import const
#-------------------------------------------------------------------------
#

View File

@ -43,7 +43,6 @@ _LOG = logging.getLogger("maps.dummynogps")
# Gramps Modules
#
#-------------------------------------------------------------------------
import const
#-------------------------------------------------------------------------
#

View File

@ -50,7 +50,7 @@ from gen.display.name import displayer as _nd
from gui.views.navigationview import NavigationView
from libformatting import FormattingHelper
from gen.errors import WindowActiveError
import const
from gen.const import HOME_DIR, ROOT_DIR
from gui.managedwindow import ManagedWindow
from gen.config import config
from gui.editors import EditPlace, EditEvent, EditFamily, EditPerson
@ -75,7 +75,7 @@ _LOG = logging.getLogger("maps.geography")
# Constants
#
#-------------------------------------------------------------------------
GEOGRAPHY_PATH = os.path.join(const.HOME_DIR, "maps")
GEOGRAPHY_PATH = os.path.join(HOME_DIR, "maps")
#-------------------------------------------------------------------------
#
@ -144,11 +144,11 @@ class GeoGraphyView(OsmGps, NavigationView):
self.places_found = []
self.select_fct = None
self.geo_mainmap = gtk.gdk.pixbuf_new_from_file_at_size(
os.path.join(const.ROOT_DIR, "images", "48x48",
os.path.join(ROOT_DIR, "images", "48x48",
('gramps-geo-mainmap' + '.png' )),
48, 48)
self.geo_altmap = gtk.gdk.pixbuf_new_from_file_at_size(
os.path.join(const.ROOT_DIR, "images", "48x48",
os.path.join(ROOT_DIR, "images", "48x48",
('gramps-geo-altmap' + '.png' )),
48, 48)
if ( config.get('geography.map_service') in
@ -161,7 +161,7 @@ class GeoGraphyView(OsmGps, NavigationView):
gen.lib.EventType.DEATH,
gen.lib.EventType.MARRIAGE ):
self.geo_othermap[ident] = gtk.gdk.pixbuf_new_from_file_at_size(
os.path.join(const.ROOT_DIR, "images", "48x48",
os.path.join(ROOT_DIR, "images", "48x48",
(constants.ICONS.get(int(ident), default_image) + '.png' )),
48, 48)

View File

@ -51,7 +51,6 @@ import gtk
# Gramps Modules
#
#-------------------------------------------------------------------------
import const
import cairo
#-------------------------------------------------------------------------

View File

@ -51,7 +51,6 @@ import gtk
# Gramps Modules
#
#-------------------------------------------------------------------------
import const
import cairo
#-------------------------------------------------------------------------
#

View File

@ -52,7 +52,6 @@ import gtk
# Gramps Modules
#
#-------------------------------------------------------------------------
import const
import cairo
import pango
import pangocairo

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