Requesting UI freeze break for Deskbar-Applet
- From: Sebastian Pölsterl <marduk k-d-w org>
- To: desktop-devel-list gnome org
- Cc: gnome-i18n gnome org, gnome-doc-list gnome org, release-team gnome org
- Subject: Requesting UI freeze break for Deskbar-Applet
- Date: Fri, 24 Aug 2007 17:50:01 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
The attached patch adds a "Back to matches" button under the list of
actions (see attachment) and makes the '>' beneath matches that have
more than one action clickable to go the list of actions. This replaces
that you have to press ctrl while clicking on a match to display its
actions.
Raphaël knows about this patch, too, and is all for it.
This patch tackles bug #468455 and bug #468456.
The patch is important, because it helps a lot to navigate. Without it,
navigating between the list of actions and the list of matches would
only be possible using the keyboard. Navigating using the keyboard is
somewhat a hidden feature and everything you could achieve with the
keyboard should be possible with the mouse, too.
If the patch won't be part of the final 2.20 release many users
obviously won't recognize the new feature of actions, because they won't
intuitionally find the way to the list actions. Actions are a core
feature of the new Deskbar-Applet. Therefore, I think this patch should
be applied.
[1]: http://bugzilla.gnome.org/show_bug.cgi?id=468455
[2]: http://bugzilla.gnome.org/show_bug.cgi?id=468456
- --
Greetings,
Sebastian Pölsterl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGzv4p1ygZeJ3lLIcRAo0GAKCFkOSjz2ksRdVtYZ7DHZnmY9ADGACcClIm
d4alahwCUn8j0auFKXXhctw=
=01Vk
-----END PGP SIGNATURE-----
Index: /home/sebp/workspace/deskbar-applet/deskbar/ui/cuemiac/CuemiacTreeView.py
===================================================================
--- /home/sebp/workspace/deskbar-applet/deskbar/ui/cuemiac/CuemiacTreeView.py (revision 1582)
+++ /home/sebp/workspace/deskbar-applet/deskbar/ui/cuemiac/CuemiacTreeView.py (working copy)
@@ -29,10 +29,13 @@
'has-more-actions' : (gobject.TYPE_BOOLEAN, 'whether the match has more than one action',
'If set to True a symbol will be displayed on the right',
False, gobject.PARAM_READWRITE),
- 'match-markup' : (gobject.TYPE_STRING, 'markup for match description',
- 'markup for match description',
- "", gobject.PARAM_READWRITE),
}
+ __gsignals__ = {
+ # This signal will be emited when '>' on the right is clicked
+ "show-actions-activated": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]),
+ # This signal will be emited then an area that's not the '>' from above is clicked
+ "do-action-activated": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]),
+ }
def __init__ (self):
gtk.CellRendererText.__init__ (self)
@@ -40,6 +43,12 @@
self.__match_count = 0
self.__has_more_actions = False
self.__match_markup = ""
+ self.__button_x = 0
+ self.__button_y = 0
+ self.__button_width = 0
+ self.__button_height = 0
+
+ self.set_property("mode", gtk.CELL_RENDERER_MODE_ACTIVATABLE)
# Grab some default theme settings
# they are probably incorrect, but we reset
@@ -64,8 +73,8 @@
self.render_match (window, widget, background_area, cell_area, expose_area, flags)
else:
self.render_category (window, widget, background_area, cell_area, expose_area, flags)
-
- def render_match (self, window, widget, background_area, cell_area, expose_area, flag):
+
+ def render_match (self, window, widget, background_area, cell_area, expose_area, flags):
ctx = window.cairo_create ()
# Set up a pango.Layout
@@ -72,8 +81,7 @@
more_actions_layout = ctx.create_layout ()
if self.get_property("has-more-actions"):
more_actions_layout.set_markup ("<b>></b>")
- else:
- more_actions_layout.set_text("")
+
more_actions_layout.set_font_description (self.header_font_desc)
more_actions_layout_width, more_actions_layout_height = more_actions_layout.get_pixel_size()
@@ -78,19 +86,41 @@
more_actions_layout_width, more_actions_layout_height = more_actions_layout.get_pixel_size()
- state = self.renderer_state_to_widget_state(flag)
+ state = self.renderer_state_to_widget_state(flags)
+
+ self.__button_width = more_actions_layout_width + 2
+ self.__button_height = cell_area.height
# Draw the actual text in the remaining area
cell_area_width = cell_area.width
- cell_area.width -= more_actions_layout_width + 2
- gtk.CellRendererText.do_render (self, window, widget, background_area, cell_area, expose_area, flag)
+ cell_area.width -= self.__button_width
+ gtk.CellRendererText.do_render (self, window, widget, background_area, cell_area, expose_area, flags)
mod_gc = widget.get_style().text_gc[state]
+
+ self.__button_x = (cell_area.x + cell_area_width) - more_actions_layout_width - 2
+ self.__button_y = cell_area.y + ( (cell_area.height - more_actions_layout_height) / 2 ) + 1
+
window.draw_layout(mod_gc,
- (cell_area.x + cell_area_width) - more_actions_layout_width - 2,
- cell_area.y + ( (cell_area.height - more_actions_layout_height) / 2 ) + 1,
+ self.__button_x,
+ self.__button_y,
more_actions_layout)
+ if self.get_property("has-more-actions"):
+ # Add some additional area around the '>' to activate it
+ self.__button_x -= 3
+ self.__button_y = cell_area.y
+ self.__button_width += 3
+ else:
+ self.__button_height = 0
+ self.__button_width = 0
+ self.__button_x = 0
+ self.__button_y = 0
+
+ #window.draw_rectangle(mod_gc, False, self.__button_x, self.__button_y,
+ # self.__button_width, self.__button_height
+ # )
+
def render_category (self, window, widget, background_area, cell_area, expose_area, flag):
"""
Renders the category title from the "category-header" property and displays a rigth aligned
@@ -105,7 +135,7 @@
cat_layout = ctx.create_layout ()
cat_layout.set_font_description (self.header_font_desc)
- cat_layout.set_markup("...")
+ cat_layout.set_markup("...")
cat_layout_width, cat_layout_height = cat_layout.get_pixel_size()
ellipsise_size = cat_layout_width
@@ -153,6 +183,33 @@
if (gtk.CELL_RENDERER_SELECTED & flags) == gtk.CELL_RENDERER_SELECTED:
state = gtk.STATE_SELECTED
return state
+
+ def do_activate(self, event, widget, path_string, background_area, cell_area, flags):
+ if not isinstance(widget, gtk.TreeView):
+ # Not a treeview
+ return False
+
+ if event.type != gtk.gdk.BUTTON_PRESS:
+ # Event type not GDK_BUTTON_PRESS
+ return True
+
+ ex = event.x
+ ey = event.y
+ bx = self.__button_x
+ # Otherwise, we get problems when the cell
+ # is at the top of the visible part of the treeview
+ by = cell_area.y
+ bw = self.__button_width
+ bh = self.__button_height
+
+ path = tuple([int(i) for i in path_string.split(':')])
+ if (ex < bx or ex > (bx+bw) or ey < by or ey > (by+bh)):
+ # Click wasn't on the icon
+ self.emit("do-action-activated", path)
+ return True
+ else:
+ self.emit("show-actions-activated", path)
+ return False
def do_get_property(self, property):
if property.name == 'category-header':
@@ -161,8 +218,6 @@
return self.__match_count
elif property.name == 'has-more-actions':
return self.__has_more_actions
- elif property.name == 'match-markup':
- return self.__match_markup
else:
raise AttributeError, 'unknown property %s' % property.name
@@ -173,8 +228,6 @@
self.__match_count = value
elif property.name == 'has-more-actions':
self.__has_more_actions = value
- elif property.name == 'match-markup':
- self.__match_markup = value
else:
raise AttributeError, 'unknown property %s' % property.name
@@ -198,8 +251,7 @@
gtk.TreeView.__init__ (self, model)
self.set_enable_search (False)
self.set_property ("headers-visible", False)
-
- self.connect ("button-press-event", self.__on_button_press)
+
self.connect ("key-press-event", self.__on_key_press)
icon = gtk.CellRendererPixbuf ()
@@ -205,8 +257,10 @@
icon = gtk.CellRendererPixbuf ()
icon.set_property("xpad", 10)
hit_title = CellRendererCuemiacCategory ()
+ hit_title.connect("show-actions-activated", self.__on_show_actions_activated)
+ hit_title.connect("do-action-activated", self.__on_do_action_activated)
hit_title.set_property ("ellipsize", pango.ELLIPSIZE_END)
-
+
hits = gtk.TreeViewColumn ("Hits")
hits.pack_start (icon, expand=False)
hits.pack_start (hit_title)
@@ -291,20 +345,7 @@
path = self.__find_bottom_path()
if path != None:
self.__select_path(path)
-
- def __on_button_press (self, treeview, event):
- # We want to activate items on single click
- path_ctx = self.get_path_at_pos (int(event.x), int(event.y))
- if path_ctx is not None:
- path, col, x, y = path_ctx
- model = self.get_model ()
- match = model[model.get_iter(path)][model.MATCHES]
- if match.__class__ != CuemiacCategory:
- if event.state & gtk.gdk.CONTROL_MASK:
- self.__on_activated(treeview, path, col, event)
- else:
- self.__on_do_default_action(treeview, path, col, event)
-
+
# def __on_config_expanded_cat (self, value):
# if value != None and value.type == gconf.VALUE_LIST:
# self.__collapsed_rows = [h.get_string() for h in value.get_list()]
@@ -346,7 +387,18 @@
cell.set_property ("has-more-actions", len(match.get_actions()) > 1)
cell.set_property ("markup", model[iter][model.ACTIONS])
+
+ def __on_show_actions_activated(self, widget, path):
+ col = self.get_model().ACTIONS
+ self.__on_activated(self, path, col, None)
+ def __on_do_action_activated(self, widget, path):
+ model = self.get_model ()
+ match = model[model.get_iter(path)][model.MATCHES]
+ col = self.get_model().ACTIONS
+ if match.__class__ != CuemiacCategory:
+ self.__on_do_default_action(self, path, col, None)
+
def __on_do_default_action(self, treeview, path, col, event):
model = self.get_model()
iter = model.get_iter (path)
Index: /home/sebp/workspace/deskbar-applet/deskbar/ui/CuemiacWindowView.py
===================================================================
--- /home/sebp/workspace/deskbar-applet/deskbar/ui/CuemiacWindowView.py (revision 1582)
+++ /home/sebp/workspace/deskbar-applet/deskbar/ui/CuemiacWindowView.py (working copy)
@@ -110,6 +110,8 @@
self.scrolled_results.show()
# Actions TreeView
+ self.actions_box = gtk.VBox(spacing=3)
+
self.actions_model = CuemiacActionsModel()
self.aview = CuemiacActionsTreeView(self.actions_model)
self.aview.connect ("action-selected", self._controller.on_action_selected)
@@ -120,6 +122,20 @@
self.scrolled_actions.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.scrolled_actions.set_shadow_type(gtk.SHADOW_IN)
self.scrolled_actions.add(self.aview)
+ self.scrolled_actions.show()
+ self.actions_box.pack_start(self.scrolled_actions)
+
+ buttonbox = gtk.HButtonBox()
+ buttonbox.set_layout(gtk.BUTTONBOX_START)
+ buttonbox.show()
+ self.actions_box.pack_start(buttonbox, False)
+
+ back_button = gtk.Button(_("Back to matches"))
+ back_button.set_image( gtk.image_new_from_stock(gtk.STOCK_GO_BACK, gtk.ICON_SIZE_MENU) )
+ back_button.set_relief(gtk.RELIEF_NONE)
+ back_button.connect("clicked", self.__on_go_back)
+ back_button.show()
+ buttonbox.pack_start(back_button, False, False, 0)
# Results
self.results_box = gtk.HBox()
@@ -124,7 +140,7 @@
# Results
self.results_box = gtk.HBox()
self.results_box.pack_start(self.scrolled_results)
- self.results_box.pack_start(self.scrolled_actions)
+ self.results_box.pack_start(self.actions_box)
self.vbox_main.pack_start(self.results_box)
def clear_all(self):
@@ -165,7 +181,15 @@
self.realize()
self.window.set_user_time(time)
self.present()
-
+
+ def __show_matches(self):
+ self.scrolled_results.show()
+ self.actions_box.hide()
+
+ def __show_actions(self):
+ self.scrolled_results.hide()
+ self.actions_box.show()
+
def show_results(self):
width, height = self.get_size()
if self.__small_window_height == None:
@@ -171,8 +195,7 @@
if self.__small_window_height == None:
self.__small_window_height = height
self.results_box.show()
- self.scrolled_results.show()
- self.scrolled_actions.hide()
+ self.__show_matches()
self.resize( width, self._model.get_window_height() )
def display_actions(self, actions, qstring):
@@ -177,8 +200,7 @@
def display_actions(self, actions, qstring):
self.actions_model.clear()
- self.scrolled_results.hide()
- self.scrolled_actions.show()
+ self.__show_actions()
self.actions_model.add_actions(actions, qstring)
self.aview.grab_focus()
@@ -220,9 +242,8 @@
self.entry.set_icon (icon)
- def __on_go_back(self, treeview):
- self.scrolled_actions.hide()
- self.scrolled_results.show()
+ def __on_go_back(self, widget):
+ self.__show_matches()
self.cview.grab_focus()
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]