From c731d02c3499e0ccb5c03f5f68d339214b6f5e60 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 30 Oct 2008 15:09:21 +0100 Subject: add plugin list icon for dvdburn --- lib/python/Plugins/Extensions/DVDBurn/dvdburn.png | Bin 0 -> 3869 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 lib/python/Plugins/Extensions/DVDBurn/dvdburn.png (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/dvdburn.png b/lib/python/Plugins/Extensions/DVDBurn/dvdburn.png new file mode 100755 index 00000000..7e7adead Binary files /dev/null and b/lib/python/Plugins/Extensions/DVDBurn/dvdburn.png differ -- cgit v1.2.3 From d84d4fe3d913d20b5472ea101b6474a19ece1860 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 30 Oct 2008 18:24:06 +0100 Subject: fix execute string for tasks --- lib/python/Components/Task.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 7ea64f1a..c152e9a2 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -136,7 +136,6 @@ class Task(object): def setTool(self, tool): self.cmd = tool - self.args = [tool] self.global_preconditions.append(ToolExistsPrecondition()) self.postconditions.append(ReturncodePostcondition()) @@ -172,7 +171,7 @@ class Task(object): if self.cwd is not None: self.container.setCWD(self.cwd) - execstr = self.cmd + " ".join(self.args) + #execstr = " ".join([self.cmd]+self.args) print "execute:", self.container.execute(execstr), execstr if self.initial_input: self.writeInput(self.initial_input) -- cgit v1.2.3 From 928c31cf9a5a1195fa3a20835b43a688ae089a01 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 30 Oct 2008 18:54:24 +0100 Subject: add possibility to disable user input in Messageboxes --- lib/python/Screens/MessageBox.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py index 8477fe04..8a5989c7 100644 --- a/lib/python/Screens/MessageBox.py +++ b/lib/python/Screens/MessageBox.py @@ -12,7 +12,7 @@ class MessageBox(Screen): TYPE_WARNING = 2 TYPE_ERROR = 3 - def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True): + def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True): self.type = type Screen.__init__(self, session) @@ -47,20 +47,21 @@ class MessageBox(Screen): self["selectedChoice"].setText(self.list[0][0]) self["list"] = MenuList(self.list) - self["actions"] = ActionMap(["MsgBoxActions", "DirectionActions"], - { - "cancel": self.cancel, - "ok": self.ok, - "alwaysOK": self.alwaysOK, - "up": self.up, - "down": self.down, - "left": self.left, - "right": self.right, - "upRepeated": self.up, - "downRepeated": self.down, - "leftRepeated": self.left, - "rightRepeated": self.right - }, -1) + if enable_input: + self["actions"] = ActionMap(["MsgBoxActions", "DirectionActions"], + { + "cancel": self.cancel, + "ok": self.ok, + "alwaysOK": self.alwaysOK, + "up": self.up, + "down": self.down, + "left": self.left, + "right": self.right, + "upRepeated": self.up, + "downRepeated": self.down, + "leftRepeated": self.left, + "rightRepeated": self.right + }, -1) def initTimeout(self, timeout): self.timeout = timeout -- cgit v1.2.3 From 52c94625063d5ea3ebf77db99acac8a43639c12a Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 31 Oct 2008 11:18:40 +0100 Subject: uncomment necessary line --- lib/python/Components/Task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index c152e9a2..47acc87e 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -171,7 +171,7 @@ class Task(object): if self.cwd is not None: self.container.setCWD(self.cwd) - #execstr = " ".join([self.cmd]+self.args) + execstr = " ".join([self.cmd]+self.args) print "execute:", self.container.execute(execstr), execstr if self.initial_input: self.writeInput(self.initial_input) -- cgit v1.2.3 From 728c78384a71b0231cfe0047292e34b8ec860522 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 31 Oct 2008 13:07:01 +0100 Subject: add possibility to call eConsoleAppContainer execute with unlimited count of arguments when its called with single argument, then /bin/sh is started else not --- lib/base/console.cpp | 36 +++++++++++++++++++++++++++++++----- lib/python/Components/Task.py | 4 ++-- 2 files changed, 33 insertions(+), 7 deletions(-) (limited to 'lib/python') diff --git a/lib/base/console.cpp b/lib/base/console.cpp index a12cb5e2..25318cc9 100644 --- a/lib/base/console.cpp +++ b/lib/base/console.cpp @@ -476,11 +476,37 @@ eConsolePy_running(eConsolePy* self) static PyObject * eConsolePy_execute(eConsolePy* self, PyObject *argt) { - const char *str; - if (PyArg_ParseTuple(argt, "s", &str)) - return PyInt_FromLong(self->cont->execute(str)); - PyErr_SetString(PyExc_TypeError, - "argument is not a string"); + Py_ssize_t argc = PyTuple_Size(argt); + if (argc > 1) + { + const char *argv[argc + 1]; + int argpos=0; + while(argpos < argc) + { + PyObject *arg = PyTuple_GET_ITEM(argt, argpos); + if (!PyString_Check(arg)) + { + char err[255]; + if (argpos) + snprintf(err, 255, "arg %d is not a string", argpos); + else + snprintf(err, 255, "cmd is not a string!"); + PyErr_SetString(PyExc_TypeError, err); + return NULL; + } + argv[argpos++] = PyString_AsString(arg); + } + argv[argpos] = 0; + return PyInt_FromLong(self->cont->execute(argv[0], argv)); + } + else + { + const char *str; + if (PyArg_ParseTuple(argt, "s", &str)) + return PyInt_FromLong(self->cont->execute(str)); + PyErr_SetString(PyExc_TypeError, + "cmd is not a string!"); + } return NULL; } diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 47acc87e..ab85c667 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -136,6 +136,7 @@ class Task(object): def setTool(self, tool): self.cmd = tool + self.args = [tool] self.global_preconditions.append(ToolExistsPrecondition()) self.postconditions.append(ReturncodePostcondition()) @@ -171,8 +172,7 @@ class Task(object): if self.cwd is not None: self.container.setCWD(self.cwd) - execstr = " ".join([self.cmd]+self.args) - print "execute:", self.container.execute(execstr), execstr + print "execute:", self.container.execute(self.cmd, *self.args), self.cmd, *self.args if self.initial_input: self.writeInput(self.initial_input) -- cgit v1.2.3 From 0a9c12b0d928a0d4837046830a253fef966ef672 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 31 Oct 2008 14:04:12 +0100 Subject: fix syntax error --- lib/python/Components/Task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index ab85c667..f249f711 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -172,7 +172,7 @@ class Task(object): if self.cwd is not None: self.container.setCWD(self.cwd) - print "execute:", self.container.execute(self.cmd, *self.args), self.cmd, *self.args + print "execute:", self.container.execute(self.cmd, *self.args), self.cmd, self.args if self.initial_input: self.writeInput(self.initial_input) -- cgit v1.2.3 From 1b586ab3e622c38f22280ad21d2cd5a08c4424b9 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 31 Oct 2008 14:11:59 +0100 Subject: actually burn and not just simulate burning to dvd-MINUS-r(w) media --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index b8a3788e..1cc11e2d 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -701,7 +701,7 @@ class DVDJob(Job): if output == "dvd": self.name = _("Burn DVD") tool = "/bin/growisofs" - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] elif output == "iso": self.name = _("Create DVD-ISO") tool = "/usr/bin/mkisofs" @@ -739,7 +739,7 @@ class DVDdataJob(Job): tool = "/bin/growisofs" if output == "dvd": self.name = _("Burn DVD") - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] elif output == "iso": tool = "/usr/bin/mkisofs" self.name = _("Create DVD-ISO") @@ -762,11 +762,11 @@ class DVDisoJob(Job): self.menupreview = False if imagepath.endswith(".iso"): PreviewTask(self, imagepath) - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD() + '='+imagepath, "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD() + '='+imagepath, "-dvd-compat" ] else: PreviewTask(self, imagepath + "/VIDEO_TS/") volName = self.project.settings.name.getValue() - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, imagepath ] tool = "/bin/growisofs" BurnTask(self, burnargs, tool) -- cgit v1.2.3 From 14ccf994868546b74185de6404739b2eb77e6cfe Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 31 Oct 2008 15:08:48 +0100 Subject: add additional clear text error messages for burntask --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 1cc11e2d..7a03b7eb 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -251,11 +251,13 @@ class BurnTaskPostcondition(Condition): task.ERROR_WRITE_FAILED: _("Write failed!"), task.ERROR_DVDROM: _("No (supported) DVDROM found!"), task.ERROR_ISOFS: _("Medium is not empty!"), + task.ERROR_FILETOOLARGE: _("TS file is too large for ISO9660 level 1!"), + task.ERROR_ISOTOOLARGE: _("ISO file is too large for this filesystem!"), task.ERROR_UNKNOWN: _("An unknown error occured!") }[task.error] class BurnTask(Task): - ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_UNKNOWN = range(7) + ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_UNKNOWN = range(9) def __init__(self, job, extra_args=[], tool="/bin/growisofs"): Task.__init__(self, job, job.name) self.weighting = 500 @@ -303,6 +305,10 @@ class BurnTask(Task): else: self.error = self.ERROR_UNKNOWN print "BurnTask: unknown error %s" % line + elif line.find("-allow-limited-size was not specified. There is no way do represent this file size. Aborting.") != -1: + self.error = self.ERROR_FILETOOLARGE + elif line.startswith("genisoimage: File too large."): + self.error = self.ERROR_ISOTOOLARGE class RemoveDVDFolder(Task): def __init__(self, job): -- cgit v1.2.3 From d1969e292c8208feb7825bdcd4fc3e64e0dbc2fa Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 31 Oct 2008 16:43:41 +0100 Subject: needed update for avahi stuff --- lib/python/Components/Network.py | 102 +++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 37 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 9b0898e0..5c9e06b7 100644 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -14,10 +14,11 @@ class Network: self.Console = Console() self.getInterfaces() - def getInterfaces(self): + def getInterfaces(self, callback = None): devicesPattern = re_compile('[a-z]+[0-9]+') self.configuredInterfaces = [] fp = file('/proc/net/dev', 'r') + system("cat /proc/net/dev") result = fp.readlines() fp.close() for line in result: @@ -25,19 +26,10 @@ class Network: device = devicesPattern.search(line).group() if device == 'wifi0': continue - self.getDataForInterface(device) - # Show only UP Interfaces in E2 - #if self.getAdapterAttribute(device, 'up') is False: - # del self.ifaces[device] + self.getDataForInterface(device, callback) except AttributeError: pass - #print "self.ifaces:", self.ifaces - #self.writeNetworkConfig() - #print ord(' ') - #for line in result: - # print ord(line[0]) - # helper function def regExpMatch(self, pattern, string): if string is None: @@ -55,12 +47,37 @@ class Network: ip.append(int(x)) return ip - def getDataForInterface(self, iface): - cmd = "ifconfig " + iface - self.Console.ePopen(cmd, self.ifconfigFinished, iface) - - def ifconfigFinished(self, result, retval, iface): + def IPaddrFinished(self, result, retval, extra_args): + (iface, callback ) = extra_args data = { 'up': False, 'dhcp': False, 'preup' : False, 'postdown' : False } + globalIPpattern = re_compile("scope global") + ipRegexp = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' + ipLinePattern = re_compile('inet ' + ipRegexp +'/') + ipPattern = re_compile(ipRegexp) + + for line in result.splitlines(): + split = line.strip().split(' ',2) + if (split[1] == iface): + if re_search(globalIPpattern, split[2]): + ip = self.regExpMatch(ipPattern, self.regExpMatch(ipLinePattern, split[2])) + if ip is not None: + data['ip'] = self.convertIP(ip) + if not data.has_key('ip'): + data['dhcp'] = True + data['ip'] = [0, 0, 0, 0] + data['netmask'] = [0, 0, 0, 0] + data['gateway'] = [0, 0, 0, 0] + + cmd = "ifconfig " + iface + self.Console.ePopen(cmd, self.ifconfigFinished, [iface, data, callback]) + + def getDataForInterface(self, iface,callback): + #get ip out of ip addr, as avahi sometimes overrides it in ifconfig. + cmd = "ip -o addr" + self.Console.ePopen(cmd, self.IPaddrFinished, [iface,callback]) + + def ifconfigFinished(self, result, retval, extra_args ): + (iface, data, callback ) = extra_args ipRegexp = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ipLinePattern = re_compile('inet addr:' + ipRegexp) netmaskLinePattern = re_compile('Mask:' + ipRegexp) @@ -68,15 +85,15 @@ class Network: ipPattern = re_compile(ipRegexp) upPattern = re_compile('UP ') macPattern = re_compile('[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2}') - + for line in result.splitlines(): - ip = self.regExpMatch(ipPattern, self.regExpMatch(ipLinePattern, line)) + #ip = self.regExpMatch(ipPattern, self.regExpMatch(ipLinePattern, line)) netmask = self.regExpMatch(ipPattern, self.regExpMatch(netmaskLinePattern, line)) bcast = self.regExpMatch(ipPattern, self.regExpMatch(bcastLinePattern, line)) up = self.regExpMatch(upPattern, line) mac = self.regExpMatch(macPattern, line) - if ip is not None: - data['ip'] = self.convertIP(ip) + #if ip is not None: + # data['ip'] = self.convertIP(ip) if netmask is not None: data['netmask'] = self.convertIP(netmask) if bcast is not None: @@ -87,27 +104,34 @@ class Network: self.configuredInterfaces.append(iface) if mac is not None: data['mac'] = mac - if not data.has_key('ip'): - data['dhcp'] = True - data['ip'] = [0, 0, 0, 0] - data['netmask'] = [0, 0, 0, 0] - data['gateway'] = [0, 0, 0, 0] - + cmd = "route -n | grep " + iface - self.Console.ePopen(cmd,self.routeFinished,[iface,data,ipPattern]) + self.Console.ePopen(cmd,self.routeFinished,[iface,data,callback]) def routeFinished(self, result, retval, extra_args): - (iface, data, ipPattern) = extra_args - + (iface, data, callback) = extra_args + ipRegexp = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' + ipPattern = re_compile(ipRegexp) + ipLinePattern = re_compile(ipRegexp) + for line in result.splitlines(): print line[0:7] if line[0:7] == "0.0.0.0": gateway = self.regExpMatch(ipPattern, line[16:31]) if gateway is not None: data['gateway'] = self.convertIP(gateway) + + for line in result.splitlines(): #get real netmask in case avahi has overridden ifconfig netmask + split = line.strip().split(' ') + if re_search(ipPattern, split[0]): + foundip = self.convertIP(split[0]) + if (foundip[0] == data['ip'][0] and foundip[1] == data['ip'][1]): + if re_search(ipPattern, split[4]): + mask = self.regExpMatch(ipPattern, self.regExpMatch(ipLinePattern, split[4])) + if mask is not None: + data['netmask'] = self.convertIP(mask) self.ifaces[iface] = data - if len(self.Console.appContainers) == 0: - self.loadNetworkConfig() + self.loadNetworkConfig(iface,callback) def writeNetworkConfig(self): self.configuredInterfaces = [] @@ -144,8 +168,7 @@ class Network: fp.write("nameserver %d.%d.%d.%d\n" % tuple(nameserver)) fp.close() - def loadNetworkConfig(self): - self.loadNameserverConfig() + def loadNetworkConfig(self,iface,callback = None): interfaces = [] # parse the interfaces-file try: @@ -166,7 +189,7 @@ class Network: ifaces[currif]["dhcp"] = True else: ifaces[currif]["dhcp"] = False - if (currif != ""): + if (currif == iface): #read information only for available interfaces if (split[0] == "address"): ifaces[currif]["address"] = map(int, split[1].split('.')) if self.ifaces[currif].has_key("ip"): @@ -181,7 +204,7 @@ class Network: ifaces[currif]["gateway"] = map(int, split[1].split('.')) if self.ifaces[currif].has_key("gateway"): if self.ifaces[currif]["gateway"] != ifaces[currif]["gateway"] and ifaces[currif]["dhcp"] == False: - self.ifaces[currif]["gateway"] = map(int, split[1].split('.')) + self.ifaces[currif]["gateway"] = map(int, split[1].split('.')) if (split[0] == "pre-up"): if self.ifaces[currif].has_key("preup"): self.ifaces[currif]["preup"] = i @@ -189,11 +212,16 @@ class Network: if self.ifaces[currif].has_key("postdown"): self.ifaces[currif]["postdown"] = i - print "read interfaces:", ifaces for ifacename, iface in ifaces.items(): if self.ifaces.has_key(ifacename): self.ifaces[ifacename]["dhcp"] = iface["dhcp"] - print "self.ifaces after loading:", self.ifaces + if len(self.Console.appContainers) == 0: + # load ns only once + self.loadNameserverConfig() + print "read configured interfac:", ifaces + print "self.ifaces after loading:", self.ifaces + if callback is not None: + callback(True) def loadNameserverConfig(self): ipRegexp = "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" -- cgit v1.2.3 From 9d3e9f9dcb8b1f579fac1b36185507d314b2b9b7 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 31 Oct 2008 17:16:10 +0100 Subject: remove debug output --- lib/python/Components/Network.py | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 5c9e06b7..cf21c6d0 100644 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -18,7 +18,6 @@ class Network: devicesPattern = re_compile('[a-z]+[0-9]+') self.configuredInterfaces = [] fp = file('/proc/net/dev', 'r') - system("cat /proc/net/dev") result = fp.readlines() fp.close() for line in result: -- cgit v1.2.3 From ef6af8235aef7f58c25e5962ee14a264fc66fdf8 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 31 Oct 2008 19:36:58 +0100 Subject: add missing import --- lib/python/Components/Network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index cf21c6d0..bed9d95f 100644 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -1,5 +1,5 @@ from os import system, popen, path as os_path, listdir -from re import compile as re_compile +from re import compile as re_compile, search as re_search from socket import * from enigma import eConsoleAppContainer from Components.Console import Console -- cgit v1.2.3 From 355537a6ba6eac5030b1d8b9edb6e5902913453d Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Sat, 1 Nov 2008 00:34:47 +0100 Subject: add icon to be installed. remove deprecated directories --- .../Plugins/Extensions/DVDBurn/data/Makefile.am | 6 ------ .../Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg | Bin 187417 -> 0 bytes .../Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg | Bin 575488 -> 0 bytes .../Plugins/Extensions/DVDBurn/data/silence.mp2 | Bin 8340 -> 0 bytes .../DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml | 18 ------------------ .../Plugins/Extensions/DVDBurn/template/Makefile.am | 7 ------- 6 files changed, 31 deletions(-) delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am delete mode 100755 lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am deleted file mode 100644 index e5992b9c..00000000 --- a/lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -AUTOMAKE_OPTIONS = gnu - -installdir = $(DATADIR)/enigma2 - -install_DATA = \ - dreamdvd_boat.jpg dreamvmgm.mpg silence.mp2 diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg b/lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg deleted file mode 100755 index a5256e28..00000000 Binary files a/lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg and /dev/null differ diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg b/lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg deleted file mode 100644 index 4797986f..00000000 Binary files a/lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg and /dev/null differ diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 b/lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 deleted file mode 100644 index e8a817f8..00000000 Binary files a/lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 and /dev/null differ diff --git a/lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml b/lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml deleted file mode 100644 index b839ad8a..00000000 --- a/lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - diff --git a/lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am deleted file mode 100644 index f0d9e8a0..00000000 --- a/lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -AUTOMAKE_OPTIONS = gnu - -installdir = /etc/enigma2/playlist - -install_DATA = \ - DreamboxDVDtemplate.ddvdp.xml - -- cgit v1.2.3 From ce8e939502fb096515b84a16087bdcb2c498bfdc Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 2 Nov 2008 11:14:33 +0100 Subject: add .mp2 as supported filetype --- lib/python/Components/FileList.py | 1 + lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 6 +++--- lib/service/servicemp3.cpp | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 7801c556..e028ec3a 100644 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -10,6 +10,7 @@ from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \ from Tools.LoadPixmap import LoadPixmap EXTENSIONS = { + "mp2": "music", "mp3": "music", "wav": "music", "ogg": "music", diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index a144f2cd..841ad614 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -66,7 +66,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.addPlaylistParser(PlaylistIOInternal, "e2pls") # 'None' is magic to start at the list of mountpoints - self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") + self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") self["filelist"] = self.filelist self.playlist = MyPlayList() @@ -727,7 +727,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB ext = text[-4:].lower() # FIXME: the information if the service contains video (and we should hide our window) should com from the service instead - if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: + if ext not in [".mp2", ".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: self.hide() else: needsInfoUpdate = True @@ -754,7 +754,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB currref = self.playlist.getServiceRefList()[idx] text = currref.getPath() ext = text[-4:].lower() - if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: + if ext not in [".mp2", ".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: self.hide() else: needsInfoUpdate = True diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 5c982aa1..c76e346e 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -27,6 +27,7 @@ eServiceFactoryMP3::eServiceFactoryMP3() if (sc) { std::list extensions; + extensions.push_back("mp2"); extensions.push_back("mp3"); extensions.push_back("ogg"); extensions.push_back("mpg"); -- cgit v1.2.3 From 58fe3de03d974c022df060acdf5d0e3dbc5bac90 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 3 Nov 2008 09:01:50 +0100 Subject: user correct playlist parser from dict --- lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 841ad614..ed1a8874 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -592,12 +592,13 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def PlaylistSelected(self,path): if path is not None: self.clear_playlist() - self.playlistIOInternal = PlaylistIOInternal() - list = self.playlistIOInternal.open(path[1]) - if list: + extension = path[0].rsplit('.',1)[-1] + if self.playlistparsers.has_key(extension): + playlist = self.playlistparsers[extension]() + list = playlist.open(path[1]) for x in list: self.playlist.addFile(x.ref) - self.playlist.updateList() + self.playlist.updateList() def delete_saved_playlist(self): listpath = [] -- cgit v1.2.3 From 8f1f4a52e0e913bb51e58efa542dcbe404dba77d Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 3 Nov 2008 13:47:04 +0100 Subject: fix streaming playback (webradio) --- lib/python/Components/Playlist.py | 2 ++ lib/service/servicemp3.cpp | 35 +++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Playlist.py b/lib/python/Components/Playlist.py index 22799692..744ee3af 100644 --- a/lib/python/Components/Playlist.py +++ b/lib/python/Components/Playlist.py @@ -70,6 +70,8 @@ class PlaylistIOM3U(PlaylistIO): # TODO: use e2 facilities to create a service ref from file if entry[0] == "/": self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry)) + elif entry.startswith("http"): + self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry.replace(':',"%3a"))) else: self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + os.path.dirname(filename) + "/" + entry)) file.close() diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index c76e346e..19b7735b 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -227,11 +227,29 @@ eServiceMP3::eServiceMP3(const char *filename): m_filename(filename), m_pump(eAp if (!m_gst_pipeline) m_error_message = "failed to create GStreamer pipeline!\n"; - if ( sourceinfo.containertype == ctCDA ) + if ( sourceinfo.is_streaming ) + { + eDebug("play webradio!"); + source = gst_element_factory_make ("neonhttpsrc", "http-source"); + if (source) + { + g_object_set (G_OBJECT (source), "location", filename, NULL); + g_object_set (G_OBJECT (source), "automatic-redirect", TRUE, NULL); + } + else + m_error_message = "GStreamer plugin neonhttpsrc not available!\n"; + } + else if ( sourceinfo.containertype == ctCDA ) { source = gst_element_factory_make ("cdiocddasrc", "cda-source"); if (source) + { g_object_set (G_OBJECT (source), "device", "/dev/cdroms/cdrom0", NULL); + int track = atoi(filename+18); + eDebug("play audio CD track #%i",track); + if (track > 0) + g_object_set (G_OBJECT (source), "track", track, NULL); + } else sourceinfo.containertype = ctNone; } @@ -243,21 +261,6 @@ eServiceMP3::eServiceMP3(const char *filename): m_filename(filename), m_pump(eAp else m_error_message = "GStreamer can't open filesrc " + (std::string)filename + "!\n"; } - else if ( sourceinfo.is_streaming ) - { - source = gst_element_factory_make ("neonhttpsrc", "http-source"); - if (source) - g_object_set (G_OBJECT (source), "automatic-redirect", TRUE, NULL); - else - m_error_message = "GStreamer plugin neonhttpsrc not available!\n"; - } - else - { - int track = atoi(filename+18); - eDebug("play audio CD track #%i",track); - if (track > 0) - g_object_set (G_OBJECT (source), "track", track, NULL); - } if ( sourceinfo.is_video ) { /* filesrc -> mpegdemux -> | queue_audio -> dvbaudiosink -- cgit v1.2.3 From 229f1d3e77143ffe1351fcd05a66665132e3e6d1 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 3 Nov 2008 20:48:01 +0100 Subject: save backup network configuration files and not only gui stuff from enigma2 and change the default backup location to harddisk (on behalf of sat-man) --- lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py index 9ff8c05d..7a918da6 100644 --- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py @@ -104,8 +104,8 @@ class BackupSetup(Screen): self.list = [ ] self["config"] = ConfigList(self.list) self.backup = ConfigSubsection() - self.backup.type = ConfigSelection(choices = [("settings", _("only /etc/enigma2 directory")), ("var", _("/var directory")), ("skin", _("/usr/share/enigma2 directory"))], default="settings") - self.backup.location = ConfigSelection(choices = [("usb", _("USB Stick")), ("cf", _("CF Drive")), ("hdd", _("Harddisk"))]) + self.backup.type = ConfigSelection(choices = [("settings", _("enigma2 and network")), ("var", _("/var directory")), ("skin", _("/usr/share/enigma2 directory"))], default="settings") + self.backup.location = ConfigSelection(choices = [("hdd", _("Harddisk")), ("usb", _("USB Stick")), ("cf", _("CF Drive"))]) self.list.append(getConfigListEntry(_("Backup Mode"), self.backup.type)) self.list.append(getConfigListEntry(_("Backup Location"), self.backup.location)) @@ -132,7 +132,7 @@ class BackupSetup(Screen): self.path = BackupPath[self.backup.location.value] if self.backup.type.value == "settings": print "Backup Mode: Settings" - self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/"]) + self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"]) elif self.backup.type.value == "var": print "Backup Mode: var" self.session.open(Console, title = "Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_var_backup.tar.gz /var/"]) -- cgit v1.2.3 From 1101fc3f4349fbdbed94e82870aae6b4af9312fe Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 4 Nov 2008 11:30:56 +0100 Subject: more failsave code, remove imho unneeded invalidate calls --- lib/python/Screens/TimerEdit.py | 47 ++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 27 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py index 67c49cc5..800bab33 100644 --- a/lib/python/Screens/TimerEdit.py +++ b/lib/python/Screens/TimerEdit.py @@ -117,41 +117,40 @@ class TimerEditList(Screen): self.session.nav.RecordTimer.timeChanged(t) self.refill() self.updateState() - + + def removeAction(self, descr): + actions = self["actions"].actions + if descr in actions: + del actions[descr] + def updateState(self): cur = self["timerlist"].getCurrent() if cur: if self.key_red_choice != self.DELETE: self["actions"].actions.update({"red":self.removeTimerQuestion}) self["key_red"].setText(_("Delete")) - self["key_red"].instance.invalidate() self.key_red_choice = self.DELETE if cur.disabled and (self.key_yellow_choice != self.ENABLE): self["actions"].actions.update({"yellow":self.toggleDisabledState}) self["key_yellow"].setText(_("Enable")) - self["key_yellow"].instance.invalidate() self.key_yellow_choice = self.ENABLE elif cur.isRunning() and not cur.repeated and (self.key_yellow_choice != self.EMPTY): - del self["actions"].actions["yellow"] + self.removeAction("yellow") self["key_yellow"].setText(" ") - self["key_yellow"].instance.invalidate() self.key_yellow_choice = self.EMPTY elif ((not cur.isRunning())or cur.repeated ) and (not cur.disabled) and (self.key_yellow_choice != self.DISABLE): self["actions"].actions.update({"yellow":self.toggleDisabledState}) self["key_yellow"].setText(_("Disable")) - self["key_yellow"].instance.invalidate() self.key_yellow_choice = self.DISABLE else: if self.key_red_choice != self.EMPTY: - del self["actions"].actions["red"] + self.removeAction("red") self["key_red"].setText(" ") - self["key_red"].instance.invalidate() self.key_red_choice = self.EMPTY if self.key_yellow_choice != self.EMPTY: - del self["actions"].actions["yellow"] + self.removeAction("yellow") self["key_yellow"].setText(" ") - self["key_yellow"].instance.invalidate() self.key_yellow_choice = self.EMPTY showCleanup = True @@ -164,15 +163,12 @@ class TimerEditList(Screen): if showCleanup and (self.key_blue_choice != self.CLEANUP): self["actions"].actions.update({"blue":self.cleanupQuestion}) self["key_blue"].setText(_("Cleanup")) - self["key_blue"].instance.invalidate() self.key_blue_choice = self.CLEANUP elif (not showCleanup) and (self.key_blue_choice != self.EMPTY): - del self["actions"].actions["blue"] + self.removeAction("blue") self["key_blue"].setText(" ") - self["key_blue"].instance.invalidate() self.key_blue_choice = self.EMPTY - def fillTimerList(self): del self.list[:] @@ -399,23 +395,25 @@ class TimerSanityConflict(Screen): def down(self): self["list"].instance.moveSelection(self["list"].instance.moveDown) self["timer2"].moveToIndex(self["list"].getSelectedIndex()) - + + def removeAction(self, descr): + actions = self["actions"].actions + if descr in actions: + del actions[descr] + def updateState(self): if self.timer[0] is not None: if self.timer[0].disabled and self.key_green_choice != self.ENABLE: self["actions"].actions.update({"green":self.toggleTimer1}) self["key_green"].setText(_("Enable")) - self["key_green"].instance.invalidate() self.key_green_choice = self.ENABLE elif self.timer[0].isRunning() and not timer[0].repeated and self.key_green_choice != self.EMPTY: - del self["actions"].actions["green"] + self.removeAction("green") self["key_green"].setText(" ") - self["key_green"].instance.invalidate() self.key_green_choice = self.EMPTY elif (not self.timer[0].isRunning() or self.timer[0].repeated ) and self.key_green_choice != self.DISABLE: self["actions"].actions.update({"green":self.toggleTimer1}) self["key_green"].setText(_("Disable")) - self["key_green"].instance.invalidate() self.key_green_choice = self.DISABLE if len(self.timer) > 1: x = self["list"].getSelectedIndex() @@ -423,25 +421,20 @@ class TimerSanityConflict(Screen): if self.timer[x].disabled and self.key_blue_choice != self.ENABLE: self["actions"].actions.update({"blue":self.toggleTimer2}) self["key_blue"].setText(_("Enable")) - self["key_blue"].instance.invalidate() self.key_blue_choice = self.ENABLE elif self.timer[x].isRunning() and not timer[x].repeated and self.key_blue_choice != self.EMPTY: - del self["actions"].actions["blue"] + self.removeAction("blue") self["key_blue"].setText(" ") - self["key_blue"].instance.invalidate() self.key_blue_choice = self.EMPTY elif (not self.timer[x].isRunning() or self.timer[x].repeated ) and self.key_blue_choice != self.DISABLE: self["actions"].actions.update({"blue":self.toggleTimer2}) self["key_blue"].setText(_("Disable")) - self["key_blue"].instance.invalidate() self.key_blue_choice = self.DISABLE else: #FIXME.... this doesnt hide the buttons self.... just the text - del self["actions"].actions["yellow"] + self.removeAction("yellow") self["key_yellow"].setText(" ") - self["key_yellow"].instance.invalidate() self.key_yellow_choice = self.EMPTY - del self["actions"].actions["blue"] + self.removeAction("blue") self["key_blue"].setText(" ") - self["key_blue"].instance.invalidate() self.key_blue_choice = self.EMPTY -- cgit v1.2.3 From 1be69784396f194419adda53331d5fee02ea062b Mon Sep 17 00:00:00 2001 From: Acid-Burn Date: Tue, 4 Nov 2008 12:13:37 +0100 Subject: add virtual keyboard as easy input help add icons for virtual keyboard network fixes wlan fixeS --- data/skin_default.xml | 11 +- data/skin_default/vkey_backspace.png | Bin 0 -> 783 bytes data/skin_default/vkey_bg.png | Bin 0 -> 577 bytes data/skin_default/vkey_clr.png | Bin 0 -> 955 bytes data/skin_default/vkey_esc.png | Bin 0 -> 1321 bytes data/skin_default/vkey_icon.png | Bin 0 -> 2512 bytes data/skin_default/vkey_left.png | Bin 0 -> 819 bytes data/skin_default/vkey_ok.png | Bin 0 -> 990 bytes data/skin_default/vkey_right.png | Bin 0 -> 817 bytes data/skin_default/vkey_sel.png | Bin 0 -> 173 bytes data/skin_default/vkey_shift.png | Bin 0 -> 767 bytes data/skin_default/vkey_shift_sel.png | Bin 0 -> 1395 bytes data/skin_default/vkey_space.png | Bin 0 -> 577 bytes data/skin_default/vkey_text.png | Bin 0 -> 262 bytes lib/python/Components/HelpMenuList.py | 25 +- lib/python/Components/Network.py | 331 +++++++++++++------ lib/python/Screens/Makefile.am | 2 +- lib/python/Screens/NetworkSetup.py | 604 ++++++++++++++++++++++++---------- lib/python/Screens/VirtualKeyBoard.py | 287 ++++++++++++++++ 19 files changed, 978 insertions(+), 282 deletions(-) mode change 100644 => 100755 data/skin_default.xml create mode 100755 data/skin_default/vkey_backspace.png create mode 100755 data/skin_default/vkey_bg.png create mode 100755 data/skin_default/vkey_clr.png create mode 100755 data/skin_default/vkey_esc.png create mode 100755 data/skin_default/vkey_icon.png create mode 100755 data/skin_default/vkey_left.png create mode 100755 data/skin_default/vkey_ok.png create mode 100755 data/skin_default/vkey_right.png create mode 100755 data/skin_default/vkey_sel.png create mode 100755 data/skin_default/vkey_shift.png create mode 100755 data/skin_default/vkey_shift_sel.png create mode 100755 data/skin_default/vkey_space.png create mode 100755 data/skin_default/vkey_text.png mode change 100644 => 100755 lib/python/Components/HelpMenuList.py mode change 100644 => 100755 lib/python/Components/Network.py mode change 100644 => 100755 lib/python/Screens/Makefile.am mode change 100644 => 100755 lib/python/Screens/NetworkSetup.py create mode 100755 lib/python/Screens/VirtualKeyBoard.py (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml old mode 100644 new mode 100755 index 88cf8b40..41a7e4c9 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -42,6 +42,9 @@ + + + @@ -568,7 +571,7 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + @@ -1157,4 +1160,10 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) + + + + + + diff --git a/data/skin_default/vkey_backspace.png b/data/skin_default/vkey_backspace.png new file mode 100755 index 00000000..ed49159f Binary files /dev/null and b/data/skin_default/vkey_backspace.png differ diff --git a/data/skin_default/vkey_bg.png b/data/skin_default/vkey_bg.png new file mode 100755 index 00000000..5151da4c Binary files /dev/null and b/data/skin_default/vkey_bg.png differ diff --git a/data/skin_default/vkey_clr.png b/data/skin_default/vkey_clr.png new file mode 100755 index 00000000..0c7734bf Binary files /dev/null and b/data/skin_default/vkey_clr.png differ diff --git a/data/skin_default/vkey_esc.png b/data/skin_default/vkey_esc.png new file mode 100755 index 00000000..56c52d30 Binary files /dev/null and b/data/skin_default/vkey_esc.png differ diff --git a/data/skin_default/vkey_icon.png b/data/skin_default/vkey_icon.png new file mode 100755 index 00000000..f27b7f86 Binary files /dev/null and b/data/skin_default/vkey_icon.png differ diff --git a/data/skin_default/vkey_left.png b/data/skin_default/vkey_left.png new file mode 100755 index 00000000..2e77e713 Binary files /dev/null and b/data/skin_default/vkey_left.png differ diff --git a/data/skin_default/vkey_ok.png b/data/skin_default/vkey_ok.png new file mode 100755 index 00000000..2c0c7e88 Binary files /dev/null and b/data/skin_default/vkey_ok.png differ diff --git a/data/skin_default/vkey_right.png b/data/skin_default/vkey_right.png new file mode 100755 index 00000000..fefb17c5 Binary files /dev/null and b/data/skin_default/vkey_right.png differ diff --git a/data/skin_default/vkey_sel.png b/data/skin_default/vkey_sel.png new file mode 100755 index 00000000..b612b947 Binary files /dev/null and b/data/skin_default/vkey_sel.png differ diff --git a/data/skin_default/vkey_shift.png b/data/skin_default/vkey_shift.png new file mode 100755 index 00000000..477f8db2 Binary files /dev/null and b/data/skin_default/vkey_shift.png differ diff --git a/data/skin_default/vkey_shift_sel.png b/data/skin_default/vkey_shift_sel.png new file mode 100755 index 00000000..339ddb46 Binary files /dev/null and b/data/skin_default/vkey_shift_sel.png differ diff --git a/data/skin_default/vkey_space.png b/data/skin_default/vkey_space.png new file mode 100755 index 00000000..5151da4c Binary files /dev/null and b/data/skin_default/vkey_space.png differ diff --git a/data/skin_default/vkey_text.png b/data/skin_default/vkey_text.png new file mode 100755 index 00000000..6bdb8c84 Binary files /dev/null and b/data/skin_default/vkey_text.png differ diff --git a/lib/python/Components/HelpMenuList.py b/lib/python/Components/HelpMenuList.py old mode 100644 new mode 100755 index 25c9b8b6..04815c8d --- a/lib/python/Components/HelpMenuList.py +++ b/lib/python/Components/HelpMenuList.py @@ -1,7 +1,6 @@ from GUIComponent import GUIComponent from enigma import eListboxPythonMultiContent, eListbox, gFont - from Tools.KeyBindings import queryKeyBinding, getKeyDescription #getKeyPositions @@ -13,6 +12,7 @@ class HelpMenuList(GUIComponent): self.onSelChanged = [ ] self.l = eListboxPythonMultiContent() self.callback = callback + self.extendedHelp = False l = [ ] for (actionmap, context, actions) in list: @@ -36,17 +36,26 @@ class HelpMenuList(GUIComponent): if flags & 8: # for long keypresses, prepend l_ into the key name. name = (name[0], "long") - print "name:", name - entry.append( (actionmap, context, action, name ) ) - entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 28, 0, 0, help) ) - + + if type(help).__name__== 'list': + self.extendedHelp = True + print "extendedHelpEntry found" + entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 26, 0, 0, help[0]) ) + entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 28, 400, 20, 1, 0, help[1]) ) + else: + entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 28, 0, 0, help) ) + l.append(entry) self.l.setList(l) - - self.l.setFont(0, gFont("Regular", 24)) - self.l.setItemHeight(38) + if self.extendedHelp is True: + self.l.setFont(0, gFont("Regular", 24)) + self.l.setFont(1, gFont("Regular", 18)) + self.l.setItemHeight(50) + else: + self.l.setFont(0, gFont("Regular", 24)) + self.l.setItemHeight(38) def ok(self): # a list entry has a "private" tuple as first entry... diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py old mode 100644 new mode 100755 index bed9d95f..e10c6a0e --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -7,11 +7,19 @@ from Components.Console import Console class Network: def __init__(self): self.ifaces = {} - self.configuredInterfaces = [] + self.configuredInterfaces = [] + self.configuredNetworkAdapters = [] + self.NetworkState = 0 + self.DnsState = 0 self.nameservers = [] self.ethtool_bin = "/usr/sbin/ethtool" self.container = eConsoleAppContainer() self.Console = Console() + self.LinkConsole = Console() + self.restartConsole = Console() + self.deactivateConsole = Console() + self.activateConsole = Console() + self.resetNetworkConsole = Console() self.getInterfaces() def getInterfaces(self, callback = None): @@ -28,6 +36,11 @@ class Network: self.getDataForInterface(device, callback) except AttributeError: pass + #print "self.ifaces:", self.ifaces + #self.writeNetworkConfig() + #print ord(' ') + #for line in result: + # print ord(line[0]) # helper function def regExpMatch(self, pattern, string): @@ -46,66 +59,58 @@ class Network: ip.append(int(x)) return ip + def getDataForInterface(self, iface,callback): + #get ip out of ip addr, as avahi sometimes overrides it in ifconfig. + cmd = "ip -o addr" + self.Console.ePopen(cmd, self.IPaddrFinished, [iface,callback]) + def IPaddrFinished(self, result, retval, extra_args): (iface, callback ) = extra_args data = { 'up': False, 'dhcp': False, 'preup' : False, 'postdown' : False } globalIPpattern = re_compile("scope global") ipRegexp = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' - ipLinePattern = re_compile('inet ' + ipRegexp +'/') + netRegexp = '[0-9]{1,2}' + macRegexp = '[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}' + ipLinePattern = re_compile('inet ' + ipRegexp + '/') ipPattern = re_compile(ipRegexp) - + netmaskLinePattern = re_compile('/' + netRegexp + ' brd ') + netmaskPattern = re_compile(netRegexp) + bcastLinePattern = re_compile(' brd ' + ipRegexp) + upPattern = re_compile('UP') + macPattern = re_compile('[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}') + macLinePattern = re_compile('link/ether ' + macRegexp) + for line in result.splitlines(): split = line.strip().split(' ',2) + if (split[1][:-1] == iface): + up = self.regExpMatch(upPattern, split[2]) + mac = self.regExpMatch(macPattern, self.regExpMatch(macLinePattern, split[2])) + if up is not None: + data['up'] = True + if iface is not 'lo': + self.configuredInterfaces.append(iface) + if mac is not None: + data['mac'] = mac if (split[1] == iface): if re_search(globalIPpattern, split[2]): ip = self.regExpMatch(ipPattern, self.regExpMatch(ipLinePattern, split[2])) + netmask = self.calc_netmask(self.regExpMatch(netmaskPattern, self.regExpMatch(netmaskLinePattern, split[2]))) + bcast = self.regExpMatch(ipPattern, self.regExpMatch(bcastLinePattern, split[2])) if ip is not None: data['ip'] = self.convertIP(ip) + if netmask is not None: + data['netmask'] = self.convertIP(netmask) + if bcast is not None: + data['bcast'] = self.convertIP(bcast) + if not data.has_key('ip'): data['dhcp'] = True data['ip'] = [0, 0, 0, 0] data['netmask'] = [0, 0, 0, 0] data['gateway'] = [0, 0, 0, 0] - cmd = "ifconfig " + iface - self.Console.ePopen(cmd, self.ifconfigFinished, [iface, data, callback]) - - def getDataForInterface(self, iface,callback): - #get ip out of ip addr, as avahi sometimes overrides it in ifconfig. - cmd = "ip -o addr" - self.Console.ePopen(cmd, self.IPaddrFinished, [iface,callback]) - - def ifconfigFinished(self, result, retval, extra_args ): - (iface, data, callback ) = extra_args - ipRegexp = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' - ipLinePattern = re_compile('inet addr:' + ipRegexp) - netmaskLinePattern = re_compile('Mask:' + ipRegexp) - bcastLinePattern = re_compile('Bcast:' + ipRegexp) - ipPattern = re_compile(ipRegexp) - upPattern = re_compile('UP ') - macPattern = re_compile('[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2}') - - for line in result.splitlines(): - #ip = self.regExpMatch(ipPattern, self.regExpMatch(ipLinePattern, line)) - netmask = self.regExpMatch(ipPattern, self.regExpMatch(netmaskLinePattern, line)) - bcast = self.regExpMatch(ipPattern, self.regExpMatch(bcastLinePattern, line)) - up = self.regExpMatch(upPattern, line) - mac = self.regExpMatch(macPattern, line) - #if ip is not None: - # data['ip'] = self.convertIP(ip) - if netmask is not None: - data['netmask'] = self.convertIP(netmask) - if bcast is not None: - data['bcast'] = self.convertIP(bcast) - if up is not None: - data['up'] = True - if iface is not 'lo': - self.configuredInterfaces.append(iface) - if mac is not None: - data['mac'] = mac - cmd = "route -n | grep " + iface - self.Console.ePopen(cmd,self.routeFinished,[iface,data,callback]) + self.Console.ePopen(cmd,self.routeFinished, [iface, data, callback]) def routeFinished(self, result, retval, extra_args): (iface, data, callback) = extra_args @@ -119,16 +124,7 @@ class Network: gateway = self.regExpMatch(ipPattern, line[16:31]) if gateway is not None: data['gateway'] = self.convertIP(gateway) - - for line in result.splitlines(): #get real netmask in case avahi has overridden ifconfig netmask - split = line.strip().split(' ') - if re_search(ipPattern, split[0]): - foundip = self.convertIP(split[0]) - if (foundip[0] == data['ip'][0] and foundip[1] == data['ip'][1]): - if re_search(ipPattern, split[4]): - mask = self.regExpMatch(ipPattern, self.regExpMatch(ipLinePattern, split[4])) - if mask is not None: - data['netmask'] = self.convertIP(mask) + self.ifaces[iface] = data self.loadNetworkConfig(iface,callback) @@ -203,7 +199,7 @@ class Network: ifaces[currif]["gateway"] = map(int, split[1].split('.')) if self.ifaces[currif].has_key("gateway"): if self.ifaces[currif]["gateway"] != ifaces[currif]["gateway"] and ifaces[currif]["dhcp"] == False: - self.ifaces[currif]["gateway"] = map(int, split[1].split('.')) + self.ifaces[currif]["gateway"] = map(int, split[1].split('.')) if (split[0] == "pre-up"): if self.ifaces[currif].has_key("preup"): self.ifaces[currif]["preup"] = i @@ -215,7 +211,9 @@ class Network: if self.ifaces.has_key(ifacename): self.ifaces[ifacename]["dhcp"] = iface["dhcp"] if len(self.Console.appContainers) == 0: - # load ns only once + # save configured interfacelist + self.configuredNetworkAdapters = self.configuredInterfaces + # load ns only once self.loadNameserverConfig() print "read configured interfac:", ifaces print "self.ifaces after loading:", self.ifaces @@ -244,16 +242,39 @@ class Network: print "nameservers:", self.nameservers - def deactivateNetworkConfig(self): + def deactivateNetworkConfig(self, callback = None): + self.deactivateConsole = Console() + self.commands = [] + self.commands.append("/etc/init.d/avahi-daemon stop") for iface in self.ifaces.keys(): - system("ip addr flush " + iface) - system("/etc/init.d/networking stop") - system("killall -9 udhcpc") - system("rm /var/run/udhcpc*") + cmd = "ip addr flush " + iface + self.commands.append(cmd) + self.commands.append("/etc/init.d/networking stop") + self.commands.append("killall -9 udhcpc") + self.commands.append("rm /var/run/udhcpc*") + self.deactivateConsole.eBatch(self.commands, self.deactivateNetworkFinished, callback, debug=True) + + def deactivateNetworkFinished(self,extra_args): + callback = extra_args + if len(self.deactivateConsole.appContainers) == 0: + if callback is not None: + callback(True) - def activateNetworkConfig(self): - system("/etc/init.d/networking start") - self.getInterfaces() + def activateNetworkConfig(self, callback = None): + self.activateConsole = Console() + self.commands = [] + self.commands.append("/etc/init.d/networking start") + self.commands.append("/etc/init.d/avahi-daemon start") + self.activateConsole.eBatch(self.commands, self.activateNetworkFinished, callback, debug=True) + + def activateNetworkFinished(self,extra_args): + callback = extra_args + if len(self.activateConsole.appContainers) == 0: + if callback is not None: + callback(True) + + def getConfiguredAdapters(self): + return self.configuredNetworkAdapters def getNumberOfAdapters(self): return len(self.ifaces) @@ -312,7 +333,24 @@ class Network: if self.nameservers[i] == oldnameserver: self.nameservers[i] = newnameserver - def writeDefaultNetworkConfig(self,mode='lan'): + def resetNetworkConfig(self, mode='lan', callback = None): + self.resetNetworkConsole = Console() + self.commands = [] + self.commands.append("/etc/init.d/avahi-daemon stop") + for iface in self.ifaces.keys(): + cmd = "ip addr flush " + iface + self.commands.append(cmd) + self.commands.append("/etc/init.d/networking stop") + self.commands.append("killall -9 udhcpc") + self.commands.append("rm /var/run/udhcpc*") + self.resetNetworkConsole.eBatch(self.commands, self.resetNetworkFinishedCB, [mode, callback], debug=True) + + def resetNetworkFinishedCB(self, extra_args): + (mode, callback) = extra_args + if len(self.resetNetworkConsole.appContainers) == 0: + self.writeDefaultNetworkConfig(mode, callback) + + def writeDefaultNetworkConfig(self,mode='lan', callback = None): fp = file('/etc/network/interfaces', 'w') fp.write("# automatically generated by enigma 2\n# do NOT change manually!\n\n") fp.write("auto lo\n") @@ -329,50 +367,95 @@ class Network: fp.write("\n") fp.close() - def resetNetworkConfig(self,mode='lan'): - self.deactivateNetworkConfig() - self.writeDefaultNetworkConfig(mode) + self.resetNetworkConsole = Console() + self.commands = [] if mode == 'wlan': - system("ifconfig eth0 down") - system("ifconfig ath0 down") - system("ifconfig wlan0 up") + self.commands.append("ifconfig eth0 down") + self.commands.append("ifconfig ath0 down") + self.commands.append("ifconfig wlan0 up") if mode == 'wlan-mpci': - system("ifconfig eth0 down") - system("ifconfig wlan0 down") - system("ifconfig ath0 up") + self.commands.append("ifconfig eth0 down") + self.commands.append("ifconfig wlan0 down") + self.commands.append("ifconfig ath0 up") if mode == 'lan': - system("ifconfig eth0 up") - system("ifconfig wlan0 down") - system("ifconfig ath0 down") - self.getInterfaces() - - def checkNetworkState(self): - # www.dream-multimedia-tv.de, www.heise.de, www.google.de - return system("ping -c 1 82.149.226.170") == 0 or \ - system("ping -c 1 193.99.144.85") == 0 or \ - system("ping -c 1 209.85.135.103") == 0 - - def restartNetwork(self): - iNetwork.deactivateNetworkConfig() - iNetwork.activateNetworkConfig() + self.commands.append("ifconfig eth0 up") + self.commands.append("ifconfig wlan0 down") + self.commands.append("ifconfig ath0 down") + self.commands.append("/etc/init.d/avahi-daemon start") + self.resetNetworkConsole.eBatch(self.commands, self.resetNetworkFinished, [mode,callback], debug=True) + + def resetNetworkFinished(self,extra_args): + (mode, callback) = extra_args + if len(self.resetNetworkConsole.appContainers) == 0: + if callback is not None: + callback(True,mode) + + def checkNetworkState(self,statecallback): + # www.dream-multimedia-tv.de, www.heise.de, www.google.de + cmd1 = "ping -c 1 82.149.226.170" + cmd2 = "ping -c 1 193.99.144.85" + cmd3 = "ping -c 1 209.85.135.103" + self.PingConsole = Console() + self.PingConsole.ePopen(cmd1, self.checkNetworkStateFinished,statecallback) + self.PingConsole.ePopen(cmd2, self.checkNetworkStateFinished,statecallback) + self.PingConsole.ePopen(cmd3, self.checkNetworkStateFinished,statecallback) + + def checkNetworkStateFinished(self, result, retval,extra_args): + (statecallback) = extra_args + if self.PingConsole is not None: + if retval == 0: + self.PingConsole = None + statecallback(self.NetworkState) + else: + self.NetworkState += 1 + if len(self.PingConsole.appContainers) == 0: + statecallback(self.NetworkState) + + def restartNetwork(self,callback): + self.restartConsole = Console() + self.commands = [] + self.commands.append("/etc/init.d/avahi-daemon stop") + for iface in self.ifaces.keys(): + cmd = "ip addr flush " + iface + self.commands.append(cmd) + self.commands.append("/etc/init.d/networking stop") + self.commands.append("killall -9 udhcpc") + self.commands.append("rm /var/run/udhcpc*") + self.commands.append("/etc/init.d/networking start") + self.commands.append("/etc/init.d/avahi-daemon start") + self.restartConsole.eBatch(self.commands, self.restartNetworkFinished, callback, debug=True) + + def restartNetworkFinished(self,extra_args): + callback = extra_args + if len(self.restartConsole.appContainers) == 0: + callback(True) def getLinkState(self,iface,callback): - self.dataAvail = callback cmd = self.ethtool_bin + " " + iface - self.container.appClosed.append(self.cmdFinished) - self.container.dataAvail.append(callback) - self.container.execute(cmd) - - def cmdFinished(self,retval): - self.container.appClosed.remove(self.cmdFinished) - self.container.dataAvail.remove(self.dataAvail) - - def stopContainer(self): - self.container.kill() - - def ContainerRunning(self): - return self.container.running() - + self.LinkConsole = Console() + self.LinkConsole.ePopen(cmd, self.getLinkStateFinished,callback) + + def getLinkStateFinished(self, result, retval,extra_args): + (callback) = extra_args + if self.LinkConsole is not None: + if len(self.LinkConsole.appContainers) == 0: + callback(result) + + def stopLinkStateConsole(self): + if self.LinkConsole is not None: + self.LinkConsole = None + + def stopRestartConsole(self): + if self.restartConsole is not None: + self.restartConsole = None + + def RestartConsoleRunning(self): + if self.restartConsole is not None: + if len(self.restartConsole.appContainers) == 0: + return False + else: + return True + def checkforInterface(self,iface): if self.getAdapterAttribute(iface, 'up') is True: return True @@ -384,13 +467,37 @@ class Network: else: return False - def checkDNSLookup(self): - return system("nslookup www.dream-multimedia-tv.de") == 0 or \ - system("nslookup www.heise.de") == 0 or \ - system("nslookup www.google.de") + def checkDNSLookup(self,statecallback): + cmd1 = "nslookup www.dream-multimedia-tv.de" + cmd2 = "nslookup www.heise.de" + cmd3 = "nslookup www.google.de" + self.DnsConsole = Console() + self.DnsConsole.ePopen(cmd1, self.checkDNSLookupFinished,statecallback) + self.DnsConsole.ePopen(cmd2, self.checkDNSLookupFinished,statecallback) + self.DnsConsole.ePopen(cmd3, self.checkDNSLookupFinished,statecallback) + + def checkDNSLookupFinished(self, result, retval,extra_args): + (statecallback) = extra_args + if self.DnsConsole is not None: + if retval == 0: + self.DnsConsole = None + statecallback(self.DnsState) + else: + self.DnsState += 1 + if len(self.DnsConsole.appContainers) == 0: + statecallback(self.DnsState) def deactivateInterface(self,iface): - system("ifconfig " + iface + " down") + self.deactivateInterfaceConsole = Console() + self.commands = [] + cmd1 = "ip addr flush " + iface + cmd2 = "ifconfig " + iface + " down" + self.commands.append(cmd1) + self.commands.append(cmd2) + self.deactivateInterfaceConsole.eBatch(self.commands, self.deactivateInterfaceFinished, extra_args = None, debug=True) + + def deactivateInterfaceFinished(self,extra_args): + pass def detectWlanModule(self): self.wlanmodule = None @@ -411,6 +518,20 @@ class Network: self.wlanmodule = 'zydas' return self.wlanmodule + def calc_netmask(self,nmask): + from struct import pack, unpack + from socket import inet_ntoa, inet_aton + mask = 1L<<31 + xnet = (1L<<32)-1 + cidr_range = range(0, 32) + cidr = long(nmask) + if cidr not in cidr_range: + print 'cidr invalid: %d' % cidr + return None + else: + nm = ((1L<L', nm))) + return netmask iNetwork = Network() diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am old mode 100644 new mode 100755 index 186c6f32..a3cf70bb --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -13,5 +13,5 @@ install_PYTHON = \ TimerSelection.py PictureInPicture.py TimeDateInput.py \ SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py \ SleepTimerEdit.py Ipkg.py RdsDisplay.py Globals.py DefaultWizard.py \ - SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py + SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py VirtualKeyBoard.py diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py old mode 100644 new mode 100755 index 862bce46..c26302fa --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -1,25 +1,25 @@ from Screen import Screen -from Components.ActionMap import ActionMap,NumberActionMap from Screens.MessageBox import MessageBox from Screens.InputBox import InputBox from Screens.Standby import * +from Screens.VirtualKeyBoard import VirtualKeyBoard +from Screens.HelpMenu import HelpableScreen from Components.Network import iNetwork from Components.Label import Label,MultiColorLabel from Components.Pixmap import Pixmap,MultiPixmap from Components.MenuList import MenuList -from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigText, ConfigSelection, getConfigListEntry, ConfigNothing +from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigText, ConfigPassword, ConfigSelection, getConfigListEntry, ConfigNothing from Components.ConfigList import ConfigListScreen from Components.PluginComponent import plugins from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest +from Components.ActionMap import ActionMap, NumberActionMap, HelpableActionMap +from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE +from Tools.LoadPixmap import LoadPixmap from Plugins.Plugin import PluginDescriptor -from enigma import eTimer +from enigma import eTimer, ePoint, eSize, RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont from os import path as os_path, system as os_system, unlink from re import compile as re_compile, search as re_search -from Tools.Directories import resolveFilename, SCOPE_PLUGINS -from Tools.Directories import SCOPE_SKIN_IMAGE,SCOPE_PLUGINS, resolveFilename -from Tools.LoadPixmap import LoadPixmap -from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont class InterfaceList(MenuList): def __init__(self, list, enableWrapAround=False): @@ -30,11 +30,13 @@ class InterfaceList(MenuList): def InterfaceEntryComponent(index,name,default,active ): res = [ (index) ] res.append(MultiContentEntryText(pos=(80, 5), size=(430, 25), font=0, text=name)) - if default is True: - png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue.png")) - if default is False: - png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue_off.png")) - res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png)) + num_configured_if = len(iNetwork.getConfiguredAdapters()) + if num_configured_if >= 2: + if default is True: + png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue.png")) + if default is False: + png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue_off.png")) + res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png)) if active is True: png2 = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_on.png")) if active is False: @@ -43,41 +45,64 @@ def InterfaceEntryComponent(index,name,default,active ): return res -class NetworkAdapterSelection(Screen): +class NetworkAdapterSelection(Screen,HelpableScreen): def __init__(self, session): Screen.__init__(self, session) - + HelpableScreen.__init__(self) + self.wlan_errortext = _("No working wireless networkadapter found.\nPlease verify that you have attached a compatible WLAN USB Stick and your Network is configured correctly.") self.lan_errortext = _("No working local networkadapter found.\nPlease verify that you have attached a network cable and your Network is configured correctly.") + self.oktext = _("Press OK on your remote control to continue.") + self.restartLanRef = None self["ButtonBluetext"] = Label(_("Set as default Interface")) + self["ButtonBlue"] = Pixmap() self["ButtonRedtext"] = Label(_("Close")) self["introduction"] = Label(_("Press OK to edit the settings.")) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] - + if len(self.adapters) == 0: self.onFirstExecBegin.append(self.NetworkFallback) - + + self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", + { + "cancel": (self.close, _("exit networkinterface list")), + "ok": (self.okbuttonClick, _("select interface")), + }) + + self["ColorActions"] = HelpableActionMap(self, "ColorActions", + { + "red": (self.close, _("exit networkinterface list")), + }) + + self["DefaultInterfaceAction"] = HelpableActionMap(self, "ColorActions", + { + "blue": (self.setDefaultInterface, [_("Set interface as default Interface"),_("* Only available if more then one interface is active.")] ), + }) + self.list = [] self["list"] = InterfaceList(self.list) self.updateList() - self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], - { - "ok": self.okbuttonClick, - "cancel": self.close, - "blue": self.setDefaultInterface, - "red": self.close - }, -2) - + if len(self.adapters) == 1: self.onFirstExecBegin.append(self.okbuttonClick) - + self.onClose.append(self.cleanup) + def updateList(self): iNetwork.getInterfaces() self.list = [] default_gw = None - num_configured_if = len(iNetwork.configuredInterfaces) + num_configured_if = len(iNetwork.getConfiguredAdapters()) + if num_configured_if >= 2: + self["ButtonBlue"].show() + self["ButtonBluetext"].show() + self["DefaultInterfaceAction"].setEnabled(True) + else: + self["ButtonBlue"].hide() + self["ButtonBluetext"].hide() + self["DefaultInterfaceAction"].setEnabled(False) + if num_configured_if < 2 and os_path.exists("/etc/default_gw"): unlink("/etc/default_gw") @@ -86,7 +111,7 @@ class NetworkAdapterSelection(Screen): result = fp.read() fp.close() default_gw = result - + if len(self.adapters) == 0: # no interface available => display only eth0 self.list.append(InterfaceEntryComponent("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True )) else: @@ -106,24 +131,22 @@ class NetworkAdapterSelection(Screen): selection = self["list"].getCurrent() num_if = len(self.list) old_default_gw = None + num_configured_if = len(iNetwork.getConfiguredAdapters()) if os_path.exists("/etc/default_gw"): fp = open('/etc/default_gw', 'r') old_default_gw = fp.read() fp.close() - if num_if > 1 and (not old_default_gw or old_default_gw != selection[0]): + if num_configured_if > 1 and (not old_default_gw or old_default_gw != selection[0]): fp = open('/etc/default_gw', 'w+') fp.write(selection[0]) fp.close() - iNetwork.restartNetwork() - self.updateList() - elif old_default_gw and num_if < 2: + self.restartLan() + elif old_default_gw and num_configured_if < 2: unlink("/etc/default_gw") - iNetwork.restartNetwork() - self.updateList() + self.restartLan() def okbuttonClick(self): selection = self["list"].getCurrent() - print "selection",selection if selection is not None: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, selection[0]) @@ -134,25 +157,47 @@ class NetworkAdapterSelection(Screen): self.updateList() def NetworkFallback(self): - if iNetwork.configuredInterfaces.has_key('wlan0') is True: + if iNetwork.configuredNetworkAdapters.has_key('wlan0') is True: self.session.openWithCallback(self.ErrorMessageClosed, MessageBox, self.wlan_errortext, type = MessageBox.TYPE_INFO,timeout = 10) - if iNetwork.configuredInterfaces.has_key('ath0') is True: + if iNetwork.configuredNetworkAdapters.has_key('ath0') is True: self.session.openWithCallback(self.ErrorMessageClosed, MessageBox, self.wlan_errortext, type = MessageBox.TYPE_INFO,timeout = 10) else: self.session.openWithCallback(self.ErrorMessageClosed, MessageBox, self.lan_errortext, type = MessageBox.TYPE_INFO,timeout = 10) def ErrorMessageClosed(self, *ret): - if iNetwork.configuredInterfaces.has_key('wlan0') is True: + if iNetwork.configuredNetworkAdapters.has_key('wlan0') is True: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, 'wlan0') - elif iNetwork.configuredInterfaces.has_key('ath0') is True: + elif iNetwork.configuredNetworkAdapters.has_key('ath0') is True: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, 'ath0') else: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetupConfiguration, 'eth0') -class NameserverSetup(Screen, ConfigListScreen): + def cleanup(self): + iNetwork.stopLinkStateConsole() + iNetwork.stopRestartConsole() + + def restartLan(self): + iNetwork.restartNetwork(self.restartLanDataAvail) + self.restartLanRef = self.session.openWithCallback(self.restartfinishedCB, MessageBox, _("Please wait while we configure your network..."), type = MessageBox.TYPE_INFO, enable_input = False) + + def restartLanDataAvail(self, data): + if data is True: + iNetwork.getInterfaces(self.getInterfacesDataAvail) + + def getInterfacesDataAvail(self, data): + if data is True: + self.restartLanRef.close(True) + + def restartfinishedCB(self,data): + if data is True: + self.updateList() + self.session.open(MessageBox, _("Finished configuring your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False) + + +class NameserverSetup(Screen, ConfigListScreen, HelpableScreen): def __init__(self, session): Screen.__init__(self, session) - iNetwork.getInterfaces() + HelpableScreen.__init__(self) self.backupNameserverList = iNetwork.getNameserverList()[:] print "backup-list:", self.backupNameserverList @@ -162,14 +207,19 @@ class NameserverSetup(Screen, ConfigListScreen): self["introduction"] = Label(_("Press OK to activate the settings.")) self.createConfig() - self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], - { - "ok": self.ok, - "cancel": self.cancel, - "red": self.cancel, - "green": self.add, - "yellow": self.remove - }, -2) + self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", + { + "cancel": (self.cancel, _("exit nameserver configuration")), + "ok": (self.ok, _("activate current configuration")), + }) + + self["ColorActions"] = HelpableActionMap(self, "ColorActions", + { + "red": (self.cancel, _("exit nameserver configuration")), + "green": (self.add, _("add a nameserver entry")), + "yellow": (self.remove, _("remove a nameserver entry")), + }) + self.list = [] ConfigListScreen.__init__(self, self.list) @@ -222,31 +272,51 @@ class NameserverSetup(Screen, ConfigListScreen): self.createConfig() self.createSetup() -class AdapterSetup(Screen, ConfigListScreen): +class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): def __init__(self, session, iface,essid=None, aplist=None): Screen.__init__(self, session) + HelpableScreen.__init__(self) self.session = session self.iface = iface self.essid = essid self.aplist = aplist self.extended = None + self.applyConfigRef = None + self.finished_cb = None + self.oktext = _("Press OK on your remote control to continue.") self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") - iNetwork.getInterfaces() - - self.createConfig() + #iNetwork.getInterfaces() - self["actions"] = NumberActionMap(["SetupActions", "ColorActions"], + self.createConfig() + + self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", + { + "cancel": (self.close, _("exit networkadapter setup menu")), + "ok": (self.ok, _("select menu entry")), + }) + + self["ColorActions"] = HelpableActionMap(self, "ColorActions", + { + "red": (self.cancel, _("exit networkadapter configuration")), + "blue": (self.KeyBlue, _("open nameserver configuration")), + }) + + self["VirtualKB"] = HelpableActionMap(self, "ColorActions", + { + "green": (self.KeyGreen, [_("open virtual keyboard input help"),_("* Only available when entering hidden ssid or network key")] ), + }) + + self["actions"] = NumberActionMap(["SetupActions"], { "ok": self.ok, - "cancel": self.cancel, - "red": self.cancel, - "blue": self.KeyBlue, }, -2) + self.list = [] ConfigListScreen.__init__(self, self.list,session = self.session) self.createSetup() self.onLayoutFinish.append(self.layoutFinished) + self.onClose.append(self.cleanup) self["DNS1text"] = Label(_("Primary DNS")) self["DNS2text"] = Label(_("Secondary DNS")) @@ -271,56 +341,81 @@ class AdapterSetup(Screen, ConfigListScreen): self["ButtonRedtext"] = Label(_("Close")) self["ButtonBlue"] = Pixmap() self["ButtonBluetext"] = Label(_("Edit DNS")) + self["ButtonGreen"] = Pixmap() + self["VKeyIcon"] = Pixmap() + self["HelpWindow"] = Pixmap() def layoutFinished(self): self["DNS1"].setText(self.primaryDNS.getText()) self["DNS2"].setText(self.secondaryDNS.getText()) if self.ipConfigEntry.getText() is not None: - self["IP"].setText(self.ipConfigEntry.getText()) + if self.ipConfigEntry.getText() == "0.0.0.0": + self["IP"].setText(_("N/A")) + else: + self["IP"].setText(self.ipConfigEntry.getText()) else: - self["IP"].setText([0,0,0,0]) - self["Mask"].setText(self.netmaskConfigEntry.getText()) + self["IP"].setText(_("N/A")) + if self.netmaskConfigEntry.getText() is not None: + if self.netmaskConfigEntry.getText() == "0.0.0.0": + self["Mask"].setText(_("N/A")) + else: + self["Mask"].setText(self.netmaskConfigEntry.getText()) + else: + self["IP"].setText(_("N/A")) if iNetwork.getAdapterAttribute(self.iface, "gateway"): - self["Gateway"].setText(self.gatewayConfigEntry.getText()) + if self.gatewayConfigEntry.getText() == "0.0.0.0": + self["Gateway"].setText(_("N/A")) + else: + self["Gateway"].setText(self.gatewayConfigEntry.getText()) else: self["Gateway"].hide() self["Gatewaytext"].hide() self["Adapter"].setText(iNetwork.getFriendlyAdapterName(self.iface)) + self["ButtonGreen"].hide() + self["VKeyIcon"].hide() + self["VirtualKB"].setEnabled(False) + self["HelpWindow"].hide() def createConfig(self): self.InterfaceEntry = None self.dhcpEntry = None self.gatewayEntry = None - self.SSIDscan = None + self.hiddenSSID = None self.wlanSSID = None - self.manualwlanSSID = None self.encryptionEnabled = None self.encryptionKey = None + self.encryptionType = None self.nwlist = None + self.encryptionlist = None + self.weplist = None self.wsconfig = None self.default = None if self.iface == "wlan0" or self.iface == "ath0" : from Plugins.SystemPlugins.WirelessLan.Wlan import wpaSupplicant,Wlan + self.w = Wlan(self.iface) self.ws = wpaSupplicant() - list = [] - list.append(_("WEP")) - list.append(_("WPA")) - list.append(_("WPA2")) + self.encryptionlist = [] + self.encryptionlist.append(("WEP", _("WEP"))) + self.encryptionlist.append(("WPA", _("WPA"))) + self.encryptionlist.append(("WPA2", _("WPA2"))) + self.encryptionlist.append(("WPA/WPA2", _("WPA or WPA2"))) + self.weplist = [] + self.weplist.append("ASCII") + self.weplist.append("HEX") if self.aplist is not None: self.nwlist = self.aplist self.nwlist.sort(key = lambda x: x[0]) else: self.nwlist = [] - self.w = None self.aps = None try: - self.w = Wlan(self.iface) self.aps = self.w.getNetworkList() if self.aps is not None: print "[NetworkSetup.py] got Accespoints!" - for ap in aps: - a = aps[ap] + print self.aps + for ap in self.aps: + a = self.aps[ap] if a['active']: if a['essid'] == "": a['essid'] = a['bssid'] @@ -330,17 +425,23 @@ class AdapterSetup(Screen, ConfigListScreen): self.nwlist.append("No Networks found") self.wsconfig = self.ws.loadConfig() - self.default = self.essid or self.wsconfig['ssid'] + if self.essid is not None: # ssid from wlan scan + self.default = self.essid + else: + self.default = self.wsconfig['ssid'] + + if "hidden..." not in self.nwlist: + self.nwlist.append("hidden...") if self.default not in self.nwlist: self.nwlist.append(self.default) - config.plugins.wlan.essidscan = NoSave(ConfigYesNo(default = self.wsconfig['ssidscan'])) - if self.wsconfig['ssidscan'] is True: - config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default )) - else: - config.plugins.wlan.essid = NoSave(ConfigText(default = self.default, visible_width = 50, fixed_size = False)) + + config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default )) + config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = self.wsconfig['hiddenessid'], visible_width = 50, fixed_size = False)) + config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = self.wsconfig['encryption'] )) - config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = self.wsconfig['encryption_type'] )) - config.plugins.wlan.encryption.psk = NoSave(ConfigText(default = self.wsconfig['key'], visible_width = 50, fixed_size = False)) + config.plugins.wlan.encryption.type = NoSave(ConfigSelection(self.encryptionlist, default = self.wsconfig['encryption_type'] )) + config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(self.weplist, default = self.wsconfig['encryption_wepkeytype'] )) + config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = self.wsconfig['key'], visible_width = 50, fixed_size = False)) self.activateInterfaceEntry = NoSave(ConfigYesNo(default=iNetwork.getAdapterAttribute(self.iface, "up") or False)) self.dhcpConfigEntry = NoSave(ConfigYesNo(default=iNetwork.getAdapterAttribute(self.iface, "dhcp") or False)) @@ -382,26 +483,56 @@ class AdapterSetup(Screen, ConfigListScreen): self.configStrings = p.__call__["configStrings"] else: self.configStrings = None - self.SSIDscan = getConfigListEntry(_("Automatic SSID lookup"), config.plugins.wlan.essidscan) - self.list.append(self.SSIDscan) - self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid) - self.list.append(self.wlanSSID) + if config.plugins.wlan.essid.value == 'hidden...': + self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid) + self.list.append(self.wlanSSID) + self.hiddenSSID = getConfigListEntry(_("Hidden network SSID"), config.plugins.wlan.hiddenessid) + self.list.append(self.hiddenSSID) + else: + self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid) + self.list.append(self.wlanSSID) self.encryptionEnabled = getConfigListEntry(_("Encryption"), config.plugins.wlan.encryption.enabled) self.list.append(self.encryptionEnabled) if config.plugins.wlan.encryption.enabled.value: - self.list.append(getConfigListEntry(_("Encryption Type"), config.plugins.wlan.encryption.type)) - self.encryptionKey = getConfigListEntry(_("Encryption Key"), config.plugins.wlan.encryption.psk) - self.list.append(self.encryptionKey) + self.encryptionType = getConfigListEntry(_("Encryption Type"), config.plugins.wlan.encryption.type) + self.list.append(self.encryptionType) + if config.plugins.wlan.encryption.type.value == 'WEP': + self.list.append(getConfigListEntry(_("Encryption Keytype"), config.plugins.wlan.encryption.wepkeytype)) + self.encryptionKey = getConfigListEntry(_("Encryption Key"), config.plugins.wlan.encryption.psk) + self.list.append(self.encryptionKey) + else: + self.encryptionKey = getConfigListEntry(_("Encryption Key"), config.plugins.wlan.encryption.psk) + self.list.append(self.encryptionKey) + self["config"].list = self.list self["config"].l.setList(self.list) + if not self.selectionChanged in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.selectionChanged) def KeyBlue(self): self.session.openWithCallback(self.NameserverSetupClosed, NameserverSetup) + def KeyGreen(self): + if self.iface == "wlan0" or self.iface == "ath0" : + if self["config"].getCurrent() == self.hiddenSSID: + if config.plugins.wlan.essid.value == 'hidden...': + self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN networkname/SSID:")), text = config.plugins.wlan.essid.value) + if self["config"].getCurrent() == self.encryptionKey: + self.session.openWithCallback(self.VirtualKeyBoardKeyCallback, VirtualKeyBoard, title = (_("Enter WLAN passphrase/key:")), text = config.plugins.wlan.encryption.psk.value) + + def VirtualKeyBoardSSIDCallback(self, callback = None): + if callback is not None and len(callback): + config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = callback, visible_width = 50, fixed_size = False)) + self.createSetup() + + def VirtualKeyBoardKeyCallback(self, callback = None): + if callback is not None and len(callback): + config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = callback, visible_width = 50, fixed_size = False)) + self.createSetup() + def newConfig(self): - print self["config"].getCurrent() if self["config"].getCurrent() == self.InterfaceEntry: self.createSetup() if self["config"].getCurrent() == self.dhcpEntry: @@ -409,15 +540,12 @@ class AdapterSetup(Screen, ConfigListScreen): if self["config"].getCurrent() == self.gatewayEntry: self.createSetup() if self.iface == "wlan0" or self.iface == "ath0" : - if self["config"].getCurrent() == self.SSIDscan: - if config.plugins.wlan.essidscan.value is True: - config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default )) - else: - config.plugins.wlan.essid = NoSave(ConfigText(default = self.default, visible_width = 50, fixed_size = False)) + if self["config"].getCurrent() == self.wlanSSID: self.createSetup() if self["config"].getCurrent() == self.encryptionEnabled: self.createSetup() - + if self["config"].getCurrent() == self.encryptionType: + self.createSetup() def keyLeft(self): ConfigListScreen.keyLeft(self) self.newConfig() @@ -426,24 +554,92 @@ class AdapterSetup(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) self.newConfig() + def selectionChanged(self): + current = self["config"].getCurrent() + if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...': + helpwindowpos = self["HelpWindow"].getPosition() + if current[1].help_window.instance is not None: + current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) + self["ButtonGreen"].show() + self["VKeyIcon"].show() + self["VirtualKB"].setEnabled(True) + elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value: + helpwindowpos = self["HelpWindow"].getPosition() + if current[1].help_window.instance is not None: + current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) + self["ButtonGreen"].show() + self["VKeyIcon"].show() + self["VirtualKB"].setEnabled(True) + else: + self["ButtonGreen"].hide() + self["VKeyIcon"].hide() + self["VirtualKB"].setEnabled(False) + def ok(self): - iNetwork.setAdapterAttribute(self.iface, "up", self.activateInterfaceEntry.value) - iNetwork.setAdapterAttribute(self.iface, "dhcp", self.dhcpConfigEntry.value) - iNetwork.setAdapterAttribute(self.iface, "ip", self.ipConfigEntry.value) - iNetwork.setAdapterAttribute(self.iface, "netmask", self.netmaskConfigEntry.value) - if self.hasGatewayConfigEntry.value: - iNetwork.setAdapterAttribute(self.iface, "gateway", self.gatewayConfigEntry.value) + current = self["config"].getCurrent() + if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...': + if current[1].help_window.instance is not None: + current[1].help_window.instance.hide() + elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value: + if current[1].help_window.instance is not None: + current[1].help_window.instance.hide() + self.session.openWithCallback(self.applyConfig, MessageBox, (_("Are you sure you want to activate this network configuration?\n\n") + self.oktext ) ) + + def applyConfig(self, ret = False): + if (ret == True): + iNetwork.setAdapterAttribute(self.iface, "up", self.activateInterfaceEntry.value) + iNetwork.setAdapterAttribute(self.iface, "dhcp", self.dhcpConfigEntry.value) + iNetwork.setAdapterAttribute(self.iface, "ip", self.ipConfigEntry.value) + iNetwork.setAdapterAttribute(self.iface, "netmask", self.netmaskConfigEntry.value) + if self.hasGatewayConfigEntry.value: + iNetwork.setAdapterAttribute(self.iface, "gateway", self.gatewayConfigEntry.value) + else: + iNetwork.removeAdapterAttribute(self.iface, "gateway") + if self.extended is not None and self.configStrings is not None: + iNetwork.setAdapterAttribute(self.iface, "configStrings", self.configStrings(self.iface)) + self.ws.writeConfig() + if self.activateInterfaceEntry.value is False: + iNetwork.deactivateInterface(self.iface) + iNetwork.writeNetworkConfig() + iNetwork.restartNetwork(self.applyConfigDataAvail) + self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait while activating your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False) else: - iNetwork.removeAdapterAttribute(self.iface, "gateway") - if self.extended is not None and self.configStrings is not None: - iNetwork.setAdapterAttribute(self.iface, "configStrings", self.configStrings(self.iface)) - self.ws.writeConfig() - if self.activateInterfaceEntry.value is False: - iNetwork.deactivateInterface(self.iface) - iNetwork.writeNetworkConfig() - iNetwork.deactivateNetworkConfig() - iNetwork.activateNetworkConfig() - self.close() + self.cancel() + + def applyConfigDataAvail(self, data): + if data is True: + iNetwork.getInterfaces(self.getInterfacesDataAvail) + + def getInterfacesDataAvail(self, data): + if data is True: + self.applyConfigRef.close(True) + + def applyConfigfinishedCB(self,data): + if data is True: + num_configured_if = len(iNetwork.getConfiguredAdapters()) + if num_configured_if >= 2: + self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("Your network configuration has been activated.\nA second configured interface has been found.\n\nDo you want to disable the second networkinterface?"), default = True) + else: + if self.finished_cb: + self.session.openWithCallback(self.finished_cb, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10) + else: + self.session.openWithCallback(self.ConfigfinishedCB, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10) + + def secondIfaceFoundCB(self,data): + if data is False: + self.close('ok') + else: + configuredInterfaces = configuredNetworkAdapters + for interface in configuredInterfaces: + if interface == self.iface: + continue + iNetwork.setAdapterAttribute(interface, "up", False) + iNetwork.deactivateInterface(interface) + self.applyConfig(True) + + def ConfigfinishedCB(self,data): + if data is True: + self.close('ok') def cancel(self): iNetwork.setAdapterAttribute(self.iface, "up", self.oldInterfaceState) @@ -451,11 +647,12 @@ class AdapterSetup(Screen, ConfigListScreen): if self.activateInterfaceEntry.value is False: iNetwork.deactivateInterface(self.iface) iNetwork.getInterfaces() - self.close() + self.close('cancel') - def run(self): + def runAsync(self, finished_cb): + self.finished_cb = finished_cb self.ok() - + def NameserverSetupClosed(self, *ret): iNetwork.loadNameserverConfig() nameserver = (iNetwork.getNameserverList() + [[0,0,0,0]] * 2)[0:2] @@ -463,13 +660,18 @@ class AdapterSetup(Screen, ConfigListScreen): self.secondaryDNS = NoSave(ConfigIP(default=nameserver[1])) self.createSetup() self.layoutFinished() - + + def cleanup(self): + iNetwork.stopLinkStateConsole() + iNetwork.stopRestartConsole() -class AdapterSetupConfiguration(Screen): +class AdapterSetupConfiguration(Screen, HelpableScreen): def __init__(self, session,iface): Screen.__init__(self, session) + HelpableScreen.__init__(self) self.session = session self.iface = iface + self.restartLanRef = None self.mainmenu = self.genMainMenu() self["menulist"] = MenuList(self.mainmenu) self["description"] = Label() @@ -485,8 +687,27 @@ class AdapterSetupConfiguration(Screen): self.oktext = _("Press OK on your remote control to continue.") self.reboottext = _("Your Dreambox will restart after pressing OK on your remote control.") - self.errortext = _("No working wireless interface found.\n Please verify that you have attached a compatible WLAN device or enable your local network interface.") + self.errortext = _("No working wireless interface found.\n Please verify that you have attached a compatible WLAN device or enable you local network interface.") + + self["WizardActions"] = HelpableActionMap(self, "WizardActions", + { + "up": (self.up, _("move up to previous entry")), + "down": (self.down, _("move down to next entry")), + "left": (self.left, _("move up to first entry")), + "right": (self.right, _("move down to last entry")), + }) + self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", + { + "cancel": (self.close, _("exit networkadapter setup menu")), + "ok": (self.ok, _("select menu entry")), + }) + + self["ColorActions"] = HelpableActionMap(self, "ColorActions", + { + "red": (self.close, _("exit networkadapter setup menu")), + }) + self["actions"] = NumberActionMap(["WizardActions","ShortcutActions"], { "ok": self.ok, @@ -498,9 +719,10 @@ class AdapterSetupConfiguration(Screen): "right": self.right, }, -2) - iNetwork.getInterfaces() + iNetwork.getInterfaces(self.updateStatusbar) self.onLayoutFinish.append(self.layoutFinished) - self.updateStatusbar() + self.onClose.append(self.cleanup) + self.onHide.append(self.cleanup) def ok(self): if self["menulist"].getCurrent()[1] == 'edit': @@ -549,7 +771,6 @@ class AdapterSetupConfiguration(Screen): self.wlanresponse = ifobj.getStatistics() if self.wlanresponse[0] != 19: self.session.openWithCallback(self.AdapterSetupClosed, WlanStatus,self.iface) - #self.session.open(WlanStatus,self.iface) else: # Display Wlan not available Message self.showErrorMessage() @@ -584,6 +805,7 @@ class AdapterSetupConfiguration(Screen): self.loadDescription() def loadDescription(self): + print self["menulist"].getCurrent()[1] if self["menulist"].getCurrent()[1] == 'edit': self["description"].setText(_("Edit the network configuration of your Dreambox.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'test': @@ -601,7 +823,7 @@ class AdapterSetupConfiguration(Screen): if self["menulist"].getCurrent()[1][0] == 'extendedSetup': self["description"].setText(_(self["menulist"].getCurrent()[1][1]) + self.oktext ) - def updateStatusbar(self): + def updateStatusbar(self, data = None): self["IFtext"].setText(_("Network:")) self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) self["Statustext"].setText(_("Link:")) @@ -661,21 +883,52 @@ class AdapterSetupConfiguration(Screen): return menu def AdapterSetupClosed(self, *ret): - self.mainmenu = self.genMainMenu() - self["menulist"].l.setList(self.mainmenu) - iNetwork.getInterfaces() - self.updateStatusbar() + if ret is not None and len(ret): + if ret[0] == 'ok' and (self.iface == 'wlan0' or self.iface == 'ath0') and iNetwork.getAdapterAttribute(self.iface, "up") is True: + try: + from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus + from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + except ImportError: + self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) + else: + ifobj = Wireless(self.iface) # a Wireless NIC Object + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse[0] != 19: + self.session.openWithCallback(self.AdapterSetupClosed, WlanStatus,self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() + else: + self.mainmenu = self.genMainMenu() + self["menulist"].l.setList(self.mainmenu) + iNetwork.getInterfaces(self.updateStatusbar) + else: + self.mainmenu = self.genMainMenu() + self["menulist"].l.setList(self.mainmenu) + iNetwork.getInterfaces(self.updateStatusbar) def WlanScanClosed(self,*ret): if ret[0] is not None: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1]) else: - self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,None,ret[0]) - + self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,None,None) def restartLan(self, ret = False): if (ret == True): - iNetwork.restartNetwork() + iNetwork.restartNetwork(self.restartLanDataAvail) + self.restartLanRef = self.session.openWithCallback(self.restartfinishedCB, MessageBox, _("Please wait while your network is restarting..."), type = MessageBox.TYPE_INFO, enable_input = False) + + def restartLanDataAvail(self, data): + if data is True: + iNetwork.getInterfaces(self.getInterfacesDataAvail) + + def getInterfacesDataAvail(self, data): + if data is True: + self.restartLanRef.close(True) + + def restartfinishedCB(self,data): + if data is True: + self.session.open(MessageBox, _("Finished restarting your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False) def getLinkState(self,iface): iNetwork.getLinkState(iface,self.dataAvail) @@ -693,12 +946,16 @@ class AdapterSetupConfiguration(Screen): def showErrorMessage(self): self.session.open(MessageBox, self.errortext, type = MessageBox.TYPE_INFO,timeout = 10 ) + + def cleanup(self): + iNetwork.stopLinkStateConsole() class NetworkAdapterTest(Screen): def __init__(self, session,iface): Screen.__init__(self, session) self.iface = iface + self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") iNetwork.getInterfaces() self.setLabels() @@ -713,8 +970,8 @@ class NetworkAdapterTest(Screen): self["shortcuts"] = ActionMap(["ShortcutActions","WizardActions"], { - "red": self.close, - "back": self.close, + "red": self.cancel, + "back": self.cancel, }, -2) self["infoshortcuts"] = ActionMap(["ShortcutActions","WizardActions"], { @@ -745,6 +1002,12 @@ class NetworkAdapterTest(Screen): self.nextStepTimer = eTimer() self.nextStepTimer.callback.append(self.nextStepTimerFire) + def cancel(self): + if self.oldInterfaceState is False: + iNetwork.setAdapterAttribute(self.iface, "up", self.oldInterfaceState) + iNetwork.deactivateInterface(self.iface) + self.close() + def closeInfo(self): self["shortcuts"].setEnabled(True) self["infoshortcuts"].setEnabled(False) @@ -874,48 +1137,15 @@ class NetworkAdapterTest(Screen): def doStep5(self): self["IPtext"].setForegroundColorNum(1) - ret = iNetwork.checkNetworkState() - if ret == True: - self["IP"].setForegroundColorNum(2) - self["IP"].setText(_("confirmed")) - self["IPInfo_Check"].setPixmapNum(0) - else: - self["IP"].setForegroundColorNum(1) - self["IP"].setText(_("unconfirmed")) - self["IPInfo_Check"].setPixmapNum(1) - self["IPInfo_Check"].show() - self["IPInfo_Text"].setForegroundColorNum(1) - self.steptimer = True - self.nextStepTimer.start(3000) + self["IP"].setText(_("Please wait...")) + iNetwork.checkNetworkState(self.NetworkStatedataAvail) def doStep6(self): self.steptimer = False self.nextStepTimer.stop() self["DNStext"].setForegroundColorNum(1) - ret = iNetwork.checkDNSLookup() - if ret == True: - self["DNS"].setForegroundColorNum(2) - self["DNS"].setText(_("confirmed")) - self["DNSInfo_Check"].setPixmapNum(0) - else: - self["DNS"].setForegroundColorNum(1) - self["DNS"].setText(_("unconfirmed")) - self["DNSInfo_Check"].setPixmapNum(1) - self["DNSInfo_Check"].show() - self["DNSInfo_Text"].setForegroundColorNum(1) - - self["EditSettings_Text"].show() - self["EditSettingsButton"].setPixmapNum(1) - self["EditSettings_Text"].setForegroundColorNum(2) # active - self["EditSettingsButton"].show() - self["ButtonYellow_Check"].setPixmapNum(1) - self["ButtonGreentext"].setText(_("Restart test")) - self["ButtonGreen_Check"].setPixmapNum(0) - self["shortcutsgreen"].setEnabled(False) - self["shortcutsgreen_restart"].setEnabled(True) - self["shortcutsyellow"].setEnabled(False) - self["updown_actions"].setEnabled(True) - self.activebutton = 6 + self["DNS"].setText(_("Please wait...")) + iNetwork.checkDNSLookup(self.DNSLookupdataAvail) def KeyGreen(self): self["shortcutsgreen"].setEnabled(False) @@ -1076,9 +1306,9 @@ class NetworkAdapterTest(Screen): self["NetworkInfo_Check"].setPixmapNum(1) self["NetworkInfo_Check"].show() else: - iNetwork.getLinkState(iface,self.dataAvail) + iNetwork.getLinkState(iface,self.LinkStatedataAvail) - def dataAvail(self,data): + def LinkStatedataAvail(self,data): self.output = data.strip() result = self.output.split('\n') pattern = re_compile("Link detected: yes") @@ -1093,4 +1323,44 @@ class NetworkAdapterTest(Screen): self["NetworkInfo_Check"].setPixmapNum(1) self["NetworkInfo_Check"].show() - + def NetworkStatedataAvail(self,data): + print "DATA",data + if data <= 2: + self["IP"].setForegroundColorNum(2) + self["IP"].setText(_("confirmed")) + self["IPInfo_Check"].setPixmapNum(0) + else: + self["IP"].setForegroundColorNum(1) + self["IP"].setText(_("unconfirmed")) + self["IPInfo_Check"].setPixmapNum(1) + self["IPInfo_Check"].show() + self["IPInfo_Text"].setForegroundColorNum(1) + self.steptimer = True + self.nextStepTimer.start(3000) + + def DNSLookupdataAvail(self,data): + print "DATA",data + if data <= 2: + self["DNS"].setForegroundColorNum(2) + self["DNS"].setText(_("confirmed")) + self["DNSInfo_Check"].setPixmapNum(0) + else: + self["DNS"].setForegroundColorNum(1) + self["DNS"].setText(_("unconfirmed")) + self["DNSInfo_Check"].setPixmapNum(1) + self["DNSInfo_Check"].show() + self["DNSInfo_Text"].setForegroundColorNum(1) + self["EditSettings_Text"].show() + self["EditSettingsButton"].setPixmapNum(1) + self["EditSettings_Text"].setForegroundColorNum(2) # active + self["EditSettingsButton"].show() + self["ButtonYellow_Check"].setPixmapNum(1) + self["ButtonGreentext"].setText(_("Restart test")) + self["ButtonGreen_Check"].setPixmapNum(0) + self["shortcutsgreen"].setEnabled(False) + self["shortcutsgreen_restart"].setEnabled(True) + self["shortcutsyellow"].setEnabled(False) + self["updown_actions"].setEnabled(True) + self.activebutton = 6 + + \ No newline at end of file diff --git a/lib/python/Screens/VirtualKeyBoard.py b/lib/python/Screens/VirtualKeyBoard.py new file mode 100755 index 00000000..53970ab8 --- /dev/null +++ b/lib/python/Screens/VirtualKeyBoard.py @@ -0,0 +1,287 @@ +# -*- coding: iso-8859-1 -*- +from Components.Language import language +from Components.ActionMap import ActionMap +from Components.Label import Label +from Components.Pixmap import Pixmap +from Components.MenuList import MenuList +from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest +from enigma import eListboxPythonMultiContent, gFont, loadPNG, RT_HALIGN_CENTER, RT_VALIGN_CENTER +from Screen import Screen +from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE + +key_backspace = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_backspace.png")) +key_bg = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_bg.png")) +key_clr = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_clr.png")) +key_esc = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_esc.png")) +key_ok = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_ok.png")) +key_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_sel.png")) +key_shift = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift.png")) +key_shift_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift_sel.png")) +key_space = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_space.png")) + +class VirtualKeyBoardList(MenuList): + def __init__(self, list, enableWrapAround=False): + MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) + self.l.setFont(0, gFont("Regular", 22)) + self.l.setItemHeight(45) + +def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False): + res = [ (keys) ] + + x = 0 + count = 0 + if shiftMode: + shiftkey_png = key_shift_sel + else: + shiftkey_png = key_shift + for key in keys: + if key == "EXIT": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_esc)) + elif key == "BACKSPACE": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_backspace)) + elif key == "CLEAR": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_clr)) + elif key == "SHIFT": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=shiftkey_png)) + elif key == "SPACE": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_space)) + elif key == "OK": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_ok)) + #elif key == "<-": + # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_left)) + #elif key == "->": + # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_right)) + + else: + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_bg)) + res.append(MultiContentEntryText(pos=(x, 0), size=(45, 45), font=0, text=key.encode("utf-8"), flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER)) + + if selectedKey == count: + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_sel)) + + x += 45 + count += 1 + + return res + + +class VirtualKeyBoard(Screen): + + def __init__(self, session, title="", text=""): + Screen.__init__(self, session) + self.keys_list = [] + self.shiftkeys_list = [] + self.lang = language.getLanguage() + if self.lang == 'de_DE': + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"", u"+"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"", u"", u"#"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"@", u"", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"", u"", u"'"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + [u"SHIFT", u"SPACE", u"?", u"\\", u"OK"]] + + elif self.lang == 'es_ES': + #still missing keys (u"") + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"", u"+"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"", u"", u"#"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"@", u"", u"", u"", u"", u"", u"", u"", u"", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"", u"", u"'"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + [u"SHIFT", u"SPACE", u"?", u"\\", u"", u"", u"", u"", u"", u"", u"", u"OK"]] + + elif self.lang in ['sv_SE', 'fi_FI']: + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"", u"+"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"", u"", u"#"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"@", u"", u"", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"", u"", u"'"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + [u"SHIFT", u"SPACE", u"?", u"\\", u"", u"OK"]] + else: + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"+", u"@"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"#", u"\\"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"'", u"?"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + [u"SHIFT", u"SPACE", u"OK"]] + + self.shiftMode = False + self.text = text + self.selectedKey = 0 + + self["header"] = Label(title) + self["text"] = Label(self.text) + self["list"] = VirtualKeyBoardList([]) + + self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions"], + { + "ok": self.okClicked, + "cancel": self.exit, + "left": self.left, + "right": self.right, + "up": self.up, + "down": self.down, + "red": self.backClicked, + "green": self.ok + }, -2) + + self.onLayoutFinish.append(self.buildVirtualKeyBoard) + + def buildVirtualKeyBoard(self, selectedKey=0): + list = [] + + if self.shiftMode: + self.k_list = self.shiftkeys_list + for keys in self.k_list: + if selectedKey < 12 and selectedKey > -1: + list.append(VirtualKeyBoardEntryComponent(keys, selectedKey,True)) + else: + list.append(VirtualKeyBoardEntryComponent(keys, -1,True)) + selectedKey -= 12 + else: + self.k_list = self.keys_list + for keys in self.k_list: + if selectedKey < 12 and selectedKey > -1: + list.append(VirtualKeyBoardEntryComponent(keys, selectedKey)) + else: + list.append(VirtualKeyBoardEntryComponent(keys, -1)) + selectedKey -= 12 + + self["list"].setList(list) + + + def backClicked(self): + self.text = self["text"].getText()[:-1] + self["text"].setText(self.text) + + def okClicked(self): + if self.shiftMode: + list = self.shiftkeys_list + else: + list = self.keys_list + + selectedKey = self.selectedKey + + for x in list: + if selectedKey < 12: + text = x[selectedKey] + break + else: + selectedKey -= 12 + + text = text.encode("utf-8") + + if text == "EXIT": + self.close(None) + + elif text == "BACKSPACE": + self.text = self["text"].getText()[:-1] + self["text"].setText(self.text) + + elif text == "CLEAR": + self.text = "" + self["text"].setText(self.text) + + elif text == "SHIFT": + if self.shiftMode: + self.shiftMode = False + else: + self.shiftMode = True + + self.buildVirtualKeyBoard(self.selectedKey) + + elif text == "SPACE": + self.text += " " + self["text"].setText(self.text) + + elif text == "OK": + self.close(self["text"].getText()) + + else: + self.text = self["text"].getText() + self.text += text + self["text"].setText(self.text) + + def ok(self): + self.close(self["text"].getText()) + + def exit(self): + self.close(None) + + def left(self): + self.selectedKey -= 1 + + if self.selectedKey == -1: + self.selectedKey = 11 + elif self.selectedKey == 11: + self.selectedKey = 23 + elif self.selectedKey == 23: + self.selectedKey = 35 + elif self.selectedKey == 35: + self.selectedKey = 47 + elif self.selectedKey == 47: + self.selectedKey = 59 + + self.showActiveKey() + + def right(self): + self.selectedKey += 1 + + if self.selectedKey == 12: + self.selectedKey = 0 + elif self.selectedKey == 24: + self.selectedKey = 12 + elif self.selectedKey == 36: + self.selectedKey = 24 + elif self.selectedKey == 48: + self.selectedKey = 36 + elif self.selectedKey == 60: + self.selectedKey = 48 + + self.showActiveKey() + + def up(self): + self.selectedKey -= 12 + + if self.selectedKey < 0: + self.selectedKey += 60 + + self.showActiveKey() + + def down(self): + self.selectedKey += 12 + + if self.selectedKey > 59: + self.selectedKey -= 60 + + self.showActiveKey() + + def showActiveKey(self): + self.buildVirtualKeyBoard(self.selectedKey) -- cgit v1.2.3 From 70e2fc28acaa3fb20a095acac7079377f8e1eb51 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 4 Nov 2008 15:27:06 +0100 Subject: implement blanking of dvd minus rw media --- lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py index 0c375129..d4e6a375 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py @@ -150,7 +150,7 @@ class DVDformatJob(Job): DVDformatTask(self) def retry(self): - self.tasks[0].args += [ "-force" ] + self.tasks[0].args += self.tasks[0].retryargs Job.retry(self) class DVDformatTaskPostcondition(Condition): @@ -174,6 +174,7 @@ class DVDformatTask(Task): self.setTool("/bin/dvd+rw-format") self.args += [ "/dev/" + harddiskmanager.getCD() ] self.end = 1100 + self.retryargs = [ ] def prepare(self): self.error = None @@ -181,7 +182,10 @@ class DVDformatTask(Task): def processOutputLine(self, line): if line.startswith("- media is already formatted"): self.error = self.ERROR_ALREADYFORMATTED - self.force = True + self.retryargs = [ "-force" ] + if line.startswith("- media is not blank"): + self.error = self.ERROR_ALREADYFORMATTED + self.retryargs = [ "-blank" ] if line.startswith(":-( mounted media doesn't appear to be"): self.error = self.ERROR_NOTWRITEABLE -- cgit v1.2.3 From 2977b2dfa5d96055c5abc10ec31adb4dbf8f9e2a Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 4 Nov 2008 23:03:42 +0100 Subject: don't crash when exitting dvd image selection without selection --- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 600411ce..19380af4 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -207,10 +207,11 @@ class TitleList(Screen, HelpableScreen): self.session.openWithCallback(self.JobViewCB, JobView, job) def burnISO(self, path, scope): - job = Process.DVDisoJob(self.project, path) - job_manager.AddJob(job) - job_manager.in_background = False - self.session.openWithCallback(self.JobViewCB, JobView, job) + if path: + job = Process.DVDisoJob(self.project, path) + job_manager.AddJob(job) + job_manager.in_background = False + self.session.openWithCallback(self.JobViewCB, JobView, job) def JobViewCB(self, in_background): job_manager.in_background = in_background -- cgit v1.2.3 From bae21e629bb99a0be7194d22eb4b7c25ea1646a9 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 Nov 2008 09:00:27 +0100 Subject: don't crash when background jobs fail and user presses red key --- lib/python/Components/Task.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index f249f711..b276438f 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -265,6 +265,7 @@ class JobManager: from Tools import Notifications if self.in_background: from Screens.TaskView import JobView + self.in_background = False Notifications.AddNotification(JobView, self.active_job) if problems: from Screens.MessageBox import MessageBox -- cgit v1.2.3 From 6eecc2f4fcc1e40f9fb093d08271dca3000d4b8d Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 Nov 2008 12:52:46 +0100 Subject: nastily pretend the dvd minus rw bruning error never happened --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 7a03b7eb..9cca8f70 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -241,7 +241,11 @@ class WaitForResidentTasks(Task): class BurnTaskPostcondition(Condition): RECOVERABLE = True def check(self, task): - return task.error is None + if task.returncode == 0: + return True + elif task.error is None or task.error is task.ERROR_MINUSRWBUG: + return True + return False def getErrorMessage(self, task): return { @@ -257,7 +261,7 @@ class BurnTaskPostcondition(Condition): }[task.error] class BurnTask(Task): - ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_UNKNOWN = range(9) + ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_MINUSRWBUG, ERROR_UNKNOWN = range(10) def __init__(self, job, extra_args=[], tool="/bin/growisofs"): Task.__init__(self, job, job.name) self.weighting = 500 @@ -284,12 +288,17 @@ class BurnTask(Task): self.error = self.ERROR_NOTWRITEABLE if line.find("ASC=24h") != -1: self.error = self.ERROR_LOAD + if line.find("SK=5h/ASC=A8h/ACQ=04h") != -1: + self.error = self.ERROR_MINUSRWBUG else: self.error = self.ERROR_UNKNOWN print "BurnTask: unknown error %s" % line elif line.startswith(":-("): if line.find("No space left on device") != -1: self.error = self.ERROR_SIZE + elif self.error == self.ERROR_MINUSRWBUG: + print "*sigh* this is a known bug. we're simply gonna assume everything is fine." + self.postconditions = [] elif line.find("write failed") != -1: self.error = self.ERROR_WRITE_FAILED elif line.find("unable to open64(") != -1 and line.find(",O_RDONLY): No such file or directory") != -1: @@ -309,6 +318,11 @@ class BurnTask(Task): self.error = self.ERROR_FILETOOLARGE elif line.startswith("genisoimage: File too large."): self.error = self.ERROR_ISOTOOLARGE + + def setTool(self, tool): + self.cmd = tool + self.args = [tool] + self.global_preconditions.append(ToolExistsPrecondition()) class RemoveDVDFolder(Task): def __init__(self, job): -- cgit v1.2.3 From be7ed059a249fd76b9acb3db00c5d22dff6d6694 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 Nov 2008 14:32:25 +0100 Subject: try to add dvdburn icon once again --- lib/python/Plugins/Extensions/DVDBurn/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am index d5c558d1..cb65f56a 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am @@ -5,5 +5,5 @@ install_PYTHON = \ plugin.py \ DVDProject.py DVDTitle.py TitleCutter.py TitleList.py Process.py ProjectSettings.py DVDToolbox.py -install_DATA = *.xml *.jpg *.mpg *.mp2 +install_DATA = *.xml *.jpg *.mpg *.mp2 *.png -- cgit v1.2.3 From d14da9c99de7d25b8811292e53cc745e30594234 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 Nov 2008 17:25:52 +0100 Subject: allow setting progress for current task from within resident task, implement rudimentary progress for mplextask in dvdburn (requires dvdauthor patch) --- lib/python/Components/Task.py | 12 ++++--- lib/python/Plugins/Extensions/DVDBurn/Process.py | 45 ++++++++++++++---------- 2 files changed, 33 insertions(+), 24 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index b276438f..9a768425 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -45,6 +45,7 @@ class Job(object): def addTask(self, task): task.job = self + task.task_progress_changed = self.task_progress_changed_CB self.tasks.append(task) def start(self, callback): @@ -70,7 +71,7 @@ class Job(object): else: print "still waiting for %d resident task(s) %s to finish" % (len(self.resident_tasks), str(self.resident_tasks)) else: - self.tasks[self.current_task].run(self.taskCallback, self.task_progress_changed_CB) + self.tasks[self.current_task].run(self.taskCallback) self.state_changed() def taskCallback(self, task, res, stay_resident = False): @@ -151,7 +152,7 @@ class Task(object): not_met.append(precondition) return not_met - def run(self, callback, task_progress_changed): + def run(self, callback): failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if len(failed_preconditions): callback(self, failed_preconditions) @@ -159,7 +160,6 @@ class Task(object): self.prepare() self.callback = callback - self.task_progress_changed = task_progress_changed from enigma import eConsoleAppContainer self.container = eConsoleAppContainer() self.container.appClosed.append(self.processFinished) @@ -235,7 +235,8 @@ class Task(object): if progress < 0: progress = 0 self.__progress = progress - self.task_progress_changed() + if self.task_progress_changed: + self.task_progress_changed() progress = property(getProgress, setProgress) @@ -372,7 +373,8 @@ class ToolExistsPrecondition(Condition): return _("A required tool (%s) was not found.") % (self.realpath) class AbortedPostcondition(Condition): - pass + def getErrorMessage(self, task): + return "Cancelled upon user request" class ReturncodePostcondition(Condition): def check(self, task): diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 9cca8f70..49054596 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -10,8 +10,8 @@ class png2yuvTask(Task): self.dumpFile = outputfile self.weighting = 15 - def run(self, callback, task_progress_changed): - Task.run(self, callback, task_progress_changed) + def run(self, callback): + Task.run(self, callback) self.container.stdoutAvail.remove(self.processStdout) self.container.dumpToFile(self.dumpFile) @@ -26,8 +26,8 @@ class mpeg2encTask(Task): self.inputFile = inputfile self.weighting = 25 - def run(self, callback, task_progress_changed): - Task.run(self, callback, task_progress_changed) + def run(self, callback): + Task.run(self, callback) self.container.readFromFile(self.inputFile) def processOutputLine(self, line): @@ -42,8 +42,8 @@ class spumuxTask(Task): self.dumpFile = outputfile self.weighting = 15 - def run(self, callback, task_progress_changed): - Task.run(self, callback, task_progress_changed) + def run(self, callback): + Task.run(self, callback) self.container.stdoutAvail.remove(self.processStdout) self.container.dumpToFile(self.dumpFile) self.container.readFromFile(self.inputFile) @@ -212,7 +212,7 @@ class RemoveESFiles(Task): class DVDAuthorTask(Task): def __init__(self, job): Task.__init__(self, job, "Authoring DVD") - self.weighting = 300 + self.weighting = 20 self.setTool("/usr/bin/dvdauthor") self.CWD = self.job.workspace self.args += ["-x", self.job.workspace+"/dvdauthor.xml"] @@ -222,6 +222,14 @@ class DVDAuthorTask(Task): print "[DVDAuthorTask] ", line[:-1] if not self.menupreview and line.startswith("STAT: Processing"): self.callback(self, [], stay_resident=True) + elif line.startswith("STAT: VOBU"): + try: + progress = int(line.split("MB")[0].split(" ")[-1]) + if progress: + self.job.mplextask.progress = progress + print "[DVDAuthorTask] update mplextask progress:", self.job.mplextask.progress, "of", self.job.mplextask.end + except: + print "couldn't set mux progress" class DVDAuthorFinalTask(Task): def __init__(self, job): @@ -233,7 +241,7 @@ class WaitForResidentTasks(Task): def __init__(self, job): Task.__init__(self, job, "waiting for dvdauthor to finalize") - def run(self, callback, task_progress_changed): + def run(self, callback): print "waiting for %d resident task(s) %s to finish..." % (len(self.job.resident_tasks),str(self.job.resident_tasks)) if self.job.resident_tasks == 0: callback(self, []) @@ -334,23 +342,24 @@ class RemoveDVDFolder(Task): class CheckDiskspaceTask(Task): def __init__(self, job): Task.__init__(self, job, "Checking free space") - totalsize = 50*1024*1024 # require an extra safety 50 MB + totalsize = 0 # require an extra safety 50 MB maxsize = 0 for title in job.project.titles: titlesize = title.estimatedDiskspace if titlesize > maxsize: maxsize = titlesize totalsize += titlesize diskSpaceNeeded = totalsize + maxsize + job.estimateddvdsize = totalsize / 1024 / 1024 + totalsize += 50*1024*1024 # require an extra safety 50 MB self.global_preconditions.append(DiskspacePrecondition(diskSpaceNeeded)) self.weighting = 5 - def run(self, callback, task_progress_changed): + def run(self, callback): failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if len(failed_preconditions): callback(self, failed_preconditions) return self.callback = callback - self.task_progress_changed = task_progress_changed Task.processFinished(self, 0) class PreviewTask(Task): @@ -361,9 +370,8 @@ class PreviewTask(Task): self.path = path self.weighting = 10 - def run(self, callback, task_progress_changed): + def run(self, callback): self.callback = callback - self.task_progress_changed = task_progress_changed if self.job.menupreview: self.previewProject() else: @@ -439,9 +447,8 @@ class ImagePrepareTask(Task): self.job = job self.Menus = job.Menus - def run(self, callback, task_progress_changed): + def run(self, callback): self.callback = callback - self.task_progress_changed = task_progress_changed # we are doing it this weird way so that the TaskView Screen actually pops up before the spinner comes from enigma import eTimer self.delayTimer = eTimer() @@ -451,7 +458,7 @@ class ImagePrepareTask(Task): def conduct(self): try: from ImageFont import truetype - from Image import open as Image_open + from Image import open as Image_open s = self.job.project.settings self.Menus.im_bg_orig = Image_open(s.menubg.getValue()) if self.Menus.im_bg_orig.size != (self.Menus.imgwidth, self.Menus.imgheight): @@ -475,9 +482,8 @@ class MenuImageTask(Task): self.menubgpngfilename = menubgpngfilename self.highlightpngfilename = highlightpngfilename - def run(self, callback, task_progress_changed): + def run(self, callback): self.callback = callback - self.task_progress_changed = task_progress_changed try: import ImageDraw, Image, os s = self.job.project.settings @@ -712,7 +718,8 @@ class DVDJob(Job): title_filename = self.workspace + "/dvd_title_%d.mpg" % (self.i+1) LinkTS(self, title.inputfile, link_name) demux = DemuxTask(self, link_name) - MplexTask(self, outputfile=title_filename, demux_task=demux) + self.mplextask = MplexTask(self, outputfile=title_filename, demux_task=demux) + self.mplextask.end = self.estimateddvdsize RemoveESFiles(self, demux) WaitForResidentTasks(self) PreviewTask(self, self.workspace + "/dvd/VIDEO_TS/") -- cgit v1.2.3 From 040e658a3f89783e0030392110e87cc992264cdd Mon Sep 17 00:00:00 2001 From: Mladen Horvat Date: Wed, 5 Nov 2008 20:22:38 +0100 Subject: some fixes B A A --- lib/python/Components/Network.py | 5 ++ lib/python/Screens/NetworkSetup.py | 102 ++++++++++++++++++++++++------------- 2 files changed, 73 insertions(+), 34 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index e10c6a0e..8e9fc120 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -20,6 +20,7 @@ class Network: self.deactivateConsole = Console() self.activateConsole = Console() self.resetNetworkConsole = Console() + self.DnsConsole = Console() self.getInterfaces() def getInterfaces(self, callback = None): @@ -445,6 +446,10 @@ class Network: if self.LinkConsole is not None: self.LinkConsole = None + def stopDNSConsole(self): + if self.DnsConsole is not None: + self.DnsConsole = None + def stopRestartConsole(self): if self.restartConsole is not None: self.restartConsole = None diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index c26302fa..6ace1857 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -770,7 +770,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): ifobj = Wireless(self.iface) # a Wireless NIC Object self.wlanresponse = ifobj.getStatistics() if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.AdapterSetupClosed, WlanStatus,self.iface) + self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) else: # Display Wlan not available Message self.showErrorMessage() @@ -830,19 +830,14 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self.iface == 'wlan0' or self.iface == 'ath0': try: - from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan - w = Wlan(self.iface) - stats = w.getStatus() - if stats['BSSID'] == "00:00:00:00:00:00": - self["statuspic"].setPixmapNum(1) - else: - self["statuspic"].setPixmapNum(0) - self["statuspic"].show() + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status except: self["statuspic"].setPixmapNum(1) self["statuspic"].show() + else: + iStatus.getDataForInterface(self.iface,self.getInfoCB) else: - self.getLinkState(self.iface) + iNetwork.getLinkState(self.iface,self.dataAvail) def doNothing(self): pass @@ -894,7 +889,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): ifobj = Wireless(self.iface) # a Wireless NIC Object self.wlanresponse = ifobj.getStatistics() if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.AdapterSetupClosed, WlanStatus,self.iface) + self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) else: # Display Wlan not available Message self.showErrorMessage() @@ -907,6 +902,14 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self["menulist"].l.setList(self.mainmenu) iNetwork.getInterfaces(self.updateStatusbar) + def WlanStatusClosed(self, *ret): + if ret is not None and len(ret): + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + iStatus.stopWlanConsole() + self.mainmenu = self.genMainMenu() + self["menulist"].l.setList(self.mainmenu) + iNetwork.getInterfaces(self.updateStatusbar) + def WlanScanClosed(self,*ret): if ret[0] is not None: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1]) @@ -930,18 +933,15 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if data is True: self.session.open(MessageBox, _("Finished restarting your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False) - def getLinkState(self,iface): - iNetwork.getLinkState(iface,self.dataAvail) - def dataAvail(self,data): self.output = data.strip() result = self.output.split('\n') pattern = re_compile("Link detected: yes") for item in result: if re_search(pattern, item): - self["statuspic"].setPixmapNum(0) - else: self["statuspic"].setPixmapNum(1) + else: + self["statuspic"].setPixmapNum(0) self["statuspic"].show() def showErrorMessage(self): @@ -949,7 +949,27 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def cleanup(self): iNetwork.stopLinkStateConsole() - + try: + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + except ImportError: + pass + else: + iStatus.stopWlanConsole() + + def getInfoCB(self,data,status): + print "im getInfoCB" + if data is not None: + if data is True: + if status is not None: + print "im getInfoCB status" + print "acesspoint",status[self.iface]["acesspoint"] + if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False: + print "setting statuspix 1" + self["statuspic"].setPixmapNum(1) + else: + self["statuspic"].setPixmapNum(0) + print "setting statuspix 0" + self["statuspic"].show() class NetworkAdapterTest(Screen): def __init__(self, session,iface): @@ -958,6 +978,8 @@ class NetworkAdapterTest(Screen): self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") iNetwork.getInterfaces() self.setLabels() + self.onClose.append(self.cleanup) + self.onHide.append(self.cleanup) self["updown_actions"] = NumberActionMap(["WizardActions","ShortcutActions"], { @@ -1115,6 +1137,7 @@ class NetworkAdapterTest(Screen): def doStep3(self): self["Networktext"].setForegroundColorNum(1) + self["Network"].setText(_("Please wait...")) self.getLinkState(self.iface) self["NetworkInfo_Text"].setForegroundColorNum(1) self.steptimer = True @@ -1287,24 +1310,14 @@ class NetworkAdapterTest(Screen): def getLinkState(self,iface): if iface == 'wlan0' or iface == 'ath0': try: - from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan - w = Wlan(iface) - stats = w.getStatus() - if stats['BSSID'] == "00:00:00:00:00:00": - self["Network"].setForegroundColorNum(1) - self["Network"].setText(_("disconnected")) - self["NetworkInfo_Check"].setPixmapNum(1) - self["NetworkInfo_Check"].show() - else: - self["Network"].setForegroundColorNum(2) - self["Network"].setText(_("connected")) - self["NetworkInfo_Check"].setPixmapNum(0) - self["NetworkInfo_Check"].show() + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status except: self["Network"].setForegroundColorNum(1) self["Network"].setText(_("disconnected")) self["NetworkInfo_Check"].setPixmapNum(1) self["NetworkInfo_Check"].show() + else: + iStatus.getDataForInterface(self.iface,self.getInfoCB) else: iNetwork.getLinkState(iface,self.LinkStatedataAvail) @@ -1324,7 +1337,6 @@ class NetworkAdapterTest(Screen): self["NetworkInfo_Check"].show() def NetworkStatedataAvail(self,data): - print "DATA",data if data <= 2: self["IP"].setForegroundColorNum(2) self["IP"].setText(_("confirmed")) @@ -1339,7 +1351,6 @@ class NetworkAdapterTest(Screen): self.nextStepTimer.start(3000) def DNSLookupdataAvail(self,data): - print "DATA",data if data <= 2: self["DNS"].setForegroundColorNum(2) self["DNS"].setText(_("confirmed")) @@ -1362,5 +1373,28 @@ class NetworkAdapterTest(Screen): self["shortcutsyellow"].setEnabled(False) self["updown_actions"].setEnabled(True) self.activebutton = 6 - - \ No newline at end of file + + def getInfoCB(self,data,status): + if data is not None: + if data is True: + if status is not None: + if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False: + self["Network"].setForegroundColorNum(1) + self["Network"].setText(_("disconnected")) + self["NetworkInfo_Check"].setPixmapNum(1) + self["NetworkInfo_Check"].show() + else: + self["Network"].setForegroundColorNum(2) + self["Network"].setText(_("connected")) + self["NetworkInfo_Check"].setPixmapNum(0) + self["NetworkInfo_Check"].show() + + def cleanup(self): + iNetwork.stopLinkStateConsole() + iNetwork.stopDNSConsole() + try: + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + except ImportError: + pass + else: + iStatus.stopWlanConsole() \ No newline at end of file -- cgit v1.2.3 From 81d7587c5c5489dcc300cc4d91ca967838471472 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 5 Nov 2008 22:39:18 +0100 Subject: remove debug --- lib/python/Screens/NetworkSetup.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index 6ace1857..7c9dc827 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -413,7 +413,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.aps = self.w.getNetworkList() if self.aps is not None: print "[NetworkSetup.py] got Accespoints!" - print self.aps + #print self.aps for ap in self.aps: a = self.aps[ap] if a['active']: @@ -957,18 +957,13 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): iStatus.stopWlanConsole() def getInfoCB(self,data,status): - print "im getInfoCB" if data is not None: if data is True: if status is not None: - print "im getInfoCB status" - print "acesspoint",status[self.iface]["acesspoint"] if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False: - print "setting statuspix 1" self["statuspic"].setPixmapNum(1) else: self["statuspic"].setPixmapNum(0) - print "setting statuspix 0" self["statuspic"].show() class NetworkAdapterTest(Screen): -- cgit v1.2.3 From 9519fb597efae0d6ba27d2d140285358fcb94979 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 Nov 2008 10:14:43 +0100 Subject: fix typo --- lib/python/Screens/NetworkSetup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index 7c9dc827..619db4e1 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -629,7 +629,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): if data is False: self.close('ok') else: - configuredInterfaces = configuredNetworkAdapters + configuredInterfaces = iNetwork.getConfiguredAdapters() for interface in configuredInterfaces: if interface == self.iface: continue -- cgit v1.2.3 From 85acd407a2cc4029270d904fdc12643f00fea1de Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 Nov 2008 11:06:45 +0100 Subject: better netmask parsing --- lib/python/Components/Network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 8e9fc120..e317ef05 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -74,7 +74,7 @@ class Network: macRegexp = '[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}' ipLinePattern = re_compile('inet ' + ipRegexp + '/') ipPattern = re_compile(ipRegexp) - netmaskLinePattern = re_compile('/' + netRegexp + ' brd ') + netmaskLinePattern = re_compile(ipRegexp + '/' + netRegexp) netmaskPattern = re_compile(netRegexp) bcastLinePattern = re_compile(' brd ' + ipRegexp) upPattern = re_compile('UP') -- cgit v1.2.3 From 99c296ce8c61a4393dae09fd78ae54b4510ec6fd Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 6 Nov 2008 12:38:03 +0100 Subject: DVDPlayer/plugin.py: more robust code --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 107 ++++++++++++---------- 1 file changed, 59 insertions(+), 48 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 4298642c..cb5f0e0d 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -371,13 +371,25 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP if retval > 0: self.zapToNumber(retval) + def getServiceInterface(self, iface): + service = self.service + if service: + attr = getattr(service, iface, None) + if callable(attr): + return attr() + return None + def __serviceStopped(self): self.dvdScreen.hide() - self.service.subtitle().disableSubtitles(self.session.current_dialog.instance) + subs = self.getServiceInterface("subtitle") + if subs: + subs.disableSubtitles(self.session.current_dialog.instance) def serviceStarted(self): #override InfoBarShowHide function self.dvdScreen.show() - self.service.subtitle().enableSubtitles(self.dvdScreen.instance, None) + subs = self.getServiceInterface("subtitle") + if subs: + subs.enableSubtitles(self.dvdScreen.instance, None) def doEofInternal(self, playing): if self.in_menu: @@ -435,17 +447,19 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP print "StringAvail" def __osdAudioInfoAvail(self): - audioTuple = self.service.info().getInfoObject(iServiceInformation.sUser+6) + info = self.getServiceInterface("info") + audioTuple = info and info.getInfoObject(iServiceInformation.sUser+6) print "AudioInfoAvail ", repr(audioTuple) if audioTuple: audioString = "%d: %s (%s)" % (audioTuple[0],audioTuple[1],audioTuple[2]) self["audioLabel"].setText(audioString) if audioTuple != self.last_audioTuple and not self.in_menu: self.doShow() - self.last_audioTuple = audioTuple + self.last_audioTuple = audioTuple def __osdSubtitleInfoAvail(self): - subtitleTuple = self.service.info().getInfoObject(iServiceInformation.sUser+7) + info = self.getServiceInterface("info") + subtitleTuple = info and info.getInfoObject(iServiceInformation.sUser+7) print "SubtitleInfoAvail ", repr(subtitleTuple) if subtitleTuple: subtitleString = "" @@ -454,21 +468,25 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self["subtitleLabel"].setText(subtitleString) if subtitleTuple != self.last_subtitleTuple and not self.in_menu: self.doShow() - self.last_subtitleTuple = subtitleTuple + self.last_subtitleTuple = subtitleTuple def __chapterUpdated(self): - self.currentChapter = self.service.info().getInfo(iServiceInformation.sCurrentChapter) - self.totalChapters = self.service.info().getInfo(iServiceInformation.sTotalChapters) - self.setChapterLabel() - print "__chapterUpdated: %d/%d" % (self.currentChapter, self.totalChapters) + info = self.getServiceInterface("info") + if info: + self.currentChapter = info.getInfo(iServiceInformation.sCurrentChapter) + self.totalChapters = info.getInfo(iServiceInformation.sTotalChapters) + self.setChapterLabel() + print "__chapterUpdated: %d/%d" % (self.currentChapter, self.totalChapters) def __titleUpdated(self): - self.currentTitle = self.service.info().getInfo(iServiceInformation.sCurrentTitle) - self.totalTitles = self.service.info().getInfo(iServiceInformation.sTotalTitles) - self.setChapterLabel() - print "__titleUpdated: %d/%d" % (self.currentTitle, self.totalTitles) - if not self.in_menu: - self.doShow() + info = self.getServiceInterface("info") + if info: + self.currentTitle = info.getInfo(iServiceInformation.sCurrentTitle) + self.totalTitles = info.getInfo(iServiceInformation.sTotalTitles) + self.setChapterLabel() + print "__titleUpdated: %d/%d" % (self.currentTitle, self.totalTitles) + if not self.in_menu: + self.doShow() def askLeavePlayer(self): choices = [(_("Continue playing"), "play"), (_("Exit"), "exit")] @@ -476,73 +494,65 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP choices.insert(1,(_("Return to file browser"), "browser")) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) + def sendKey(self, key): + keys = self.getServiceInterface("keys") + if keys: + keys.keyPressed(key) + return keys + def nextAudioTrack(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser) + self.sendKey(iServiceKeys.keyUser) def nextSubtitleTrack(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+1) + self.sendKey(iServiceKeys.keyUser+1) def enterDVDAudioMenu(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+2) + self.sendKey(iServiceKeys.keyUser+2) def nextChapter(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+3) + self.sendKey(iServiceKeys.keyUser+3) def prevChapter(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+4) + self.sendKey(iServiceKeys.keyUser+4) def nextTitle(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+5) + self.sendKey(iServiceKeys.keyUser+5) def prevTitle(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+6) + self.sendKey(iServiceKeys.keyUser+6) def enterDVDMenu(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+7) + self.sendKey(iServiceKeys.keyUser+7) def seekBeginning(self): if self.service: seekable = self.getSeek() - if seekable is not None: + if seekable: seekable.seekTo(0) def zapToNumber(self, number): if self.service: seekable = self.getSeek() - if seekable is not None: + if seekable: print "seek to chapter %d" % number seekable.seekChapter(number) # MENU ACTIONS def keyRight(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyRight) + self.sendKey(iServiceKeys.keyRight) def keyLeft(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyLeft) + self.sendKey(iServiceKeys.keyLeft) def keyUp(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUp) + self.sendKey(iServiceKeys.keyUp) def keyDown(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyDown) + self.sendKey(iServiceKeys.keyDown) def keyOk(self): - if self.service: - if not self.in_menu: - self.toggleInfo() - self.service.keys().keyPressed(iServiceKeys.keyOk) + if self.sendKey(iServiceKeys.keyOk) and not self.in_menu: + self.toggleInfo() def keyCancel(self): self.askLeavePlayer() @@ -606,9 +616,10 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def playLastCB(self, answer): # overwrite infobar cuesheet function print "playLastCB", answer, self.resume_point if self.service: - seek = self.service.seek() if answer == True: - seek.seekTo(self.resume_point) + seekable = self.getSeek() + if seekable: + seekable.seekTo(self.resume_point) pause = self.service.pause() pause.unpause() self.hideAfterResume() -- cgit v1.2.3 From 56253715ea1292610ad7fc802a533a99304af8cb Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 Nov 2008 14:48:51 +0100 Subject: better async handling dont open adaptersetup after wlanscan close, only open on connect inside wlanscan some cleanups and fixes --- lib/python/Components/Network.py | 31 ++++++++++++++++------------ lib/python/Screens/NetworkSetup.py | 42 ++++++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 28 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index e317ef05..c41469da 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -18,6 +18,7 @@ class Network: self.LinkConsole = Console() self.restartConsole = Console() self.deactivateConsole = Console() + self.deactivateInterfaceConsole = Console() self.activateConsole = Console() self.resetNetworkConsole = Console() self.DnsConsole = Console() @@ -74,7 +75,7 @@ class Network: macRegexp = '[0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}\:[a-z0-9]{2}' ipLinePattern = re_compile('inet ' + ipRegexp + '/') ipPattern = re_compile(ipRegexp) - netmaskLinePattern = re_compile(ipRegexp + '/' + netRegexp) + netmaskLinePattern = re_compile('/' + netRegexp) netmaskPattern = re_compile(netRegexp) bcastLinePattern = re_compile(' brd ' + ipRegexp) upPattern = re_compile('UP') @@ -412,7 +413,7 @@ class Network: if len(self.PingConsole.appContainers) == 0: statecallback(self.NetworkState) - def restartNetwork(self,callback): + def restartNetwork(self,callback = None): self.restartConsole = Console() self.commands = [] self.commands.append("/etc/init.d/avahi-daemon stop") @@ -427,8 +428,8 @@ class Network: self.restartConsole.eBatch(self.commands, self.restartNetworkFinished, callback, debug=True) def restartNetworkFinished(self,extra_args): - callback = extra_args - if len(self.restartConsole.appContainers) == 0: + ( callback ) = extra_args + if callback is not None: callback(True) def getLinkState(self,iface,callback): @@ -454,12 +455,13 @@ class Network: if self.restartConsole is not None: self.restartConsole = None - def RestartConsoleRunning(self): - if self.restartConsole is not None: - if len(self.restartConsole.appContainers) == 0: - return False - else: - return True + def stopGetInterfacesConsole(self): + if self.Console is not None: + self.Console = None + + def stopDeactivateInterfaceConsole(self): + if self.deactivateInterfaceConsole: + self.deactivateInterfaceConsole = None def checkforInterface(self,iface): if self.getAdapterAttribute(iface, 'up') is True: @@ -492,17 +494,20 @@ class Network: if len(self.DnsConsole.appContainers) == 0: statecallback(self.DnsState) - def deactivateInterface(self,iface): + def deactivateInterface(self,iface,callback = None): self.deactivateInterfaceConsole = Console() self.commands = [] cmd1 = "ip addr flush " + iface cmd2 = "ifconfig " + iface + " down" self.commands.append(cmd1) self.commands.append(cmd2) - self.deactivateInterfaceConsole.eBatch(self.commands, self.deactivateInterfaceFinished, extra_args = None, debug=True) + self.deactivateInterfaceConsole.eBatch(self.commands, self.deactivateInterfaceFinished, callback, debug=True) def deactivateInterfaceFinished(self,extra_args): - pass + callback = extra_args + if len(self.deactivateInterfaceConsole.appContainers) == 0: + if callback is not None: + callback(True) def detectWlanModule(self): self.wlanmodule = None diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index 619db4e1..887e1674 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -285,13 +285,12 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.finished_cb = None self.oktext = _("Press OK on your remote control to continue.") self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") - #iNetwork.getInterfaces() self.createConfig() self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", { - "cancel": (self.close, _("exit networkadapter setup menu")), + "cancel": (self.cancel, _("exit networkadapter setup menu")), "ok": (self.ok, _("select menu entry")), }) @@ -413,7 +412,6 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.aps = self.w.getNetworkList() if self.aps is not None: print "[NetworkSetup.py] got Accespoints!" - #print self.aps for ap in self.aps: a = self.aps[ap] if a['active']: @@ -638,17 +636,26 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.applyConfig(True) def ConfigfinishedCB(self,data): - if data is True: - self.close('ok') + if data is not None: + if data is True: + self.close('ok') def cancel(self): - iNetwork.setAdapterAttribute(self.iface, "up", self.oldInterfaceState) - self.activateInterfaceEntry.value = self.oldInterfaceState - if self.activateInterfaceEntry.value is False: - iNetwork.deactivateInterface(self.iface) - iNetwork.getInterfaces() - self.close('cancel') + if self.oldInterfaceState is False: + iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB) + else: + self.close('cancel') + def deactivateInterfaceCB(self,data): + if data is not None: + if data is True: + iNetwork.getInterfaces(self.cancelCB) + + def cancelCB(self,data): + if data is not None: + if data is True: + self.close('cancel') + def runAsync(self, finished_cb): self.finished_cb = finished_cb self.ok() @@ -663,7 +670,8 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): def cleanup(self): iNetwork.stopLinkStateConsole() - iNetwork.stopRestartConsole() + iNetwork.stopDeactivateInterfaceConsole() + class AdapterSetupConfiguration(Screen, HelpableScreen): def __init__(self, session,iface): @@ -722,7 +730,6 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): iNetwork.getInterfaces(self.updateStatusbar) self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.cleanup) - self.onHide.append(self.cleanup) def ok(self): if self["menulist"].getCurrent()[1] == 'edit': @@ -914,8 +921,12 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if ret[0] is not None: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1]) else: - self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,None,None) - + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + iStatus.stopWlanConsole() + self.mainmenu = self.genMainMenu() + self["menulist"].l.setList(self.mainmenu) + iNetwork.getInterfaces(self.updateStatusbar) + def restartLan(self, ret = False): if (ret == True): iNetwork.restartNetwork(self.restartLanDataAvail) @@ -949,6 +960,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def cleanup(self): iNetwork.stopLinkStateConsole() + iNetwork.stopDeactivateInterfaceConsole() try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status except ImportError: -- cgit v1.2.3 From 77488b1ad023f9221684e42e23d4e8f2a299d948 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 6 Nov 2008 19:09:33 +0100 Subject: Wizard.py: add handling for async code --- lib/python/Screens/Wizard.py | 78 +++++++++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 23 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index cee057dc..53600dfe 100644 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -84,7 +84,7 @@ class Wizard(Screen): timeoutstep = str(attrs.get('timeoutstep')) else: timeoutstep = '' - self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "nextstep": nextstep} + self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "code_async": "", "codeafter_async": "", "nextstep": nextstep} elif (name == "text"): self.wizard[self.lastStep]["text"] = string.replace(str(attrs.get('value')), "\\n", "\n") elif (name == "displaytext"): @@ -119,6 +119,7 @@ class Wizard(Screen): if (attrs.has_key('evaluation')): self.wizard[self.lastStep]["config"]["evaluation"] = str(attrs.get('evaluation')) elif (name == "code"): + self.async_code = attrs.has_key('async') and str(attrs.get('async')) == "yes" if attrs.has_key('pos') and str(attrs.get('pos')) == "after": self.codeafter = True else: @@ -129,10 +130,16 @@ class Wizard(Screen): def endElement(self, name): self.currContent = "" if name == 'code': - if self.codeafter: - self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"].strip() + if self.async_code: + if self.codeafter: + self.wizard[self.lastStep]["codeafter_async"] = self.wizard[self.lastStep]["codeafter_async"].strip() + else: + self.wizard[self.lastStep]["code_async"] = self.wizard[self.lastStep]["code_async"].strip() else: - self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"].strip() + if self.codeafter: + self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"].strip() + else: + self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"].strip() elif name == 'condition': self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"].strip() elif name == 'step': @@ -141,13 +148,19 @@ class Wizard(Screen): def characters(self, ch): if self.currContent == "code": - if self.codeafter: - self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"] + ch + if self.async_code: + if self.codeafter: + self.wizard[self.lastStep]["codeafter_async"] = self.wizard[self.lastStep]["codeafter_async"] + ch + else: + self.wizard[self.lastStep]["code_async"] = self.wizard[self.lastStep]["code_async"] + ch else: - self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"] + ch + if self.codeafter: + self.wizard[self.lastStep]["codeafter"] = self.wizard[self.lastStep]["codeafter"] + ch + else: + self.wizard[self.lastStep]["code"] = self.wizard[self.lastStep]["code"] + ch elif self.currContent == "condition": self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"] + ch - + def __init__(self, session, showSteps = True, showStepSlider = True, showList = True, showConfig = True): Screen.__init__(self, session) @@ -298,7 +311,7 @@ class Wizard(Screen): if self.updateValues not in self.onShown: self.onShown.append(self.updateValues) - + if self.showConfig: if self.wizard[currStep]["config"]["type"] == "dynamic": eval("self." + self.wizard[currStep]["config"]["evaluation"])() @@ -317,16 +330,20 @@ class Wizard(Screen): self.markDone() self.close() else: + self.codeafter=True self.runCode(self.wizard[currStep]["codeafter"]) + async = self.runCode(self.wizard[currStep]["codeafter_async"]) if self.wizard[currStep]["nextstep"] is not None: self.currStep = self.getStepWithID(self.wizard[currStep]["nextstep"]) if gotoStep is not None: self.currStep = self.getStepWithID(gotoStep) - self.currStep += 1 - self.updateValues() - - print "Now: " + str(self.currStep) - + if not async: + self.currStep += 1 + self.updateValues() + print "Now: " + str(self.currStep) + else: + self.onShown.remove(self.updateValues) + print "Now: " + str(self.currStep+1), "(after async code finished)" def ok(self): print "OK" @@ -371,7 +388,7 @@ class Wizard(Screen): def up(self): self.resetCounter() if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None or self.wizard[self.currStep]["config"]["type"] == "dynamic"): - self["config"].instance.moveSelection(self["config"].instance.moveUp) + self["config"].instance.moveSelection(self["config"].instance.moveUp) elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0): self["list"].selectPrevious() if self.wizard[self.currStep].has_key("onselect"): @@ -415,7 +432,9 @@ class Wizard(Screen): if code != "": print "code", code exec(code) - + return True + return False + def getTranslation(self, text): return _(text) @@ -470,8 +489,24 @@ class Wizard(Screen): for x in self.lcdCallbacks: x(displaytext) + self.codeafter=False self.runCode(self.wizard[self.currStep]["code"]) - + self.async = self.runCode(self.wizard[self.currStep]["code_async"]) + if self.async: + self.onShown.remove(self.updateValues) + else: + self.afterAsyncCode() + else: + self.currStep += 1 + self.updateValues() + + def afterAsyncCode(self): + if self.updateValues not in self.onShown: + self.onShown.append(self.updateValues) + if self.codeafter: + self.currStep += 1 + self.updateValues() + else: if self.showList: print "showing list,", self.currStep for renderer in self.renderer: @@ -482,7 +517,7 @@ class Wizard(Screen): print "setZPosition" rootrenderer.instance.setZPosition(1) renderer = renderer.source - + #self["list"].instance.setZPosition(1) self.list = [] if (self.wizard[self.currStep].has_key("dynamiclist")): @@ -524,7 +559,7 @@ class Wizard(Screen): self["config"].l.setList(self.configInstance["config"].list) callbacks = self.configInstance["config"].onSelectionChanged self.configInstance["config"].destroy() - print "clearConfigList", self.configInstance["config"], self["config"] + print "clearConfigList", self.configInstance["config"], self["config"] self.configInstance["config"] = self["config"] self.configInstance["config"].onSelectionChanged = callbacks print "clearConfigList", self.configInstance["config"], self["config"] @@ -533,10 +568,7 @@ class Wizard(Screen): else: if self.has_key("config"): self["config"].hide() - else: # condition false - self.currStep += 1 - self.updateValues() - + def timeoutCounterFired(self): self.timeoutCounter -= 1 print "timeoutCounter:", self.timeoutCounter -- cgit v1.2.3 From fde1aa8770d42e9a5abb598f1db3c54045f0d8c8 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Thu, 6 Nov 2008 19:32:18 +0100 Subject: allow reading jfif embedded exif thumbnails from jpeg files and use them to speed up thumbnail view in pictureplayer plugin --- lib/gdi/picload.cpp | 159 ++++++++++++++++++++- lib/gdi/picload.h | 2 +- .../Plugins/Extensions/PicturePlayer/plugin.py | 4 +- 3 files changed, 159 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/gdi/picload.cpp b/lib/gdi/picload.cpp index 94cb35b1..1f9bed48 100644 --- a/lib/gdi/picload.cpp +++ b/lib/gdi/picload.cpp @@ -10,6 +10,8 @@ #include // savePNG need it +#define JDCT_DEFAULT JDCT_IFAST + extern "C" { #include #include @@ -163,6 +165,151 @@ static int jpeg_save(unsigned char *image_buffer, const char * filename, int qua return 0; } +/* Expanded data source object for memory buffer input */ +typedef struct +{ + struct jpeg_source_mgr pub; /* public fields */ + FILE *infile; /* source stream */ + JOCTET *buffer; /* start of buffer */ + boolean start_of_file; /* have we gotten any data yet? */ +} mem_source_mgr; + +typedef mem_source_mgr *mem_src_ptr; + +static void init_source (j_decompress_ptr cinfo) +{ + mem_src_ptr src = (mem_src_ptr) cinfo->src; + src->start_of_file = TRUE; +} + +static boolean fill_input_buffer (j_decompress_ptr cinfo) +{ + /* no-op */ (void)cinfo; + return TRUE; + } + +static void skip_input_data (j_decompress_ptr cinfo, long num_bytes) +{ + mem_src_ptr src = (mem_src_ptr) cinfo->src; + + if (num_bytes > 0) + { + src->pub.next_input_byte += (size_t) num_bytes; + src->pub.bytes_in_buffer -= (size_t) num_bytes; + } +} + +static void term_source (j_decompress_ptr cinfo) +{ + /* no-op */ (void)cinfo; +} + +static void jpeg_memory_src (j_decompress_ptr cinfo, unsigned char *inbfr, int len) +{ + mem_src_ptr src; + if (cinfo->src == NULL) + { + cinfo->src = (struct jpeg_source_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, (size_t)sizeof(mem_source_mgr)); + src = (mem_src_ptr) cinfo->src; + src->buffer = (JOCTET *) inbfr; + } + src = (mem_src_ptr) cinfo->src; + src->pub.init_source = init_source; + src->pub.fill_input_buffer = fill_input_buffer; + src->pub.skip_input_data = skip_input_data; + src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ + src->pub.term_source = term_source; + src->infile = 0L; + src->pub.bytes_in_buffer = len; /* sets to entire file len */ + src->pub.next_input_byte = (JOCTET *)inbfr; /* at start of buffer */ +} + +static int jpeg_load_thumb(const char *filename, int *x, int *y) +{ + struct jpeg_decompress_struct cinfo; + struct jpeg_decompress_struct *ciptr = &cinfo; + struct r_jpeg_error_mgr emgr; + FILE *fh; + + if (!(fh = fopen(filename, "rb"))) + return 0; + + ciptr->err = jpeg_std_error(&emgr.pub); + emgr.pub.error_exit = jpeg_cb_error_exit; + if (setjmp(emgr.envbuffer) == 1) + { + jpeg_destroy_decompress(ciptr); + fclose(fh); + return 0; + } + + jpeg_create_decompress(ciptr); + jpeg_stdio_src(ciptr, fh); + + jpeg_save_markers (ciptr, JPEG_APP0 + 1, 0xffff); + + jpeg_read_header(ciptr, TRUE); + + struct jpeg_marker_struct *m = cinfo.marker_list; + + unsigned char *thumb_buf = NULL; + size_t bufsize; + + if ( m ) + { + unsigned char *p_data = m->data; + while ( p_data < m->data+m->data_length ) + { + if ( p_data[0] == 0xFF && p_data[1] == 0xD8 ) + { + bufsize = (size_t) m->data_length - (size_t) (p_data-m->data); + thumb_buf = new unsigned char[bufsize]; + bufsize = 0; + do { + thumb_buf[bufsize++] = *p_data; + } while ( !(*p_data++ == 0xFF && *p_data == 0xD9) && p_data < m->data+m->data_length ); + thumb_buf[bufsize++] = *p_data; + } + p_data++; + } + } + + if ( thumb_buf != NULL ) + { + jpeg_create_decompress(ciptr); + jpeg_memory_src(ciptr, thumb_buf, bufsize-2); + jpeg_read_header(ciptr, TRUE); + } + else + eDebug("no exif thumbnail found! loading actual image instead"); + + ciptr->out_color_space = JCS_RGB; + ciptr->scale_denom = 1; + + jpeg_start_decompress(ciptr); + + *x=ciptr->output_width; + *y=ciptr->output_height; + + if(ciptr->output_components == 3) + { + JSAMPLE *lb = (JSAMPLE *)(*ciptr->mem->alloc_small)((j_common_ptr) ciptr, JPOOL_PERMANENT, ciptr->output_width * ciptr->output_components); + pic_buffer = new unsigned char[ciptr->output_height * ciptr->output_width * ciptr->output_components]; + unsigned char *bp = pic_buffer; + + while (ciptr->output_scanline < ciptr->output_height) + { + jpeg_read_scanlines(ciptr, &lb, 1); + memcpy(bp, lb, ciptr->output_width * ciptr->output_components); + bp += ciptr->output_width * ciptr->output_components; + } + } + jpeg_finish_decompress(ciptr); + jpeg_destroy_decompress(ciptr); + fclose(fh); + return 1; +} static int jpeg_load(const char *filename, int *x, int *y) { @@ -410,7 +557,7 @@ static int png_load(const char *filename, int *x, int *y) if (width * height > 1000000) // 1000x1000 or equiv. { - eDebug("[png_load] image size is %d x %d, which is \"too large\".", width, height); + eDebug("[png_load] image size is %d x %d, which is \"too large\".", (int)width, (int)height); png_read_end(png_ptr, info_ptr); png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); fclose(fh); @@ -632,7 +779,7 @@ static int pic_id(const char *name) return F_NONE; } -int loadPic(ePtr &result, std::string filename, int w, int h, int aspect, int resize_mode, int rotate, int background, std::string cachefile) +int loadPic(ePtr &result, std::string filename, int w, int h, int aspect, int resize_mode, int rotate, int background, std::string cachefile, int thumbnail) { result = 0; int ox=0, oy=0, imx, imy; @@ -650,7 +797,13 @@ int loadPic(ePtr &result, std::string filename, int w, int h, int aspec switch(pic_id(filename.c_str())) { case F_PNG: png_load(filename.c_str(), &ox, &oy);break; - case F_JPEG: jpeg_load(filename.c_str(), &ox, &oy);pic_buffer = conv24to32(pic_buffer, ox*oy, 1); break; + case F_JPEG: { + if (thumbnail) + jpeg_load_thumb(filename.c_str(), &ox, &oy); + else + jpeg_load(filename.c_str(), &ox, &oy); + pic_buffer = conv24to32(pic_buffer, ox*oy, 1); + break; } case F_BMP: bmp_load(filename.c_str(), &ox, &oy);pic_buffer = conv24to32(pic_buffer, ox*oy, 1); break; case F_GIF: gif_load(filename.c_str(), &ox, &oy);pic_buffer = conv24to32(pic_buffer, ox*oy, 1); break; default: diff --git a/lib/gdi/picload.h b/lib/gdi/picload.h index 7d5d8b2a..7bb9adf1 100644 --- a/lib/gdi/picload.h +++ b/lib/gdi/picload.h @@ -5,7 +5,7 @@ #include #include -SWIG_VOID(int) loadPic(ePtr &SWIG_OUTPUT, std::string filename, int x, int y, int aspect, int resize_mode=0, int rotate=0, int background=0, std::string cachefile=""); +SWIG_VOID(int) loadPic(ePtr &SWIG_OUTPUT, std::string filename, int x, int y, int aspect, int resize_mode=0, int rotate=0, int background=0, std::string cachefile="", int thumbnail=0); PyObject *getExif(const char *filename); #endif // __picload_h__ diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index a9d61ed9..ea906f0d 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -155,7 +155,7 @@ class ThumbView(Screen): if not createDir(cachedir): cachefile = "" - ptr = loadPic(self.path + self.thumblist[self.thumbindex], 180, 160, self.aspect, int(config.pic.resize.value), int(config.pic.rotate.value),1, cachefile) + ptr = loadPic(self.path + self.thumblist[self.thumbindex], 180, 160, self.aspect, int(config.pic.resize.value), int(config.pic.rotate.value), 1, cachefile, 1) if ptr != None: self["thumb"+str(self.thumbindex)].show() self["thumb"+str(self.thumbindex)].instance.setPixmap(ptr) @@ -486,7 +486,7 @@ class picmain(Screen): if not createDir(cachedir): cachefile = "" - ptr = loadPic(self.filelist.getCurrentDirectory() + self.filelist.getFilename(), 180, 160, self.aspect, int(config.pic.resize.value), 0, 0, cachefile) + ptr = loadPic(self.filelist.getCurrentDirectory() + self.filelist.getFilename(), 180, 160, self.aspect, int(config.pic.resize.value), 0, 0, cachefile, 1) if ptr != None: self["thumbnail"].show() self["thumbnail"].instance.setPixmap(ptr) -- cgit v1.2.3 From e0e7cf8fbfac3bfbf577b7c76c3b9d461a2854ee Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 Nov 2008 21:26:23 +0100 Subject: fix Dreambox Keyboard Numberinput inside ConfigIP --- lib/python/Components/config.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 lib/python/Components/config.py (limited to 'lib/python') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py old mode 100644 new mode 100755 index b448ca6d..c21a9192 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -513,6 +513,7 @@ class ConfigIP(ConfigSequence): self.auto_jump = auto_jump def handleKey(self, key): + if key == KEY_LEFT: if self.marked_block > 0: self.marked_block -= 1 @@ -531,8 +532,14 @@ class ConfigIP(ConfigSequence): self.marked_block = len(self.limits)-1 self.overwrite = True - if key in KEY_NUMBERS: - number = getKeyNumber(key) + if key in KEY_NUMBERS or key == KEY_ASCII: + if key == KEY_ASCII: + code = getPrevAsciiCode() + if code < 48 or code > 57: + return + number = code - 48 + else: + number = getKeyNumber(key) oldvalue = self._value[self.marked_block] if self.overwrite: -- cgit v1.2.3 From c9faacfea68f90597fb82504790dc1f7d7b71f3f Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 6 Nov 2008 23:05:15 +0100 Subject: Wizard.py: hopefully fix async stuff --- lib/python/Screens/Wizard.py | 96 +++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 51 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 53600dfe..17a8150e 100644 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -307,43 +307,37 @@ class Wizard(Screen): def finished(self, gotoStep = None, *args, **kwargs): print "finished" - currStep = self.currStep + self.prevStep = self.currStep + self.gotoStep = gotoStep if self.updateValues not in self.onShown: self.onShown.append(self.updateValues) if self.showConfig: - if self.wizard[currStep]["config"]["type"] == "dynamic": - eval("self." + self.wizard[currStep]["config"]["evaluation"])() + if self.wizard[self.prevStep]["config"]["type"] == "dynamic": + eval("self." + self.wizard[self.prevStep]["config"]["evaluation"])() if self.showList: - if (len(self.wizard[currStep]["evaluatedlist"]) > 0): + if (len(self.wizard[self.prevStep]["evaluatedlist"]) > 0): print "current:", self["list"].current nextStep = self["list"].current[1] - if (self.wizard[currStep].has_key("listevaluation")): + if (self.wizard[self.prevStep].has_key("listevaluation")): exec("self." + self.wizard[self.currStep]["listevaluation"] + "('" + nextStep + "')") else: self.currStep = self.getStepWithID(nextStep) - if ((currStep == self.numSteps and self.wizard[currStep]["nextstep"] is None) or self.wizard[currStep]["id"] == "end"): # wizard finished + if ((self.prevStep == self.numSteps and self.wizard[self.prevStep]["nextstep"] is None) or self.wizard[self.prevStep]["id"] == "end"): # wizard finished print "wizard finished" self.markDone() self.close() else: - self.codeafter=True - self.runCode(self.wizard[currStep]["codeafter"]) - async = self.runCode(self.wizard[currStep]["codeafter_async"]) - if self.wizard[currStep]["nextstep"] is not None: - self.currStep = self.getStepWithID(self.wizard[currStep]["nextstep"]) - if gotoStep is not None: - self.currStep = self.getStepWithID(gotoStep) - if not async: - self.currStep += 1 - self.updateValues() - print "Now: " + str(self.currStep) + self.codeafterA=True + self.runCode(self.wizard[self.prevStep]["codeafter"]) + if self.runCode(self.wizard[self.prevStep]["codeafter_async"]): + if self.updateValues in self.onShown: + self.onShown.remove(self.updateValues) else: - self.onShown.remove(self.updateValues) - print "Now: " + str(self.currStep+1), "(after async code finished)" + self.afterAsyncCode() def ok(self): print "OK" @@ -358,7 +352,8 @@ class Wizard(Screen): # for this. If there is one, please do a more specific check # and/or a comment in which situation there is no run() if callable(getattr(self.configInstance, "runAsync", None)): - self.onShown.remove(self.updateValues) + if self.updateValues in self.onShown: + self.onShown.remove(self.updateValues) self.configInstance.runAsync(self.finished) return else: @@ -464,48 +459,47 @@ class Wizard(Screen): del self.configInstance["config"] self.configInstance.doClose() self.configInstance = None - - self.condition = True + exec (self.wizard[self.currStep]["condition"]) - if self.condition: - if len(self.stepHistory) == 0 or self.stepHistory[-1] != self.currStep: - self.stepHistory.append(self.currStep) - print "wizard step:", self.wizard[self.currStep] + + if len(self.stepHistory) == 0 or self.stepHistory[-1] != self.currStep: + self.stepHistory.append(self.currStep) + print "wizard step:", self.wizard[self.currStep] - if self.showSteps: - self["step"].setText(self.getTranslation("Step ") + str(self.currStep) + "/" + str(self.numSteps)) - if self.showStepSlider: - self["stepslider"].setValue(self.currStep) + if self.showSteps: + self["step"].setText(self.getTranslation("Step ") + str(self.currStep) + "/" + str(self.numSteps)) + if self.showStepSlider: + self["stepslider"].setValue(self.currStep) - if self.wizard[self.currStep]["timeout"] is not None: - self.resetCounter() - self.timeoutTimer.start(1000) + if self.wizard[self.currStep]["timeout"] is not None: + self.resetCounter() + self.timeoutTimer.start(1000) - print "wizard text", self.getTranslation(self.wizard[self.currStep]["text"]) - self.updateText(firstset = True) - if self.wizard[self.currStep].has_key("displaytext"): - displaytext = self.wizard[self.currStep]["displaytext"] - print "set LCD text" - for x in self.lcdCallbacks: - x(displaytext) + print "wizard text", self.getTranslation(self.wizard[self.currStep]["text"]) + self.updateText(firstset = True) + if self.wizard[self.currStep].has_key("displaytext"): + displaytext = self.wizard[self.currStep]["displaytext"] + print "set LCD text" + for x in self.lcdCallbacks: + x(displaytext) - self.codeafter=False - self.runCode(self.wizard[self.currStep]["code"]) - self.async = self.runCode(self.wizard[self.currStep]["code_async"]) - if self.async: + self.codeafterA=False + self.runCode(self.wizard[self.currStep]["code"]) + if self.runCode(self.wizard[self.currStep]["code_async"]): + if self.updateValues in self.onShown: self.onShown.remove(self.updateValues) - else: - self.afterAsyncCode() else: - self.currStep += 1 - self.updateValues() + self.afterAsyncCode() def afterAsyncCode(self): - if self.updateValues not in self.onShown: - self.onShown.append(self.updateValues) - if self.codeafter: + if self.codeafterA: + if self.wizard[self.prevStep]["nextstep"] is not None: + self.currStep = self.getStepWithID(self.wizard[self.currStep]["nextstep"]) + if self.gotoStep is not None: + self.currStep = self.getStepWithID(self.gotoStep) self.currStep += 1 self.updateValues() + print "Now: " + str(self.currStep) else: if self.showList: print "showing list,", self.currStep -- cgit v1.2.3 From e4632437dcaf95c92abd3b1fed122a61c97e3a5b Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 7 Nov 2008 00:36:51 +0100 Subject: Wizard.py: async fixes --- lib/python/Screens/Wizard.py | 92 +++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 40 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 17a8150e..23d6253a 100644 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -307,37 +307,42 @@ class Wizard(Screen): def finished(self, gotoStep = None, *args, **kwargs): print "finished" - self.prevStep = self.currStep - self.gotoStep = gotoStep + currStep = self.currStep if self.updateValues not in self.onShown: self.onShown.append(self.updateValues) - + if self.showConfig: - if self.wizard[self.prevStep]["config"]["type"] == "dynamic": - eval("self." + self.wizard[self.prevStep]["config"]["evaluation"])() + if self.wizard[currStep]["config"]["type"] == "dynamic": + eval("self." + self.wizard[currStep]["config"]["evaluation"])() if self.showList: - if (len(self.wizard[self.prevStep]["evaluatedlist"]) > 0): + if (len(self.wizard[currStep]["evaluatedlist"]) > 0): print "current:", self["list"].current nextStep = self["list"].current[1] - if (self.wizard[self.prevStep].has_key("listevaluation")): + if (self.wizard[currStep].has_key("listevaluation")): exec("self." + self.wizard[self.currStep]["listevaluation"] + "('" + nextStep + "')") else: self.currStep = self.getStepWithID(nextStep) - if ((self.prevStep == self.numSteps and self.wizard[self.prevStep]["nextstep"] is None) or self.wizard[self.prevStep]["id"] == "end"): # wizard finished + print_now = True + if ((currStep == self.numSteps and self.wizard[currStep]["nextstep"] is None) or self.wizard[currStep]["id"] == "end"): # wizard finished print "wizard finished" self.markDone() self.close() else: - self.codeafterA=True - self.runCode(self.wizard[self.prevStep]["codeafter"]) - if self.runCode(self.wizard[self.prevStep]["codeafter_async"]): + self.codeafter = True + self.runCode(self.wizard[currStep]["codeafter"]) + self.prevStep = currStep + self.gotoStep = gotoStep + if not self.runCode(self.wizard[currStep]["codeafter_async"]): + self.afterAsyncCode() + else: if self.updateValues in self.onShown: self.onShown.remove(self.updateValues) - else: - self.afterAsyncCode() + + if print_now: + print "Now: " + str(self.currStep) def ok(self): print "OK" @@ -460,41 +465,48 @@ class Wizard(Screen): self.configInstance.doClose() self.configInstance = None + self.condition = True exec (self.wizard[self.currStep]["condition"]) - - if len(self.stepHistory) == 0 or self.stepHistory[-1] != self.currStep: - self.stepHistory.append(self.currStep) - print "wizard step:", self.wizard[self.currStep] + if not self.condition: + self.currStep += 1 + self.updateValues() + else: + if len(self.stepHistory) == 0 or self.stepHistory[-1] != self.currStep: + self.stepHistory.append(self.currStep) + print "wizard step:", self.wizard[self.currStep] - if self.showSteps: - self["step"].setText(self.getTranslation("Step ") + str(self.currStep) + "/" + str(self.numSteps)) - if self.showStepSlider: - self["stepslider"].setValue(self.currStep) + if self.showSteps: + self["step"].setText(self.getTranslation("Step ") + str(self.currStep) + "/" + str(self.numSteps)) + if self.showStepSlider: + self["stepslider"].setValue(self.currStep) - if self.wizard[self.currStep]["timeout"] is not None: - self.resetCounter() - self.timeoutTimer.start(1000) + if self.wizard[self.currStep]["timeout"] is not None: + self.resetCounter() + self.timeoutTimer.start(1000) - print "wizard text", self.getTranslation(self.wizard[self.currStep]["text"]) - self.updateText(firstset = True) - if self.wizard[self.currStep].has_key("displaytext"): - displaytext = self.wizard[self.currStep]["displaytext"] - print "set LCD text" - for x in self.lcdCallbacks: - x(displaytext) + print "wizard text", self.getTranslation(self.wizard[self.currStep]["text"]) + self.updateText(firstset = True) + if self.wizard[self.currStep].has_key("displaytext"): + displaytext = self.wizard[self.currStep]["displaytext"] + print "set LCD text" + for x in self.lcdCallbacks: + x(displaytext) - self.codeafterA=False - self.runCode(self.wizard[self.currStep]["code"]) - if self.runCode(self.wizard[self.currStep]["code_async"]): - if self.updateValues in self.onShown: - self.onShown.remove(self.updateValues) - else: - self.afterAsyncCode() + self.codeafter=False + self.runCode(self.wizard[self.currStep]["code"]) + if self.runCode(self.wizard[self.currStep]["code_async"]): + if self.updateValues in self.onShown: + self.onShown.remove(self.updateValues) + else: + self.afterAsyncCode() def afterAsyncCode(self): - if self.codeafterA: + if not self.updateValues in self.onShown: + self.onShown.append(self.updateValues) + + if self.codeafter: if self.wizard[self.prevStep]["nextstep"] is not None: - self.currStep = self.getStepWithID(self.wizard[self.currStep]["nextstep"]) + self.currStep = self.getStepWithID(self.wizard[self.prevStep]["nextstep"]) if self.gotoStep is not None: self.currStep = self.getStepWithID(self.gotoStep) self.currStep += 1 -- cgit v1.2.3 From be71c7f9fddf86a831914bc5096a1339d331d91d Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 7 Nov 2008 08:40:20 +0100 Subject: parse #EXTINT title info from m3u playlists --- lib/python/Components/Playlist.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Playlist.py b/lib/python/Components/Playlist.py index 744ee3af..c9ebe479 100644 --- a/lib/python/Components/Playlist.py +++ b/lib/python/Components/Playlist.py @@ -58,6 +58,7 @@ class PlaylistIOM3U(PlaylistIO): def open(self, filename): self.clear() + self.displayname = None try: file = open(filename, "r") except IOError: @@ -66,14 +67,22 @@ class PlaylistIOM3U(PlaylistIO): entry = file.readline().strip() if entry == "": break - if entry[0] != "#": + if entry.startswith("#EXTINF:"): + extinf = entry.split(',',1) + if len(extinf) > 1: + self.displayname = extinf[1] # TODO: use e2 facilities to create a service ref from file + elif entry[0] != "#": if entry[0] == "/": - self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry)) + sref = ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry) elif entry.startswith("http"): - self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry.replace(':',"%3a"))) + sref = ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + entry.replace(':',"%3a")) else: - self.addService(ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + os.path.dirname(filename) + "/" + entry)) + sref = ServiceReference("4097:0:0:0:0:0:0:0:0:0:" + os.path.dirname(filename) + "/" + entry) + if self.displayname: + sref.ref.setName(self.displayname) + self.displayname = None + self.addService(sref) file.close() return self.list -- cgit v1.2.3 From 8c5e8f7163867e2e8bfc07784904dc14a9ebaa86 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 7 Nov 2008 08:58:21 +0100 Subject: move selection index on EOS (this will scroll through playlist instead of always displaying the uppermost page) --- lib/python/Components/MediaPlayer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/MediaPlayer.py b/lib/python/Components/MediaPlayer.py index 791274fc..87ba977c 100644 --- a/lib/python/Components/MediaPlayer.py +++ b/lib/python/Components/MediaPlayer.py @@ -40,7 +40,7 @@ def PlaylistEntryComponent(serviceref, state): if png is not None: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 0, 16, 16, png)) - + return res class PlayList(MenuList): @@ -76,6 +76,7 @@ class PlayList(MenuList): def setCurrentPlaying(self, index): self.oldCurrPlaying = self.currPlaying self.currPlaying = index + self.moveToIndex(index) def updateState(self, state): if len(self.list) > self.oldCurrPlaying and self.oldCurrPlaying != -1: -- cgit v1.2.3 From cef8f42aa76d0ebf17b5b7ddf9883d6d6128c280 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 7 Nov 2008 09:21:24 +0100 Subject: refresh playlist when adding playlist via filelist. when copying directory to playlist, only add media files and no playlist files --- lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index ed1a8874..2233998c 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -632,7 +632,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB if x[0][1] == True: #isDir if recursive: self.copyDirectory(x[0][0]) - else: + elif filelist.getServiceRef().type != 4098: self.playlist.addFile(x[0][0]) self.playlist.updateList() @@ -646,6 +646,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB list = playlist.open(ServiceRef.getPath()) for x in list: self.playlist.addFile(x.ref) + self.playlist.updateList() else: self.playlist.addFile(self.filelist.getServiceRef()) self.playlist.updateList() -- cgit v1.2.3 From f5dc0e14397ef85ad77df165de061264dd2166fd Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 7 Nov 2008 11:14:18 +0100 Subject: fix coverart displaying, allow using cover art with all different image formats, remove some debug prints --- .../Plugins/Extensions/MediaPlayer/plugin.py | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 2233998c..963247d6 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -1,6 +1,6 @@ from os import path as os_path, remove as os_remove, listdir as os_listdir from time import strftime -from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation +from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation, loadPic from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.InputBox import InputBox @@ -14,6 +14,7 @@ from Tools.Directories import resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCO from Components.ServicePosition import ServicePositionGauge from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.Playlist import PlaylistIOInternal, PlaylistIOM3U, PlaylistIOPLS +from Components.AVSwitch import AVSwitch from Screens.InfoBarGenerics import InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport from ServiceReference import ServiceReference from Screens.ChoiceBox import ChoiceBox @@ -42,6 +43,7 @@ class MediaPixmap(Pixmap): break if self.default_pixmap is None: self.default_pixmap = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/no_coverArt.png") + self.coverFileNames = ["folder.png", "folder.jpg"] return Pixmap.applySkin(self, desktop, screen) class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, HelpableScreen): @@ -283,13 +285,15 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def updateCoverArtPixmap(self, path): while not path.endswith("/"): path = path[:-1] - pngname = path + "folder.png" - - if not fileExists(pngname): - pngname = self["coverArt"].default_pixmap - if self.coverArtFileName != pngname: - self.coverArtFileName = pngname - self["coverArt"].instance.setPixmapFromFile(self.coverArtFileName) + new_coverArtFileName = self["coverArt"].default_pixmap + for filename in self["coverArt"].coverFileNames: + if fileExists(path + filename): + new_coverArtFileName = path + filename + if self.coverArtFileName != new_coverArtFileName: + self.coverArtFileName = new_coverArtFileName + pixmap = loadPic(self.coverArtFileName, 116, 116, AVSwitch().getAspectRatioSetting()/2,1,0,0) + if pixmap is not None: + self["coverArt"].instance.setPixmap(pixmap.__deref__()) def leftDown(self): self.lefttimer = True @@ -632,7 +636,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB if x[0][1] == True: #isDir if recursive: self.copyDirectory(x[0][0]) - elif filelist.getServiceRef().type != 4098: + elif filelist.getServiceRef() and filelist.getServiceRef().type == 4097: self.playlist.addFile(x[0][0]) self.playlist.updateList() @@ -640,7 +644,6 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB if self.filelist.getServiceRef().type == 4098: # playlist ServiceRef = self.filelist.getServiceRef() extension = ServiceRef.getPath()[ServiceRef.getPath().rfind('.') + 1:] - print "extension:", extension if self.playlistparsers.has_key(extension): playlist = self.playlistparsers[extension]() list = playlist.open(ServiceRef.getPath()) @@ -763,7 +766,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.unPauseService() if needsInfoUpdate == True: - self.updateCoverArtPixmap(currref.getPath()) + path = self.playlist.getServiceRefList()[self.playlist.getCurrentIndex()].getPath() + self.updateCoverArtPixmap(path) else: pngname = self["coverArt"].default_pixmap self.coverArtFileName = pngname @@ -815,7 +819,6 @@ class MediaPlayerLCDScreen(Screen): self["text4"] = Label("") def setText(self, text, line): - print "lcd set text:", text, line if len(text) > 10: if text[-4:] == ".mp3": text = text[:-4] -- cgit v1.2.3 From 613447d89ad124aa6fb52627dd7c98085cdd8d31 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 7 Nov 2008 14:38:00 +0100 Subject: fix bsod in some cases --- lib/python/Screens/TimerEdit.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py index 800bab33..aae345db 100644 --- a/lib/python/Screens/TimerEdit.py +++ b/lib/python/Screens/TimerEdit.py @@ -317,6 +317,7 @@ class TimerSanityConflict(Screen): EMPTY = 0 ENABLE = 1 DISABLE = 2 + EDIT = 3 def __init__(self, session, timer): Screen.__init__(self, session) @@ -338,10 +339,11 @@ class TimerSanityConflict(Screen): self["key_red"] = Button("Edit") self["key_green"] = Button(" ") - self["key_yellow"] = Button("Edit") + self["key_yellow"] = Button(" ") self["key_blue"] = Button(" ") self.key_green_choice = self.EMPTY + self.key_yellow_choice = self.EMPTY self.key_blue_choice = self.EMPTY self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "ShortcutActions", "TimerEditActions"], @@ -415,9 +417,14 @@ class TimerSanityConflict(Screen): self["actions"].actions.update({"green":self.toggleTimer1}) self["key_green"].setText(_("Disable")) self.key_green_choice = self.DISABLE + if len(self.timer) > 1: x = self["list"].getSelectedIndex() if self.timer[x] is not None: + if self.key_yellow_choice == self.EMPTY: + self["actions"].actions.update({"yellow":self.editTimer2}) + self["key_yellow"].setText(_("Edit")) + self.key_yellow_choice = self.EDIT if self.timer[x].disabled and self.key_blue_choice != self.ENABLE: self["actions"].actions.update({"blue":self.toggleTimer2}) self["key_blue"].setText(_("Enable")) @@ -432,9 +439,11 @@ class TimerSanityConflict(Screen): self.key_blue_choice = self.DISABLE else: #FIXME.... this doesnt hide the buttons self.... just the text - self.removeAction("yellow") - self["key_yellow"].setText(" ") - self.key_yellow_choice = self.EMPTY - self.removeAction("blue") - self["key_blue"].setText(" ") - self.key_blue_choice = self.EMPTY + if self.key_yellow_choice != self.EMPTY: + self.removeAction("yellow") + self["key_yellow"].setText(" ") + self.key_yellow_choice = self.EMPTY + if self.key_blue_choice != self.EMPTY: + self.removeAction("blue") + self["key_blue"].setText(" ") + self.key_blue_choice = self.EMPTY -- cgit v1.2.3 From a90424c0dc460b587898b65f6a89a564399ab551 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 7 Nov 2008 20:35:57 +0100 Subject: fix non working invert of oled display add non working standby slider in display setup --- lib/gdi/lcd.cpp | 8 +++++++- lib/python/Components/Lcd.py | 10 ++++++---- lib/python/Components/config.py | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/gdi/lcd.cpp b/lib/gdi/lcd.cpp index 39117194..ecc19b53 100644 --- a/lib/gdi/lcd.cpp +++ b/lib/gdi/lcd.cpp @@ -166,8 +166,14 @@ void eDBoxLCD::update() memset(raw, 0, 64*64); for (y=0; y<64; y++) { + int pix=0; for (x=0; x<128 / 2; x++) - raw[y*64+x] = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4); + { + pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4); + if (inverted) + pix = 0xFF - pix; + raw[y*64+x] = pix; + } } if (lcdfd >= 0) write(lcdfd, raw, 64*64); diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 0471843c..0e501237 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -44,9 +44,14 @@ def InitLcd(): ilcd = LCD() - config.lcd.bright = ConfigSlider(default=10, limits=(0, 10)) + config.lcd.standby = ConfigSlider(default=0, limits=(0, 10)) + config.lcd.standby.addNotifier(setLCDbright); + config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby) + + config.lcd.bright = ConfigSlider(default=5, limits=(0, 10)) config.lcd.bright.addNotifier(setLCDbright); config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright) + config.lcd.bright.callNotifiersOnSaveAndCancel = True if not ilcd.isOled(): config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20)) @@ -54,9 +59,6 @@ def InitLcd(): else: config.lcd.contrast = ConfigNothing() - config.lcd.standby = ConfigSlider(default=0, limits=(0, 10)) - config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby) - config.lcd.invert = ConfigYesNo(default=False) config.lcd.invert.addNotifier(setLCDinverted); else: diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index c21a9192..4ddcabec 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -34,6 +34,7 @@ class ConfigElement(object): self.save_disabled = False self.notifiers = [] self.enabled = True + self.callNotifiersOnSaveAndCancel = False # you need to override this to do input validation def setValue(self, value): @@ -66,9 +67,13 @@ class ConfigElement(object): self.saved_value = None else: self.saved_value = self.tostring(self.value) + if self.callNotifiersOnSaveAndCancel: + self.changed() def cancel(self): self.load() + if self.callNotifiersOnSaveAndCancel: + self.changed() def isChanged(self): sv = self.saved_value -- cgit v1.2.3 From b81939c5a6375795d59a7fd8d9f81c0810c7eebe Mon Sep 17 00:00:00 2001 From: acid-burn Date: Fri, 7 Nov 2008 21:30:25 +0100 Subject: fix typos fix async callback translation update --- lib/python/Screens/NetworkSetup.py | 42 +++++++++++--------- po/de.po | 81 ++++++++++++++++++++++---------------- 2 files changed, 71 insertions(+), 52 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index 887e1674..580673e4 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -50,8 +50,8 @@ class NetworkAdapterSelection(Screen,HelpableScreen): Screen.__init__(self, session) HelpableScreen.__init__(self) - self.wlan_errortext = _("No working wireless networkadapter found.\nPlease verify that you have attached a compatible WLAN USB Stick and your Network is configured correctly.") - self.lan_errortext = _("No working local networkadapter found.\nPlease verify that you have attached a network cable and your Network is configured correctly.") + self.wlan_errortext = _("No working wireless network adapter found.\nPlease verify that you have attached a compatible WLAN device and your network is configured correctly.") + self.lan_errortext = _("No working local network adapter found.\nPlease verify that you have attached a network cable and your network is configured correctly.") self.oktext = _("Press OK on your remote control to continue.") self.restartLanRef = None @@ -67,18 +67,18 @@ class NetworkAdapterSelection(Screen,HelpableScreen): self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", { - "cancel": (self.close, _("exit networkinterface list")), + "cancel": (self.close, _("exit network interface list")), "ok": (self.okbuttonClick, _("select interface")), }) self["ColorActions"] = HelpableActionMap(self, "ColorActions", { - "red": (self.close, _("exit networkinterface list")), + "red": (self.close, _("exit network interface list")), }) self["DefaultInterfaceAction"] = HelpableActionMap(self, "ColorActions", { - "blue": (self.setDefaultInterface, [_("Set interface as default Interface"),_("* Only available if more then one interface is active.")] ), + "blue": (self.setDefaultInterface, [_("Set interface as default Interface"),_("* Only available if more than one interface is active.")] ), }) self.list = [] @@ -273,13 +273,18 @@ class NameserverSetup(Screen, ConfigListScreen, HelpableScreen): self.createSetup() class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): - def __init__(self, session, iface,essid=None, aplist=None): + def __init__(self, session, networkinfo, essid=None, aplist=None): Screen.__init__(self, session) HelpableScreen.__init__(self) self.session = session - self.iface = iface - self.essid = essid - self.aplist = aplist + if isinstance(networkinfo, (list, tuple)): + self.iface = networkinfo[0] + self.essid = networkinfo[1] + self.aplist = networkinfo[2] + else: + self.iface = networkinfo + self.essid = essid + self.aplist = aplist self.extended = None self.applyConfigRef = None self.finished_cb = None @@ -290,19 +295,19 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", { - "cancel": (self.cancel, _("exit networkadapter setup menu")), + "cancel": (self.cancel, _("exit network adapter setup menu")), "ok": (self.ok, _("select menu entry")), }) self["ColorActions"] = HelpableActionMap(self, "ColorActions", { - "red": (self.cancel, _("exit networkadapter configuration")), + "red": (self.cancel, _("exit network adapter configuration")), "blue": (self.KeyBlue, _("open nameserver configuration")), }) self["VirtualKB"] = HelpableActionMap(self, "ColorActions", { - "green": (self.KeyGreen, [_("open virtual keyboard input help"),_("* Only available when entering hidden ssid or network key")] ), + "green": (self.KeyGreen, [_("open virtual keyboard input help"),_("* Only available when entering hidden SSID or network key")] ), }) self["actions"] = NumberActionMap(["SetupActions"], @@ -516,7 +521,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): if self.iface == "wlan0" or self.iface == "ath0" : if self["config"].getCurrent() == self.hiddenSSID: if config.plugins.wlan.essid.value == 'hidden...': - self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN networkname/SSID:")), text = config.plugins.wlan.essid.value) + self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN network name/SSID:")), text = config.plugins.wlan.essid.value) if self["config"].getCurrent() == self.encryptionKey: self.session.openWithCallback(self.VirtualKeyBoardKeyCallback, VirtualKeyBoard, title = (_("Enter WLAN passphrase/key:")), text = config.plugins.wlan.encryption.psk.value) @@ -600,7 +605,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): iNetwork.deactivateInterface(self.iface) iNetwork.writeNetworkConfig() iNetwork.restartNetwork(self.applyConfigDataAvail) - self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait while activating your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False) + self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False) else: self.cancel() @@ -616,10 +621,10 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): if data is True: num_configured_if = len(iNetwork.getConfiguredAdapters()) if num_configured_if >= 2: - self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("Your network configuration has been activated.\nA second configured interface has been found.\n\nDo you want to disable the second networkinterface?"), default = True) + self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("Your network configuration has been activated.\nA second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True) else: if self.finished_cb: - self.session.openWithCallback(self.finished_cb, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10) + self.session.openWithCallback(lambda x : self.finished_cb(), MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10) else: self.session.openWithCallback(self.ConfigfinishedCB, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10) @@ -695,7 +700,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self.oktext = _("Press OK on your remote control to continue.") self.reboottext = _("Your Dreambox will restart after pressing OK on your remote control.") - self.errortext = _("No working wireless interface found.\n Please verify that you have attached a compatible WLAN device or enable you local network interface.") + self.errortext = _("No working wireless network interface found.\n Please verify that you have attached a compatible WLAN device or enable your local network interface.") self["WizardActions"] = HelpableActionMap(self, "WizardActions", { @@ -1404,4 +1409,5 @@ class NetworkAdapterTest(Screen): except ImportError: pass else: - iStatus.stopWlanConsole() \ No newline at end of file + iStatus.stopWlanConsole() + diff --git a/po/de.po b/po/de.po index eb38d378..e5f33eec 100755 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: tuxbox-enigma 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-11-07 09:36+0100\n" +"POT-Creation-Date: 2008-11-07 21:18+0100\n" "PO-Revision-Date: 2008-10-15 12:10+0100\n" "Last-Translator: Andreas Frisch \n" "Language-Team: none\n" @@ -98,13 +98,11 @@ msgstr "(leer)" msgid "(show optional DVD audio menu)" msgstr "" -msgid "* Only available if more then one interface is active." +msgid "* Only available if more than one interface is active." msgstr "* Nur verfügbar wenn mehr als ein Netzwerkadapter aktiv ist." -msgid "* Only available when entering hidden ssid or network key" -msgstr "" -"* Nur verfügbar während der eingabe einer versteckten Netzwerk SSID oder " -"WLAN Passwortes" +msgid "* Only available when entering hidden SSID or network key" +msgstr "* Verfügbar für die Eingabe der Netzwerk SSID oder Passwortes" msgid ".NFI Download failed:" msgstr "" @@ -596,7 +594,7 @@ msgid "Change bouquets in quickzap" msgstr "Bouquet wechseln beim Quickzap" msgid "Change dir." -msgstr "Verzeichniss wechseln" +msgstr "Verzeichnis wechseln" msgid "Change pin code" msgstr "Pincode ändern" @@ -1163,8 +1161,8 @@ msgstr "Anfängliche Vorlaufgeschwindigkeit eingeben" msgid "Enter Rewind at speed" msgstr "Anfängliche Rücklaufgeschwindigkeit eingeben" -msgid "Enter WLAN networkname/SSID:" -msgstr "WLAN Netzwerkname/SSID eingeben:" +msgid "Enter WLAN network name/SSID:" +msgstr "" msgid "Enter WLAN passphrase/key:" msgstr "WLAN Schlüssel/Passwort eingeben:" @@ -1262,10 +1260,10 @@ msgid "Finished" msgstr "Beendet" msgid "Finished configuring your network" -msgstr "" +msgstr "Netzwerkkonfiguration abgeschlossen" msgid "Finished restarting your network" -msgstr "" +msgstr "Netzwerkneustart abgeschlossen" msgid "Finnish" msgstr "Finnisch" @@ -1499,7 +1497,7 @@ msgid "Integrated Ethernet" msgstr "Eingebaute Netzwerkschnittstelle" msgid "Integrated Wireless" -msgstr "Integriertes Funknetzwerk" +msgstr "Integriertes WLAN" msgid "Intermediate" msgstr "Fortgeschritten" @@ -1885,22 +1883,31 @@ msgstr "" "Wenn Sie 'NEIN' wählen, bleibt der Einstellungen-Schutz deaktiviert!" msgid "" -"No working local networkadapter found.\n" -"Please verify that you have attached a network cable and your Network is " +"No working local network adapter found.\n" +"Please verify that you have attached a network cable and your network is " "configured correctly." msgstr "" +"Kein funktionierender Netzwerkadapter gefunden.\n" +"Stellen Sie sicher, dass Sie ein Netzwerkkabel angeschlossen haben und das " +"Ihr Netzwerk richtig konfiguriert ist." msgid "" -"No working wireless interface found.\n" -" Please verify that you have attached a compatible WLAN device or enable you " -"local network interface." +"No working wireless network adapter found.\n" +"Please verify that you have attached a compatible WLAN device and your " +"network is configured correctly." msgstr "" +"Kein funktionierende WLAN Netzwerkadapter gefunden.\n" +"Stellen Sie sicher, dass Sie ein kompatibles Gerät angeschlossen haben oder " +"aktivieren Sie den internen Netzwerkadapter." msgid "" -"No working wireless networkadapter found.\n" -"Please verify that you have attached a compatible WLAN USB Stick and your " -"Network is configured correctly." +"No working wireless network interface found.\n" +"Please verify that you have attached a compatible WLAN device or enable your " +"local network interface." msgstr "" +"Kein funktionierender WLAN Netzwerkadapter gefunden.\n" +"Stellen Sie sicher, dass Sie ein kompatibles Gerät angeschlossen haben und " +"das Ihr Netzwerk richtig konfiguriert ist." msgid "No, but restart from begin" msgstr "Nein, aber von Anfang an neu beginnen" @@ -2166,12 +2173,12 @@ msgstr "" "Bitte benutzen Sie die Hoch/Runter-Tasten, um Ihre Sprache auszuwählen. " "Danach drücken Sie bitte OK." +msgid "Please wait for activation of your network configuration..." +msgstr "Bitte warten während die Netzwerkkonfiguration aktiviert wird..." + msgid "Please wait for md5 signature verification..." msgstr "" -msgid "Please wait while activating your network configuration..." -msgstr "Bitte warten während die Netzwerkkonfiguration aktiviert wird..." - msgid "Please wait while we configure your network..." msgstr "Bitte warten während das Netzwerk konfiguriert wird..." @@ -2693,7 +2700,7 @@ msgid "Set as default Interface" msgstr "Netzwerkadapter als Standard definieren" msgid "Set interface as default Interface" -msgstr "Setze Netzwerkadapter als Standardad" +msgstr "Setze Netzwerkadapter als Standardd" msgid "Set limits" msgstr "Limits setzen" @@ -3751,7 +3758,7 @@ msgid "" "Your network configuration has been activated.\n" "A second configured interface has been found.\n" "\n" -"Do you want to disable the second networkinterface?" +"Do you want to disable the second network interface?" msgstr "" "Ihre Netzwerkkonfiguration wurde aktiviert.\n" "Ein zweiter konfigurierter Netzwerkadapter wurde gefunden.\n" @@ -3881,7 +3888,7 @@ msgid "chapters" msgstr "Kapitel" msgid "choose destination directory" -msgstr "Wähle Zielverzeichniss" +msgstr "Wähle Zielverzeichnis" msgid "circular left" msgstr "links-zirkulär" @@ -3914,7 +3921,7 @@ msgid "copy to bouquets" msgstr "in Bouquets kopieren" msgid "create directory" -msgstr "Verzeichniss erstellen" +msgstr "Verzeichnis erstellen" msgid "daily" msgstr "täglich" @@ -4015,15 +4022,18 @@ msgstr "Verlasse Filmliste" msgid "exit nameserver configuration" msgstr "DNS Serverkonfiguration verlassen" -msgid "exit networkadapter configuration" +msgid "exit network adapter configuration" msgstr "Netzwerkadapterkonfiguration verlassen" -msgid "exit networkadapter setup menu" +msgid "exit network adapter setup menu" msgstr "Netzwerkadaptermenu verlassen" -msgid "exit networkinterface list" +msgid "exit network interface list" msgstr "Netzwerkadapterübersicht verlassen" +msgid "exit networkadapter setup menu" +msgstr "" + msgid "failed" msgstr "" @@ -4252,7 +4262,7 @@ msgid "open servicelist(up)" msgstr "Kanalliste öffnen(nach oben)" msgid "open virtual keyboard input help" -msgstr "Virtuelle Tastatur Eingabehilfe öffnen" +msgstr "Virtuelle Tastatureingabehilfe öffnen" msgid "pass" msgstr "Durchgang" @@ -4309,7 +4319,7 @@ msgid "remove bookmark" msgstr "Bookmark entfernen" msgid "remove directory" -msgstr "Verzeichniss entfernen" +msgstr "Verzeichnis entfernen" msgid "remove entry" msgstr "Eintrag entfernen" @@ -4370,10 +4380,10 @@ msgid "select image from server" msgstr "Wähle ein Image vom Server" msgid "select interface" -msgstr "Wähle einen Ntzwerkadapter" +msgstr "Wähle einen Netzwerkadapter" msgid "select menu entry" -msgstr "Wähle einen Menupunkt" +msgstr "Wähle einen Menüpunkt" msgid "select movie" msgstr "Wähle Film" @@ -4616,6 +4626,9 @@ msgstr "umgeschaltet" #~ msgid "Enable WLAN Support" #~ msgstr "Aktiviere WLAN Unterstützung" +#~ msgid "Enter WLAN networ kname/SSID:" +#~ msgstr "WLAN Netzwerkname/SSID eingeben:" + #~ msgid "Games / Plugins" #~ msgstr "Spiele / Erweiterungen" -- cgit v1.2.3 From 19b37ace32489ada16dbc4c88b74907064d9c292 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 Nov 2008 00:16:49 +0100 Subject: add (tune)simulate support to some functions --- lib/dvb/db.cpp | 4 ++-- lib/dvb/dvb.cpp | 22 +++++++++++++--------- lib/dvb/dvb.h | 4 ++-- lib/dvb/idvb.h | 2 +- lib/python/enigma_python.i | 4 ++-- lib/service/iservice.h | 2 +- lib/service/service.cpp | 2 +- lib/service/servicedvb.cpp | 4 ++-- lib/service/servicedvb.h | 2 +- 9 files changed, 25 insertions(+), 21 deletions(-) (limited to 'lib/python') diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index 02ecc1d2..c6c2e855 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -151,7 +151,7 @@ RESULT eDVBService::getEvent(const eServiceReference &ref, ePtr & return eEPGCache::getInstance()->lookupEventTime(ref, start_time, ptr); } -int eDVBService::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +int eDVBService::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate) { ePtr res_mgr; if ( eDVBResourceManager::getInstance( res_mgr ) ) @@ -161,7 +161,7 @@ int eDVBService::isPlayable(const eServiceReference &ref, const eServiceReferenc eDVBChannelID chid, chid_ignore; ((const eServiceReferenceDVB&)ref).getChannelID(chid); ((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore); - return res_mgr->canAllocateChannel(chid, chid_ignore); + return res_mgr->canAllocateChannel(chid, chid_ignore, simulate); } return 0; } diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 68d9a0dd..e04caa00 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -713,12 +713,13 @@ RESULT eDVBResourceManager::connectChannelAdded(const Slot1 & return 0; } -int eDVBResourceManager::canAllocateFrontend(ePtr &feparm) +int eDVBResourceManager::canAllocateFrontend(ePtr &feparm, bool simulate) { + eSmartPtrList &frontends = simulate ? m_simulate_frontend : m_frontend; ePtr best; int bestval = 0; - for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) + for (eSmartPtrList::iterator i(frontends.begin()); i != frontends.end(); ++i) if (!i->m_inuse) { int c = i->m_frontend->isCompatibleWith(feparm); @@ -755,10 +756,11 @@ int tuner_type_channel_default(ePtr &channellist, const eDVBCha return 0; } -int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore) +int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore, bool simulate) { + std::list &active_channels = simulate ? m_active_simulate_channels : m_active_channels; int ret=0; - if (m_cached_channel) + if (!simulate && m_cached_channel) { eDVBChannel *cache_chan = (eDVBChannel*)&(*m_cached_channel); if(channelid==cache_chan->getChannelID()) @@ -767,7 +769,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons /* first, check if a channel is already existing. */ // eDebug("allocate channel.. %04x:%04x", channelid.transport_stream_id.get(), channelid.original_network_id.get()); - for (std::list::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i) + for (std::list::iterator i(active_channels.begin()); i != active_channels.end(); ++i) { // eDebug("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get()); if (i->m_channel_id == channelid) @@ -780,8 +782,9 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons int *decremented_cached_channel_fe_usecount=NULL, *decremented_fe_usecount=NULL; - for (std::list::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i) + for (std::list::iterator i(active_channels.begin()); i != active_channels.end(); ++i) { + eSmartPtrList &frontends = simulate ? m_simulate_frontend : m_frontend; // eDebug("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get()); if (i->m_channel_id == ignore) { @@ -795,7 +798,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons ePtr fe; if (!i->m_channel->getFrontend(fe)) { - for (eSmartPtrList::iterator ii(m_frontend.begin()); ii != m_frontend.end(); ++ii) + for (eSmartPtrList::iterator ii(frontends.begin()); ii != frontends.end(); ++ii) { if ( &(*fe) == &(*ii->m_frontend) ) { @@ -822,7 +825,8 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons ePtr fe; if (!channel->getFrontend(fe)) { - for (eSmartPtrList::iterator ii(m_frontend.begin()); ii != m_frontend.end(); ++ii) + eSmartPtrList &frontends = simulate ? m_simulate_frontend : m_frontend; + for (eSmartPtrList::iterator ii(frontends.begin()); ii != frontends.end(); ++ii) { if ( &(*fe) == &(*ii->m_frontend) ) { @@ -852,7 +856,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons goto error; } - ret = canAllocateFrontend(feparm); + ret = canAllocateFrontend(feparm, simulate); error: if (decremented_fe_usecount) diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 1a773efa..13556c26 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -184,7 +184,7 @@ public: }; RESULT connectChannelAdded(const Slot1 &channelAdded, ePtr &connection); - int canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore); + int canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore, bool simulate=false); /* allocate channel... */ RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr &channel, bool simulate=false); @@ -206,7 +206,7 @@ public: #ifdef SWIG public: #endif - int canAllocateFrontend(ePtr &feparm); + int canAllocateFrontend(ePtr &feparm, bool simulate=false); bool canMeasureFrontendInputPower(); PSignal1 frontendUseMaskChanged; SWIG_VOID(RESULT) allocateRawChannel(eUsePtr &SWIG_OUTPUT, int slot_index); diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index a2cce94d..cda05894 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -315,7 +315,7 @@ public: // iStaticServiceInformation RESULT getName(const eServiceReference &ref, std::string &name); RESULT getEvent(const eServiceReference &ref, ePtr &ptr, time_t start_time); - int isPlayable(const eServiceReference &ref, const eServiceReference &ignore); + int isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate=false); PyObject *getInfoObject(const eServiceReference &ref, int); // implemented in lib/service/servicedvb.h /* for filtering: */ diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 8f05d53d..7de05d2b 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -282,9 +282,9 @@ PyObject *New_iRecordableServicePtr(const ePtr &ptr) /* needed for service groups */ -PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore); +PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore, bool simulate=false); %{ -PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore) +PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore, bool simulate=false) { eStaticServiceDVBBouquetInformation info; if (info.isPlayable(bouquet_ref, ignore)) diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 0385b9c2..02fc4508 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -240,7 +240,7 @@ public: virtual int getLength(const eServiceReference &ref); virtual SWIG_VOID(RESULT) getEvent(const eServiceReference &ref, ePtr &SWIG_OUTPUT, time_t start_time=-1); // returns true when not implemented - virtual int isPlayable(const eServiceReference &ref, const eServiceReference &ignore); + virtual int isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate=false); virtual int getInfo(const eServiceReference &ref, int w); virtual std::string getInfoString(const eServiceReference &ref,int w); diff --git a/lib/service/service.cpp b/lib/service/service.cpp index f34237d2..eb2757ab 100644 --- a/lib/service/service.cpp +++ b/lib/service/service.cpp @@ -239,7 +239,7 @@ int iStaticServiceInformation::getLength(const eServiceReference &ref) return -1; } -int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate) { return 0; } diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 954a3964..2f98ed6b 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -412,7 +412,7 @@ RESULT eStaticServiceDVBBouquetInformation::getName(const eServiceReference &ref return -1; } -int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate) { if (ref.flags & eServiceReference::isGroup) { @@ -453,7 +453,7 @@ int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref { 2, 1, 3 } // -T -S -C }; ((const eServiceReferenceDVB&)*it).getChannelID(chid); - int tmp=res->canAllocateChannel(chid, chid_ignore); + int tmp=res->canAllocateChannel(chid, chid_ignore, simulate); switch(tmp) { case 0: diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 85e97ea1..d19b92d6 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -293,7 +293,7 @@ public: eServiceReference &getPlayableService() { return m_playable_service; } RESULT getName(const eServiceReference &ref, std::string &name); int getLength(const eServiceReference &ref); - int isPlayable(const eServiceReference &ref, const eServiceReference &ignore); + int isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate=false); RESULT getEvent(const eServiceReference &ref, ePtr &ptr, time_t start_time); }; -- cgit v1.2.3 From 68182033644faf17e06f10d1b98a128b5e3a7058 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 Nov 2008 00:18:59 +0100 Subject: fix TimerSanityCheck for Service Groups (Alternatives) dont care about tuner slot num in Timersanity Check fix wrong timersanitycheck result in some cases (Bug: unknown Conflict) --- Navigation.py | 4 +-- lib/python/Components/TimerSanityCheck.py | 54 +++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 19 deletions(-) (limited to 'lib/python') diff --git a/Navigation.py b/Navigation.py index bda6f584..42733cb2 100644 --- a/Navigation.py +++ b/Navigation.py @@ -79,14 +79,14 @@ class Navigation: def getCurrentlyPlayingServiceReference(self): return self.currentlyPlayingServiceReference - def recordService(self, ref): + def recordService(self, ref, simulate=False): service = None print "recording service: %s" % (str(ref)) if isinstance(ref, ServiceReference.ServiceReference): ref = ref.ref if ref: if ref.flags & eServiceReference.isGroup: - ref = getBestPlayableServiceReference(ref, eServiceReference()) + ref = getBestPlayableServiceReference(ref, eServiceReference(), simulate) service = ref and self.pnav and self.pnav.recordService(ref) if service is None: print "record returned non-zero" diff --git a/lib/python/Components/TimerSanityCheck.py b/lib/python/Components/TimerSanityCheck.py index e793cdcd..031c9cae 100644 --- a/lib/python/Components/TimerSanityCheck.py +++ b/lib/python/Components/TimerSanityCheck.py @@ -1,9 +1,7 @@ -import string import NavigationInstance from time import localtime -from Components.NimManager import nimmanager from ServiceReference import ServiceReference -from enigma import iServiceInformation, eServiceCenter +from enigma import iServiceInformation, eServiceCenter, eServiceReference class TimerSanityCheck: def __init__(self, timerlist, newtimer=None): @@ -54,6 +52,7 @@ class TimerSanityCheck: # index -1 for the new Timer, 0..n index of the existing timers # count of running timers + serviceHandler = eServiceCenter.getInstance() print "checkTimerlist" # create a list with all start and end times # split it into recurring and singleshot timers @@ -149,9 +148,7 @@ class TimerSanityCheck: fakeRecList = [] ConflictTimer = None ConflictTunerType = None - ConflictSlot = None newTimerTunerType = None - newTimerTunerSlot = None cnt = 0 idx = 0 overlaplist = [] @@ -162,24 +159,45 @@ class TimerSanityCheck: else: timer = self.timerlist[event[2]] if event[1] == self.bflag: - fakeRecService = NavigationInstance.instance.recordService(timer.service_ref) - fakeRecResult = fakeRecService.start(True) - feinfo = fakeRecService.frontendInfo().getFrontendData() - tunerType = feinfo.get("tuner_type") - tunerSlot = feinfo.get("tuner_number") + tunerType = [ ] + fakeRecService = NavigationInstance.instance.recordService(timer.service_ref, True) + if fakeRecService: + fakeRecResult = fakeRecService.start(True) + else: + fakeRecResult = -1 + if not fakeRecResult: # tune okay + feinfo = fakeRecService.frontendInfo().getFrontendData() + tunerType.append(feinfo.get("tuner_type")) + else: # tune failed.. so we must go another way to get service type (DVB-S, DVB-T, DVB-C) + + def getServiceType(ref): # helper function to get a service type of a service reference + serviceInfo = serviceHandler.info(ref) + serviceInfo = serviceInfo and serviceInfo.getInfoObject(ref, iServiceInformation.sTransponderData) + if serviceInfo: + return { "Satellite" : "DVB-S", "Cable" : "DVB-C", "Terrestrial" : "DVB-T"}[serviceInfo["type"]] + + ref = timer.service_ref.ref + if ref.flags & eServiceReference.isGroup: # service group ? + serviceList = serviceHandler.list(ref) # get all alternative services + if serviceList: + for ref in serviceList.getContent("R"): # iterate over all group service references + type = getServiceType(ref) + if not type in tunerType: # just add single time + tunerType.append(type) + else: + tunerType.append(getServiceType(ref)) + if event[2] == -1: # new timer newTimerTunerType = tunerType - newTimerTunerSlot = tunerSlot - overlaplist.append((fakeRecResult, timer, tunerType, tunerSlot)) + overlaplist.append((fakeRecResult, timer, tunerType)) fakeRecList.append((timer, fakeRecService)) if fakeRecResult: if ConflictTimer is None: # just take care of the first conflict ConflictTimer = timer ConflictTunerType = tunerType - ConflictTunerSlot = tunerSlot elif event[1] == self.eflag: for fakeRec in fakeRecList: - if timer == fakeRec[0]: + if timer == fakeRec[0] and fakeRec[1]: NavigationInstance.instance.stopRecordService(fakeRec[1]) fakeRecList.remove(fakeRec) del fakeRec @@ -211,7 +229,6 @@ class TimerSanityCheck: if nt and kt: ConflictTimer = self.newtimer ConflictTunerType = newTimerTunerType - ConflictSlot = newTimerTunerSlot break self.simultimer = [ ConflictTimer ] @@ -223,8 +240,11 @@ class TimerSanityCheck: else: continue for entry in event[4]: - if not self.simultimer.count(entry[1]) and (entry[2] == ConflictTunerType or entry[3] == ConflictTunerSlot): - self.simultimer.append(entry[1]) + if not entry[1] in self.simultimer: + for x in entry[2]: + if x in ConflictTunerType: + self.simultimer.append(entry[1]) + break if len(self.simultimer) < 2: print "Bug: unknown Conflict!" -- cgit v1.2.3 From 2aa5cf5a1bfe64fbb1ef6b082920c82ff927007a Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 Nov 2008 00:23:39 +0100 Subject: fix rotor input current measurement default value for dm8000 --- lib/python/Components/NimManager.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 3c7a147e..434ab4aa 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1,3 +1,5 @@ +from Tools.HardwareInfo import HardwareInfo + from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, \ ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, \ ConfigSubDict, ConfigOnOff, ConfigDateTime @@ -153,6 +155,7 @@ class SecConfigure: for slot in nim_slots: x = slot.slot nim = slot.config + hw = HardwareInfo() if slot.isCompatible("DVB-S"): print "slot: " + str(x) + " configmode: " + str(nim.configMode.value) if nim.configMode.value in [ "loopthrough", "satposdepends", "nothing" ]: @@ -185,7 +188,7 @@ class SecConfigure: loValue = rotorParam.EAST else: loValue = rotorParam.WEST - inputPowerDelta=50 + inputPowerDelta=hw.get_device_name() == "dm8000" and 50 or 15 useInputPower=False turning_speed=0 if nim.powerMeasurement.value: @@ -842,6 +845,7 @@ def InitSecParams(): def InitNimManager(nimmgr): InitSecParams() + hw = HardwareInfo() config.Nims = ConfigSubList() for x in range(len(nimmgr.nim_slots)): @@ -972,7 +976,7 @@ def InitNimManager(nimmgr): nim.advanced.lnb[x].latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)]) nim.advanced.lnb[x].latitudeOrientation = ConfigSelection(choices = [("north", _("North")), ("south", _("South"))], default = "north") nim.advanced.lnb[x].powerMeasurement = ConfigYesNo(default=True) - nim.advanced.lnb[x].powerThreshold = ConfigInteger(default=50, limits=(0, 100)) + nim.advanced.lnb[x].powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) nim.advanced.lnb[x].turningSpeed = ConfigSelection(choices = [("fast", _("Fast")), ("slow", _("Slow")), ("fast epoch", _("Fast epoch"))], default = "fast") btime = datetime(1970, 1, 1, 7, 0); nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 600) -- cgit v1.2.3 From cb725de8216cb61d0a889b3a6a7651619161ef08 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 Nov 2008 00:28:33 +0100 Subject: 15 <-> 50 --- lib/python/Components/NimManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 434ab4aa..1ee8dddd 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -188,7 +188,7 @@ class SecConfigure: loValue = rotorParam.EAST else: loValue = rotorParam.WEST - inputPowerDelta=hw.get_device_name() == "dm8000" and 50 or 15 + inputPowerDelta=hw.get_device_name() == "dm8000" and 15 or 50 useInputPower=False turning_speed=0 if nim.powerMeasurement.value: -- cgit v1.2.3 From d3a03446578d5cf77ea3f2128aa3aeee434a23b8 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 Nov 2008 00:52:00 +0100 Subject: fix typos --- lib/python/Components/NimManager.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 1ee8dddd..3c1fe455 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -659,7 +659,7 @@ class NimManager: def canEqualTo(self, slotid): type = self.getNimType(slotid) - if self.getNimConfig(slotid) == "DVB-S2": + if type == "DVB-S2": type = "DVB-S" nimList = self.getNimListOfType(type, slotid) for nim in nimList[:]: @@ -667,10 +667,10 @@ class NimManager: if mode.configMode.value == "loopthrough" or mode.configMode.value == "satposdepends": nimList.remove(nim) return nimList - + def canDependOn(self, slotid): type = self.getNimType(slotid) - if self.getNimConfig(slotid) == "DVB-S2": + if type == "DVB-S2": type = "DVB-S" nimList = self.getNimListOfType(type, slotid) positionerList = [] -- cgit v1.2.3 From ae5651346d0b371a89287365003466fef729b72a Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 Nov 2008 01:01:18 +0100 Subject: add possibility to select "second cable of motorized LNB" also when the rotor is configured in advanced mode --- lib/python/Components/NimManager.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 3c1fe455..32fca47f 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -683,6 +683,13 @@ class NimManager: if lnb != 0: nimHaveRotor = True break + if not nimHaveRotor: + for sat in mode.advanced.sat.values(): + lnb_num = int(sat.lnb.value) + diseqcmode = lnb_num and mode.advanced.lnb[lnb_num].diseqcMode.value or "" + if diseqcmode == "1_2": + nimHaveRotor = True + break if nimHaveRotor: alreadyConnected = False for testnim in nimList: -- cgit v1.2.3 From acbad24424304473f967b678bd9deb51f73acf27 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 10 Nov 2008 10:12:53 +0100 Subject: long keypress on INFO key either brings up single servie EPG view screen like right now or, if any plugins of new type WHERE_EVENTINFO are installed (e.g. GraphMultiEPG, IMDB, OFDB), a choicebox with the relevant plugins. consequence: GraphMultiEPG is no longer ran from extensions menu (blue button) but by long keypress on INFO button instead! --- data/keymap.xml | 4 ++-- .../Plugins/Extensions/GraphMultiEPG/plugin.py | 2 +- lib/python/Plugins/Plugin.py | 4 ++++ lib/python/Screens/InfoBarGenerics.py | 22 +++++++++++++++++++--- 4 files changed, 26 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/data/keymap.xml b/data/keymap.xml index 5e73490e..6b8b583d 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -77,8 +77,8 @@ - - + + diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py index 7afbe14a..21d1bfe8 100644 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py @@ -93,4 +93,4 @@ def main(session, servicelist, **kwargs): def Plugins(**kwargs): name = _("Graphical Multi EPG") descr = _("A graphical EPG for all services of an specific bouquet") - return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ] + return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EVENTINFO, fnc=main) ] diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index a0db1d66..6df4fce7 100644 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -45,6 +45,10 @@ class PluginDescriptor: # or return a function which is called with session and the interface name for extended setup of this interface WHERE_NETWORKSETUP = 10 + # show up this plugin (or a choicebox with all of them) for long INFO keypress + # or return a function which is called with session and the interface name for extended setup of this interface + WHERE_EVENTINFO = 11 + def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False): self.name = name self.internal = internal diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index aab2b649..cdaa2c1e 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -403,8 +403,8 @@ class InfoBarEPG: self.eventView = None self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { - "showEventInfo": (self.openEventView, _("show EPG...")), - "showSingleServiceEPG": (self.openSingleServiceEPG, _("show single service EPG...")), + "showEventView": (self.openEventView, _("show EPG...")), + "showEventInfoPlugin": (self.showEventInfoPlugins, _("show single service EPG...")), "showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible, }) @@ -489,6 +489,23 @@ class InfoBarEPG: ref=self.session.nav.getCurrentlyPlayingServiceReference() self.session.open(EPGSelection, ref) + def showEventInfoPlugins(self): + list = [] + for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO): + list.append((p.name, boundFunction(self.runPlugin, p))) + if len(list): + list.append((_("show single service EPG..."), self.openSingleServiceEPG)) + self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list) + else: + self.openSingleServiceEPG() + + def runPlugin(self, plugin): + plugin(session = self.session, servicelist = self.servicelist) + + def EventInfoPluginChosen(self, answer): + if answer is not None: + answer[1]() + def openSimilarList(self, eventid, refstr): self.session.open(EPGSelection, refstr, None, eventid) @@ -1258,7 +1275,6 @@ class InfoBarExtensions: from Tools.BoundFunction import boundFunction # depends on InfoBarExtensions -from Components.PluginComponent import plugins class InfoBarPlugins: def __init__(self): -- cgit v1.2.3 From a6419d3f83e63b356dadaf67ef77dd983f20147a Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sun, 9 Nov 2008 23:55:10 +0100 Subject: on crash, read "maintainer.info" from directory which contained the file which crashed. Use first line as email address, second line as "component"-string in crashlogs. Please add a "maintainer.info"-file to your plugins so crashlogs will be redirected to the right address. --- .../Plugins/DemoPlugins/TestPlugin/Makefile.am | 1 + .../Plugins/DemoPlugins/TestPlugin/maintainer.info | 2 + .../Plugins/DemoPlugins/TestPlugin/plugin.py | 2 + main/bsod.cpp | 53 ++++++++++++++++++---- 4 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 lib/python/Plugins/DemoPlugins/TestPlugin/maintainer.info (limited to 'lib/python') diff --git a/lib/python/Plugins/DemoPlugins/TestPlugin/Makefile.am b/lib/python/Plugins/DemoPlugins/TestPlugin/Makefile.am index 8173b373..2c52330f 100644 --- a/lib/python/Plugins/DemoPlugins/TestPlugin/Makefile.am +++ b/lib/python/Plugins/DemoPlugins/TestPlugin/Makefile.am @@ -4,3 +4,4 @@ install_PYTHON = \ __init__.py \ plugin.py +install_DATA = maintainer.info diff --git a/lib/python/Plugins/DemoPlugins/TestPlugin/maintainer.info b/lib/python/Plugins/DemoPlugins/TestPlugin/maintainer.info new file mode 100644 index 00000000..4f285613 --- /dev/null +++ b/lib/python/Plugins/DemoPlugins/TestPlugin/maintainer.info @@ -0,0 +1,2 @@ +tmbinc@elitedvb.net +Demo-Plugin diff --git a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py index 1f49a9e3..a63562c8 100644 --- a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py @@ -50,6 +50,8 @@ class Test(Screen): def mycallback(self, answer): print "answer:", answer + if answer: + raise "test-crash" self.close() def keyLeft(self): diff --git a/main/bsod.cpp b/main/bsod.cpp index 42f83052..173a2cce 100644 --- a/main/bsod.cpp +++ b/main/bsod.cpp @@ -65,6 +65,8 @@ static void addToLogbuffer(int level, const std::string &log) extern std::string getLogBuffer(); +#define INFOFILE "/maintainer.info" + void bsodFatal() { char logfile[128]; @@ -72,6 +74,39 @@ void bsodFatal() FILE *f = fopen(logfile, "wb"); std::string lines = getLogBuffer(); + + /* find python-tracebacks, and extract " File "-strings */ + size_t start = 0; + + char crash_emailaddr[256] = CRASH_EMAILADDR; + char crash_component[256] = "enigma2"; + + while ((start = lines.find("\n File \"", start)) != std::string::npos) + { + start += 9; + size_t end = lines.find("\"", start); + if (end == std::string::npos) + break; + end = lines.rfind("/", end); + if (end == std::string::npos) + break; + if (end - start >= (256 - strlen(INFOFILE))) + continue; + char filename[256]; + snprintf(filename, 256, "%s%s", lines.substr(start, end - start).c_str(), INFOFILE); + FILE *cf = fopen(filename, "r"); + if (cf) + { + fgets(crash_emailaddr, sizeof crash_emailaddr, cf); + if (*crash_emailaddr && crash_emailaddr[strlen(crash_emailaddr)-1] == '\n') + crash_emailaddr[strlen(crash_emailaddr)-1] = 0; + + fgets(crash_component, sizeof crash_component, cf); + if (*crash_component && crash_component[strlen(crash_component)-1] == '\n') + crash_component[strlen(crash_component)-1] = 0; + fclose(cf); + } + } if (f) { @@ -85,7 +120,7 @@ void bsodFatal() #ifdef ENIGMA2_CHECKOUT_ROOT fprintf(f, "enigma2 checked out from " ENIGMA2_CHECKOUT_ROOT "\n"); #endif - fprintf(f, "please email this file to " CRASH_EMAILADDR "\n"); + fprintf(f, "please email this file to %s\n", crash_emailaddr); std::string buffer = getLogBuffer(); fwrite(buffer.c_str(), buffer.size(), 1, f); fclose(f); @@ -134,14 +169,16 @@ void bsodFatal() p.clear(); eRect usable_area = eRect(100, 70, my_dc->size().width() - 150, 100); + + char text[512]; + snprintf(text, 512, "We are really sorry. Your Dreambox encountered " + "a software problem, and needs to be restarted. " + "Please send the logfile created in /hdd/ to %s.\n" + "Your Dreambox restarts in 10 seconds!\n" + "Component: %s", + crash_emailaddr, crash_component); - p.renderText(usable_area, - "We are really sorry. Something happened " - "which should not have happened, and " - "resulted in a crash. If you want to help " - "us in improving this situation, please send " - "the logfile created in /hdd/ to " CRASH_EMAILADDR "." - "Your receiver restarts in 10 seconds !", gPainter::RT_WRAP|gPainter::RT_HALIGN_LEFT); + p.renderText(usable_area, text, gPainter::RT_WRAP|gPainter::RT_HALIGN_LEFT); usable_area = eRect(100, 170, my_dc->size().width() - 180, my_dc->size().height() - 20); -- cgit v1.2.3 From c138841fc86578cb4344a305cc2ca7e0f7fd4ca8 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 10 Nov 2008 16:15:44 +0100 Subject: remove unneeded calls to iNetwork.getinterfaces cleanups fix typo --- lib/python/Components/Network.py | 7 ++++--- lib/python/Screens/NetworkSetup.py | 21 +++++++++------------ 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index c41469da..7cc61d84 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -505,9 +505,10 @@ class Network: def deactivateInterfaceFinished(self,extra_args): callback = extra_args - if len(self.deactivateInterfaceConsole.appContainers) == 0: - if callback is not None: - callback(True) + if self.deactivateInterfaceConsole: + if len(self.deactivateInterfaceConsole.appContainers) == 0: + if callback is not None: + callback(True) def detectWlanModule(self): self.wlanmodule = None diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index 580673e4..6bfe54ad 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -90,7 +90,6 @@ class NetworkAdapterSelection(Screen,HelpableScreen): self.onClose.append(self.cleanup) def updateList(self): - iNetwork.getInterfaces() self.list = [] default_gw = None num_configured_if = len(iNetwork.getConfiguredAdapters()) @@ -290,7 +289,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.finished_cb = None self.oktext = _("Press OK on your remote control to continue.") self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") - + self.createConfig() self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", @@ -675,8 +674,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): def cleanup(self): iNetwork.stopLinkStateConsole() - iNetwork.stopDeactivateInterfaceConsole() - + class AdapterSetupConfiguration(Screen, HelpableScreen): def __init__(self, session,iface): @@ -732,7 +730,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): "right": self.right, }, -2) - iNetwork.getInterfaces(self.updateStatusbar) + self.updateStatusbar() self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.cleanup) @@ -908,11 +906,11 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): else: self.mainmenu = self.genMainMenu() self["menulist"].l.setList(self.mainmenu) - iNetwork.getInterfaces(self.updateStatusbar) + self.updateStatusbar() else: self.mainmenu = self.genMainMenu() self["menulist"].l.setList(self.mainmenu) - iNetwork.getInterfaces(self.updateStatusbar) + self.updateStatusbar() def WlanStatusClosed(self, *ret): if ret is not None and len(ret): @@ -920,7 +918,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): iStatus.stopWlanConsole() self.mainmenu = self.genMainMenu() self["menulist"].l.setList(self.mainmenu) - iNetwork.getInterfaces(self.updateStatusbar) + self.updateStatusbar() def WlanScanClosed(self,*ret): if ret[0] is not None: @@ -930,7 +928,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): iStatus.stopWlanConsole() self.mainmenu = self.genMainMenu() self["menulist"].l.setList(self.mainmenu) - iNetwork.getInterfaces(self.updateStatusbar) + self.updateStatusbar() def restartLan(self, ret = False): if (ret == True): @@ -955,9 +953,9 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): pattern = re_compile("Link detected: yes") for item in result: if re_search(pattern, item): - self["statuspic"].setPixmapNum(1) - else: self["statuspic"].setPixmapNum(0) + else: + self["statuspic"].setPixmapNum(1) self["statuspic"].show() def showErrorMessage(self): @@ -988,7 +986,6 @@ class NetworkAdapterTest(Screen): Screen.__init__(self, session) self.iface = iface self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") - iNetwork.getInterfaces() self.setLabels() self.onClose.append(self.cleanup) self.onHide.append(self.cleanup) -- cgit v1.2.3 From b0e31efd2aca2cb7774f031e2d23e0e4d0668dbc Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 11 Nov 2008 19:12:46 +0100 Subject: change default input power current for dm8000 (for rotor turning) --- lib/python/Components/NimManager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 32fca47f..e1d3b068 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -188,12 +188,11 @@ class SecConfigure: loValue = rotorParam.EAST else: loValue = rotorParam.WEST - inputPowerDelta=hw.get_device_name() == "dm8000" and 15 or 50 + inputPowerDelta=nim.powerThreshold.value useInputPower=False turning_speed=0 if nim.powerMeasurement.value: useInputPower=True - inputPowerDelta=nim.powerThreshold.value turn_speed_dict = { "fast": rotorParam.FAST, "slow": rotorParam.SLOW } if turn_speed_dict.has_key(nim.turningSpeed.value): turning_speed = turn_speed_dict[nim.turningSpeed.value] @@ -908,7 +907,7 @@ def InitNimManager(nimmgr): nim.latitude = ConfigFloat(default=[50,767], limits=[(0,359),(0,999)]) nim.latitudeOrientation = ConfigSelection(choices={"north": _("North"), "south": _("South")}, default="north") nim.powerMeasurement = ConfigYesNo(default=True) - nim.powerThreshold = ConfigInteger(default=50, limits=(0, 100)) + nim.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) nim.turningSpeed = ConfigSelection(choices = [("fast", _("Fast")), ("slow", _("Slow")), ("fast epoch", _("Fast epoch")) ], default = "fast") btime = datetime(1970, 1, 1, 7, 0); nim.fastTurningBegin = ConfigDateTime(default = mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 900) -- cgit v1.2.3 From a6bde254f00e1cab9871d60f583c18999c08ca71 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 11 Nov 2008 19:19:09 +0100 Subject: use multiple titlesets for dvd authoring which allows correct burning of videos with different audio tracks introduce title properties screen. this is still a draft version. --- .../Plugins/Extensions/DVDBurn/DVDProject.py | 2 +- lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py | 85 +++++++++++- .../DVDBurn/DreamboxDVDtemplate.ddvdp.xml | 2 +- lib/python/Plugins/Extensions/DVDBurn/Makefile.am | 2 +- lib/python/Plugins/Extensions/DVDBurn/Process.py | 154 +++++++++++++++------ .../Plugins/Extensions/DVDBurn/TitleCutter.py | 23 ++- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 69 +++++---- .../Plugins/Extensions/DVDBurn/TitleProperties.py | 152 ++++++++++++++++++++ lib/python/Plugins/Extensions/DVDBurn/keymap.xml | 2 +- 9 files changed, 398 insertions(+), 93 deletions(-) create mode 100644 lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 8d02cb22..55a72c10 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py @@ -1,5 +1,5 @@ from Tools.Directories import fileExists -from Components.config import config, ConfigSubsection, ConfigInteger, ConfigYesNo, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence +from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence class ConfigColor(ConfigSequence): def __init__(self): diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py index 1bfb3d64..1ada9ce2 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py @@ -1,17 +1,35 @@ +from Components.config import config, ConfigSubsection, ConfigSubList, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigYesNo + +class ConfigFixedText(ConfigText): + def __init__(self, text, visible_width=60): + ConfigText.__init__(self, default = text, fixed_size = True, visible_width = visible_width) + def handleKey(self, key): + pass + +class ConfigActiveTrack(ConfigYesNo): + def __init__(self, default = True): + ConfigYesNo.__init__(self, default) + class DVDTitle: def __init__(self): + self.properties = ConfigSubsection() + self.properties.menutitle = ConfigText(fixed_size = False, visible_width = 80) + self.properties.menusubtitle = ConfigText(fixed_size = False, visible_width = 80) + self.DVBname = _("Title") + self.DVBdescr = _("Description") + self.DVBchannel = _("Channel") + self.properties.aspect = ConfigSelection(choices = [("4:3", "4:3"), ("16:9", "16:9")]) + self.properties.widescreen = ConfigSelection(choices = [("nopanscan", "nopanscan"), ("noletterbox", "noletterbox")]) + self.properties.audiotracks = ConfigSubList() self.cuesheet = [ ] self.source = None - self.name = "" - self.descr = "" self.filesize = 0 self.estimatedDiskspace = 0 self.inputfile = "" self.cutlist = [ ] self.chaptermarks = [ ] - self.audiotracks = [ ] self.timeCreate = None - self.sVideoType = -1 + self.VideoType = -1 def addService(self, service): from os import path @@ -21,18 +39,61 @@ class DVDTitle: self.source = service serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(service) - self.descr = info and " " + info.getInfoString(service, iServiceInformation.sDescription) or "" + sDescr = info and " " + info.getInfoString(service, iServiceInformation.sDescription) or "" + self.DVBdescr = sDescr sTimeCreate = info.getInfo(service, iServiceInformation.sTimeCreate) if sTimeCreate > 1: self.timeCreate = localtime(sTimeCreate) serviceref = ServiceReference(info.getInfoString(service, iServiceInformation.sServiceref)) - self.name = info and info.getName(service) or "Title" + t.descr - self.channel = serviceref.getServiceName() + name = info and info.getName(service) or "Title" + sDescr + self.DVBname = name + self.DVBchannel = serviceref.getServiceName() self.inputfile = service.getPath() self.filesize = path.getsize(self.inputfile) self.estimatedDiskspace = self.filesize self.length = info.getLength(service) + def initDVDmenuText(self, project, track): + self.properties.menutitle.setValue(self.formatDVDmenuText(project.settings.titleformat.getValue(), track)) + self.properties.menusubtitle.setValue(self.formatDVDmenuText(project.settings.subtitleformat.getValue(), track)) + + def formatDVDmenuText(self, template, track): + properties = self.properties + template = template.replace("$i", str(track)) + template = template.replace("$t", self.DVBname) + template = template.replace("$d", self.DVBdescr) + template = template.replace("$c", str(len(self.chaptermarks)+1)) + template = template.replace("$f", self.inputfile) + template = template.replace("$C", self.DVBchannel) + + #if template.find("$A") >= 0: + from TitleProperties import languageChoices + audiolist = [ ] + for audiotrack in self.properties.audiotracks: + active = audiotrack.active.getValue() + if active: + trackstring = audiotrack.format.getValue() + language = audiotrack.language.getValue() + if languageChoices.langdict.has_key(language): + trackstring += ' (' + languageChoices.langdict[language] + ')' + audiolist.append(trackstring) + audiostring = ', '.join(audiolist) + template = template.replace("$A", audiostring) + + if template.find("$l") >= 0: + l = self.length + lengthstring = "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) + template = template.replace("$l", lengthstring) + if self.timeCreate: + template = template.replace("$Y", str(self.timeCreate[0])) + template = template.replace("$M", str(self.timeCreate[1])) + template = template.replace("$D", str(self.timeCreate[2])) + timestring = "%d:%02d" % (self.timeCreate[3], self.timeCreate[4]) + template = template.replace("$T", timestring) + else: + template = template.replace("$Y", "").replace("$M", "").replace("$D", "").replace("$T", "") + return template + def produceFinalCuesheet(self): CUT_TYPE_IN = 0 CUT_TYPE_OUT = 1 @@ -84,3 +145,13 @@ class DVDTitle: while chapterpts < self.length*90000: chapterpts += 90000 * 60 * minutes self.chaptermarks.append(chapterpts) + + def getChapterMarks(self): + timestamps = [] + for p in self.chaptermarks: + h = p / (90000 * 3600) + m = p % (90000 * 3600) / (90000 * 60) + s = p % (90000 * 60) / 90000 + ms = (p % 90000) / 90 + timestamps.append("%d:%02d:%02d.%03d" % (h, m, s, ms)) + return timestamps \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml b/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml index d9831e63..9a61214a 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml +++ b/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml @@ -4,7 +4,7 @@ name="Dreambox DVD record" authormode="menu_linked" titleformat="$i. $t" - subtitleformat="$D.$M.$Y, $T $C, $d ($c chapters)" + subtitleformat="$D.$M.$Y, $T $C, $d" vmgm="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg" menubg="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/dreamdvd_boat.jpg" menuaudio="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/silence.mp2" diff --git a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am index cb65f56a..be89ebaa 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am @@ -3,7 +3,7 @@ installdir = $(LIBDIR)/enigma2/python/Plugins/Extensions/DVDBurn install_PYTHON = \ __init__.py \ plugin.py \ - DVDProject.py DVDTitle.py TitleCutter.py TitleList.py Process.py ProjectSettings.py DVDToolbox.py + DVDProject.py DVDTitle.py TitleCutter.py TitleList.py TitleProperties.py Process.py ProjectSettings.py DVDToolbox.py install_DATA = *.xml *.jpg *.mpg *.mp2 *.png diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 49054596..3cf874c0 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -85,23 +85,34 @@ class DemuxTask(Task): title = job.project.titles[job.i] self.global_preconditions.append(DiskspacePrecondition(title.estimatedDiskspace)) self.setTool("/usr/bin/projectx") - self.generated_files = [ ] + self.args += [inputfile, "-demux", "-out", self.job.workspace ] self.end = 300 self.prog_state = 0 self.weighting = 1000 self.cutfile = self.job.workspace + "/cut_%d.Xcl" % (job.i+1) self.cutlist = title.cutlist - self.args += [inputfile, "-demux", "-out", self.job.workspace ] + self.currentPID = None + self.relevantAudioPIDs = [ ] + self.getRelevantAudioPIDs(title) + self.generated_files = [ ] + self.mplex_streamfiles = [ ] if len(self.cutlist) > 1: self.args += [ "-cut", self.cutfile ] def prepare(self): self.writeCutfile() + def getRelevantAudioPIDs(self, title): + for audiotrack in title.properties.audiotracks: + if audiotrack.active.getValue(): + self.relevantAudioPIDs.append(audiotrack.pid.getValue()) + def processOutputLine(self, line): line = line[:-1] MSG_NEW_FILE = "---> new File: " MSG_PROGRESS = "[PROGRESS] " + MSG_NEW_MP2 = "--> MPEG Audio (0x" + MSG_NEW_AC3 = "--> AC-3/DTS Audio on PID " if line.startswith(MSG_NEW_FILE): file = line[len(MSG_NEW_FILE):] @@ -111,10 +122,14 @@ class DemuxTask(Task): elif line.startswith(MSG_PROGRESS): progress = line[len(MSG_PROGRESS):] self.haveProgress(progress) + elif line.startswith(MSG_NEW_MP2) or line.startswith(MSG_NEW_AC3): + self.currentPID = str(int(line.rstrip()[-6:].rsplit('0x',1)[-1],16)) def haveNewFile(self, file): - print "PRODUCED FILE [%s]" % file + print "[DemuxTask] produced file:", file self.generated_files.append(file) + if self.currentPID in self.relevantAudioPIDs or file.endswith("m2v"): + self.mplex_streamfiles.append(file) def haveProgress(self, progress): #print "PROGRESS [%s]" % progress @@ -131,7 +146,6 @@ class DemuxTask(Task): if p > self.progress: self.progress = p except ValueError: - print "val error" pass def writeCutfile(self): @@ -151,8 +165,8 @@ class DemuxTask(Task): def cleanup(self, failed): if failed: import os - for f in self.generated_files: - os.remove(f) + for file in self.generated_files.itervalues(): + os.remove(file) class MplexTaskPostcondition(Condition): def check(self, task): @@ -185,9 +199,9 @@ class MplexTask(Task): # we don't want the ReturncodePostcondition in this case because for right now we're just gonna ignore the fact that mplex fails with a buffer underrun error on some streams (this always at the very end) def prepare(self): - self.error = None + self.error = None if self.demux_task: - self.args += self.demux_task.generated_files + self.args += self.demux_task.mplex_streamfiles def processOutputLine(self, line): print "[MplexTask] ", line[:-1] @@ -206,7 +220,7 @@ class RemoveESFiles(Task): def prepare(self): self.args += ["-f"] - self.args += self.demux_task.generated_files + self.args += self.demux_task.generated_files.values() self.args += [self.demux_task.cutfile] class DVDAuthorTask(Task): @@ -411,27 +425,6 @@ class PreviewTaskPostcondition(Condition): def getErrorMessage(self, task): return "Cancel" -def formatTitle(template, title, track): - template = template.replace("$i", str(track)) - template = template.replace("$t", title.name) - template = template.replace("$d", title.descr) - template = template.replace("$c", str(len(title.chaptermarks)+1)) - template = template.replace("$A", str(title.audiotracks)) - template = template.replace("$f", title.inputfile) - template = template.replace("$C", title.channel) - l = title.length - lengthstring = "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) - template = template.replace("$l", lengthstring) - if title.timeCreate: - template = template.replace("$Y", str(title.timeCreate[0])) - template = template.replace("$M", str(title.timeCreate[1])) - template = template.replace("$D", str(title.timeCreate[2])) - timestring = "%d:%02d" % (title.timeCreate[3], title.timeCreate[4]) - template = template.replace("$T", timestring) - else: - template = template.replace("$Y", "").replace("$M", "").replace("$D", "").replace("$T", "") - return template.decode("utf-8") - class ImagingPostcondition(Condition): def check(self, task): return task.returncode == 0 @@ -518,14 +511,13 @@ class MenuImageTask(Task): menu_end_title = nr_titles+1 menu_i = 0 for title_no in range( menu_start_title , menu_end_title ): - i = title_no-1 - top = s_top + ( menu_i * rowheight ) menu_i += 1 - title = self.job.project.titles[i] - titleText = formatTitle(s.titleformat.getValue(), title, title_no) + title = self.job.project.titles[title_no-1] + top = s_top + ( menu_i * rowheight ) + titleText = title.formatDVDmenuText(s.titleformat.getValue(), title_no).decode("utf-8") draw_bg.text((s_left,top), titleText, fill=self.Menus.color_button, font=fonts[1]) draw_high.text((s_left,top), titleText, fill=1, font=self.Menus.fonts[1]) - subtitleText = formatTitle(s.subtitleformat.getValue(), title, title_no) + subtitleText = title.formatDVDmenuText(s.subtitleformat.getValue(), title_no).decode("utf-8") draw_bg.text((s_left,top+36), subtitleText, fill=self.Menus.color_button, font=fonts[2]) bottom = top+rowheight if bottom > self.Menus.imgheight: @@ -607,7 +599,7 @@ class Menus: menuoutputfilename = job.workspace+"/dvdmenu"+num+".mpg" spumuxTask(job, spuxmlfilename, menubgmpgfilename, menuoutputfilename) -def CreateAuthoringXML(job): +def CreateAuthoringXML_simple(job): nr_titles = len(job.project.titles) mode = job.project.settings.authormode.getValue() authorxml = [] @@ -649,9 +641,7 @@ def CreateAuthoringXML(job): authorxml.append(' \n') authorxml.append(' \n') for i in range( nr_titles ): - #for audiotrack in job.project.titles[i].audiotracks: - #authorxml.append('