Author: remi
Date: 2009-03-23 21:02:54 +0100 (Mon, 23 Mar 2009)
New Revision: 4192
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-clockradio/branches/0.0.3-windows-compatible/executables/tux-gadget-clockradio.py
Log:
* now uses the onGadgetStop event to stop the webradio sub-process.
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-clockradio/branches/0.0.3-windows-compatible/executables/tux-gadget-clockradio.py
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-clockradio/branches/0.0.3-windows-compatible/executables/tux-gadget-clockradio.py
2009-03-23 20:02:03 UTC (rev 4191)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-clockradio/branches/0.0.3-windows-compatible/executables/tux-gadget-clockradio.py
2009-03-23 20:02:54 UTC (rev 4192)
@@ -77,6 +77,11 @@
class WebRadioGadget(SimpleGadget):
+ def __init__(self):
+ SimpleGadget.__init__(self)
+ # Create a mplayer wrapper object
+ self.__player = Mplayer()
+
def start(self):
if self.getCommand() == "check":
self.check()
@@ -95,14 +100,13 @@
if myRadio in WEBRADIO.keys():
radioUrl = WEBRADIO[myRadio]
self.throwMessage("Web radio \"{0}\".", myRadio)
- # Create a mplayer wrapper object
- player = Mplayer()
# Start mplayer
- player.start(radioUrl, True)
- # Wait that the wrapper thread has been launched
- time.sleep(1.0)
- # Create a pid file for mplayer.
- self.writePid(player.getPid())
+ self.__player.start(radioUrl, True)
+
+ def onGadgetStop(self):
+ """Event on gadget stop.
+ """
+ self.__player.stop()
if __name__ == "__main__":
import sys
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn