Author: remi
Date: 2009-04-06 21:29:01 +0200 (Mon, 06 Apr 2009)
New Revision: 4367
Modified:
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/attitunes/AttitunesContainer.py
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/tuxdroid/const/ConstAttitunes.py
Log:
* fixed file format to unix
Modified:
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/attitunes/AttitunesContainer.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/attitunes/AttitunesContainer.py
2009-04-06 19:27:06 UTC (rev 4366)
+++
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/attitunes/AttitunesContainer.py
2009-04-06 19:29:01 UTC (rev 4367)
@@ -1,144 +1,144 @@
-# Copyright (C) 2009 C2ME Sa
-# Remi Jocaille <[email protected]>
-# Distributed under the terms of the GNU General Public License
-# http://www.gnu.org/copyleft/gpl.html
-
-import threading
-
-from tuxisalive.api.base.ApiBaseChildResource import ApiBaseChildResource
-from Attitune import Attitune
-
-#
------------------------------------------------------------------------------
-# Attitunes container.
-#
------------------------------------------------------------------------------
-class AttitunesContainer(ApiBaseChildResource):
- """Attitunes container.
- """
-
- #
--------------------------------------------------------------------------
- # Constructor of the class.
- #
--------------------------------------------------------------------------
- def __init__(self, apiBase, apiBaseServer, structure):
- """Constructor of the class.
- @param apiBase: ApiBase parent object.
- @param apiBaseServer: ApiBaseServer object.
- @param structure: Attitunes container structure as dictionary.
- """
- ApiBaseChildResource.__init__(self, apiBase, apiBaseServer)
- self.__mutex = threading.Lock()
- self.__attitunes = []
- self._update(structure)
-
- #
--------------------------------------------------------------------------
- # Update the container structure.
- #
--------------------------------------------------------------------------
- def _update(self, structure):
- """Update the container structure.
- @param structure: The new container structure dictionary.
- """
- self.__mutex.acquire()
- self.__attitunes = []
- for key in structure.keys():
- if key.lower().find('data') == 0:
- self.__attitunes.append(Attitune(self.getParent(),
- self.getServer(), self, structure[key]))
- self.__mutex.release()
-
- #
--------------------------------------------------------------------------
- # Get the attitune objects list.
- #
--------------------------------------------------------------------------
- def getAttitunes(self):
- """Get the attitune objects list.
- @return: A list of Attitune objects.
- """
- self.__mutex.acquire()
- result = self.__attitunes
- self.__mutex.release()
- return result
-
- #
--------------------------------------------------------------------------
- # Get the number of attitunes contains in the container.
- #
--------------------------------------------------------------------------
- def getCount(self):
- """Get the number of attitunes contains in the container.
- @return: An integer.
- """
- self.__mutex.acquire()
- result = len(self.__attitunes)
- self.__mutex.release()
- return result
-
- #
--------------------------------------------------------------------------
- # Show the attitunes name list in the console.
- #
--------------------------------------------------------------------------
- def showAttitunes(self):
- """Show the attitunes name list in the console.
- """
- result = []
- self.__mutex.acquire()
- for attitune in self.__attitunes:
- result.append(attitune.getDescription().getName())
- self.__mutex.release()
- self._showStringList("Attitune names :", result)
-
- #
--------------------------------------------------------------------------
- # Get an attitune object by it name or index.
- #
--------------------------------------------------------------------------
- def getAttitune(self, attitune):
- """Get an attitune object by it name or index.
- @param attitune: The name or index of the attitune.
- @return: An Attitune object or None.
- """
- self.__mutex.acquire()
- if str(type(attitune)) == "<type 'int'>":
- if attitune in range(len(self.__attitunes)):
- result = self.__attitunes[attitune]
- self.__mutex.release()
- return result
- else:
- for attObject in self.__attitunes:
- if attObject.getDescription().getName() == attitune:
- result = attObject
- self.__mutex.release()
- return result
- self.__mutex.release()
- return None
-
- #
--------------------------------------------------------------------------
- # Stop played attitune.
- #
--------------------------------------------------------------------------
- def stopAttitune(self):
- """Stop played attitune.
- @return: The success of the command.
- """
- cmd = "attitune_manager/stop_attitune?"
- return self._sendCommandBooleanResult(cmd)
-
- #
--------------------------------------------------------------------------
- # Insert an attitune in the container.
- #
--------------------------------------------------------------------------
- def insertAttitune(self, attituneFileName):
- """Insert an attitune in the container.
- @param attituneFileName: Attitune file name. Can be a local or a
distant
- file.
- @return: The success of the command.
- """
- argsToSend = {
- 'path' : attituneFileName,
- }
- cmd = "attitune_manager/insert_attitune?"
- return self._sendCommandBooleanResult(cmd, argsToSend)
-
- #
--------------------------------------------------------------------------
- # Remove an attitune from the container.
- #
--------------------------------------------------------------------------
- def removeAttitune(self, attituneName):
- """Remove an attitune from the container.
- @param attituneName: The name of the attitune.
- @return: The success of the command.
- """
- argsToSend = {
- 'name' : attituneName,
- }
- cmd = "attitune_manager/remove_attitune?"
- return self._sendCommandBooleanResult(cmd, argsToSend)
+# Copyright (C) 2009 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+import threading
+
+from tuxisalive.api.base.ApiBaseChildResource import ApiBaseChildResource
+from Attitune import Attitune
+
+#
------------------------------------------------------------------------------
+# Attitunes container.
+#
------------------------------------------------------------------------------
+class AttitunesContainer(ApiBaseChildResource):
+ """Attitunes container.
+ """
+
+ #
--------------------------------------------------------------------------
+ # Constructor of the class.
+ #
--------------------------------------------------------------------------
+ def __init__(self, apiBase, apiBaseServer, structure):
+ """Constructor of the class.
+ @param apiBase: ApiBase parent object.
+ @param apiBaseServer: ApiBaseServer object.
+ @param structure: Attitunes container structure as dictionary.
+ """
+ ApiBaseChildResource.__init__(self, apiBase, apiBaseServer)
+ self.__mutex = threading.Lock()
+ self.__attitunes = []
+ self._update(structure)
+
+ #
--------------------------------------------------------------------------
+ # Update the container structure.
+ #
--------------------------------------------------------------------------
+ def _update(self, structure):
+ """Update the container structure.
+ @param structure: The new container structure dictionary.
+ """
+ self.__mutex.acquire()
+ self.__attitunes = []
+ for key in structure.keys():
+ if key.lower().find('data') == 0:
+ self.__attitunes.append(Attitune(self.getParent(),
+ self.getServer(), self, structure[key]))
+ self.__mutex.release()
+
+ #
--------------------------------------------------------------------------
+ # Get the attitune objects list.
+ #
--------------------------------------------------------------------------
+ def getAttitunes(self):
+ """Get the attitune objects list.
+ @return: A list of Attitune objects.
+ """
+ self.__mutex.acquire()
+ result = self.__attitunes
+ self.__mutex.release()
+ return result
+
+ #
--------------------------------------------------------------------------
+ # Get the number of attitunes contains in the container.
+ #
--------------------------------------------------------------------------
+ def getCount(self):
+ """Get the number of attitunes contains in the container.
+ @return: An integer.
+ """
+ self.__mutex.acquire()
+ result = len(self.__attitunes)
+ self.__mutex.release()
+ return result
+
+ #
--------------------------------------------------------------------------
+ # Show the attitunes name list in the console.
+ #
--------------------------------------------------------------------------
+ def showAttitunes(self):
+ """Show the attitunes name list in the console.
+ """
+ result = []
+ self.__mutex.acquire()
+ for attitune in self.__attitunes:
+ result.append(attitune.getDescription().getName())
+ self.__mutex.release()
+ self._showStringList("Attitune names :", result)
+
+ #
--------------------------------------------------------------------------
+ # Get an attitune object by it name or index.
+ #
--------------------------------------------------------------------------
+ def getAttitune(self, attitune):
+ """Get an attitune object by it name or index.
+ @param attitune: The name or index of the attitune.
+ @return: An Attitune object or None.
+ """
+ self.__mutex.acquire()
+ if str(type(attitune)) == "<type 'int'>":
+ if attitune in range(len(self.__attitunes)):
+ result = self.__attitunes[attitune]
+ self.__mutex.release()
+ return result
+ else:
+ for attObject in self.__attitunes:
+ if attObject.getDescription().getName() == attitune:
+ result = attObject
+ self.__mutex.release()
+ return result
+ self.__mutex.release()
+ return None
+
+ #
--------------------------------------------------------------------------
+ # Stop played attitune.
+ #
--------------------------------------------------------------------------
+ def stopAttitune(self):
+ """Stop played attitune.
+ @return: The success of the command.
+ """
+ cmd = "attitune_manager/stop_attitune?"
+ return self._sendCommandBooleanResult(cmd)
+
+ #
--------------------------------------------------------------------------
+ # Insert an attitune in the container.
+ #
--------------------------------------------------------------------------
+ def insertAttitune(self, attituneFileName):
+ """Insert an attitune in the container.
+ @param attituneFileName: Attitune file name. Can be a local or a
distant
+ file.
+ @return: The success of the command.
+ """
+ argsToSend = {
+ 'path' : attituneFileName,
+ }
+ cmd = "attitune_manager/insert_attitune?"
+ return self._sendCommandBooleanResult(cmd, argsToSend)
+
+ #
--------------------------------------------------------------------------
+ # Remove an attitune from the container.
+ #
--------------------------------------------------------------------------
+ def removeAttitune(self, attituneName):
+ """Remove an attitune from the container.
+ @param attituneName: The name of the attitune.
+ @return: The success of the command.
+ """
+ argsToSend = {
+ 'name' : attituneName,
+ }
+ cmd = "attitune_manager/remove_attitune?"
+ return self._sendCommandBooleanResult(cmd, argsToSend)
Modified:
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/tuxdroid/const/ConstAttitunes.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/tuxdroid/const/ConstAttitunes.py
2009-04-06 19:27:06 UTC (rev 4366)
+++
software_suite_v2/tuxware/pytuxisalive/branches/0.3.0/src/tuxisalive/api/tuxdroid/const/ConstAttitunes.py
2009-04-06 19:29:01 UTC (rev 4367)
@@ -1,18 +1,18 @@
-# Copyright (C) 2009 C2ME Sa
-# Remi Jocaille <[email protected]>
-# Distributed under the terms of the GNU General Public License
-# http://www.gnu.org/copyleft/gpl.html
-
-#
-# Statuses declaration
-#
-ST_NAME_AM_RUN = "attitune_manager_run"
-ST_NAME_AM_CONTAINER_DEPLOYED = "attitune_manager_container_deployed"
-ST_NAME_AM_ATTITUNE_STARTING = "attitune_manager_attitune_starting"
-ST_NAME_AM_ATTITUNE_STOPPED = "attitune_manager_attitune_stopped"
-SW_NAME_ATTITUNE_MANAGER = [
- ST_NAME_AM_RUN,
- ST_NAME_AM_CONTAINER_DEPLOYED,
- ST_NAME_AM_ATTITUNE_STARTING,
- ST_NAME_AM_ATTITUNE_STOPPED,
-]
+# Copyright (C) 2009 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+#
+# Statuses declaration
+#
+ST_NAME_AM_RUN = "attitune_manager_run"
+ST_NAME_AM_CONTAINER_DEPLOYED = "attitune_manager_container_deployed"
+ST_NAME_AM_ATTITUNE_STARTING = "attitune_manager_attitune_starting"
+ST_NAME_AM_ATTITUNE_STOPPED = "attitune_manager_attitune_stopped"
+SW_NAME_ATTITUNE_MANAGER = [
+ ST_NAME_AM_RUN,
+ ST_NAME_AM_CONTAINER_DEPLOYED,
+ ST_NAME_AM_ATTITUNE_STARTING,
+ ST_NAME_AM_ATTITUNE_STOPPED,
+]
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn