X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2FPlugins%2FSystemPlugins%2FRemoteControlCode%2Fplugin.py;h=3f41d346dcb8ab943bd0e7cef224792b24980c3f;hb=af8e3693a29957c492b9f8f335e6d7cd106032b0;hp=cb197e815c26d5f50a86793abbea7887d5122bd8;hpb=1a80430c750fbd7e5725a9cfa3c5dd093d20bc79;p=vuplus_dvbapp
diff --git a/lib/python/Plugins/SystemPlugins/RemoteControlCode/plugin.py b/lib/python/Plugins/SystemPlugins/RemoteControlCode/plugin.py
index cb197e8..3f41d34 100755
--- a/lib/python/Plugins/SystemPlugins/RemoteControlCode/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/RemoteControlCode/plugin.py
@@ -1,16 +1,34 @@
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
-from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection
+from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection, ConfigInteger
from Components.ActionMap import ActionMap
from Screens.MessageBox import MessageBox
from Components.Sources.StaticText import StaticText
from Plugins.Plugin import PluginDescriptor
from Tools.Directories import fileExists
-from enigma import eTimer
+from enigma import eTimer, quitMainloop
+
+def getModel():
+ ret = None
+ if fileExists("/proc/stb/info/vumodel"):
+ vumodel = open("/proc/stb/info/vumodel")
+ info=vumodel.read().strip()
+ vumodel.close()
+ ret = info
+
+ return ret
+
+def getRcuDefaultType():
+ if getModel() in ["uno4kse", "zero4k"]:
+ return "new"
+ return "legacy"
config.plugins.remotecontrolcode = ConfigSubsection()
config.plugins.remotecontrolcode.systemcode = ConfigSelection(default = "2", choices =
[ ("1", "1 "), ("2", "2 "), ("3", "3 "), ("4", "4 ") ] )
+config.plugins.remotecontrolcode.replytimeout = ConfigInteger(default = 30, limits = (15,9999))
+config.plugins.remotecontrolcode.rcuType = ConfigSelection(default = getRcuDefaultType(), choices =
+ [ ("legacy", "Legacy Vu+ Universal RCU"), ("new", "New Vu+ DarkBrown/Bluetooth RCU") ] )
class RemoteControlCodeInit:
def __init__(self):
@@ -25,27 +43,26 @@ class RemoteControlCodeInit:
f.close()
return 0
- def getModel(self):
- if fileExists("/proc/stb/info/vumodel"):
- vumodel = open("/proc/stb/info/vumodel")
- info=vumodel.read().strip()
- vumodel.close()
- if info in ["uno", "ultimo"]:
- return True
- else:
- return False
- else:
- return False
+ def checkModelSupport(self):
+ ret = None
+ model = getModel()
+ if model not in ["duo", "solo"]:
+ ret = True
+
+ return ret
class RemoteControlCode(Screen,ConfigListScreen,RemoteControlCodeInit):
- skin = """
-
-
-
-
-
-
- """
+ skin = """
+
+
+
+
+
+
+
+
+
+ """
def __init__(self,session):
Screen.__init__(self,session)
@@ -60,23 +77,38 @@ class RemoteControlCode(Screen,ConfigListScreen,RemoteControlCodeInit):
self.list = []
ConfigListScreen.__init__(self, self.list,session = self.session)
self["key_red"] = StaticText(_("Cancel"))
- self["key_green"] = StaticText(_("Save"))
+ self["key_green"] = StaticText(_("Ok"))
+ self.replytext_1 ="The remote control code will be reset to previous setting, set your R/C's code and select 'keep'"
+ self.replytext_2 ="\n\n"
+ self.replytext_2 +="\n1. Press Digit 2 and Digit 7 simultaneously for 3 seconds. After 3 seconds LED turns on. "
+ self.replytext_2 +="\n2. Press the key. LED is blinked and turns on."
+ self.replytext_2 +="\n3. Enter a 4 digit code(ex. code 2 is '0002')"
+
+ self.replytext_newrcu_2 ="\n\n"
+ self.replytext_newrcu_2 +="\n1. Press and simultaneously for 3 seconds. After 3 seconds LED turns on. "
+ self.replytext_newrcu_2 +="\n2. Enter a 5 digit code(ex. code 2 is '00002')"
+ self.replytext_newrcu_2 +="\n3. Press the key. LED is blinked and turns on."
+
self.createSetup()
self.onLayoutFinish.append(self.checkModel)
self.checkModelTimer = eTimer()
self.checkModelTimer.callback.append(self.invalidmodel)
def checkModel(self):
- if not self.getModel():
+ if not self.checkModelSupport():
self.checkModelTimer.start(1000,True)
def invalidmodel(self):
- self.session.openWithCallback(self.close, MessageBox, _("This Plugin only support for UNO/ULTIMO"), MessageBox.TYPE_ERROR)
+ self.session.openWithCallback(self.close, MessageBox, _("This Plugin doesn't support on SOLO/DUO"), MessageBox.TYPE_ERROR)
def createSetup(self):
self.list = []
+ self.rcuTypeEntry = getConfigListEntry(_("Remote Control Type"), config.plugins.remotecontrolcode.rcuType)
self.rcsctype = getConfigListEntry(_("Remote Control System Code"), config.plugins.remotecontrolcode.systemcode)
+ self.replytimeout = getConfigListEntry(_("Reply timeout"), config.plugins.remotecontrolcode.replytimeout)
+ self.list.append( self.rcuTypeEntry )
self.list.append( self.rcsctype )
+ self.list.append( self.replytimeout )
self["config"].list = self.list
self["config"].l.setList(self.list)
@@ -87,7 +119,13 @@ class RemoteControlCode(Screen,ConfigListScreen,RemoteControlCodeInit):
self.restoreCode()
self.session.openWithCallback(self.close, MessageBox, _("FILE NOT EXIST : /proc/stb/fp/remote_code"), MessageBox.TYPE_ERROR)
else:
- self.session.openWithCallback(self.MessageBoxConfirmCodeCallback, MessageBoxConfirmCode, _("If new remote control code correct, select 'yes'."), MessageBox.TYPE_YESNO, timeout = 10, default = False)
+ timeout = config.plugins.remotecontrolcode.replytimeout.value
+ text1 = self.replytext_1
+ text2 = self.replytext_2
+ if config.plugins.remotecontrolcode.rcuType.value == "new":
+ text2 = self.replytext_newrcu_2
+
+ self.session.openWithCallback(self.MessageBoxConfirmCodeCallback, MessageBoxConfirmCode, text1, text2, MessageBox.TYPE_YESNO, timeout = timeout, default = False)
def restoreCode(self):
for x in self["config"].list:
@@ -95,26 +133,31 @@ class RemoteControlCode(Screen,ConfigListScreen,RemoteControlCodeInit):
def MessageBoxConfirmCodeCallback(self,ret):
if ret:
- ConfigListScreen.keySave(self)
+ self.saveAll()
+ self.session.openWithCallback(self.restartCallback, MessageBox, _("GUI restart now, press 'OK' button."), MessageBox.TYPE_INFO)
else:
self.restoreCode()
self.setSystemCode(int(config.plugins.remotecontrolcode.systemcode.value))
+ def restartCallback(self,result):
+ quitMainloop(3)
+
class MessageBoxConfirmCode(MessageBox):
- skin = """
-
-
-
-
-
-
-
+
+ """
+
+ def __init__(self, session, replytext_1="", replytext_2="", type = MessageBox.TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True, msgBoxID = None):
+ self.replytext_1 = replytext_1
+ self.replytext_2 = replytext_2
+ MessageBox.__init__(self,session,self.replytext_1 + "\n" + self.replytext_2,type,timeout,close_on_any_key,default,enable_input,msgBoxID)
+ if type == MessageBox.TYPE_YESNO:
+ self.list = [ (_("Keep"), 0), (_("Restore"), 1) ]
+ self["list"].setList(self.list)
+
def timerTick(self):
if self.execing:
self.timeout -= 1
-# if self.origTitle is None:
-# self.origTitle = self.instance.getTitle()
-# self.setTitle(self.origTitle + " ( after %d second, return to previous code)" %self.timeout)
- self["text"].setText(self.text + " (after %d second, return to previous code)" %self.timeout)
+ self["text"].setText(self.replytext_1 + " in %d seconds."%self.timeout + self.replytext_2)
if self.timeout == 0:
self.timer.stop()
self.timerRunning = False