Corretti altri bug nel comportamento di play() pause() e simili,
Leonardo Robol [2009-11-23 08:02]
Corretti altri bug nel comportamento di play() pause() e simili,
che non facevano i check necessari per assicurarsi che
1) Tutto potesse funzionare
2) Non succedessero cose divertenti, ma poco costruttive
Ancora grazie Pietro per le segnalazioni! :)
diff --git a/RaiTV/Interface.py b/RaiTV/Interface.py
index 76c572f..abb281a 100644
--- a/RaiTV/Interface.py
+++ b/RaiTV/Interface.py
@@ -111,17 +111,16 @@ class UI():
if self.videowidget is None:
return
- if not self.videowidget.playing:
- treeselection = self.listacanali.get_selection()
- model, treeiter = treeselection.get_selected()
- if treeiter is None:
- ## Questo vuol dire che non abbiamo selezionato
- ## nulla, e quindi possiamo non fare nulla
- return
- mmsurl = self.channellist.getChannelFromIter(treeiter)
- self.videowidget.load_video(mmsurl)
- else:
- self.videowidget.play()
+
+ treeselection = self.listacanali.get_selection()
+ model, treeiter = treeselection.get_selected()
+ if treeiter is None:
+ ## Questo vuol dire che non abbiamo selezionato
+ ## nulla, e quindi possiamo non fare nulla
+ return
+ mmsurl = self.channellist.getChannelFromIter(treeiter)
+ self.videowidget.load_video(mmsurl)
+
def updateChannels(self):
"""Aggiorna la lista dei canali scaricandola direttamente da quella
diff --git a/RaiTV/VideoWidget.py b/RaiTV/VideoWidget.py
index 952890e..b3bbd3f 100644
--- a/RaiTV/VideoWidget.py
+++ b/RaiTV/VideoWidget.py
@@ -91,12 +91,16 @@ class GstPlayer(threading.Thread):
self.exit_required = True
def pause(self):
- self.player.set_state(gst.STATE_PAUSED)
+ if self.player is not None:
+ self.player.set_state(gst.STATE_PAUSED)
+
def play(self):
self.player.set_state(gst.STATE_PLAYING)
self.loading = False
+ self.playing = True
+
class VideoWidget(gtk.DrawingArea):
@@ -170,7 +174,8 @@ class VideoWidget(gtk.DrawingArea):
def pause(self):
- self.player.pause()
+ if self.player is not None:
+ self.player.pause()
def stop(self):
self.playing = False
@@ -193,6 +198,8 @@ class VideoWidget(gtk.DrawingArea):
def play(self):
if self.player is not None:
+ if self.playing is True:
+ self.stop()
self.playing = True
self.player.play()