/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: Jelmer Vernooij
  • Date: 2011-08-23 23:53:59 UTC
  • Revision ID: jelmer@samba.org-20110823235359-0k7mlydx8txgvw9x
Mark as supporting bzr 2.5.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
from bzrlib import (
55
55
    branch,
56
56
    config,
 
57
    errors,
57
58
    )
58
59
from bzrlib.commands import plugin_cmds
59
60
 
74
75
    from bzrlib.trace import warning
75
76
    warning("Not running as bzrlib.plugins.gtk, things may break.")
76
77
 
 
78
def import_pygtk():
 
79
    try:
 
80
        import pygtk
 
81
    except ImportError:
 
82
        raise errors.BzrCommandError("PyGTK not installed.")
 
83
    pygtk.require('2.0')
 
84
    return pygtk
 
85
 
77
86
 
78
87
def set_ui_factory():
 
88
    import_pygtk()
79
89
    from ui import GtkUIFactory
80
90
    import bzrlib.ui
81
91
    bzrlib.ui.ui_factory = GtkUIFactory()
129
139
                              "bzrlib.plugins.gtk.commands")
130
140
 
131
141
def save_commit_messages(*args):
132
 
    from bzrlib.plugins.gtk import commitmsgs
133
 
    commitmsgs.save_commit_messages(*args)
 
142
    from bzrlib.plugins.gtk import commit
 
143
    commit.save_commit_messages(*args)
134
144
 
135
145
branch.Branch.hooks.install_named_hook('post_uncommit',
136
146
                                       save_commit_messages,
137
147
                                       "Saving commit messages for gcommit")
138
148
 
139
 
config.option_registry.register(
140
 
    config.Option('nautilus_integration', default=True,
141
 
           from_unicode=config.bool_from_store,
142
 
           help='''\
143
 
Whether to enable nautilus integration.
144
 
 
145
 
Defines whether Nautilus integration should be enabled.
146
 
'''))
 
149
credential_store_registry = getattr(config, "credential_store_registry", None)
 
150
if credential_store_registry is not None:
 
151
    try:
 
152
        credential_store_registry.register_lazy(
 
153
            "gnome-keyring", "bzrlib.plugins.gtk.keyring", "GnomeKeyringCredentialStore",
 
154
            help="The GNOME Keyring.", fallback=True)
 
155
    except TypeError:
 
156
    # Fallback credentials stores were introduced in Bazaar 1.15
 
157
        credential_store_registry.register_lazy(
 
158
            "gnome-keyring", "bzrlib.plugins.gtk.keyring", "GnomeKeyringCredentialStore",
 
159
            help="The GNOME Keyring.")
147
160
 
148
161
 
149
162
def load_tests(basic_tests, module, loader):
155
168
    try:
156
169
        result = basic_tests
157
170
        try:
158
 
            import gi.repository.Gtk
159
 
        except ImportError:
 
171
            import_pygtk()
 
172
        except errors.BzrCommandError:
160
173
            return basic_tests
161
174
        basic_tests.addTest(loader.loadTestsFromModuleNames(
162
175
                ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))