PageRenderTime 48ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/gramps-3.3.2/src/const.py.in

#
Autoconf | 303 lines | 180 code | 33 blank | 90 comment | 13 complexity | 0457293a54d6460259128613c9cbdbfb MD5 | raw file
Possible License(s): GPL-2.0
  1. # -*- python -*-
  2. #
  3. # Gramps - a GTK+/GNOME based genealogy program
  4. #
  5. # Copyright (C) 2000-2006 Donald N. Allingham
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. #
  21. # $Id: const.py.in 18717 2012-01-07 07:47:07Z romjerome $
  22. """
  23. Provides constants for other modules
  24. """
  25. #-------------------------------------------------------------------------
  26. #
  27. # Standard python modules
  28. #
  29. #-------------------------------------------------------------------------
  30. import os
  31. import sys
  32. import uuid
  33. from gen.ggettext import sgettext as _
  34. #-------------------------------------------------------------------------
  35. #
  36. # Gramps Version
  37. #
  38. #-------------------------------------------------------------------------
  39. PROGRAM_NAME = "Gramps"
  40. if "@VERSIONSTRING@" == "@" + "VERSIONSTRING" + "@":
  41. VERSION = "3.3.2"
  42. else:
  43. VERSION = "@VERSIONSTRING@"
  44. VERSION_TUPLE = (3, 3, 2)
  45. #-------------------------------------------------------------------------
  46. #
  47. # Standard GRAMPS Websites
  48. #
  49. #-------------------------------------------------------------------------
  50. URL_HOMEPAGE = "http://gramps-project.org/"
  51. URL_MAILINGLIST = "http://sourceforge.net/mail/?group_id=25770"
  52. URL_BUGTRACKER = "http://bugs.gramps-project.org/bug_report_advanced_page.php"
  53. URL_WIKISTRING = "http://gramps-project.org/wiki/index.php?title="
  54. URL_MANUAL_PAGE = "Gramps_3.3_Wiki_Manual"
  55. WIKI_FAQ = "FAQ"
  56. WIKI_KEYBINDINGS = "Gramps_3.3_Wiki_Manual_-_Keybindings"
  57. WIKI_EXTRAPLUGINS= "3.3_Addons"
  58. WIKI_EXTRAPLUGINS_RAWDATA = "Plugins3.3&action=raw"
  59. #-------------------------------------------------------------------------
  60. #
  61. # Mime Types
  62. #
  63. #-------------------------------------------------------------------------
  64. APP_FAMTREE = 'x-directory/normal'
  65. APP_GRAMPS = "application/x-gramps"
  66. APP_GRAMPS_XML = "application/x-gramps-xml"
  67. APP_GEDCOM = "application/x-gedcom"
  68. APP_GRAMPS_PKG = "application/x-gramps-package"
  69. APP_GENEWEB = "application/x-geneweb"
  70. APP_VCARD = ["text/x-vcard", "text/x-vcalendar"]
  71. #-------------------------------------------------------------------------
  72. #
  73. # system paths
  74. #
  75. #-------------------------------------------------------------------------
  76. if sys.platform == "win32":
  77. if sys.prefix == os.path.dirname(os.getcwd()):
  78. PREFIXDIR = sys.prefix
  79. SYSCONFDIR = os.path.join(sys.prefix, "etc")
  80. elif sys.platform == "darwin" and sys.prefix != sys.exec_prefix:
  81. PREFIXDIR = sys.prefix
  82. SYSCONFDIR = os.path.join(sys.prefix, "etc")
  83. else:
  84. PREFIXDIR = "@prefix@"
  85. SYSCONFDIR = "@sysconfdir@"
  86. #-------------------------------------------------------------------------
  87. #
  88. # Platforms
  89. # Never test on LINUX, handle Linux in the else statement as default
  90. #
  91. #-------------------------------------------------------------------------
  92. LINUX = ["Linux", "linux", "linux2"]
  93. MACOS = ["Darwin", "darwin"]
  94. WINDOWS = ["Windows", "win32"]
  95. #-------------------------------------------------------------------------
  96. #
  97. # Determine the home directory. According to Wikipedia, most UNIX like
  98. # systems use HOME. I'm assuming that this would apply to OS X as well.
  99. # Windows apparently uses USERPROFILE
  100. #
  101. #-------------------------------------------------------------------------
  102. if os.environ.has_key('GRAMPSHOME'):
  103. USER_HOME = os.environ['GRAMPSHOME']
  104. HOME_DIR = os.path.join(USER_HOME, 'gramps')
  105. elif os.environ.has_key('USERPROFILE'):
  106. USER_HOME = os.environ['USERPROFILE']
  107. if os.environ.has_key('APPDATA'):
  108. HOME_DIR = os.path.join(os.environ['APPDATA'], 'gramps')
  109. else:
  110. HOME_DIR = os.path.join(USER_HOME, 'gramps')
  111. else:
  112. USER_HOME = os.environ['HOME']
  113. HOME_DIR = os.path.join(USER_HOME, '.gramps')
  114. # Conversion of USER_HOME to unicode was needed to have better
  115. # support for non ASCII path names in Windows for the Gramps database.
  116. USER_HOME = unicode(USER_HOME, sys.getfilesystemencoding())
  117. HOME_DIR = unicode(HOME_DIR, sys.getfilesystemencoding())
  118. #-------------------------------------------------------------------------
  119. #
  120. # Paths to files - assumes that files reside in the same directory as
  121. # this one, and that the plugins directory is in a directory below this.
  122. #
  123. #-------------------------------------------------------------------------
  124. # test for sys.frozen to detect a py2exe executable on Windows
  125. if hasattr(sys, "frozen"):
  126. ROOT_DIR = os.path.abspath(os.path.dirname(
  127. unicode(sys.executable, sys.getfilesystemencoding())))
  128. else:
  129. ROOT_DIR = os.path.abspath(os.path.dirname(
  130. unicode(__file__, sys.getfilesystemencoding())))
  131. IMAGE_DIR = os.path.join(ROOT_DIR, "images")
  132. VERSION_DIR = os.path.join(
  133. HOME_DIR, "gramps%s%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1]))
  134. CUSTOM_FILTERS = os.path.join(VERSION_DIR, "custom_filters.xml")
  135. REPORT_OPTIONS = os.path.join(HOME_DIR, "report_options.xml")
  136. TOOL_OPTIONS = os.path.join(HOME_DIR, "tool_options.xml")
  137. ENV_DIR = os.path.join(HOME_DIR, "env")
  138. TEMP_DIR = os.path.join(HOME_DIR, "temp")
  139. THUMB_DIR = os.path.join(HOME_DIR, "thumb")
  140. THUMB_NORMAL = os.path.join(THUMB_DIR, "normal")
  141. THUMB_LARGE = os.path.join(THUMB_DIR, "large")
  142. USER_PLUGINS = os.path.join(VERSION_DIR, "plugins")
  143. # dirs checked/made for each Gramps session
  144. USER_DIRLIST = (HOME_DIR, VERSION_DIR, ENV_DIR, TEMP_DIR, THUMB_DIR,
  145. THUMB_NORMAL, THUMB_LARGE, USER_PLUGINS)
  146. ICON = os.path.join(ROOT_DIR, "images", "gramps.png")
  147. LOGO = os.path.join(ROOT_DIR, "images", "logo.png")
  148. SPLASH = os.path.join(ROOT_DIR, "images", "splash.jpg")
  149. LICENSE_FILE = os.path.join(ROOT_DIR, "COPYING")
  150. #
  151. # Glade files
  152. #
  153. GLADE_DIR = os.path.join(ROOT_DIR, "glade")
  154. GLADE_FILE = os.path.join(GLADE_DIR, "gramps.glade")
  155. PERSON_GLADE = os.path.join(GLADE_DIR, "edit_person.glade")
  156. PLUGINS_GLADE = os.path.join(GLADE_DIR, "plugins.glade")
  157. MERGE_GLADE = os.path.join(GLADE_DIR, "mergedata.glade")
  158. RULE_GLADE = os.path.join(GLADE_DIR, "rule.glade")
  159. PLUGINS_DIR = os.path.join(ROOT_DIR, "plugins")
  160. DATA_DIR = os.path.join(ROOT_DIR, "data")
  161. WEB_DIR = os.path.join(ROOT_DIR, 'web')
  162. #SYSTEM_FILTERS = os.path.join(DATA_DIR, "system_filters.xml")
  163. TIP_DATA = os.path.join(DATA_DIR, "tips.xml")
  164. WEBSTUFF_DIR = os.path.join(PLUGINS_DIR, "webstuff")
  165. PAPERSIZE = os.path.join(DATA_DIR, "papersize.xml")
  166. USE_TIPS = False
  167. if os.sys.platform in WINDOWS:
  168. USE_THUMBNAILER = False
  169. else:
  170. USE_THUMBNAILER = True
  171. #-------------------------------------------------------------------------
  172. #
  173. # About box information
  174. #
  175. #-------------------------------------------------------------------------
  176. COPYRIGHT_MSG = u"\u00A9 2001-2006 Donald N. Allingham\n" \
  177. u"\u00A9 2007-2012 The Gramps Developers"
  178. COMMENTS = _("Gramps (Genealogical Research and Analysis "
  179. "Management Programming System) is a personal "
  180. "genealogy program.")
  181. AUTHORS = [
  182. "Alexander Roitman",
  183. "Benny Malengier",
  184. "Brian Matherly",
  185. "Donald A. Peterson",
  186. "Donald N. Allingham",
  187. "David Hampton",
  188. "Martin Hawlisch",
  189. "Richard Taylor",
  190. "Tim Waugh",
  191. ]
  192. AUTHORS_FILE = os.path.join(DATA_DIR, "authors.xml")
  193. DOCUMENTERS = [
  194. 'Alexander Roitman',
  195. ]
  196. TRANSLATORS = _('TRANSLATORS: Translate this to your '
  197. 'name in your native language')
  198. #-------------------------------------------------------------------------
  199. #
  200. # Constants
  201. #
  202. #-------------------------------------------------------------------------
  203. THUMBSCALE = 96.0
  204. THUMBSCALE_LARGE = 180.0
  205. XMLFILE = "data.gramps"
  206. NO_SURNAME = "(%s)" % _("none")
  207. NO_GIVEN = "(%s)" % _("none")
  208. #-------------------------------------------------------------------------
  209. #
  210. # Options Constants
  211. #
  212. #-------------------------------------------------------------------------
  213. # Note: Make sure to edit argparser.py _help string too!
  214. # (longName, shortName, type , default, flags, descrip , argDescrip)
  215. POPT_TABLE = [
  216. ("config", 'c', str, None, 0, "Set config setting(s) and start Gramps", ""),
  217. ("open", 'O', str, None, 0, "Open family tree", "FAMILY_TREE"),
  218. ("import", 'i', str, None, 0, "Import file", "FILENAME"),
  219. ("export", 'e', str, None, 0, "Export file", "FILENAME"),
  220. ("format", 'f', str, None, 0, 'Specify format', "FORMAT"),
  221. ("action", 'a', str, None, 0, 'Specify action', "ACTION"),
  222. ("options", 'p', str, None, 0, 'Specify options', "OPTIONS_STRING"),
  223. ("debug", 'd', str, None, 0, 'Enable debug logs', "LOGGER_NAME"),
  224. ("", 'l', None, None, 0, 'List Family Trees', ""),
  225. ("", 'L', None, None, 0, 'List Family Tree Details', ""),
  226. ("show", 's', None, None, 0, "Show config settings", ""),
  227. ("force-unlock", 'u', None, None, 0, 'Force unlock of family tree', ""),
  228. ("version", 'v', None, None, 0, 'Show versions', ""),
  229. ]
  230. LONGOPTS = [
  231. "action=",
  232. "class=",
  233. "config=",
  234. "debug=",
  235. "display=",
  236. "disable-sound",
  237. "disable-crash-dialog",
  238. "enable-sound",
  239. "espeaker=",
  240. "export=",
  241. "force-unlock",
  242. "format=",
  243. "gdk-debug=",
  244. "gdk-no-debug=",
  245. "gtk-debug=",
  246. "gtk-no-debug=",
  247. "gtk-module=",
  248. "g-fatal-warnings",
  249. "help",
  250. "import=",
  251. "load-modules=",
  252. "list"
  253. "name=",
  254. "oaf-activate-iid=",
  255. "oaf-ior-fd=",
  256. "oaf-private",
  257. "open=",
  258. "options=",
  259. "screen=",
  260. "show",
  261. "sm-client-id=",
  262. "sm-config-prefix=",
  263. "sm-disable",
  264. "sync",
  265. "usage",
  266. "version",
  267. "qml",
  268. ]
  269. SHORTOPTS = "O:i:e:f:a:p:d:c:lLhuv?s"
  270. GRAMPS_UUID = uuid.UUID('516cd010-5a41-470f-99f8-eb22f1098ad6')