[tuxdroid-svn] r5019 - in software_suite_v3/smart-core/smart-server/trunk: data/web_interface/deve
Status: Beta
Brought to you by:
ks156
Author: remi
Date: 2009-07-03 11:06:00 +0200 (Fri, 03 Jul 2009)
New Revision: 5019
Modified:
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/parameter.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/plugin_gadget_common.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_configuration.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/parameter.xsl
software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/01_resourceTuxOSL.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py
Log:
* Added locutor selection in the "gadget configuration"
Modified: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/parameter.xsl
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/parameter.xsl 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/parameter.xsl 2009-07-03 09:06:00 UTC (rev 5019)
@@ -139,6 +139,9 @@
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
+ <xsl:if test="count(enumValues/*) < 2">
+ <xsl:attribute name="disabled">disabled</xsl:attribute>
+ </xsl:if>
<xsl:for-each select="enumValues/*">
<xsl:element name="option">
<xsl:attribute name="value">
Modified: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/plugin_gadget_common.xsl
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/plugin_gadget_common.xsl 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/plugin_gadget_common.xsl 2009-07-03 09:06:00 UTC (rev 5019)
@@ -325,7 +325,7 @@
<!-- PARMETERS CONTENT -->
<div class="sectionContentTop2"></div>
<xsl:for-each select="parameters/*">
- <xsl:if test="visible = 'True'">
+ <xsl:if test="visible = 'True' or name = 'locutor'">
<div class="sectionContentRowBox">
<xsl:element name="input">
<xsl:attribute name="class">text</xsl:attribute>
Modified: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_configuration.xsl
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_configuration.xsl 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_configuration.xsl 2009-07-03 09:06:00 UTC (rev 5019)
@@ -91,7 +91,7 @@
</div>
<!-- GADGET PARAMETERS -->
<xsl:for-each select="root/data/parameters/*">
- <xsl:if test="visible = 'True'">
+ <xsl:if test="visible = 'True' or name = 'locutor'">
<div class="gadgetConfContentFrameMiddle">
<div class="gadgetConfContentFrameSep"></div>
<xsl:element name="input">
Modified: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/parameter.xsl
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/parameter.xsl 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/parameter.xsl 2009-07-03 09:06:00 UTC (rev 5019)
@@ -139,6 +139,9 @@
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
+ <xsl:if test="count(enumValues/*) < 2">
+ <xsl:attribute name="disabled">disabled</xsl:attribute>
+ </xsl:if>
<xsl:for-each select="enumValues/*">
<xsl:element name="option">
<xsl:attribute name="value">
Modified: software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/01_resourceTuxOSL.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/01_resourceTuxOSL.py 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/01_resourceTuxOSL.py 2009-07-03 09:06:00 UTC (rev 5019)
@@ -106,6 +106,9 @@
secondLocutor = resourceUsers.getCurrentUserConfiguration()['locutor2']
self.ttsSpeak(" ", secondLocutor, pitch)
time.sleep(3.0)
+ # Reference locutors list
+ resourcePluginsServer.getPluginsContainer().setLocutorsList(self.ttsVoicesList())
+ # Start the robot/content interactions
resourceRobotContentInteractions.startMe()
if value:
t = threading.Thread(target = startTuxOsl)
Modified: software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py 2009-07-03 09:06:00 UTC (rev 5019)
@@ -101,10 +101,11 @@
'visible' : 'false',
})
self.__parameters.append(pluginParameter)
+ defaultLocutor = self.__parent.getLocutor().replace("8k", "")
pluginParameter = PluginParameter(self, {
'name' : 'locutor',
- 'type' : 'string',
- 'defaultValue' : self.__parent.getLocutor(),
+ 'type' : 'enum(' + defaultLocutor + ')',
+ 'defaultValue' : defaultLocutor,
'description' : 'Locutor',
'category' : 'internals',
'visible' : 'false',
Modified: software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py 2009-07-03 09:06:00 UTC (rev 5019)
@@ -42,6 +42,7 @@
self.__onPluginDeployedCallback = None
self.__onPluginDeploymentErrorCallback = None
self.__onPluginUndeployedCallback = None
+ self.__locutors = []
# --------------------------------------------------------------------------
# Configure the locale values of the plugins container.
@@ -106,6 +107,31 @@
self.__mutex.release()
return result
+ # --------------------------------------------------------------------------
+ # Set the available locutors list.
+ # --------------------------------------------------------------------------
+ def setLocutorsList(self, locutors):
+ """Set the available locutors list.
+ @param locutors: Locutors list.
+ """
+ self.__mutex.acquire()
+ self.__locutors = []
+ for locutor in locutors:
+ self.__locutors.append(locutor.replace("8k", ""))
+ self.__mutex.release()
+
+ # --------------------------------------------------------------------------
+ # Get the available locutors list.
+ # --------------------------------------------------------------------------
+ def getLocutorsList(self):
+ """Get the available locutors list.
+ @return: A list of strings.
+ """
+ self.__mutex.acquire()
+ result = self.__locutors
+ self.__mutex.release()
+ return result
+
# ==========================================================================
# AUTO-DEPLOYER
# ==========================================================================
Modified: software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py 2009-07-02 13:51:06 UTC (rev 5018)
+++ software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py 2009-07-03 09:06:00 UTC (rev 5019)
@@ -39,6 +39,7 @@
# Create descriptor
self.__description = UgcDescription(self, dictionary['description'])
# Create ugc parameters
+ self.__checkForLocals(dictionary)
self.__parameters = []
if dictionary.has_key('parameters'):
for key in dictionary['parameters'].keys():
@@ -54,6 +55,28 @@
self.__tasks.append(task)
# --------------------------------------------------------------------------
+ # Check for locals
+ # --------------------------------------------------------------------------
+ def __checkForLocals(self, dictionary):
+ """Check for locals
+ """
+ def checkParam(paramName, defaultValue):
+ for key in dictionary['parameters'].keys():
+ if dictionary['parameters'][key]['name'] == paramName:
+ return
+ keyName = "param_%.2d" % len(dictionary['parameters'].keys())
+ dictionary['parameters'][keyName] = {
+ 'name' : paramName,
+ 'value' : defaultValue,
+ }
+ if not dictionary.has_key('parameters'):
+ return
+ checkParam("locutor", self.__parent.getLocutor().replace("8k", ""))
+ checkParam("pitch", self.__parent.getPitch())
+ checkParam("language", self.__parent.getLanguage())
+ checkParam("country", self.__parent.getCountry())
+
+ # --------------------------------------------------------------------------
# Get the data of the Ugc as dictionary.
# --------------------------------------------------------------------------
def getData(self, language):
@@ -119,6 +142,21 @@
else:
data['parameters'][nodeName]['defaultValue'] = parentParameter.getDefaultValue(language)
data['parameters'][nodeName]['enumValues'] = parentParameter.getEnumValues(language)
+ # Hack for 'locutor' parameter. Locutors list is dynamique and depends
+ # Of the dongle plug and Tuxosl states.
+ if parentParameter.getName() == 'locutor':
+ # Get the current locutors list from tuxosl
+ locutorsList = self.getParentGadget().getParentPlugin().getContainer().getLocutorsList()
+ # Insert the selected locutor
+ selectedLocutor = data['parameters'][nodeName]['defaultValue']
+ if not selectedLocutor in locutorsList:
+ locutorsList.append(selectedLocutor)
+ locutorsStr = ""
+ for locutor in locutorsList:
+ if len(locutorsStr) != 0:
+ locutorsStr += ","
+ locutorsStr += locutor
+ data['parameters'][nodeName]['enumValues'] = locutorsStr
data['parameters'][nodeName]['minValue'] = parentParameter.getMinValue()
data['parameters'][nodeName]['maxValue'] = parentParameter.getMaxValue()
data['parameters'][nodeName]['stepValue'] = parentParameter.getStepValue()
@@ -423,8 +461,11 @@
myParameters[key] = parameters[key]
if not myParameters.has_key("language"):
myParameters["language"] = self.__parent.getLanguage()
+ if not myParameters.has_key("locutor"):
myParameters["locutor"] = self.__parent.getLocutor()
+ if not myParameters.has_key("pitch"):
myParameters["pitch"] = self.__parent.getPitch()
+ if not myParameters.has_key("country"):
myParameters["country"] = self.__parent.getCountry()
return self.__parentGadget.start(command, myParameters)
|