Re: [Sugar-devel] [PATCH sugar-toolkit] Remove hippo from naming alert

2011-09-27 Thread Daniel Drake
On Mon, Sep 26, 2011 at 2:55 PM, Sascha Silbe si...@activitycentral.com wrote:
 I haven't tried it out to verify the layout, but the code changes look
 sane to me.

 Reviewed-By: Sascha Silbe si...@activitycentral.com

pushed with the suggested changes, thanks
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar-toolkit] Remove hippo from naming alert

2011-09-26 Thread Sascha Silbe
Excerpts from Daniel Drake's message of 2011-09-17 19:37:48 +0200:

 Reimplement the favorite icon as a ToggleButton, and use standard
 boxes, entrys and textviews for the other aspects.

Thanks for the patch! The sooner we can get rid of HippoCanvas the
better. :)

I haven't tried it out to verify the layout, but the code changes look
sane to me.

Reviewed-By: Sascha Silbe si...@activitycentral.com

[src/sugar/activity/namingalert.py]
[NamingAlert._create_text_view()]
 +#scrolled_window.set_border_width(30)

Leftover from testing?

[NamingAlert.__keep_cb()]
 +text_buffer = self._tags.get_buffer()
 +bounds = text_buffer.get_bounds()
 +new_tags = text_buffer.get_text(bounds[0], bounds[1])

How about start, end instead of bounds?

 +text_buffer = self._description.get_buffer()
 +bounds = text_buffer.get_bounds()
 +new_description = text_buffer.get_text(bounds[0], bounds[1])

Dto.

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH sugar-toolkit] Remove hippo from naming alert

2011-09-17 Thread Daniel Drake
Reimplement the favorite icon as a ToggleButton, and use standard
boxes, entrys and textviews for the other aspects.
---
 src/sugar/activity/namingalert.py |  227 +++--
 1 files changed, 90 insertions(+), 137 deletions(-)

I know there is some discussion around removing this dialog, but to
keep things moving and unblocked on the hippo removal front, here is
a quick port.

For correct visual appearance, depends on:
[PATCH sugar-artwork] Add style for naming alert

diff --git a/src/sugar/activity/namingalert.py 
b/src/sugar/activity/namingalert.py
index c3d45df..80d3e14 100644
--- a/src/sugar/activity/namingalert.py
+++ b/src/sugar/activity/namingalert.py
@@ -21,17 +21,13 @@ import os
 import gio
 import gtk
 import gobject
-import hippo
 import gconf
 
 from sugar.graphics import style
 from sugar.graphics.icon import Icon
 from sugar.graphics.xocolor import XoColor
-from sugar.graphics.icon import CanvasIcon
 from sugar.graphics.icon import get_icon_file_name
-from sugar.graphics.entry import CanvasEntry
 from sugar.graphics.toolbutton import ToolButton
-from sugar.graphics.canvastextview import CanvasTextView
 
 from sugar.bundle.activitybundle import ActivityBundle
 
@@ -114,45 +110,37 @@ class NamingToolbar(gtk.Toolbar):
 self.emit('keep-clicked')
 
 
-class FavoriteIcon(CanvasIcon):
+class FavoriteIcon(gtk.ToggleButton):
 
-def __init__(self, favorite):
-CanvasIcon.__init__(self, icon_name='emblem-favorite',
-box_width=style.GRID_CELL_SIZE * 3 / 5,
-size=style.SMALL_ICON_SIZE)
-self._favorite = None
-self.set_favorite(favorite)
-self.connect('button-release-event', self.__release_event_cb)
-self.connect('motion-notify-event', self.__motion_notify_event_cb)
+def __init__(self):
+gtk.ToggleButton.__init__(self)
+self.set_relief(gtk.RELIEF_NONE)
+self.set_focus_on_click(False)
+
+self._icon = Icon(icon_name='emblem-favorite',
+  pixel_size=style.SMALL_ICON_SIZE)
+self.set_image(self._icon)
 
-def set_favorite(self, favorite):
-if favorite == self._favorite:
-return
+self.connect('toggled', self.__toggled_cb)
+self.connect('leave-notify-event', self.__leave_notify_event_cb)
+self.connect('enter-notify-event', self.__enter_notify_event_cb)
 
-self._favorite = favorite
-if favorite:
+def __toggled_cb(self, widget):
+if self.get_active():
 client = gconf.client_get_default()
 color = XoColor(client.get_string('/desktop/sugar/user/color'))
-self.props.xo_color = color
+self._icon.props.xo_color = color
 else:
-self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg()
-self.props.fill_color = style.COLOR_WHITE.get_svg()
-
-def get_favorite(self):
-return self._favorite
-
-favorite = gobject.property(
-type=bool, default=False, getter=get_favorite, setter=set_favorite)
+self._icon.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg()
+self._icon.props.fill_color = style.COLOR_WHITE.get_svg()
 
-def __release_event_cb(self, icon, event):
-self.props.favorite = not self.props.favorite
+def __enter_notify_event_cb(self, icon, event):
+if not self.get_active():
+self._icon.props.fill_color = style.COLOR_BUTTON_GREY.get_svg()
 
-def __motion_notify_event_cb(self, icon, event):
-if not self._favorite:
-if event.detail == hippo.MOTION_DETAIL_ENTER:
-icon.props.fill_color = style.COLOR_BUTTON_GREY.get_svg()
-elif event.detail == hippo.MOTION_DETAIL_LEAVE:
-icon.props.fill_color = style.COLOR_TRANSPARENT.get_svg()
+def __leave_notify_event_cb(self, icon, event):
+if not self.get_active():
+self._icon.props.fill_color = style.COLOR_TRANSPARENT.get_svg()
 
 
 class NamingAlert(gtk.Window):
@@ -194,71 +182,66 @@ class NamingAlert(gtk.Window):
 vbox.pack_start(toolbar, False)
 toolbar.show()
 
-canvas = hippo.Canvas()
-self._root = hippo.CanvasBox()
-self._root.props.background_color = style.COLOR_WHITE.get_int()
-canvas.set_root(self._root)
-vbox.pack_start(canvas)
-canvas.show()
-
 body = self._create_body()
-self._root.append(body, hippo.PACK_EXPAND)
+vbox.pack_start(body, expand=True, fill=True)
+body.show()
 
-widget = self._title.get_property('widget')
-widget.grab_focus()
+self._title.grab_focus()
 
 def _create_body(self):
-body = hippo.CanvasBox()
-body.props.orientation = hippo.ORIENTATION_VERTICAL
-body.props.background_color = style.COLOR_WHITE.get_int()
-body.props.padding_top = style.DEFAULT_SPACING * 3
+body = 

Re: [Sugar-devel] [PATCH sugar-toolkit] Remove hippo from naming alert

2011-09-17 Thread Marco Pesenti Gritti
On 17 Sep 2011, at 18:37, Daniel Drake d...@laptop.org wrote:

 Reimplement the favorite icon as a ToggleButton, and use standard
 boxes, entrys and textviews for the other aspects.
 ---
 src/sugar/activity/namingalert.py |  227 +++--
 1 files changed, 90 insertions(+), 137 deletions(-)
 
 I know there is some discussion around removing this dialog, but to
 keep things moving and unblocked on the hippo removal front, here is
 a quick port.
 
 For correct visual appearance, depends on:
 [PATCH sugar-artwork] Add style for naming alert

Simon has a patch to drop the alert. If there is consensus I guess it would be 
easier to just do that, not sure if that's the case though.

Marco
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel