Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/datastore/datastore.py17
-rw-r--r--sugar/graphics/menu.py6
2 files changed, 19 insertions, 4 deletions
diff --git a/services/datastore/datastore.py b/services/datastore/datastore.py
index 177f528..cac71a3 100644
--- a/services/datastore/datastore.py
+++ b/services/datastore/datastore.py
@@ -275,12 +275,25 @@ class DataStore(object):
return 0
def find(self, query):
- sql_query = "SELECT DISTINCT(objid) FROM properties"
+ sql_query = "SELECT props1.objid objid," \
+ " props1.value date," \
+ " props2.value object_type," \
+ " props3.value buddies " \
+ "FROM properties props1," \
+ " properties props2," \
+ " properties props3 " \
+ "WHERE props1.objid = props2.objid AND" \
+ " props2.objid = props3.objid AND" \
+ " props1.key = 'date' AND" \
+ " props2.key = 'object-type' AND" \
+ " props3.key = 'buddies' " \
+ "ORDER BY date DESC"
if query:
# TODO: parse the query for avoiding sql injection attacks.
- sql_query += " WHERE (%s)" % query
+ sql_query = "SELECT objid FROM (%s) WHERE (%s)" % (sql_query, query)
sql_query += ";"
curs = self._dbcx.cursor()
+ logging.debug(sql_query)
curs.execute(sql_query)
rows = curs.fetchall()
self._dbcx.commit()
diff --git a/sugar/graphics/menu.py b/sugar/graphics/menu.py
index adafd53..766ed72 100644
--- a/sugar/graphics/menu.py
+++ b/sugar/graphics/menu.py
@@ -41,12 +41,12 @@ class MenuItem(hippo.CanvasBox):
hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL)
self._action_id = action_id
- self.props.padding = 5
+ self.props.spacing = units.points_to_pixels(2)
if icon_name:
icon = CanvasIcon(icon_name=icon_name,
scale=units.SMALL_ICON_SCALE,
- box_width=units.microgrid_to_pixels(3))
+ box_width=units.microgrid_to_pixels(2))
if icon_color:
icon.props.xo_color = icon_color
self.append(icon)
@@ -93,6 +93,8 @@ class Menu(Popup):
self.props.background_color = color.MENU_BACKGROUND.get_int()
self.props.border_color = color.MENU_BORDER.get_int()
self.props.border = units.points_to_pixels(1)
+ self.props.padding = units.points_to_pixels(3)
+ self.props.spacing = units.points_to_pixels(3)
if title:
title_item = hippo.CanvasText(text=title)