Skip to content

Commit

Permalink
[inputdevice] apply atv changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AbuBaniaz committed Jun 2, 2020
1 parent b446eb6 commit 70a1493
Showing 1 changed file with 190 additions and 49 deletions.
239 changes: 190 additions & 49 deletions lib/python/Screens/InputDeviceSetup.py
Expand Up @@ -9,7 +9,8 @@
from Components.ActionMap import ActionMap, HelpableActionMap
from Tools.Directories import resolveFilename, SCOPE_ACTIVE_SKIN
from Tools.LoadPixmap import LoadPixmap
from boxbranding import getBoxType, getMachineBrand, getMachineName
from Components.Pixmap import Pixmap
from boxbranding import getBoxType, getMachineBrand, getMachineName, getBrandOEM

class InputDeviceSelection(Screen, HelpableScreen):
def __init__(self, session, menu_path=""):
Expand Down Expand Up @@ -55,8 +56,12 @@ def __init__(self, session, menu_path=""):
self.list = []
self["list"] = List(self.list)
self.updateList()
self.onLayoutFinish.append(self.layoutFinished)
self.onClose.append(self.cleanup)

def layoutFinished(self):
self.setTitle(_("Select input device"))

def cleanup(self):
self.currentIndex = 0

Expand Down Expand Up @@ -273,48 +278,163 @@ def createSummary(self):


class RemoteControlType(Screen, ConfigListScreen):
odinRemote = "OdinM9"
if getBoxType() == "maram9":
odinRemote = "MaraM9"

rcList = [
("0", _("Default")),
("3", _(odinRemote)),
("4", _("DMM normal")),
("5", _("et9000/et9100")),
("6", _("DMM advanced")),
("7", _("et5000/6000")),
("8", _("VU+")),
("9", _("et8000/et10000")),
("11", _("et9200/9500/6500")),
("13", _("et4000")),
("14", _("XP1000")),
("16", _("HD1100/et7x00/et8500")),
("18", _("F1/F3")),
("19", _("HD2400")),
]

defaultRcList = [
("et4000", 13),
("et5000", 7),
("et6000", 7),
("et6500", 11),
("et8000", 9),
("et9000", 5),
("et9100", 5),
("et9200", 11),
("et9500", 11),
("et10000", 9),
("formuler1", 18),
("formuler3", 18),
("xp1000", 14),
("hd1100", 16),
("hd2400", 19),
("et7000", 16),
("et7500", 16),
("et8500", 16),
("hd51", 16),
]
if getBrandOEM() in ('broadmedia','octagon','odin','protek','ultramini') or getBoxType() in ('et7000','et7100','et7200','et7500','et7x00','et8500','et1x000','et13000'):
rcList = [
("0", _("Default")),
("3", _("MaraM9")),
("4", _("DMM normal")),
("5", _("et9000/et9100")),
("6", _("DMM advanced")),
("7", _("et5000/6000")),
("8", _("VU+")),
("9", _("et8000/et10000/et13000/SF5008")),
("11", _("et9200/9500/6500")),
("13", _("et4000")),
("14", _("XP1000")),
("16", _("HD11/HD51/HD1100/HD1200/HD1265/HD1500/HD500C/HD530C/et7x00/et8500/VS1000/VS1500")),
("17", _("XP3000")),
("18", _("F1/F3/F4/F4-TURBO/TRIPLEX")),
("19", _("HD2400")),
("20", _("Zgemma Star S/2S/H1/H2")),
("21", _("Zgemma H.S/H.2S/H.2H/H5/H7")),
("500", _("WWIO_BRE2ZE_TC")),
("501", _("OCTAGON_SF4008")),
("502", _("GIGABLUE Black")),
("503", _("MIRACLEBOX_TWINPLUS")),
("504", _("E3HD/XPEEDLX/GI")),
("505", _("ODIN_M7")),
("507", _("Beyonwiz U4")),
("511", _("OCTAGON SF5008"))
]

defaultRcList = [
("default", 0),
("et4000", 13),
("et5000", 7),
("et6000", 7),
("et6500", 11),
("et7x00",16),
("et7100",16),
("et7000",16),
("et7500",16),
("et7000mini",16),
("et8000", 9),
("et13000", 9),
("et8500",16),
("et9000", 5),
("et9100", 5),
("et9200", 11),
("et9500", 11),
("et10000", 9),
("formuler1",18),
("formuler3",18),
("formuler4",18),
("formuler4turbo",18),
("hd11",16),
("hd51",16),
("hd1100",16),
("hd1200",16),
("hd1265",16),
("hd500c",16),
("hd530c",16),
("vs1000",16),
("vs1500",16),
("hd2400",19),
("triplex",18),
("xp1000", 14),
("xp3000", 17),
("sh1", 20),
("h3", 21),
("h5", 21),
("h7", 21),
("bre2ze_tc", 500),
("sf4008", 501),
("g100", 501),
("sf4018", 501),
("gbquadplus", 502),
("g300", 503),
("e3hd", 504),
("et7000mini", 504),
("et1x000", 504),
("xpeedc.", 504),
("odinm7", 505),
("beyonwizu4", 507),
("sf5008", 511)
]
else:
rcList = [
("0", _("Default")),
("3", _("MaraM9")),
("4", _("DMM normal")),
("5", _("et9000/et9100")),
("6", _("DMM advanced")),
("7", _("et5000/6000")),
("8", _("VU+")),
("9", _("et8000/et10000/et13000")),
("11", _("et9200/9500/6500")),
("13", _("et4000")),
("14", _("XP1000")),
("16", _("HD11/HD51/HD1100/HD1200/HD1265/HD1500/HD500C/HD530C/VS1000/VS1500")),
("17", _("XP3000")),
("18", _("F1/F3/F4/F4-TURBO/TRIPLEX")),
("19", _("HD2400")),
("20", _("Zgemma Star S/2S/H1/H2")),
("21", _("Zgemma H.S/H.2S/H.2H/H5/H7 old Model")),
("22", _("Zgemma i55")),
("23", _("WWIO 4K")),
("24", _("Axas E4HD Ultra")),
("25", _("Zgemma H9/I55Plus old Model")),
("26", _("Protek 4K UHD/HD61")),
("27", _("HD60")),
("28", _("H7/H9/H9COMBO/H10 new Model"))
]
defaultRcList = [
("default", 0),
("et4000", 13),
("et5000", 7),
("et6000", 7),
("et6500", 11),
("et8000", 9),
("et13000", 9),
("et9000", 5),
("et9100", 5),
("et9200", 11),
("et9500", 11),
("et10000", 9),
("formuler1",18),
("formuler3",18),
("formuler4",18),
("formuler4turbo",18),
("hd11",16),
("hd51",16),
("hd1100",16),
("hd1200",16),
("hd1265",16),
("hd500c",16),
("hd530c",16),
("vs1000",16),
("vs1500",16),
("hd2400",19),
("triplex",18),
("xp1000", 14),
("xp3000", 17),
("sh1", 20),
("h3", 21),
("h5", 21),
#("h7", 21),# old model
("i55", 22),
("bre2ze4k", 23),
("e4hd", 24),
#("h9", 25),# old model
("i55plus", 25),
("protek4k", 26),
("hd61", 26),
("hd60", 27),
("h7", 28), # new model
("h9", 28), # new model
("h9combo", 28),
("h10", 28)
]

def __init__(self, session, menu_path=""):
Screen.__init__(self, session)
Expand All @@ -326,8 +446,12 @@ def __init__(self, session, menu_path=""):
"save": self.keySave,
}, -1)

self["HelpWindow"] = Pixmap()
self["HelpWindow"].hide()
self["key_green"] = StaticText(_("Save"))
self["key_red"] = StaticText(_("Cancel"))
self["footnote"] = StaticText()
self["description"] = StaticText()

self.list = []
ConfigListScreen.__init__(self, self.list, session = self.session)
Expand All @@ -340,16 +464,33 @@ def __init__(self, session, menu_path=""):
self.defaultRcType = 0
self.getDefaultRcType()

def getBoxTypeCompatible(self):
try:
with open('/proc/stb/info/boxtype', 'r') as fd:
boxType = fd.read()
return boxType
except:
return "Default"
return "Default"

def getDefaultRcType(self):
data = iRcTypeControl.getBoxType()
boxtype = getBoxType()
boxtypecompat = self.getBoxTypeCompatible()
self.defaultRcType = 0
#print "Boxtype is %s" % boxtype
for x in self.defaultRcList:
if x[0] in data:
if x[0] in boxtype:
self.defaultRcType = x[1]
#print "Selecting %d as defaultRcType" % self.defaultRcType
break
# If there is none in the list, use the current value...
#
if self.defaultRcType == 0:
self.defaultRcType = iRcTypeControl.readRcType()

# boxtypecompat should be removed in the future
if (self.defaultRcType==0):
for x in self.defaultRcList:
if x[0] in boxtypecompat:
self.defaultRcType = x[1]
#print "Selecting %d as defaultRcType" % self.defaultRcType
break

def setDefaultRcType(self):
iRcTypeControl.writeRcType(self.defaultRcType)
Expand Down

0 comments on commit 70a1493

Please sign in to comment.