-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathucl-study-journal
executable file
·102 lines (87 loc) · 3.69 KB
/
ucl-study-journal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /usr/bin/env python
# -.- coding: utf-8 -.-
#
# GNOME Activity Journal
#
# Copyright © 2009 Seif Lotfy <[email protected]>
# Copyright © 2010 Siegfried Gevatter <[email protected]>
# Copyright © 2010 Peter Lund <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import gtk
import gettext
import optparse
# Where this file lives
our_dir = os.path.abspath(os.path.dirname(__file__))
# If UCL Study Journal is installed system-wide, as indicated by
# this file residing in $prefix/bin, we expect to find the remaining code
# in $prefix/share/ucl-study-journal/.
if os.path.basename(our_dir) == 'bin':
sys.path.insert(0, os.path.join(os.path.dirname(our_dir),
'share/ucl-study-journal'))
# Check for critical modules from other repositories.
# Support side-by-side or nested repositories during development.
#
# If zeitgeist is installed locally (with --prefix=<home>/.local) then Python
# should have added ~/.local/lib/python<ver>/site-packages to the search path
# automatically. If it hasn't, then take a closer look at site.USER_SITE,
# site.USER_BASE, and site.ENABLE_USER_SITE.
try:
# repo/module names
other_repos = ['zeitgeist']
# paths of potential repos next to us and below us
repo_paths = ([os.path.join(our_dir, '..', repo) for repo in other_repos] +
[os.path.join(our_dir, '.' , repo) for repo in other_repos])
# look for (and import) the needed modules
from imp import load_module, find_module
for module in other_repos:
m = find_module(module, repo_paths + sys.path)
if "--debug" in sys.argv: # OptParse isn't instantiated yet, here!
print "Using the \"%s\" module from %s" % (module, os.path.abspath(m[1]))
load_module(module, *m)
except ImportError, e:
print "-" * 60
print "ERROR: %s." % e.message
print "The public Python API for Zeitgeist was not found."
print
print "Please see the README file for more information, or contact us"
print "in IRC channel #zeitgeist on Freenode (irc.freenode.net)."
print "-" * 60
sys.exit(1)
from src import config
# Import zeitgeist.datamodel before running gettext.install, so that it doesn't
# override the location we set (ie., "build/mo").
from zeitgeist import datamodel
gettext.bindtextdomain('ucl-study-journal', config.GETTEXT_PATH)
gettext.textdomain('ucl-study-journal')
gettext.install('ucl-study-journal', config.GETTEXT_PATH, unicode=True)
parser = optparse.OptionParser(version=config.VERSION)
parser.add_option("--debug",
action = "store_true", default=False, dest="debug",
help = _("print additional debugging information"))
options, arguments = parser.parse_args()
from src.external import CLIENT, CLIENT_VERSION
if CLIENT_VERSION is None:
sys.exit(1)
elif CLIENT_VERSION < [0, 8, 0]:
print "You need Zeitgeist 0.8.0 or later for the UCL Study Journal to work."
print "https://launchpad.net/zeitgeist"
sys.exit(1)
from src.main import PortalWindow
if __name__ == "__main__":
portal = PortalWindow()
gtk.gdk.threads_init()
gtk.main()