4 from gstfile
import GstFile
9 #tell pyGTK, if possible, that we want GTKv2
12 #Some distributions come with GTK2, but not pyGTK
19 print "You need to install pyGTK or GTKv2 ",
20 print "or set your PYTHONPATH correctly."
21 print "try: export PYTHONPATH=",
22 print "/usr/local/lib/python2.2/site-packages/"
24 #now we have both gtk and gtk.glade imported
25 #Also, we know we are running GTK v2
31 In this init we are going to display the main
34 gladefile
="souffleur.glade"
35 windowname
="MAIN_WINDOW"
36 self
.wTree
=gtk
.glade
.XML (gladefile
,windowname
)
37 self
.gladefile
= gladefile
38 # we only have two callbacks to register, but
39 # you could register any number, or use a
40 # special class that automatically
41 # registers all callbacks. If you wanted to pass
42 # an argument, you would use a tuple like this:
43 # dic = { "on button1_clicked" : (self.button1_clicked, arg1,arg2) , ...
45 #dic = { "on_button1_clicked" : self.button1_clicked, \
46 # "gtk_main_quit" : (gtk.mainquit) }
47 dic
= { "gtk_main_quit" : (gtk
.main_quit
),\
48 "on_main_file_quit_activate": (gtk
.main_quit
), \
49 "on_main_file_open_activate": self
.mainFileOpen
}
50 self
.wTree
.signal_autoconnect (dic
)
52 self
.windowFileOpen
=None
53 self
.windowStreams
=gtk
.glade
.XML (self
.gladefile
,"STREAM_WINDOW")
54 ### Setup LIST_STREAMS
55 LIST
= self
.windowStreams
.get_widget("LIST_STREAMS")
57 self
.streamsTreeStore
= gtk
.TreeStore(gobject
.TYPE_STRING
)
58 LIST
.set_model(self
.streamsTreeStore
)
59 cell
= gtk
.CellRendererText()
60 tvcolumn
= gtk
.TreeViewColumn('Streams', cell
, text
= 0)
61 LIST
.append_column(tvcolumn
)
62 WND
=self
.windowStreams
.get_widget("STREAM_WINDOW")
65 #==============================================================================
66 def mainFileOpen(self
, widget
):
67 if(self
.windowFileOpen
==None):
68 self
.windowFileOpen
=gtk
.glade
.XML (self
.gladefile
,"OPEN_OGG")
69 dic
={"on_OPEN_BUTTON_CANCEL_clicked": self
.openFileCancel
,\
70 "on_OPEN_BUTTON_OPEN_clicked": self
.openFileOpen
}
71 self
.windowFileOpen
.signal_autoconnect(dic
)
72 # WND=self.windowFileOpen.get_widget("OPEN_OGG")
73 # Filter=gtk.FileFilter()
74 # Filter.set_name("OGM file")
75 # Filter.add_pattern("*.og[gm]")
76 # WND.add_filter(Filter)
78 WND
=self
.windowFileOpen
.get_widget("OPEN_OGG")
80 self
.windowFileOpen
=None
81 self
.mainFileOpen(widget
)
85 #==============================================================================
86 def openFileCancel(self
, widget
):
87 if(self
.windowFileOpen
==None): return
88 WND
=self
.windowFileOpen
.get_widget("OPEN_OGG")
91 #==============================================================================
92 def openFileOpen(self
, widget
):
93 WND
=self
.windowFileOpen
.get_widget("OPEN_OGG")
96 if((FN
!="")and(FN
!=None)):
97 # self.Streams=oggStreams.oggStreams(FN)
103 WND
=self
.windowStreams
.get_widget("STREAM_WINDOW")
105 self
.addStreams(Streams
)
106 # self.refreshStreamsWindow()
108 #==============================================================================
109 def addStreams(self
, Streams
):
112 iter = self
.streamsTreeStore
.append(None)
113 self
.streamsTreeStore
.set(iter, 0, Streams
.MIME
+ " " + Streams
.SOURCE
)
114 for i
in Streams
.STREAMS
.keys():
115 child
= self
.streamsTreeStore
.append(iter)
116 self
.streamsTreeStore
.set(child
, 0, i
+" " + Streams
.STREAMS
[i
])
117 print i
+" " + Streams
.STREAMS
[i
]
119 # def refreshStreamsWindow(self):
120 # TStreams=self.Streams.getStreams()
121 # for OGGStream in Streams:
125 #==============================================================================
127 #==============================================================================
128 souffleur
=Souffleur()