/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: Aaron Bentley
  • Date: 2007-01-02 17:27:43 UTC
  • mto: This revision was merged to the branch mainline in revision 127.
  • Revision ID: aaron.bentley@utoronto.ca-20070102172743-07vtiipbvehi2fmg
Nicer error when PyGTK not installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
__version__ = '0.13.0'
27
27
 
 
28
 
 
29
def import_pygtk():
 
30
    try:
 
31
        import pygtk
 
32
    except ImportError:
 
33
        raise errors.BzrCommandError("PyGTK not installed.")
 
34
    pygtk.require('2.0')
 
35
    return pygtk
 
36
 
 
37
 
28
38
class cmd_gbranch(Command):
29
39
    """GTK+ branching.
30
40
    
31
41
    """
32
42
 
33
43
    def run(self):
34
 
        import pygtk
35
 
        pygtk.require("2.0")
 
44
        pygtk = import_pygtk()
36
45
        try:
37
46
            import gtk
38
47
        except RuntimeError, e:
150
159
    aliases = ["gblame", "gpraise"]
151
160
    
152
161
    def run(self, filename, all=False, plain=False, line='1', revision=None):
153
 
        import pygtk
154
 
        pygtk.require("2.0")
 
162
        pygtk = import_pygtk()
155
163
 
156
164
        try:
157
165
            import gtk
213
221
 
214
222
    def run(self, filename=None):
215
223
        import os
216
 
        import pygtk
217
 
        pygtk.require("2.0")
 
224
        pygtk = import_pygtk()
218
225
 
219
226
        try:
220
227
            import gtk