[gnome-clocks/clutter] add standalone testing
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/clutter] add standalone testing
- Date: Fri, 24 Aug 2012 12:13:10 +0000 (UTC)
commit 9caaf7983e5c5f5c1e05b7b69df8af6bbf1d36bf
Author: Seif Lotfy <seif lotfy com>
Date: Fri Aug 24 14:12:17 2012 +0200
add standalone testing
gnomeclocks/widgets.py | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/gnomeclocks/widgets.py b/gnomeclocks/widgets.py
index 4fd1b5c..f61264b 100644
--- a/gnomeclocks/widgets.py
+++ b/gnomeclocks/widgets.py
@@ -679,13 +679,14 @@ class SelectableIconView(Gtk.IconView):
class SelectionToolbar():
def __init__(self, parent_actor):
self._parent_actor = parent_actor
+
self.widget = Gtk.Toolbar()
self.widget.set_show_arrow(False)
self.widget.set_icon_size(Gtk.IconSize.LARGE_TOOLBAR)
self.widget.get_style_context().add_class('osd');
self.widget.set_size_request(SELECTION_TOOLBAR_DEFAULT_WIDTH, -1);
+
self.actor = GtkClutter.Actor.new_with_contents(self.widget)
- #self.actor.set_show_on_set_parent(False)
self.actor.set_opacity(0)
#Utils.alphaGtkWidget(self.actor.get_widget());
constraint = Clutter.AlignConstraint()
@@ -696,6 +697,7 @@ class SelectionToolbar():
constraint.set_source(self._parent_actor)
constraint.set_align_axis(Clutter.AlignAxis.Y_AXIS)
constraint.set_factor(0.50)
+
self._leftBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self._leftGroup = Gtk.ToolItem()
self._leftGroup.add(self._leftBox)
@@ -715,7 +717,7 @@ class SelectionToolbar():
self._fade_out()
def _fade_in(self):
- if self.actor.opacity != 0:
+ if self.actor.get_opacity() != 0:
return
else:
self.actor.opacity = 0
@@ -771,22 +773,30 @@ class Embed (GtkClutter.Embed):
self._contentsActor.add_actor(self._viewActor)
self._notebook = notebook
+ self._selectionToolbar = SelectionToolbar(self._contentsActor)
self._notebookActor = GtkClutter.Actor.new_with_contents(self._notebook)
- self._overlayLayout.add(self._notebookActor, Clutter.BinAlignment.FILL, Clutter.BinAlignment.FILL)
+ self._overlayLayout.add(self._notebookActor,
+ Clutter.BinAlignment.FILL,
+ Clutter.BinAlignment.FILL)
+ self._overlayLayout.add(self._selectionToolbar.actor,
+ Clutter.BinAlignment.FIXED,
+ Clutter.BinAlignment.FIXED)
self.show_all()
################################################################################
# Main
################################################################################
def main():
- import sys
- Clutter.init(sys.argv)
- sec = SelectionToolbar(None)
- sec.actor.opacity = 0
- sec._fade_in()
- sec._fade_out()
- sec._fade_in()
+ import sys, signal
+ GtkClutter.init(sys.argv)
embed = Embed(Gtk.Label("Hi"))
+ embed._selectionToolbar._fade_in()
+ embed._selectionToolbar.actor.show_all()
+ window = Gtk.Window()
+ window.add(embed)
+ window.show_all()
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+ Gtk.main()
if __name__ == "__main__":
main ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]