File: olive-gtk

package info (click to toggle)
bzr-gtk 0.94.0-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,528 kB
  • ctags: 902
  • sloc: python: 9,783; sh: 32; makefile: 8
file content (95 lines) | stat: -rwxr-xr-x 2,744 bytes parent folder | download
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
#!/usr/bin/python

# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
#
# 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 2 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

import os
import sys
import re

try:
    version_info = sys.version_info
except AttributeError:
    version_info = 1, 5 # 1.5 or older

REINVOKE = "__BZR_REINVOKE"
NEED_VERS = (2, 4)
KNOWN_PYTHONS = ('python2.4',)

if version_info < NEED_VERS:
    if not os.environ.has_key(REINVOKE):
        # mutating os.environ doesn't work in old Pythons
        os.putenv(REINVOKE, "1")
        for python in KNOWN_PYTHONS:
            try:
                os.execvp(python, [python] + sys.argv)
            except OSError:
                pass
    print >>sys.stderr, ('bzr: error: cannot find a suitable python interpreter'
                         ' (need %d.%d or later)'
                        ) % NEED_VERS
    sys.exit(1)

try:
    import pygtk
    pygtk.require("2.0")
except:
    pass

try:
    import gtk
    import gtk.glade
except:
    print >>sys.stderr, ('You need to install python-glade2 and/or pygtk2 (gtk2)'
                         ' or set your PYTHONPATH correctly.\n'
                         'try: export PYTHONPATH=/usr/local/lib/python2.4/site-packages/'
                        )
    sys.exit(1)

# gettext support
import gettext
gettext.install('olive-gtk')


# make sure we could import bzrlib
try:
    import bzrlib
except ImportError:
    # try to find bzr if it exist in $PATH
    p = os.popen('bzr version')
    s = p.read()
    r = p.close()
    if r not in (None, 0):
        print >>sys.stderr, "bzr not found"
        sys.exit(1)
    else:
        bzrlib_match = re.compile(r"bzrlib: (.*)[/\\]bzrlib").search(s)
        if bzrlib_match:
            sys.path.append(bzrlib_match.group(1))
        else:
            print >>sys.stderr, "Can't find bzrlib location"
            sys.exit(1)

from bzrlib.plugin import load_plugins
load_plugins()

import bzrlib.ui
import bzrlib.plugins.gtk.ui as ui
bzrlib.ui.ui_factory = ui.GtkUIFactory()

from bzrlib.plugins.gtk.olive import OliveGtk
app = OliveGtk()
gtk.main()