diff options
author | Joshua Lock <josh@linux.intel.com> | 2012-03-20 17:05:03 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-22 14:40:41 +0000 |
commit | 457ec75e390e7ee1193a9b62a463b28db5730845 (patch) | |
tree | 82fb1f80814970e2871315f9b0937e379a771c1f /bitbake/lib | |
parent | e587c1ef3f747e6fdbdd0ccd895fc1c3daca14ae (diff) | |
download | poky-457ec75e390e7ee1193a9b62a463b28db5730845.tar.gz |
ui/crumbs/persistenttooltip: fix whitespace
We use 4 spaces, not a tab, in BitBake
(From Poky rev: 7d9c9fd7c267d69bab51590074d66a2d68e98ca6)
(Bitbake rev: 7658cd6d8e0e558f60df72b294019a40c27bc703)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/persistenttooltip.py | 264 |
1 files changed, 132 insertions, 132 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py index d065ab2c07..8ba0043381 100644 --- a/bitbake/lib/bb/ui/crumbs/persistenttooltip.py +++ b/bitbake/lib/bb/ui/crumbs/persistenttooltip.py | |||
@@ -26,135 +26,135 @@ except: | |||
26 | pass | 26 | pass |
27 | 27 | ||
28 | class PersistentTooltip(gtk.Window): | 28 | class PersistentTooltip(gtk.Window): |
29 | """ | 29 | """ |
30 | A tooltip which persists once shown until the user dismisses it with the Esc | 30 | A tooltip which persists once shown until the user dismisses it with the Esc |
31 | key or by clicking the close button. | 31 | key or by clicking the close button. |
32 | 32 | ||
33 | # FIXME: the PersistentTooltip should be disabled when the user clicks anywhere off | 33 | # FIXME: the PersistentTooltip should be disabled when the user clicks anywhere off |
34 | # it. We can't do this with focus-out-event becuase modal ensures we have focus? | 34 | # it. We can't do this with focus-out-event becuase modal ensures we have focus? |
35 | 35 | ||
36 | markup: some Pango text markup to display in the tooltip | 36 | markup: some Pango text markup to display in the tooltip |
37 | """ | 37 | """ |
38 | def __init__(self, markup): | 38 | def __init__(self, markup): |
39 | gtk.Window.__init__(self, gtk.WINDOW_POPUP) | 39 | gtk.Window.__init__(self, gtk.WINDOW_POPUP) |
40 | 40 | ||
41 | # Inherit the system theme for a tooltip | 41 | # Inherit the system theme for a tooltip |
42 | style = gtk.rc_get_style_by_paths(gtk.settings_get_default(), | 42 | style = gtk.rc_get_style_by_paths(gtk.settings_get_default(), |
43 | 'gtk-tooltip', 'gtk-tooltip', gobject.TYPE_NONE) | 43 | 'gtk-tooltip', 'gtk-tooltip', gobject.TYPE_NONE) |
44 | self.set_style(style) | 44 | self.set_style(style) |
45 | 45 | ||
46 | # The placement of the close button on the tip should reflect how the | 46 | # The placement of the close button on the tip should reflect how the |
47 | # window manager of the users system places close buttons. Try to read | 47 | # window manager of the users system places close buttons. Try to read |
48 | # the metacity gconf key to determine whether the close button is on the | 48 | # the metacity gconf key to determine whether the close button is on the |
49 | # left or the right. | 49 | # left or the right. |
50 | # In the case that we can't determine the users configuration we default | 50 | # In the case that we can't determine the users configuration we default |
51 | # to close buttons being on the right. | 51 | # to close buttons being on the right. |
52 | __button_right = True | 52 | __button_right = True |
53 | try: | 53 | try: |
54 | client = gconf.client_get_default() | 54 | client = gconf.client_get_default() |
55 | order = client.get_string("/apps/metacity/general/button_layout") | 55 | order = client.get_string("/apps/metacity/general/button_layout") |
56 | if order and order.endswith(":"): | 56 | if order and order.endswith(":"): |
57 | __button_right = False | 57 | __button_right = False |
58 | except NameError: | 58 | except NameError: |
59 | pass | 59 | pass |
60 | 60 | ||
61 | # We need to ensure we're only shown once | 61 | # We need to ensure we're only shown once |
62 | self.shown = False | 62 | self.shown = False |
63 | 63 | ||
64 | # We don't want any WM decorations | 64 | # We don't want any WM decorations |
65 | self.set_decorated(False) | 65 | self.set_decorated(False) |
66 | # We don't want to show in the taskbar or window switcher | 66 | # We don't want to show in the taskbar or window switcher |
67 | self.set_skip_pager_hint(True) | 67 | self.set_skip_pager_hint(True) |
68 | self.set_skip_taskbar_hint(True) | 68 | self.set_skip_taskbar_hint(True) |
69 | # We must be modal to ensure we grab focus when presented from a gtk.Dialog | 69 | # We must be modal to ensure we grab focus when presented from a gtk.Dialog |
70 | self.set_modal(True) | 70 | self.set_modal(True) |
71 | 71 | ||
72 | self.set_border_width(0) | 72 | self.set_border_width(0) |
73 | self.set_position(gtk.WIN_POS_MOUSE) | 73 | self.set_position(gtk.WIN_POS_MOUSE) |
74 | self.set_opacity(0.95) | 74 | self.set_opacity(0.95) |
75 | 75 | ||
76 | # Draw our label and close buttons | 76 | # Draw our label and close buttons |
77 | hbox = gtk.HBox(False, 0) | 77 | hbox = gtk.HBox(False, 0) |
78 | hbox.show() | 78 | hbox.show() |
79 | vbox = gtk.VBox(False, 0) | 79 | vbox = gtk.VBox(False, 0) |
80 | vbox.show() | 80 | vbox.show() |
81 | vbox.pack_start(hbox, True, True, 0) | 81 | vbox.pack_start(hbox, True, True, 0) |
82 | 82 | ||
83 | img = gtk.Image() | 83 | img = gtk.Image() |
84 | img.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_BUTTON) | 84 | img.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_BUTTON) |
85 | 85 | ||
86 | self.button = gtk.Button() | 86 | self.button = gtk.Button() |
87 | self.button.set_image(img) | 87 | self.button.set_image(img) |
88 | self.button.connect("clicked", self._dismiss_cb) | 88 | self.button.connect("clicked", self._dismiss_cb) |
89 | self.button.set_can_default(True) | 89 | self.button.set_can_default(True) |
90 | self.button.grab_focus() | 90 | self.button.grab_focus() |
91 | self.button.show() | 91 | self.button.show() |
92 | if __button_right: | 92 | if __button_right: |
93 | hbox.pack_end(self.button, False, False, 0) | 93 | hbox.pack_end(self.button, False, False, 0) |
94 | else: | 94 | else: |
95 | hbox.pack_start(self.button, False, False, 0) | 95 | hbox.pack_start(self.button, False, False, 0) |
96 | 96 | ||
97 | self.set_default(self.button) | 97 | self.set_default(self.button) |
98 | 98 | ||
99 | hbox = gtk.HBox(True, 6) | 99 | hbox = gtk.HBox(True, 6) |
100 | hbox.set_border_width(6) | 100 | hbox.set_border_width(6) |
101 | hbox.show() | 101 | hbox.show() |
102 | vbox.pack_end(hbox, True, True, 6) | 102 | vbox.pack_end(hbox, True, True, 6) |
103 | self.label = gtk.Label() | 103 | self.label = gtk.Label() |
104 | # We want to match the colours of the normal tooltips, as dictated by | 104 | # We want to match the colours of the normal tooltips, as dictated by |
105 | # the users gtk+-2.0 theme, wherever possible - on some systems this | 105 | # the users gtk+-2.0 theme, wherever possible - on some systems this |
106 | # requires explicitly setting a fg_color for the label which matches the | 106 | # requires explicitly setting a fg_color for the label which matches the |
107 | # tooltip_fg_color | 107 | # tooltip_fg_color |
108 | settings = gtk.settings_get_default() | 108 | settings = gtk.settings_get_default() |
109 | colours = settings.get_property('gtk-color-scheme').split('\n') | 109 | colours = settings.get_property('gtk-color-scheme').split('\n') |
110 | # remove any empty lines, there's likely to be a trailing one after | 110 | # remove any empty lines, there's likely to be a trailing one after |
111 | # calling split on a dictionary-like string | 111 | # calling split on a dictionary-like string |
112 | colours = filter(None, colours) | 112 | colours = filter(None, colours) |
113 | for col in colours: | 113 | for col in colours: |
114 | item, val = col.split(': ') | 114 | item, val = col.split(': ') |
115 | if item == 'tooltip_fg_color': | 115 | if item == 'tooltip_fg_color': |
116 | style = self.label.get_style() | 116 | style = self.label.get_style() |
117 | style.fg[gtk.STATE_NORMAL] = gtk.gdk.color_parse(val) | 117 | style.fg[gtk.STATE_NORMAL] = gtk.gdk.color_parse(val) |
118 | self.label.set_style(style) | 118 | self.label.set_style(style) |
119 | break # we only care for the tooltip_fg_color | 119 | break # we only care for the tooltip_fg_color |
120 | self.label.set_markup(markup) | 120 | self.label.set_markup(markup) |
121 | self.label.show() | 121 | self.label.show() |
122 | hbox.pack_end(self.label, True, True, 6) | 122 | hbox.pack_end(self.label, True, True, 6) |
123 | 123 | ||
124 | self.connect("key-press-event", self._catch_esc_cb) | 124 | self.connect("key-press-event", self._catch_esc_cb) |
125 | 125 | ||
126 | self.add(vbox) | 126 | self.add(vbox) |
127 | 127 | ||
128 | """ | 128 | """ |
129 | Callback when the PersistentTooltip's close button is clicked. | 129 | Callback when the PersistentTooltip's close button is clicked. |
130 | Hides the PersistentTooltip. | 130 | Hides the PersistentTooltip. |
131 | """ | 131 | """ |
132 | def _dismiss_cb(self, button): | 132 | def _dismiss_cb(self, button): |
133 | self.hide() | 133 | self.hide() |
134 | return True | 134 | return True |
135 | 135 | ||
136 | """ | 136 | """ |
137 | Callback when the Esc key is detected. Hides the PersistentTooltip. | 137 | Callback when the Esc key is detected. Hides the PersistentTooltip. |
138 | """ | 138 | """ |
139 | def _catch_esc_cb(self, widget, event): | 139 | def _catch_esc_cb(self, widget, event): |
140 | keyname = gtk.gdk.keyval_name(event.keyval) | 140 | keyname = gtk.gdk.keyval_name(event.keyval) |
141 | if keyname == "Escape": | 141 | if keyname == "Escape": |
142 | self.hide() | 142 | self.hide() |
143 | return True | 143 | return True |
144 | 144 | ||
145 | """ | 145 | """ |
146 | Called to present the PersistentTooltip. | 146 | Called to present the PersistentTooltip. |
147 | Overrides the superclasses show() method to include state tracking. | 147 | Overrides the superclasses show() method to include state tracking. |
148 | """ | 148 | """ |
149 | def show(self): | 149 | def show(self): |
150 | if not self.shown: | 150 | if not self.shown: |
151 | self.shown = True | 151 | self.shown = True |
152 | gtk.Window.show(self) | 152 | gtk.Window.show(self) |
153 | 153 | ||
154 | """ | 154 | """ |
155 | Called to hide the PersistentTooltip. | 155 | Called to hide the PersistentTooltip. |
156 | Overrides the superclasses hide() method to include state tracking. | 156 | Overrides the superclasses hide() method to include state tracking. |
157 | """ | 157 | """ |
158 | def hide(self): | 158 | def hide(self): |
159 | self.shown = False | 159 | self.shown = False |
160 | gtk.Window.hide(self) | 160 | gtk.Window.hide(self) |