[tuxdroid-svn] r5298 - in software_suite_v3/software/plugin/plugin-battery/trunk: executables reso
Status: Beta
Brought to you by:
ks156
|
From: gwadavel <c2m...@c2...> - 2009-08-07 15:46:18
|
Author: gwadavel Date: 2009-08-07 17:45:57 +0200 (Fri, 07 Aug 2009) New Revision: 5298 Added: software_suite_v3/software/plugin/plugin-battery/trunk/resources/help.wiki software_suite_v3/software/plugin/plugin-battery/trunk/resources/plugin.pot Removed: software_suite_v3/software/plugin/plugin-battery/trunk/executables/tux-gadget-battery.py Log: Deleted: software_suite_v3/software/plugin/plugin-battery/trunk/executables/tux-gadget-battery.py =================================================================== --- software_suite_v3/software/plugin/plugin-battery/trunk/executables/tux-gadget-battery.py 2009-08-07 15:28:10 UTC (rev 5297) +++ software_suite_v3/software/plugin/plugin-battery/trunk/executables/tux-gadget-battery.py 2009-08-07 15:45:57 UTC (rev 5298) @@ -1,128 +0,0 @@ -# -*- coding: utf-8 -*- - -# Write with Python gadget skeleton -# Copyright (C) 2009 Kysoh Sa -# Remi Jocaille <rem...@c2...> -# Distributed under the terms of the GNU General Public License -# http://www.gnu.org/copyleft/gpl.html - - -""" -CHANGES -======= - -2009/03/22 - version 0.0.1: - - Initial version -2009/03/25 - version 0.1 - - Add command "Run" and "Check" - 2009/04/26 - version 0.1.1 - - Rewrite with Python gadget skeleton - -TODO LIST -========= - -- Internationalization - -__author__ = "Eric Lescaudron AKA Gwadavel" -__appname__ = "tux battery level" -__version__ = "0.1.1" -__date__ = "2009/04/26" -__license__ = "GPL" - -""" - -import os -import time -import sys -from tuxisalive.api.TuxAPI import * - -sys.path.append(os.environ['TUXDROID_SERVER_PYTHON_UTIL']) - -from util.SimpleGadget.SimpleGadgetConfiguration import SimpleGadgetConfiguration -from util.SimpleGadget.SimpleGadget import SimpleGadget - -class Configuration(SimpleGadgetConfiguration): - """This class make an access to the gadget parameters. - Parameters are automatically filled by the SimpleGadget class at gadget - starting. - """ - - def __init__(self): - """Initialization of the class. - It's necessary to initialize the values because the type of the python - variables is set by value assignation. If we don't initialize the - parameters the simple gadget class can't check and validate the values - passed by the framework through the os environment variables. - """ - # Call the super class - SimpleGadgetConfiguration.__init__(self) - - -class BatteryGadget(SimpleGadget): - """This class override the SimpleGadget class to make easy - the gadget coding. - """ - - def __init__(self): - """Initialization of the class. - """ - # Call the super class - SimpleGadget.__init__(self) - # Initialize some values ... - __tgp_ip = "127.0.0.1" - self.tux = TuxAPI(__tgp_ip, 270) - self.tux.server.connect(CLIENT_LEVEL_RESTRICTED, 'BatteryGadget', 'battery') - self.__daemonRun = False - - def start(self): - """Gadget entry point. - This method should be used to dispatch commands. - """ - if self.getCommand() == "run": - self.run() - elif self.getCommand() == "run_daemon": - self.runDaemon() - elif self.getCommand() == "check": - self.check() - else: - self.run() - - def run(self): - """Gadget entry point for the "run" command. - """ - level = self.tux.battery.getLevel() - state = self.tux.battery.getState() - message = "the battery level is %1.2f it state is %s" %(level, state) - self.throwMessage(message) - - def runDaemon(self): - """Gadget entry point for the "run_daemon" command. - """ - # Start a fake daemon loop ... - # Warning the daemonRun flag is not safe-thread (in order to have a - # clean code in this gadget example) - self.__daemonRun = True - while self.__daemonRun: - time.sleep(0.5) - self.check() - - def check(self): - """Gadget entry point for the "check" command. - """ - # Check a condition ... - state = self.tux.battery.getState() - # Speak only if state == EMPTY - if state == "LOW": - message = "the battery is %s " %state - self.throwMessage(message) - - def onGadgetStop(self): - """Callback on gadget stop. - """ - # Stop the fake daemon loop - self.__daemonRun = False - self.tux.server.disconnect() - -if __name__ == "__main__": - gadget = BatteryGadget() - gadget.boot(sys.argv[1:], Configuration()) Added: software_suite_v3/software/plugin/plugin-battery/trunk/resources/help.wiki =================================================================== --- software_suite_v3/software/plugin/plugin-battery/trunk/resources/help.wiki (rev 0) +++ software_suite_v3/software/plugin/plugin-battery/trunk/resources/help.wiki 2009-08-07 15:45:57 UTC (rev 5298) @@ -0,0 +1,4 @@ += Synopsis = +Tux Droid says battery level and it's state. + + Added: software_suite_v3/software/plugin/plugin-battery/trunk/resources/plugin.pot =================================================================== --- software_suite_v3/software/plugin/plugin-battery/trunk/resources/plugin.pot (rev 0) +++ software_suite_v3/software/plugin/plugin-battery/trunk/resources/plugin.pot 2009-08-07 15:45:57 UTC (rev 5298) @@ -0,0 +1,8 @@ +msgid "Battery Level" +msgstr "" +msgid "Says battery level and it's state or says if battery is low" +msgstr "" +msgid "Says the battery level and it's state" +msgstr "" +msgid "Says if battery is low" +msgstr "" |