deskbar-applet r2052 - in trunk: . deskbar/interfaces deskbar/ui/cuemiac
- From: sebp svn gnome org
- To: svn-commits-list gnome org
- Subject: deskbar-applet r2052 - in trunk: . deskbar/interfaces deskbar/ui/cuemiac
- Date: Sun, 30 Mar 2008 15:17:37 +0100 (BST)
Author: sebp
Date: Sun Mar 30 15:17:37 2008
New Revision: 2052
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2052&view=rev
Log:
Added (set|get)_snippet methods to Match interface.
If a snippet is set it will displayed in a new line under the matche's get_verb value
Modified:
trunk/ChangeLog
trunk/deskbar/interfaces/Match.py
trunk/deskbar/ui/cuemiac/CuemiacModel.py
Modified: trunk/deskbar/interfaces/Match.py
==============================================================================
--- trunk/deskbar/interfaces/Match.py (original)
+++ trunk/deskbar/interfaces/Match.py Sun Mar 30 15:17:37 2008
@@ -27,6 +27,10 @@
- priority: Match's priority. It's recommended that you use your
module's L{set_priority_for_matches<deskbar.interfaces.Module.Module.set_priority_for_matches>}
method to assign your matches the priority of your module.
+ - snippet: A snippet where the search term appears.
+ The snippet will be displayed under the return value of L{deskbar.interfaces.Match.get_verb}
+ using the Pango markup size='small' and style='italic'. The snippet can contain Pango markup
+ itsself.
"""
self._name = ""
self._icon = None
@@ -35,6 +39,7 @@
self._priority = 0
self._actions = []
self._default_action = None
+ self._snippet = None
self.__actions_hashes = set()
if "name" in args:
self._name = args["name"]
@@ -48,7 +53,9 @@
self._category = args["category"]
if "priority" in args:
self._priority = args["priority"]
-
+ if "snippet" in args:
+ self._snippet = args["snippet"]
+
def _get_default_icon(self):
"""
Retrieve pixbuf depending on category
@@ -98,6 +105,20 @@
if not isinstance(iconname, str):
raise TypeError, "icon must be a string"
self._icon = iconname
+
+ def get_snippet(self):
+ """
+ Get the snippet where the search term appears
+ """
+ return self._snippet
+
+ def set_snippet(self, snippet):
+ """
+ Set the snippet where the search term appears
+
+ @type snippet: string
+ """
+ self._snippet = snippet
def get_category(self):
"""
Modified: trunk/deskbar/ui/cuemiac/CuemiacModel.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/CuemiacModel.py (original)
+++ trunk/deskbar/ui/cuemiac/CuemiacModel.py Sun Mar 30 15:17:37 2008
@@ -195,6 +195,8 @@
def __append_match_to_iter (self, iter, qstring, match_obj):
action = match_obj.get_actions()[0]
label = action.get_verb() % action.get_escaped_name(qstring)
+ if match_obj.get_snippet() != None:
+ label += "\n<span size='small' style='italic'>%s</span>" % match_obj.get_snippet()
iter = self.append_method (self, iter, [qstring, match_obj, label])
return iter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]