Author: remi
Date: 2009-06-10 14:48:50 +0200 (Wed, 10 Jun 2009)
New Revision: 4777

Modified:
   
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
Log:
* handled "mute" and "standby" events

Modified: 
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
      2009-06-10 12:10:35 UTC (rev 4776)
+++ 
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
      2009-06-10 12:48:50 UTC (rev 4777)
@@ -465,6 +465,8 @@
     def createPguContext(self, pluginInterpreterContext):
         """
         """
+        if not self.isStarted():
+            return
         # Create new pguContext
         pguContext = PguContext(pluginInterpreterContext)
         # Add the new pguContext in the system
@@ -645,11 +647,31 @@
                 return
         self.__onDemandNext()
 
-    def __contextBtMute(self):
+    def __contextBtMute(self, eventName, *args):
         """
         """
-        pass
+        if self.isStarted():
+            self.stop()
+            resourceTuxDriver.playSound(12, 100.0)
+            self.__contextBtStandby("remote", ("K_STANDBY", 0.0))
+        else:
+            resourceTuxDriver.playSound(12, 100.0)
+            self.start()
 
+    def __contextBtStandby(self, eventName, *args):
+        """
+        """
+        # Flush the foreground stack
+        self.__pguContextsMutex.acquire()
+        self.__pguContexts = []
+        self.__pguContextsMutex.release()
+        # Stop current foreground context
+        if self.getForegroundPguContext() != None:
+            self.getForegroundPguContext().stopExecution()
+        # Stop current background context
+        if self.getBackgroundPguContext() != None:
+            self.getBackgroundPguContext().stopExecution()
+
     def __contextBtOther(self, eventName, *args):
         """
         """
@@ -662,7 +684,11 @@
     def sendEvent(self, eventName, *args):
         """
         """
-        def async():
+        if not self.isStarted():
+            if eventName == "remote":
+                if args[0] == "K_MUTE":
+                    self.__contextBtMute(eventName, *args)
+        else:
             if eventName == "head":
                 if args[0] == True:
                     self.__contextBtRunAbort()
@@ -683,10 +709,12 @@
                     self.__contextRBNext(eventName, *args)
                 elif args[0] == "K_DOWN":
                     self.__contextRBNext(eventName, *args)
+                elif args[0] == "K_MUTE":
+                    self.__contextBtMute(eventName, *args)
+                elif args[0] == "K_STANDBY":
+                    self.__contextBtStandby(eventName, *args)
                 else:
                     self.__contextBtOther(eventName, *args)
-        t = threading.Thread(target = async)
-        t.start()
 
 # 
==============================================================================
 # 
******************************************************************************


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to