[tuxdroid-svn] r4574 - softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-04-21 11:49:44
|
Author: remi
Date: 2009-04-21 13:49:35 +0200 (Tue, 21 Apr 2009)
New Revision: 4574
Modified:
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py
Log:
* updated method to update the gadgets parameters of the configured gadgets
Modified: softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py
===================================================================
--- softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py 2009-04-21 11:41:05 UTC (rev 4573)
+++ softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py 2009-04-21 11:49:35 UTC (rev 4574)
@@ -175,6 +175,19 @@
return result
# --------------------------------------------------------------------------
+ # Get the hidden parameters name list.
+ # --------------------------------------------------------------------------
+ def getHiddenParametersName(self):
+ """Get the hidden parameters name list.
+ @return: A list of strings.
+ """
+ result = []
+ for parameter in self.__parameters:
+ if not parameter.isVisible():
+ result.append(parameter.getName())
+ return result
+
+ # --------------------------------------------------------------------------
# Get if the Gadget object is a configuration or an original gadget.
# --------------------------------------------------------------------------
def isConfiguration(self):
@@ -484,12 +497,15 @@
# --------------------------------------------------------------------------
# Update the parameters of the configured gadget.
# --------------------------------------------------------------------------
- def updateParameters(self, parameters = {}, hiddenParameters = []):
+ def updateParameters(self, parameters = {}, hiddenParameters = None):
"""Update the parameters of the configured gadget.
@param parameters: Parameters of the gadget as dictionary.
if no parameter is defined the default ones are set.
if a parameter is wrong or missing the default one is set.
@param hiddenParameters: Hidden parameters list.
+ if no list (None value) is defined the previous ones are set.
+ if you want reinitializing the default list, you must to pass an
+ empty list.
@return: The success of the command.
* This method only work with a configured gadget.
"""
@@ -497,6 +513,8 @@
return False
if not self._checkObjectType('parameters', parameters, 'dict'):
return False
+ if hiddenParameters == None:
+ hiddenParameters = self.getHiddenParametersName()
args = ""
for key in parameters.keys():
args += "%s=%s|" % (key, parameters[key])
|