/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: Mikkel Kamstrup Erlandsen
  • Date: 2011-09-28 07:45:39 UTC
  • mto: This revision was merged to the branch mainline in revision 740.
  • Revision ID: mikkel.kamstrup@gmail.com-20110928074539-qxl1yn1bkjel6ir0
Add X-GNOME-Autostart-Delay=30 to bzr-notify.desktop

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
 
 
38
36
import os
39
37
import sys
40
38
 
56
54
from bzrlib import (
57
55
    branch,
58
56
    config,
 
57
    errors,
59
58
    )
60
59
from bzrlib.commands import plugin_cmds
61
60
 
62
 
from bzrlib.plugins.gtk.info import (
 
61
from info import (
63
62
    bzr_plugin_version as version_info,
64
63
    bzr_compatible_versions,
65
64
    )
76
75
    from bzrlib.trace import warning
77
76
    warning("Not running as bzrlib.plugins.gtk, things may break.")
78
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
 
79
86
 
80
87
def set_ui_factory():
81
 
    from bzrlib.plugins.gtk.ui import GtkUIFactory
 
88
    import_pygtk()
 
89
    from ui import GtkUIFactory
82
90
    import bzrlib.ui
83
91
    bzrlib.ui.ui_factory = GtkUIFactory()
84
92
 
131
139
                              "bzrlib.plugins.gtk.commands")
132
140
 
133
141
def save_commit_messages(*args):
134
 
    from bzrlib.plugins.gtk import commitmsgs
135
 
    commitmsgs.save_commit_messages(*args)
 
142
    from bzrlib.plugins.gtk import commit
 
143
    commit.save_commit_messages(*args)
136
144
 
137
145
branch.Branch.hooks.install_named_hook('post_uncommit',
138
146
                                       save_commit_messages,
139
147
                                       "Saving commit messages for gcommit")
140
148
 
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')
 
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.")
 
160
 
145
161
 
146
162
def load_tests(basic_tests, module, loader):
147
163
    testmod_names = [
152
168
    try:
153
169
        result = basic_tests
154
170
        try:
155
 
            import gi.repository.Gtk
156
 
        except ImportError:
 
171
            import_pygtk()
 
172
        except errors.BzrCommandError:
157
173
            return basic_tests
158
174
        basic_tests.addTest(loader.loadTestsFromModuleNames(
159
175
                ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))