Merge branch 'master' of git+ssh://guillaume@dev.laptop.org/git/sugar

This commit is contained in:
Guillaume Desmottes 2007-03-05 18:56:34 +01:00
commit 42609e447c
2 changed files with 19 additions and 4 deletions

View File

@ -275,12 +275,25 @@ class DataStore(object):
return 0 return 0
def find(self, query): 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: if query:
# TODO: parse the query for avoiding sql injection attacks. # 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 += ";" sql_query += ";"
curs = self._dbcx.cursor() curs = self._dbcx.cursor()
logging.debug(sql_query)
curs.execute(sql_query) curs.execute(sql_query)
rows = curs.fetchall() rows = curs.fetchall()
self._dbcx.commit() self._dbcx.commit()

View File

@ -41,12 +41,12 @@ class MenuItem(hippo.CanvasBox):
hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL) hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL)
self._action_id = action_id self._action_id = action_id
self.props.padding = 5 self.props.spacing = units.points_to_pixels(2)
if icon_name: if icon_name:
icon = CanvasIcon(icon_name=icon_name, icon = CanvasIcon(icon_name=icon_name,
scale=units.SMALL_ICON_SCALE, scale=units.SMALL_ICON_SCALE,
box_width=units.microgrid_to_pixels(3)) box_width=units.microgrid_to_pixels(2))
if icon_color: if icon_color:
icon.props.xo_color = icon_color icon.props.xo_color = icon_color
self.append(icon) self.append(icon)
@ -93,6 +93,8 @@ class Menu(Popup):
self.props.background_color = color.MENU_BACKGROUND.get_int() self.props.background_color = color.MENU_BACKGROUND.get_int()
self.props.border_color = color.MENU_BORDER.get_int() self.props.border_color = color.MENU_BORDER.get_int()
self.props.border = units.points_to_pixels(1) 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: if title:
title_item = hippo.CanvasText(text=title) title_item = hippo.CanvasText(text=title)