fix rotor position in infobar for motorized tuner. thx Dimitrij
authorims <ims21@users.sourceforge.net>
Tue, 31 Mar 2015 09:38:25 +0000 (11:38 +0200)
committerlittlesat <littlesat99@yahoo.com>
Tue, 31 Mar 2015 09:48:21 +0000 (11:48 +0200)
Signed-off-by: littlesat <littlesat99@yahoo.com>

lib/python/Components/Converter/RotorPosition.py
lib/python/Screens/Dish.py

index 21ee3a1..ccda648 100644 (file)
@@ -19,9 +19,12 @@ class RotorPosition(Converter, object):
                        self.type = self.TUNER_NAME
                else:
                        self.type = self.DEFAULT
+               self.LastRotorPos = config.misc.lastrotorposition.value
+               config.misc.lastrotorposition.addNotifier(self.forceChanged, initial_call=False)
 
        @cached
        def getText(self):
+               self.LastRotorPos = config.misc.lastrotorposition.value
                (rotor, tuner) = self.isMotorizedTuner()
                if rotor:
                        self.actualizeCfgLastRotorPosition()
@@ -30,7 +33,7 @@ class RotorPosition(Converter, object):
                        if self.type == self.TUNER_NAME:
                                active_tuner = self.getActiveTuner()
                                if tuner != active_tuner:
-                                       return _("%s:%s") % (chr(ord("A")+tuner), orbpos(config.misc.lastrotorposition.value))
+                                       return _("%s:%s") % ("\c0000?0?0" + chr(ord("A")+ tuner), "\c00?0?0?0" + orbpos(config.misc.lastrotorposition.value))
                                return ""
                        return orbpos(config.misc.lastrotorposition.value)
                return ""
@@ -46,8 +49,10 @@ class RotorPosition(Converter, object):
 
        def actualizeCfgLastRotorPosition(self):
                if eDVBSatelliteEquipmentControl.getInstance().isRotorMoving():
-                       config.misc.lastrotorposition.value = eDVBSatelliteEquipmentControl.getInstance().getTargetOrbitalPosition()
-                       config.misc.lastrotorposition.save()
+                       current_pos = eDVBSatelliteEquipmentControl.getInstance().getTargetOrbitalPosition()
+                       if current_pos != config.misc.lastrotorposition.value:
+                               self.LastRotorPos = config.misc.lastrotorposition.value = current_pos
+                               config.misc.lastrotorposition.save()
 
        def getActiveTuner(self):
                if not eDVBSatelliteEquipmentControl.getInstance().isRotorMoving():
@@ -56,4 +61,8 @@ class RotorPosition(Converter, object):
                        tuner = feinfo and feinfo.getFrontendData()
                        if tuner:
                                return tuner.get("tuner_number")
-               return ""
\ No newline at end of file
+               return ""
+
+       def forceChanged(self, configElement=None):
+               if self.LastRotorPos != config.misc.lastrotorposition.value:
+                       Converter.changed(self, (self.CHANGED_ALL,))
\ No newline at end of file
index 4e50d53..9f1f91f 100644 (file)
@@ -303,7 +303,8 @@ class Dishpip(Dish, Screen):
                        if self.__state == self.STATE_HIDDEN:
                                self.rotorTimer.stop()
                                self.moving_timeout = 0
-                               self.show()
+                               if config.usage.showdish.value:
+                                       self.show()
                                if self.cur_orbpos != INVALID_POSITION and self.cur_orbpos != config.misc.lastrotorposition.value:
                                        config.misc.lastrotorposition.value = self.cur_orbpos
                                        config.misc.lastrotorposition.save()
@@ -329,7 +330,7 @@ class Dishpip(Dish, Screen):
        def startPiPService(self, ref=None):
                if self.__state == self.STATE_SHOWN:
                        self.__toHide()
-               if not config.usage.showdish.value or ref is None:
+               if ref is None:
                        return
                info = eServiceCenter.getInstance().info(ref)
                data = info and info.getInfoObject(ref, iServiceInformation.sTransponderData)
@@ -389,4 +390,4 @@ class Dishpip(Dish, Screen):
                        tuner = feinfo and feinfo.getFrontendData()
                        if tuner is not None:
                                return tuner.get("tuner_number")
-               return None
\ No newline at end of file
+               return None