C'était malheureusement trop beau… Si je mets ClutterGst.init
avant GtkClutter.init
, plus de Segfault effectivement, mais j'obtiens une fenêtre noire et qui ne répond pas (pas moyen de déclencher le signal 'destroy', il faut tuer le processus…) : ![Clutter, pourquoi tant de haine ?](/media/galleries/1119/06ffe00a-bea8-4b9b-a9cb-728c284234be.png)
Je suis tombé sur le code suivant sur Internet, qui n'utilise pas Builder :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 | import sys, gi
gi.require_version("Gtk", "3.0")
gi.require_version("ClutterGst", "3.0")
gi.require_version("GtkClutter", "1.0")
from gi.repository import Gtk, ClutterGst, GtkClutter, Clutter
class ClPlayer(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
# new
self.actor = Clutter.Actor.new()
self.content = ClutterGst.Aspectratio.new()
self.player = ClutterGst.Playback.new()
# set
self.content.set_player(self.player)
self.actor.set_content(self.content)
self.actor.show()
# size
self.actor.set_width(1024)
self.actor.set_height(436)
# add
self.embed = GtkClutter.Embed()
self.stage = self.embed.get_stage()
self.stage.add_child(self.actor)
self.add(self.embed)
# play
self.player.set_uri("file:///home/mathis/Téléchargements/sintel-1024-surround.mp4")
self.player.set_playing(True)
# show
self.resize(1024, 436)
self.show_all()
def do_delete_event(self, event):
Gtk.main_quit()
#Clutter.init(sys.argv) # Error
GtkClutter.init(sys.argv)
ClutterGst.init(sys.argv)
win = ClPlayer()
Gtk.main()
|
Et il marche sans problème (la lecture se lance sans soucis, les signaux ne sont pas bloqués, bref). Par contre si on inverse (ClutterGst.init
avant Gtk.Clutter.init
), on obtient une fenêtre noire (mais Gstreamer semble quand même tourner, vu que le son passe). D'où ma question, est-ce que cela pourrait être une incompatibilité entre Clutter et Gtk.Builder ?
Au cas où, mon fichier .ui :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70 | <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Video player</property>
<property name="resizable">False</property>
<property name="window_position">center</property>
<property name="icon_name">applications-multimedia</property>
<signal name="destroy" handler="destroy" swapped="no"/>
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="button">
<property name="label">gtk-open</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScale" id="progress">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="opacity">0.96999999999999997</property>
<property name="adjustment">adjustment1</property>
<property name="show_fill_level">True</property>
<property name="round_digits">1</property>
<property name="draw_value">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
|