deskbar-applet r1866 - in branches/button-ui/deskbar/ui: . cuemiac
- From: sebp svn gnome org
- To: svn-commits-list gnome org
- Subject: deskbar-applet r1866 - in branches/button-ui/deskbar/ui: . cuemiac
- Date: Thu, 24 Jan 2008 17:36:32 +0000 (GMT)
Author: sebp
Date: Thu Jan 24 17:36:32 2008
New Revision: 1866
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=1866&view=rev
Log:
The widgets and results will ordered depending on the applet's orientation
Modified:
branches/button-ui/deskbar/ui/CuemiacAlignedView.py
branches/button-ui/deskbar/ui/cuemiac/CuemiacActionsTreeView.py
branches/button-ui/deskbar/ui/cuemiac/CuemiacModel.py
Modified: branches/button-ui/deskbar/ui/CuemiacAlignedView.py
==============================================================================
--- branches/button-ui/deskbar/ui/CuemiacAlignedView.py (original)
+++ branches/button-ui/deskbar/ui/CuemiacAlignedView.py Thu Jan 24 17:36:32 2008
@@ -66,6 +66,7 @@
# self.completion.set_popup_completion(False)
# self.completion.set_text_column(1)
+ # Search entry
self.default_entry_pixbuf = deskbar.core.Utils.load_icon("deskbar-applet-panel-h.png", width=23, height=14)
self.entry = CuemiacEntry (self.default_entry_pixbuf)
self.entry.connect("changed", self._controller.on_query_entry_changed)
@@ -78,33 +79,29 @@
self.entry.show()
self.header = CuemiacHeader ( self.entry )
- self.header.show()
-
- # Search entry
- self.vbox_main.pack_start(self.header, False)
+ self.header.show()
# History TreeView
- hhbox = gtk.HBox(spacing=6)
- hhbox.show()
- self.vbox_main.pack_start(hhbox, False)
+ self.history_box = gtk.HBox(spacing=6)
+ self.history_box.show()
hlabel = gtk.Label()
# translators: _H is a mnemonic, i.e. pressing Alt+h will focus the widget
hlabel.set_markup_with_mnemonic("<b>%s:</b>" % _("_History"))
hlabel.show()
- hhbox.pack_start(hlabel, False)
+ self.history_box.pack_start(hlabel, False)
self.hview = CuemiacHistoryView(self._model.get_history())
self.hview.connect("match-selected", self._controller.on_history_match_selected)
self.hview.show()
- hhbox.pack_start(self.hview)
+ self.history_box.pack_start(self.hview)
hlabel.set_mnemonic_widget(self.hview)
empty_button = gtk.Button()
empty_button.set_image( gtk.image_new_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU) )
empty_button.connect("clicked", self._controller.on_clear_history)
empty_button.show()
- hhbox.pack_start(empty_button, False)
+ self.history_box.pack_start(empty_button, False)
# Results TreeView
self.treeview_model = CuemiacModel ()
@@ -163,8 +160,8 @@
self.results_box = gtk.HBox()
self.results_box.pack_start(self.scrolled_results)
self.results_box.pack_start(self.actions_box)
- self.vbox_main.pack_start(self.results_box)
+ self.__set_layout_by_orientation(self.applet.get_orient())
self.__adjust_popup_size()
def __on_row_act(self, view, path, column):
@@ -300,5 +297,26 @@
w = min (w, self._max_window_width)
if w > 0 and h > 0:
self.resize (w, h)
-
+
+ def __set_layout_by_orientation (self, orient):
+ """
+ Adjust the various widgets managed to layout with repect to the given
+ orientation.
+ @param orient: The orientation to switch to.
+ Must be one of C{gnomeapplet.ORIENT_UP}, C{gnomeapplet.ORIENT_DOWN},
+ C{gnomeapplet.ORIENT_LEFT}, C{gnomeapplet.ORIENT_RIGHT}.
+ """
+ if orient in [gnomeapplet.ORIENT_LEFT, gnomeapplet.ORIENT_RIGHT, gnomeapplet.ORIENT_DOWN]:
+ self.treeview_model.set_sort_order (gtk.SORT_ASCENDING)
+ self.actions_model.set_sort_order (gtk.SORT_ASCENDING)
+ self.vbox_main.pack_start(self.header, False)
+ self.vbox_main.pack_start(self.history_box, False)
+ self.vbox_main.pack_start(self.results_box)
+ else:
+ # We are at a bottom panel. Put entry on bottom, and prepend matches (instead of append).
+ self.treeview_model.set_sort_order (gtk.SORT_DESCENDING)
+ self.actions_model.set_sort_order (gtk.SORT_DESCENDING)
+ self.vbox_main.pack_start(self.results_box)
+ self.vbox_main.pack_start(self.history_box, False)
+ self.vbox_main.pack_start(self.header, False)
Modified: branches/button-ui/deskbar/ui/cuemiac/CuemiacActionsTreeView.py
==============================================================================
--- branches/button-ui/deskbar/ui/cuemiac/CuemiacActionsTreeView.py (original)
+++ branches/button-ui/deskbar/ui/cuemiac/CuemiacActionsTreeView.py Thu Jan 24 17:36:32 2008
@@ -9,11 +9,23 @@
def __init__(self):
gtk.ListStore.__init__(self, gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+ self.set_sort_order(gtk.SORT_ASCENDING)
def add_actions(self, actions, qstring):
for action in actions:
text = action.get_verb() % action.get_escaped_name(qstring)
- self.append([action.get_pixbuf(), text, qstring, action])
+ self.append_method(self, [action.get_pixbuf(), text, qstring, action])
+
+ def set_sort_order(self, order):
+ """
+ @param order Either C{gtk.SORT_DESCENDING} or C{gtk.SORT_ASSCENDING}
+ """
+ if order == gtk.SORT_DESCENDING:
+ # Alternatively gtk.TreeStore.prepend for bottom panel layout
+ self.append_method = gtk.ListStore.prepend
+ else:
+ self.append_method = gtk.ListStore.append
+
class CuemiacActionsTreeView(gtk.TreeView):
Modified: branches/button-ui/deskbar/ui/cuemiac/CuemiacModel.py
==============================================================================
--- branches/button-ui/deskbar/ui/cuemiac/CuemiacModel.py (original)
+++ branches/button-ui/deskbar/ui/cuemiac/CuemiacModel.py Thu Jan 24 17:36:32 2008
@@ -40,12 +40,19 @@
gtk.TreeStore.__init__ (self, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)
self.__categories = {}
self.__match_hashes = {}
- self.append_method = gtk.TreeStore.append # Alternatively gtk.TreeStore.prepend for bottom panel layout
self.set_sort_func(SORT_BY_CATEGORY, self.__on_sort_categories)
self.set_sort_order(gtk.SORT_ASCENDING)
def set_sort_order(self, order):
+ """
+ @param order Either C{gtk.SORT_DESCENDING} or C{gtk.SORT_ASCENDING}
+ """
self.set_sort_column_id(SORT_BY_CATEGORY, order)
+ if order == gtk.SORT_DESCENDING:
+ # Alternatively gtk.TreeStore.prepend for bottom panel layout
+ self.append_method = gtk.TreeStore.prepend
+ else:
+ self.append_method = gtk.TreeStore.append
def __compare_priorities(self, item1, item2):
"""
@@ -200,8 +207,5 @@
return ( self.get_string_from_iter (self.get_iter(path1)) == self.get_string_from_iter (self.get_iter(path2)) )
-
-
-
if gtk.pygtk_version < (2,8,0):
gobject.type_register (CuemiacModel)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]