Merge branch 'master' of git+ssh://guillaume@dev.laptop.org/git/sugar
This commit is contained in:
commit
42609e447c
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user