add fpupgrade plugin
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 21 Feb 2006 22:04:42 +0000 (22:04 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 21 Feb 2006 22:04:42 +0000 (22:04 +0000)
configure.ac
lib/python/Plugins/Makefile.am
lib/python/Plugins/test/Makefile.am
lib/python/Plugins/test/plugin.py

index d9776ce..29a3058 100644 (file)
@@ -61,6 +61,7 @@ lib/python/Components/Makefile
 lib/python/Screens/Makefile
 lib/python/Plugins/Makefile
 lib/python/Plugins/update/Makefile
 lib/python/Screens/Makefile
 lib/python/Plugins/Makefile
 lib/python/Plugins/update/Makefile
+lib/python/Plugins/fpupgrade/Makefile
 lib/python/Plugins/test/Makefile
 lib/python/Plugins/tuxboxplugins/Makefile
 lib/python/Plugins/web/Makefile
 lib/python/Plugins/test/Makefile
 lib/python/Plugins/tuxboxplugins/Makefile
 lib/python/Plugins/web/Makefile
index ec43b90..6b749de 100644 (file)
@@ -1,7 +1,6 @@
 installdir = $(LIBDIR)/enigma2/python/Plugins
 
 installdir = $(LIBDIR)/enigma2/python/Plugins
 
-SUBDIRS = update tuxboxplugins web test
+SUBDIRS = update tuxboxplugins web test fpupgrade
 
 install_PYTHON =       \
 
 install_PYTHON =       \
-       __init__.py Plugin.py
-
+       __init__.py Plugin.py 
index c841c49..aadf8e4 100644 (file)
@@ -1,4 +1,4 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/test
+installdir = $(LIBDIR)/enigma2/python/Plugins/fpupgrade
 
 install_PYTHON =       \
        __init__.py \
 
 install_PYTHON =       \
        __init__.py \
index 668515f..f945fa7 100644 (file)
@@ -1,69 +1,54 @@
-from enigma import *
 from Screens.Screen import Screen
 from Screens.Screen import Screen
-from Screens.MessageBox import MessageBox
-from Components.ActionMap import NumberActionMap
+from Components.ActionMap import ActionMap
 from Components.Label import Label
 from Components.Label import Label
-from Components.Input import Input
-from Components.GUIComponent import *
-from Components.Pixmap import Pixmap
-from Components.FileList import FileEntryComponent, FileList
 from Plugins.Plugin import PluginDescriptor
 
 from Plugins.Plugin import PluginDescriptor
 
-import os
+def getUpgradeVersion():
+       import os
+       r = os.popen("fpupgrade --version").read()
+       if r[:16] != "FP update tool v":
+               return None
+       else:
+               return int(r[16:])
 
 
-class Test(Screen):
+class FPUpgrade(Screen):
        skin = """
        skin = """
-               <screen position="100,100" size="550,400" title="Test" >
-                       <!--widget name="text" position="0,0" size="550,25" font="Regular;20" /-->
-                       <widget name="list" position="10,0" size="190,250" scrollbarMode="showOnDemand" />
-                       <widget name="pixmap" position="200,0" size="190,250" />
+               <screen position="150,200" size="450,200" title="FP upgrade required" >
+                       <widget name="text" position="0,0" size="550,50" font="Regular;20" />
+                       <widget name="oldversion_label" position="10,100" size="290,25" font="Regular;20" />
+                       <widget name="newversion_label" position="10,125" size="290,25" font="Regular;20" />
+                       <widget name="oldversion" position="300,100" size="50,25" font="Regular;20" />
+                       <widget name="newversion" position="300,125" size="50,25" font="Regular;20" />
                </screen>"""
                </screen>"""
-       def __init__(self, session, args = None):
-               self.skin = Test.skin
+       def __init__(self, session):
+               self.skin = FPUpgrade.skin
                Screen.__init__(self, session)
                Screen.__init__(self, session)
-
-               self["list"] = FileList("/", matchingPattern = "^.*\.png")
-               self["pixmap"] = Pixmap()
                
                
-               #self["text"] = Input("1234", maxSize=True, type=Input.NUMBER)
-                               
-               self["actions"] = NumberActionMap(["WizardActions", "InputActions"],
+               from Tools.DreamboxHardware import getFPVersion
+               version = str(getFPVersion() or "N/A")
+               newversion = str(getUpgradeVersion() or "N/A")
+
+               self["text"] = Label(_("Your frontprocessor firmware must be upgraded.\nPress OK to start upgrade."))
+               self["oldversion_label"] = Label(_("Current version:"))
+               self["newversion_label"] = Label(_("New version:"))
+
+               self["oldversion"] = Label(version)
+               self["newversion"] = Label(newversion)
+
+               self["actions"] = ActionMap(["OkCancelActions"],
                {
                        "ok": self.ok,
                {
                        "ok": self.ok,
-                       "back": self.close,
-#                      "left": self.keyLeft,
-#                      "right": self.keyRight,
-                       "1": self.keyNumberGlobal,
-                       "2": self.keyNumberGlobal,
-                       "3": self.keyNumberGlobal,
-                       "4": self.keyNumberGlobal,
-                       "5": self.keyNumberGlobal,
-                       "6": self.keyNumberGlobal,
-                       "7": self.keyNumberGlobal,
-                       "8": self.keyNumberGlobal,
-                       "9": self.keyNumberGlobal,
-                       "0": self.keyNumberGlobal
-               }, -1)
-               
-       def keyLeft(self):
-               self["text"].left()
-       
-       def keyRight(self):
-               self["text"].right()
-       
-       def ok(self):
-               selection = self["list"].getSelection()
-               if selection[1] == True: # isDir
-                       self["list"].changeDir(selection[0])
-               else:
-                       self["pixmap"].instance.setPixmapFromFile(selection[0])
-       
-       def keyNumberGlobal(self, number):
-               print "pressed", number
-               self["text"].number(number)
+                       "cancel": self.close,
+               })
 
 
-def main(session):
-       session.open(Test)
+       def ok(self):
+               self.close(4)
 
 def Plugins():
 
 def Plugins():
-       return PluginDescriptor(name="Test", description="plugin to test some capabilities", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
+       from Tools.DreamboxHardware import getFPVersion
+       version = getFPVersion()
+       newversion = getUpgradeVersion() or 0
+       if version is not None and version <= newversion:
+               return PluginDescriptor(name="FP Upgrade", where = PluginDescriptor.WHERE_WIZARD, fnc=FPUpgrade)
+       else:
+               return [ ]