~bzr/ubuntu/natty/bzr-gtk/bzr-ppa

« back to all changes in this revision

Viewing changes to commands.py

  • Committer: Max Bowsher
  • Date: 2011-03-03 01:58:54 UTC
  • mfrom: (672.1.1 unstable)
  • Revision ID: maxb@f2s.com-20110303015854-57z4ypxclrbf90zg
Tags: 0.100.0-1~bazaar1~natty1
MergeĀ 0.100.0-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from bzrlib import (
18
18
    branch,
19
 
    builtins,
 
19
    errors,
20
20
    workingtree,
21
21
    )
22
22
from bzrlib.commands import (
33
33
 
34
34
from bzrlib.plugins.gtk import (
35
35
    _i18n,
36
 
    open_display,
37
36
    import_pygtk,
38
37
    set_ui_factory,
39
38
    )
40
39
 
 
40
 
 
41
class NoDisplayError(errors.BzrCommandError):
 
42
    """gtk could not find a proper display"""
 
43
 
 
44
    def __str__(self):
 
45
        return "No DISPLAY. Unable to run GTK+ application."
 
46
 
 
47
 
 
48
def open_display():
 
49
    pygtk = import_pygtk()
 
50
    try:
 
51
        import gtk
 
52
    except RuntimeError, e:
 
53
        if str(e) == "could not open display":
 
54
            raise NoDisplayError
 
55
    set_ui_factory()
 
56
    return gtk
 
57
 
 
58
 
 
59
 
41
60
class GTKCommand(Command):
42
61
    """Abstract class providing GTK specific run commands."""
43
62