1
# This program is free software; you can redistribute it and/or modify
2
# it under the terms of the GNU General Public License as published by
3
# the Free Software Foundation; either version 2 of the License, or
4
# (at your option) any later version.
6
# This program is distributed in the hope that it will be useful,
7
# but WITHOUT ANY WARRANTY; without even the implied warranty of
8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
# GNU General Public License for more details.
11
# You should have received a copy of the GNU General Public License
12
# along with this program; if not, write to the Free Software
13
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
"""Graphical support for Bazaar using GTK.
18
gannotate GTK+ annotate.
19
gbranch GTK+ branching.
20
gcheckout GTK+ checkout.
21
gcommit GTK+ commit dialog.
22
gconflicts GTK+ conflicts.
23
gdiff Show differences in working tree in a GTK+ Window.
24
ginit Initialise a new branch.
25
ginfo GTK+ branch info dialog
26
gloom GTK+ loom browse dialog
27
gmerge GTK+ merge dialog
28
gmissing GTK+ missing revisions dialog.
29
gpreferences GTK+ preferences dialog.
31
gsend GTK+ send merge directive.
32
gstatus GTK+ status dialog.
33
gtags Manage branch tags.
34
visualise Graphically visualise this branch.
39
from bzrlib import errors
40
from bzrlib.commands import plugin_cmds
44
version_info = (0, 96, 0, 'dev', 1)
46
if version_info[3] == 'final':
47
version_string = '%d.%d.%d' % version_info[:3]
49
version_string = '%d.%d.%d%s%d' % version_info
50
__version__ = version_string
52
COMPATIBLE_BZR_VERSIONS = [(1, 6, 0), (1, 7, 0), (1, 8, 0), (1, 9, 0),
53
(1, 10, 0), (1, 11, 0), (1, 12, 0), (1, 13, 0),
56
bzrlib.api.require_any_api(bzrlib, COMPATIBLE_BZR_VERSIONS)
58
if __name__ != 'bzrlib.plugins.gtk':
59
from bzrlib.trace import warning
60
warning("Not running as bzrlib.plugins.gtk, things may break.")
66
raise errors.BzrCommandError("PyGTK not installed.")
73
from ui import GtkUIFactory
75
bzrlib.ui.ui_factory = GtkUIFactory()
79
return [os.path.dirname(__file__),
81
"/usr/local/share/bzr-gtk"]
85
for basedir in data_basedirs():
86
path = os.path.join(basedir, *args)
87
if os.path.exists(path):
93
return data_path(os.path.join('icons', *args))
97
pygtk = import_pygtk()
100
except RuntimeError, e:
101
if str(e) == "could not open display":
108
"gannotate": ["gblame", "gpraise"],
124
"visualise": ["visualize", "vis", "viz"],
128
from bzrlib.plugins import loom
130
pass # Loom plugin doesn't appear to be present
132
commands["gloom"] = []
134
for cmd, aliases in commands.iteritems():
135
plugin_cmds.register_lazy("cmd_%s" % cmd, aliases, "bzrlib.plugins.gtk.commands")
139
gettext.install('olive-gtk')
141
# Let's create a specialized alias to protect '_' from being erased by other
142
# uses of '_' as an anonymous variable (think pdb for one).
143
_i18n = gettext.gettext
145
class NoDisplayError(errors.BzrCommandError):
146
"""gtk could not find a proper display"""
149
return "No DISPLAY. Unable to run GTK+ application."
153
from unittest import TestSuite
156
default_encoding = sys.getdefaultencoding()
161
except errors.BzrCommandError:
163
result.addTest(tests.test_suite())
165
if sys.getdefaultencoding() != default_encoding:
167
sys.setdefaultencoding(default_encoding)