From a5f8ad55edf20beb1e631c93c0cbd9aa05fd9447 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Mon, 23 Nov 2009 09:02:23 +0100 Subject: [PATCH] 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! :) --- RaiTV/Interface.py | 21 ++++++++++----------- RaiTV/VideoWidget.py | 11 +++++++++-- 2 files changed, 19 insertions(+), 13 deletions(-) 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() -- 2.1.4