Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2014-02-10 22:40:43 (GMT)
committer Walter Bender <walter@sugarlabs.org>2014-02-10 22:40:43 (GMT)
commite43d217b7105c6f80f2b4894c96dd2dde7065a52 (patch)
tree3d30b746829cd7df8dd8b443d984ebe4296b6cb3
parent5922cb5aad5e84c86a70d5d2bc87740542d4a744 (diff)
some more minor tweaksv199
-rw-r--r--TurtleArt/tagplay.py15
-rw-r--r--TurtleArt/talogo.py12
2 files changed, 13 insertions, 14 deletions
diff --git a/TurtleArt/tagplay.py b/TurtleArt/tagplay.py
index 06000c7..fc3ee9e 100644
--- a/TurtleArt/tagplay.py
+++ b/TurtleArt/tagplay.py
@@ -158,8 +158,8 @@ class Gplay():
return False
self.playlist.append('file://' + os.path.abspath(file_path))
if not self.player:
- # lazy init the player so that videowidget is realized
- # and has a valid widget allocation
+ # Lazy init the player so that videowidget is realized
+ # and has a valid widget allocation.
self.player = GstPlayer(self.videowidget, self.running_sugar)
self.player.connect('eos', self._player_eos_cb)
self.player.connect('error', self._player_error_cb)
@@ -172,9 +172,8 @@ class Gplay():
self.player.set_uri(self.playlist[0])
self.currentplaying = 0
self.play_toggled()
- self.show_all()
- except:
- error_output('Error playing %s' % (self.playlist[0]),
+ except Exception, e:
+ error_output('Error playing %s: %s' % (self.playlist[0], e),
self.running_sugar)
return False
@@ -279,18 +278,18 @@ class GstPlayer(gobject.GObject):
def pause(self):
self.player.set_state(gst.STATE_PAUSED)
self.playing = False
- debug_output('pausing player', self.running_sugar)
+ # debug_output('pausing player', self.running_sugar)
def play(self):
self.player.set_state(gst.STATE_PLAYING)
self.playing = True
self.error = False
- debug_output('playing player', self.running_sugar)
+ # debug_output('playing player', self.running_sugar)
def stop(self):
self.player.set_state(gst.STATE_NULL)
self.playing = False
- debug_output('stopped player', self.running_sugar)
+ # debug_output('stopped player', self.running_sugar)
def get_state(self, timeout=1):
return self.player.get_state(timeout=timeout)
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index 97b2b60..b3435e3 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -1107,7 +1107,6 @@ class LogoCode:
obj = Media(mediatype[0:5], value=tmp.name)
return obj
else:
- debug_output('Returning req.read()', self.tw.running_sugar)
return req.read()
def showlist(self, objects):
@@ -1136,7 +1135,8 @@ class LogoCode:
elif os_path_exists(obj.value):
self.filepath = obj.value
mediatype = obj.type
- if self.filepath is not None:
+ # If for some reason the obj.type is not set, try guessing.
+ if mediatype is None and self.filepath is not None:
if movie_media_type(self.filepath):
mediatype = 'video'
elif audio_media_type(self.filepath):
@@ -1180,6 +1180,10 @@ class LogoCode:
self.tw.running_sugar)
elif obj.type == 'media' or mediatype == 'image':
self.insert_image(center=center)
+ elif mediatype == 'audio':
+ self.play_sound()
+ elif mediatype == 'video':
+ self.play_video()
elif obj.type == 'descr' or mediatype == 'text':
mimetype = None
if self.dsobject is not None and \
@@ -1193,10 +1197,6 @@ class LogoCode:
'description']
self.insert_desc(mimetype, description)
- elif obj.type == 'audio' or mediatype == 'audio':
- self.play_sound()
- elif obj.type == 'video' or mediatype == 'video':
- self.play_video()
if self.dsobject is not None:
self.dsobject.destroy()