<div>Can't you use the ViewToolbar in the last patch from erikos?</div><br>from jarabe.desktop.viewtoolbar import ViewToolbar<div><br></div><div>Gonzalo</div><div><br></div><div><br></div><div><br><div class="gmail_quote">
On Mon, Aug 27, 2012 at 11:29 AM, Manuel Quiñones <span dir="ltr"><<a href="mailto:manuq@laptop.org" target="_blank">manuq@laptop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
With the new frame behaviour the toolbar was appearing and<br>
disappearing while the transition took place. this patch adds a<br>
toolbar in the transition box with a fake search entry, that is set<br>
editable=False to prevent issues.<br>
<br>
Signed-off-by: Manuel Quiñones <<a href="mailto:manuq@laptop.org">manuq@laptop.org</a>><br>
---<br>
src/jarabe/desktop/transitionbox.py | 75 +++++++++++++++++++++++++++++++++++--<br>
1 file changed, 71 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/jarabe/desktop/transitionbox.py b/src/jarabe/desktop/transitionbox.py<br>
index 54a70de..62764d7 100644<br>
--- a/src/jarabe/desktop/transitionbox.py<br>
+++ b/src/jarabe/desktop/transitionbox.py<br>
@@ -14,10 +14,12 @@<br>
# along with this program; if not, write to the Free Software<br>
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>
<br>
+import gtk<br>
import gobject<br>
<br>
from sugar.graphics import style<br>
from sugar.graphics import animator<br>
+from sugar.graphics import iconentry<br>
<br>
from jarabe.model.buddy import get_owner_instance<br>
from jarabe.view.buddyicon import BuddyIcon<br>
@@ -36,7 +38,63 @@ class _Animation(animator.Animation):<br>
self._icon.props.pixel_size = int(self.start_size + d)<br>
<br>
<br>
-class TransitionBox(BuddyIcon):<br>
+class ViewToolbar(gtk.Toolbar):<br>
+ def __init__(self):<br>
+ gtk.Toolbar.__init__(self)<br>
+<br>
+ separator = gtk.SeparatorToolItem()<br>
+ separator.props.draw = False<br>
+ separator.set_size_request(style.GRID_CELL_SIZE,<br>
+ style.GRID_CELL_SIZE)<br>
+ self.insert(separator, -1)<br>
+ separator.show()<br>
+<br>
+ tool_item = gtk.ToolItem()<br>
+ self.insert(tool_item, -1)<br>
+ tool_item.show()<br>
+<br>
+ self.search_entry = iconentry.IconEntry()<br>
+ self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,<br>
+ 'system-search')<br>
+ self.search_entry.set_width_chars(25)<br>
+ self.search_entry.props.editable = False<br>
+ tool_item.add(self.search_entry)<br>
+ self.search_entry.show()<br>
+<br>
+<br>
+class ViewContainer(gtk.HBox):<br>
+ def __init__(self, owner_icon):<br>
+ gtk.Container.__init__(self)<br>
+ self._owner_icon = owner_icon<br>
+ self.add(self._owner_icon)<br>
+ self._owner_icon.show()<br>
+ self.connect('size-allocate', self.__on_size_allocate)<br>
+<br>
+ def __on_size_allocate(self, widget, allocation):<br>
+ owner_width, owner_height = self._owner_icon.size_request()<br>
+ height = allocation.height + allocation.y<br>
+ width = allocation.width<br>
+<br>
+ # Find vertical center point of screen<br>
+ y = height / 2<br>
+<br>
+ # This container may be offset from the top by a certain amount<br>
+ # (e.g. for a toolbar at the top of the screen). Adjust the<br>
+ # center-point for that<br>
+ y -= allocation.y<br>
+<br>
+ # Now subtract half of the owner height. This gives us the y<br>
+ # coordinate for the top of the owner icon.<br>
+ y -= owner_height / 2<br>
+<br>
+ # calculate x coordinate and create allocation<br>
+ x = (width - owner_width) / 2<br>
+ owner_icon_allocation = gtk.gdk.Rectangle(x, allocation.y + y,<br>
+ owner_width, owner_height)<br>
+ self._owner_icon.size_allocate(owner_icon_allocation)<br>
+<br>
+<br>
+class TransitionBox(gtk.VBox):<br>
__gtype_name__ = 'SugarTransitionBox'<br>
<br>
__gsignals__ = {<br>
@@ -44,8 +102,17 @@ class TransitionBox(BuddyIcon):<br>
}<br>
<br>
def __init__(self):<br>
- BuddyIcon.__init__(self, buddy=get_owner_instance(),<br>
- pixel_size=style.XLARGE_ICON_SIZE)<br>
+ gtk.VBox.__init__(self)<br>
+<br>
+ self._toolbar = ViewToolbar()<br>
+ self.pack_start(self._toolbar, expand=False)<br>
+ self._toolbar.show()<br>
+<br>
+ self._owner_icon = BuddyIcon(buddy=get_owner_instance(),<br>
+ pixel_size=style.XLARGE_ICON_SIZE)<br>
+ view_container = ViewContainer(self._owner_icon)<br>
+ self.add(view_container)<br>
+ view_container.show()<br>
<br>
self._animator = animator.Animator(0.3)<br>
self._animator.connect('completed', self._animation_completed_cb)<br>
@@ -55,5 +122,5 @@ class TransitionBox(BuddyIcon):<br>
<br>
def start_transition(self, start_size, end_size):<br>
self._animator.remove_all()<br>
- self._animator.add(_Animation(self, start_size, end_size))<br>
+ self._animator.add(_Animation(self._owner_icon, start_size, end_size))<br>
self._animator.start()<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.4<br>
<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></span></blockquote></div><br></div>