/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Curtis Hovey
  • Date: 2012-02-09 03:43:01 UTC
  • mto: This revision was merged to the branch mainline in revision 776.
  • Revision ID: sinzui.is@verizon.net-20120209034301-0uwkobbb0d64ugrw
Switched from Gtk.VPaned to Gtk.Paned.new(Gtk.Orientation.VERTICAL).

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
visualise         Graphically visualise this branch.
34
34
"""
35
35
 
 
36
from __future__ import absolute_import
 
37
 
36
38
import os
37
39
import sys
38
40
 
54
56
from bzrlib import (
55
57
    branch,
56
58
    config,
57
 
    errors,
58
59
    )
59
60
from bzrlib.commands import plugin_cmds
60
61
 
61
 
from info import (
 
62
from bzrlib.plugins.gtk.info import (
62
63
    bzr_plugin_version as version_info,
63
64
    bzr_compatible_versions,
64
65
    )
65
 
from gettext import (
66
 
    gettext,
67
 
    textdomain,
68
 
    bindtextdomain,
69
 
    bind_textdomain_codeset,
70
 
    )
71
 
 
72
 
# FIXME: We should find out LOCALEDIR at compile or run time. The current
73
 
# hardcoded path will work for most distributions, but not for e.g. Solaris and
74
 
# Windows
75
 
GETTEXT_PACKAGE = 'bzr-gtk'
76
 
LOCALEDIR = '/usr/share/locale'
77
 
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR)
78
 
bind_textdomain_codeset(GETTEXT_PACKAGE, 'UTF-8')
79
 
textdomain(GETTEXT_PACKAGE)
80
66
 
81
67
if version_info[3] == 'final':
82
68
    version_string = '%d.%d.%d' % version_info[:3]
90
76
    from bzrlib.trace import warning
91
77
    warning("Not running as bzrlib.plugins.gtk, things may break.")
92
78
 
93
 
def import_pygtk():
94
 
    try:
95
 
        import pygtk
96
 
    except ImportError:
97
 
        raise errors.BzrCommandError("PyGTK not installed.")
98
 
    pygtk.require('2.0')
99
 
    return pygtk
100
 
 
101
79
 
102
80
def set_ui_factory():
103
 
    import_pygtk()
104
 
    from ui import GtkUIFactory
 
81
    from bzrlib.plugins.gtk.ui import GtkUIFactory
105
82
    import bzrlib.ui
106
83
    bzrlib.ui.ui_factory = GtkUIFactory()
107
84
 
154
131
                              "bzrlib.plugins.gtk.commands")
155
132
 
156
133
def save_commit_messages(*args):
157
 
    from bzrlib.plugins.gtk import commit
158
 
    commit.save_commit_messages(*args)
 
134
    from bzrlib.plugins.gtk import commitmsgs
 
135
    commitmsgs.save_commit_messages(*args)
159
136
 
160
137
branch.Branch.hooks.install_named_hook('post_uncommit',
161
138
                                       save_commit_messages,
162
139
                                       "Saving commit messages for gcommit")
163
140
 
164
 
credential_store_registry = getattr(config, "credential_store_registry", None)
165
 
if credential_store_registry is not None:
166
 
    try:
167
 
        credential_store_registry.register_lazy(
168
 
            "gnome-keyring", "bzrlib.plugins.gtk.keyring", "GnomeKeyringCredentialStore",
169
 
            help="The GNOME Keyring.", fallback=True)
170
 
    except TypeError:
171
 
    # Fallback credentials stores were introduced in Bazaar 1.15
172
 
        credential_store_registry.register_lazy(
173
 
            "gnome-keyring", "bzrlib.plugins.gtk.keyring", "GnomeKeyringCredentialStore",
174
 
            help="The GNOME Keyring.")
175
 
 
 
141
option_registry = getattr(config, "option_registry", None)
 
142
if option_registry is not None:
 
143
    config.option_registry.register_lazy('nautilus_integration',
 
144
            'bzrlib.plugins.gtk.config', 'opt_nautilus_integration')
176
145
 
177
146
def load_tests(basic_tests, module, loader):
178
147
    testmod_names = [
183
152
    try:
184
153
        result = basic_tests
185
154
        try:
186
 
            import_pygtk()
187
 
        except errors.BzrCommandError:
 
155
            import gi.repository.Gtk
 
156
        except ImportError:
188
157
            return basic_tests
189
158
        basic_tests.addTest(loader.loadTestsFromModuleNames(
190
159
                ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
194
163
            sys.setdefaultencoding(default_encoding)
195
164
    return basic_tests
196
165
 
197
 
 
198
 
def _i18n(text):
199
 
    return gettext(text)