Merge branch 'vuplus_experimental' of code.vuplus.com:/opt/repository/dvbapp into...
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / ManualFancontrol / plugin.py
index d38ed8c..f2da601 100755 (executable)
@@ -7,18 +7,19 @@ from Components.Sources.StaticText import StaticText
 from Plugins.Plugin import PluginDescriptor
 from Plugins.SystemPlugins.ManualFancontrol.InstandbyOn import instandbyon
 import NavigationInstance
+from enigma import eTimer
 
 class ManualFancontrol(Screen,ConfigListScreen):
        skin =  """
-               <screen position="center,center" size="560,300" title="Fancontrol Settings in Standby mode" >
-                       <ePixmap pixmap="skin_default/buttons/red.png" position="110,10" size="140,40" alphatest="on" />
-                       <ePixmap pixmap="skin_default/buttons/green.png" position="310,10" size="140,40" alphatest="on" />
+               <screen position="center,center" size="400,270" title="Fancontrol Settings in Standby mode" >
+                       <ePixmap pixmap="skin_default/buttons/red.png" position="30,10" size="140,40" alphatest="on" />
+                       <ePixmap pixmap="skin_default/buttons/green.png" position="230,10" size="140,40" alphatest="on" />
 
-                       <widget source="key_red" render="Label" position="110,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
-                       <widget source="key_green" render="Label" position="310,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
+                       <widget source="key_red" render="Label" position="30,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
+                       <widget source="key_green" render="Label" position="230,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
 
-                       <widget name="config" zPosition="2" position="5,70" size="550,200" scrollbarMode="showOnDemand" transparent="1" />
-                       <widget source="current" render="Label" position="150,270" zPosition="1" size="280,30" font="Regular;20" halign="center" valign="center" />
+                       <widget name="config" zPosition="2" position="5,70" size="380,150" scrollbarMode="showOnDemand" transparent="1" />
+                       <widget source="current" render="Label" position="60,230" zPosition="1" size="280,30" font="Regular;20" halign="center" valign="center" />
                </screen>
                """
 
@@ -41,11 +42,21 @@ class ManualFancontrol(Screen,ConfigListScreen):
                self.oldfanoffmode = instandbyon.fanoffmode
                if instandbyon.fanoffmode is 'ON' :
                        instandbyon.checkStatusLoopStop()
+               self.checkFanTimer = eTimer()
+               self.checkFanTimer.callback.append(self.fan_pwm_error)
+               self.onLayoutFinish.append(self.checkFan)
+
+       def checkFan(self):
+               if not instandbyon.check_fan_pwm():
+                       self.checkFanTimer.start(10,True)
+
+       def fan_pwm_error(self):
+               self.session.openWithCallback(self.close, MessageBox, _("Can not open 'fan_pwm'"), MessageBox.TYPE_ERROR)
 
        def displayCurrentValue(self):
                currrent_val = self["config"].getCurrent()[0]+" : "+str(self["config"].getCurrent()[1].value)
                self["current"].setText(_(currrent_val))
-               print currrent_val
+#              print currrent_val
 
        def selectionChanged(self):
                if self["config"].getCurrent() == self.pwmEntry:
@@ -90,12 +101,12 @@ class ManualFancontrol(Screen,ConfigListScreen):
 
        def keySave(self):
                if instandbyon.fanoffmode is 'OFF' and config.plugins.manualfancontrols.pwmvalue.value == 0:
-                       print "<SimpleFancontrol> instandbyon.fanoffmode 'OFF' -> 'ON'"
+#                      print "[ManualFancontrol] instandbyon.fanoffmode 'OFF' -> 'ON'"
                        instandbyon.fanoffmode = 'ON'
                        instandbyon.addRecordEventCB()
                        instandbyon.checkStatusLoopStart()
                elif instandbyon.fanoffmode is 'ON' and config.plugins.manualfancontrols.pwmvalue.value != 0:
-                       print "<SimpleFancontrol> instandbyon.fanoffmode 'ON' -> 'OFF'"
+#                      print "[ManualFancontrol] instandbyon.fanoffmode 'ON' -> 'OFF'"
                        instandbyon.fanoffmode = 'OFF'
                        instandbyon.removeRecordEventCB()
 #                      instandbyon.checkStatusLoopStop() # stoped at init