Author: remi
Date: 2009-06-17 16:51:18 +0200 (Wed, 17 Jun 2009)
New Revision: 4825

Modified:
   
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
Log:
* added support of the plugin commands with attribute "allUserButtons"
* fixed bug with commands attribute "critical"
* added a special actuation to stop TTS sentences (plugin audio menus)

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-17 14:48:51 UTC (rev 4824)
+++ 
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
      2009-06-17 14:51:18 UTC (rev 4825)
@@ -131,6 +131,10 @@
     def insertActuation(self, actuationName, arguments = []):
         """
         """
+        # Little hack for plugins audio menu
+        if actuationName == "abortTts":
+            self.__breakMessage()
+            return
         self.__insertEvent(PGU_EVENT_TYPE_ACTUATION, {
             'actuationName' : actuationName,
             'actuationArguments' : arguments,
@@ -453,6 +457,9 @@
         """
         self.__setStarted(True)
         while self.isStarted():
+            if self.backgroundPguContextIsCritical():
+                time.sleep(0.5)
+                continue
             # Get the next pguContext which must be in foreground
             pguContext = None
             self.__pguContextsMutex.acquire()
@@ -491,11 +498,7 @@
     def __startBackgroundPguContext(self):
         """
         """
-        if self.getBackgroundPguContext().getPluginCommand().isCritical():
-            self.stop()
         self.getBackgroundPguContext().startExecution()
-        if self.getBackgroundPguContext().getPluginCommand().isCritical():
-            self.start()
 
     def __insertPguContext(self, pguContext):
         """
@@ -552,6 +555,30 @@
         self.__bfPguContextMutex.release()
         return result
 
+    def backgroundPguContextIsCritical(self):
+        """
+        """
+        self.__bfPguContextMutex.acquire()
+        result = False
+        if self.__backgroundPguContext != None:
+            if self.__backgroundPguContext.executionIsStarted():
+                if self.__backgroundPguContext.getPluginCommand().isCritical():
+                    result = True
+        self.__bfPguContextMutex.release()
+        return result
+
+    def backgroundPguContextNeedAllUserButtons(self):
+        """
+        """
+        self.__bfPguContextMutex.acquire()
+        result = False
+        if self.__backgroundPguContext != None:
+            if self.__backgroundPguContext.executionIsStarted():
+                if 
self.__backgroundPguContext.getPluginCommand().needAllUserButtons():
+                    result = True
+        self.__bfPguContextMutex.release()
+        return result
+
     def __setForegroundPguContext(self, pguContext):
         """
         """
@@ -651,14 +678,13 @@
     def __checkLastRunStopActionTime(self):
         """
         """
-        print time.time() - self.__getLastRunStopActionTime()
         if (time.time() - self.__getLastRunStopActionTime()) >= 1.5:
             self.__setLastRunStopActionTime()
             return True
         else:
             return False
 
-    def __contextBtRunAbort(self):
+    def __contextBtRunAbort(self, eventName, *args):
         """
         """
         # Abort foreground context if exists
@@ -671,6 +697,10 @@
         # Else abort background context if exists
         if self.getBackgroundPguContext() != None:
             if self.getBackgroundPguContext().executionIsStarted():
+                # Exception for plugins commands with attribute 
"allUserButtons"
+                if self.backgroundPguContextNeedAllUserButtons():
+                    self.__contextBtOther(eventName, *args)
+                    return
                 if not self.__checkLastRunStopActionTime():
                     return
                 self.getBackgroundPguContext().stopExecution()
@@ -747,7 +777,7 @@
         else:
             if eventName == "head":
                 if args[0] == True:
-                    self.__contextBtRunAbort()
+                    self.__contextBtRunAbort(eventName, *args)
             elif eventName == "left":
                 if args[0] == True:
                     self.__contextRBNext(eventName, *args)
@@ -756,7 +786,7 @@
                     self.__contextLTPrevious(eventName, *args)
             elif eventName == "remote":
                 if args[0] == "K_OK":
-                    self.__contextBtRunAbort()
+                    self.__contextBtRunAbort(eventName, *args)
                 elif args[0] == "K_LEFT":
                     self.__contextLTPrevious(eventName, *args)
                 elif args[0] == "K_UP":


------------------------------------------------------------------------------
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