Support turbo2.
[vuplus_dvbapp] / lib / python / Screens / ChannelSelection.py
old mode 100644 (file)
new mode 100755 (executable)
index 912d678..6882a93
@@ -141,8 +141,14 @@ class ChannelContextMenu(Screen):
                                                if not inBouquet:
                                                        append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0)
                                else:
-                                       if current_root.getPath().find('FROM SATELLITES') != -1:
-                                               append_when_current_valid(current, menu, (_("remove selected satellite"), self.removeSatelliteServices), level = 0)
+                                       if 'FROM SATELLITES' in current_root.getPath() and _("Services") in eServiceCenter.getInstance().info(current).getName(current):
+                                               unsigned_orbpos = current.getUnsignedData(4) >> 16
+                                               if unsigned_orbpos == 0xFFFF: #Cable
+                                                       append_when_current_valid(current, menu, (_("remove cable services"), self.removeSatelliteServices), level = 0)
+                                               elif unsigned_orbpos == 0xEEEE: #Terrestrial
+                                                       append_when_current_valid(current, menu, (_("remove terrestrial services"), self.removeSatelliteServices), level = 0)
+                                               else:
+                                                       append_when_current_valid(current, menu, (_("remove selected satellite"), self.removeSatelliteServices), level = 0)
                                        if haveBouquets:
                                                if not inBouquet and current_sel_path.find("PROVIDERS") == -1:
                                                        append_when_current_valid(current, menu, (_("copy to bouquets"), self.copyCurrentToBouquetList), level = 0)
@@ -231,6 +237,7 @@ class ChannelContextMenu(Screen):
                if self.session.pipshown:
                        del self.session.pip
                self.session.pip = self.session.instantiateDialog(PictureInPicture)
+               self.session.pip.setAnimationMode(0)
                self.session.pip.show()
                newservice = self.csel.servicelist.getCurrent()
                if self.session.pip.playService(newservice):
@@ -259,14 +266,7 @@ class ChannelContextMenu(Screen):
                        self.close(False)
 
        def removeSatelliteServices(self):
-               curpath = self.csel.getCurrentSelection().getPath()
-               idx = curpath.find("satellitePosition == ")
-               if idx != -1:
-                       tmp = curpath[idx+21:]
-                       idx = tmp.find(')')
-                       if idx != -1:
-                               satpos = int(tmp[:idx])
-                               eDVBDB.getInstance().removeServices(-1, -1, -1, satpos)
+               self.csel.removeSatelliteServices()
                self.close()
 
        def copyCurrentToBouquetList(self):
@@ -570,6 +570,55 @@ class ChannelSelectionEdit:
                except OSError:
                        print "error during remove of", filename
 
+       def removeSatelliteServices(self):
+               current = self.getCurrentSelection()
+               unsigned_orbpos = current.getUnsignedData(4) >> 16
+               if unsigned_orbpos == 0XFFFF:
+                       msg = _("Are you sure to remove all cable services?")
+               elif unsigned_orbpos == 0XEEEE:
+                       msg = _("Are you sure to remove all terrestrial services?")
+               else:
+                       orbpos = current.getData(4) >> 16
+                       try:
+                               service_name = str(nimmanager.getSatDescription(orbpos))
+                       except:
+                               if orbpos > 1800: # west
+                                       orbpos = 3600 - orbpos
+                                       h = _("W")
+                               else:
+                                       h = _("E")
+                               service_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
+                       msg = _("Are you sure to remove all %s services?" % service_name)
+               self.session.openWithCallback(self.removeSatelliteServicesCallback, MessageBox, msg)
+
+       def removeSatelliteServicesCallback(self, res):
+               if not res:
+                       return
+
+               currentIndex = self.servicelist.getCurrentIndex()
+               current = self.getCurrentSelection()
+               unsigned_orbpos = current.getUnsignedData(4) >> 16
+               if unsigned_orbpos == 0XFFFF:
+                       eDVBDB.getInstance().removeServices(0xFFFF0000 - 0x100000000)
+               elif unsigned_orbpos == 0XEEEE:
+                       eDVBDB.getInstance().removeServices(0xEEEE0000 - 0x100000000)
+               else:
+                       curpath = self.getCurrentSelection().getPath()
+                       idx = curpath.find("satellitePosition == ")
+                       if idx != -1:
+                               tmp = curpath[idx+21:]
+                               idx = tmp.find(')')
+                               if idx != -1:
+                                       satpos = int(tmp[:idx])
+                                       eDVBDB.getInstance().removeServices(-1, -1, -1, satpos)
+
+               if hasattr(self, 'setMode') and hasattr(self, 'showSatellites'):
+                       self.setMode()
+                       self.showSatellites()
+                       self.servicelist.moveToIndex(currentIndex)
+                       if currentIndex != self.servicelist.getCurrentIndex():
+                               self.servicelist.instance.moveSelection(self.servicelist.instance.moveEnd)
+
 #  multiple marked entry stuff ( edit mode, later multiepg selection )
        def startMarkedEdit(self, type):
                self.savedPath = self.servicePath[:]
@@ -718,8 +767,9 @@ MODE_RADIO = 1
 # type 27 = advanced codec HD NVOD reference service (NYI)
 # type 2 = digital radio sound service
 # type 10 = advanced codec digital radio sound service
+# type 31 = High Efficiency Video Coing digital television
 
-service_types_tv = '1:7:1:0:0:0:0:0:0:0:(type == 1) || (type == 17) || (type == 22) || (type == 25) || (type == 134) || (type == 195)'
+service_types_tv = '1:7:1:0:0:0:0:0:0:0:(type == 1) || (type == 17) || (type == 22) || (type == 25) || (type == 31) || (type == 134) || (type == 195)'
 service_types_radio = '1:7:2:0:0:0:0:0:0:0:(type == 2) || (type == 10)'
 
 class ChannelSelectionBase(Screen):
@@ -1074,7 +1124,13 @@ class ChannelSelectionBase(Screen):
                        self.servicelist.moveToChar(charstr[0])
 
        def keyAsciiCode(self):
-               unichar = unichr(getPrevAsciiCode())
+               #unichar = unichr(getPrevAsciiCode())
+               from Components.config import getCharValue
+               unichar = getCharValue(getPrevAsciiCode())
+               if unichar is None:
+                       return
+               if len(str(unichar)) > 1:
+                       return
                charstr = unichar.encode("utf-8")
                if len(charstr) == 1:
                        self.servicelist.moveToChar(charstr[0])
@@ -1425,6 +1481,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS
                self.onLayoutFinish.append(self.onCreate)
 
                self.info = session.instantiateDialog(RadioInfoBar) # our simple infobar
+               self.info.setAnimationMode(0)
 
                self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"],
                        {