GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — clutter: nicer wrapper around actor_animatev · leonhd/rpythonic@28d3f3f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • examples
    • clutter-animation.py
    • libclutter_gtk
      • __init__.py
  • scripts
    • gtkfooter.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎examples/clutter-animation.py‎

Copy file name to clipboardExpand all lines: examples/clutter-animation.py
+7-24Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,18 @@
3434

3535
def sayhi(b, actor):
3636
print('hello world', actor)
37-
if 1:
38-
val = gtk.GValue()
39-
gtype = gtk.g_type_from_name('gdouble')
40-
assert gtype
41-
print('GTYPE',gtype)
42-
val = gtk.g_value_init( val, gtype )
43-
val.set_double( 2.0 )
44-
print('VAL',val)
45-
anim = actor.animatev(
46-
clutter.CLUTTER_LINEAR, 4000,
47-
1, #num properties
48-
ctypes.pointer(ctypes.c_char_p('scale-x')), val,
49-
)
50-
print(anim)
51-
#actor.set_scale( 2.0, 1.0 )
37+
if actor.get_scale()[0] < 1.0: scale = 2.0
38+
else: scale = 0.75
39+
actor.animate(
40+
clutter.CLUTTER_LINEAR, 4000,
41+
scale_x=scale,
42+
)
5243

5344
for i in range(10):
5445
button = gtk.Button('Click me')
5546
button.connect('clicked', sayhi, gact)
56-
#vbox.pack_end(button, False, False, 0)
57-
#gact.set_size(100, 100)
58-
#gact.set_anchor_point(50, 50)
59-
#gact.set_position(150, 150)
60-
#gact.set_rotation(clutter.CLUTTER_Z_AXIS, 80.0, 0, 0, 0)
6147
box.pack_start( button )
62-
box.show_all()
48+
box.show_all() # required
6349

6450
button = gtk.Button('gtk-ok')
6551
button.set_use_stock(True)
@@ -73,6 +59,3 @@ def sayhi(b, actor):
7359

7460
print('exit')
7561

76-
#if __name__ == '__main__': main()
77-
78-
Collapse file

‎examples/libclutter_gtk/__init__.py‎

Copy file name to clipboardExpand all lines: examples/libclutter_gtk/__init__.py
+30-1Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78264,6 +78264,35 @@ def connect( ptr, name, func, *args ):
7826478264
if 'GtkSocket' in globals(): # this is missing with Clutter
7826578265
GTK_WIDGET_CLASSES[ GtkSocket ] = gtk_socket_new
7826678266

78267+
if 'ClutterActor' in globals():
78268+
def _clutter_actor_animate_helper(self, atype, ms, **kw):
78269+
anims = {}
78270+
for prop in kw:
78271+
val = GValue()
78272+
gtype = g_type_from_name('gdouble')
78273+
assert gtype
78274+
val = g_value_init( val, gtype )
78275+
val.set_double( kw[prop] )
78276+
anims[prop] = self.animatev(
78277+
atype, ms,
78278+
1, #num properties
78279+
ctypes.pointer(ctypes.c_char_p(prop)), val,
78280+
)
78281+
return anims
78282+
ClutterActor.animate = _clutter_actor_animate_helper
78283+
78284+
def _get_(self):
78285+
x = ctypes.pointer( ctypes.c_double() )
78286+
y = ctypes.pointer( ctypes.c_double() )
78287+
self.clutter_actor_get_scale( x, y )
78288+
return x.contents.value, y.contents.value
78289+
ClutterActor.get_scale = _get_
78290+
def _get_(self):
78291+
x = ctypes.pointer( ctypes.c_double() )
78292+
y = ctypes.pointer( ctypes.c_double() )
78293+
self.clutter_actor_get_size( x, y )
78294+
return x.contents.value, y.contents.value
78295+
ClutterActor.get_size = _get_
7826778296

7826878297

7826978298
for d in (GTK_WIDGET_CLASSES, GTK_CONTAINER_CLASSES):
@@ -78296,4 +78325,4 @@ def gdk2rgb( c ): return (c.red/65536.0, c.green/65536.0, c.blue/65536.0)
7829678325
_rpythonic_setup_return_wrappers()
7829778326
_rpythonic_make_nice_global_enums_()
7829878327
_rpythonic_clean_up_missing_functions_()
78299-
_rpythonic_strip_prefixes_(['GTK_', 'gtk_', 'clutter_'])
78328+
_rpythonic_strip_prefixes_(['GTK_', 'gtk_', 'clutter_'])
Collapse file

‎scripts/gtkfooter.py‎

Copy file name to clipboardExpand all lines: scripts/gtkfooter.py
+29-1Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,35 @@ def connect( ptr, name, func, *args ):
302302
if 'GtkSocket' in globals(): # this is missing with Clutter
303303
GTK_WIDGET_CLASSES[ GtkSocket ] = gtk_socket_new
304304

305-
305+
if 'ClutterActor' in globals():
306+
def _clutter_actor_animate_helper(self, atype, ms, **kw):
307+
anims = {}
308+
for prop in kw:
309+
val = GValue()
310+
gtype = g_type_from_name('gdouble')
311+
assert gtype
312+
val = g_value_init( val, gtype )
313+
val.set_double( kw[prop] )
314+
anims[prop] = self.animatev(
315+
atype, ms,
316+
1, #num properties
317+
ctypes.pointer(ctypes.c_char_p(prop)), val,
318+
)
319+
return anims
320+
ClutterActor.animate = _clutter_actor_animate_helper
321+
322+
def _get_(self):
323+
x = ctypes.pointer( ctypes.c_double() )
324+
y = ctypes.pointer( ctypes.c_double() )
325+
self.clutter_actor_get_scale( x, y )
326+
return x.contents.value, y.contents.value
327+
ClutterActor.get_scale = _get_
328+
def _get_(self):
329+
x = ctypes.pointer( ctypes.c_double() )
330+
y = ctypes.pointer( ctypes.c_double() )
331+
self.clutter_actor_get_size( x, y )
332+
return x.contents.value, y.contents.value
333+
ClutterActor.get_size = _get_
306334

307335
for d in (GTK_WIDGET_CLASSES, GTK_CONTAINER_CLASSES):
308336
for o in d:

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.