19
18
# this program. If not, see <http://www.gnu.org/licenses/>.
20
19
# -----------------------------------------------------------------------------
23
Getting Things Gnome! - A personal organizer for the GNOME desktop
24
==================================================================
26
:copyright: 2008,2009,2010 Lionel Dricot & Bertrand Rousseau
27
:license: GNU General Public License, version 3 or later
21
""" Main script which parse arguments and launch GTG """
31
25
from optparse import OptionParser
26
from gtk.gdk import Screen
33
30
from GTG.tools.import_liblarch import import_liblarch
37
from gtk.gdk import Screen
34
""" Return True if GTG could be displayed on the current XServer """
39
36
if Screen().get_display():
41
38
except RuntimeError:
44
""" Parse arguments and run GTG """
47
45
parser = OptionParser()
48
parser.add_option('-b', '--boot-test', action='store_true', dest='boot_test',
49
help="Exit immediately after completing boot-up actions", default=False)
50
parser.add_option('-c', '--no-crash-handler', action='store_true', dest='no_crash_handler',
51
help="Disable the automatic crash handler", default=False)
46
parser.add_option('-b', '--boot-test', action='store_true',
47
dest='boot_test', help="Exit after completing boot-up actions",
49
parser.add_option('-c', '--no-crash-handler', action='store_true',
50
dest='no_crash_handler', help="Disable the automatic crash handler",
52
52
parser.add_option('-d', '--debug', action='store_true', dest='debug',
53
53
help="Enable debug output", default=False)
54
parser.add_option('-v', '--version', action='store_true', dest='version_and_exit',
55
help="Print GTG's version number", default=False)
54
parser.add_option('-v', '--version', action='store_true',
55
dest='print_version', help="Print GTG's version number", default=False)
56
56
(options, args) = parser.parse_args()
58
if options.version_and_exit:
60
print "GTG (Getting Things Gnome!) %s" %(info.VERSION)
58
if options.print_version:
59
print "GTG (Getting Things Gnome!)", info.VERSION
62
print "For more information: %s" %(info.URL)
61
print "For more information:", info.URL
65
elif not X_is_running():
64
elif not x_is_running():
66
65
print "Could not open X display"
69
68
elif import_liblarch():
71
sys.exit(GTG.gtg.main(options, args))
69
sys.exit(gtg.main(options, args))
73
except KeyboardInterrupt:
71
if __name__ == "__main__":
74
except KeyboardInterrupt: