/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-11-29 10:06:50 UTC
  • Revision ID: jelmer@samba.org-20111129100650-9oit3f44pxre4uq8
Credit Curtis.

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,
58
57
    )
59
58
from bzrlib.commands import plugin_cmds
60
59
 
75
74
    from bzrlib.trace import warning
76
75
    warning("Not running as bzrlib.plugins.gtk, things may break.")
77
76
 
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
 
 
86
77
 
87
78
def set_ui_factory():
88
 
    import_pygtk()
89
79
    from ui import GtkUIFactory
90
80
    import bzrlib.ui
91
81
    bzrlib.ui.ui_factory = GtkUIFactory()
139
129
                              "bzrlib.plugins.gtk.commands")
140
130
 
141
131
def save_commit_messages(*args):
142
 
    from bzrlib.plugins.gtk import commit
143
 
    commit.save_commit_messages(*args)
 
132
    from bzrlib.plugins.gtk import commitmsgs
 
133
    commitmsgs.save_commit_messages(*args)
144
134
 
145
135
branch.Branch.hooks.install_named_hook('post_uncommit',
146
136
                                       save_commit_messages,
147
137
                                       "Saving commit messages for gcommit")
148
138
 
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.")
 
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
'''))
160
147
 
161
148
 
162
149
def load_tests(basic_tests, module, loader):
168
155
    try:
169
156
        result = basic_tests
170
157
        try:
171
 
            import_pygtk()
172
 
        except errors.BzrCommandError:
 
158
            import gi.repository.Gtk
 
159
        except ImportError:
173
160
            return basic_tests
174
161
        basic_tests.addTest(loader.loadTestsFromModuleNames(
175
162
                ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))