From e5953c16c3ff3664f0f7a763f242a3eb69fed19d Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 2 Nov 2009 16:02:59 +0100 Subject: Revert "disable m2ts support for release 2.6" This reverts commit bce2a7b606d6fdfdcac86c7ccc1c02f147dc26c9. --- lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 2 +- 1 file changed, 1 insertion(+), 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 0e3bdf02..596f2d5a 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -110,7 +110,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB # 'None' is magic to start at the list of mountpoints defaultDir = config.mediaplayer.defaultDir.getValue() - self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") + self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|m2ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") self["filelist"] = self.filelist self.playlist = MyPlayList() -- cgit v1.2.3 From 3434371ea1aa6f585ef4bb406ba5ac4e4e06a7ee Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 2 Nov 2009 16:04:08 +0100 Subject: Revert "disable unicable for release 2.6" This reverts commit 597d64c2e00be8759286e37fd15823b1c1518845. --- 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 5154e2b0..70cde47c 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -939,7 +939,7 @@ def InitNimManager(nimmgr): lnb_choices = { "universal_lnb": _("Universal LNB"), -# "unicable": _("Unicable"), + "unicable": _("Unicable"), "c_band": _("C-Band"), "user_defined": _("User defined")} -- cgit v1.2.3 From e6a3b9fdb8f5ac0774a27794b175d79cf0973976 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 4 Nov 2009 12:59:17 +0100 Subject: DVDBurn fix capacity report for full dual layer media in Media Toolbox --- .../Plugins/Extensions/DVDBurn/DVDToolbox.py | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py index feb39a95..53287a36 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py @@ -82,7 +82,9 @@ class DVDToolbox(Screen): self.update() def mediainfoCB(self, mediuminfo, retval, extra_args): - capacity = 1 + formatted_capacity = 0 + read_capacity = 0 + capacity = 0 used = 0 infotext = "" mediatype = "" @@ -93,21 +95,17 @@ class DVDToolbox(Screen): self.formattable = True else: self.formattable = False - if line.find("Legacy lead-out at:") > -1: + elif line.find("Legacy lead-out at:") > -1: used = int(line.rsplit('=',1)[1]) / 1048576.0 - print "[lead out] used =", used + print "[dvd+rw-mediainfo] lead out used =", used elif line.find("formatted:") > -1: - capacity = int(line.rsplit('=',1)[1]) / 1048576.0 - print "[formatted] capacity =", capacity - elif capacity == 1 and line.find("READ CAPACITY:") > -1: - capacity = int(line.rsplit('=',1)[1]) / 1048576.0 - print "[READ CAP] capacity =", capacity - elif line.find("Disc status:") > -1: - if line.find("blank") > -1: - print "[Disc status] capacity=%d, used=0" % (capacity) - capacity = used - used = 0 - elif line.find("Free Blocks:") > -1: + formatted_capacity = int(line.rsplit('=',1)[1]) / 1048576.0 + print "[dvd+rw-mediainfo] formatted capacity =", formatted_capacity + elif formatted_capacity == 0 and line.find("READ CAPACITY:") > -1: + read_capacity = int(line.rsplit('=',1)[1]) / 1048576.0 + print "[dvd+rw-mediainfo] READ CAPACITY =", read_capacity + for line in mediuminfo.splitlines(): + if line.find("Free Blocks:") > -1: try: size = eval(line[14:].replace("KB","*1024")) except: @@ -116,8 +114,22 @@ class DVDToolbox(Screen): capacity = size / 1048576 if used: used = capacity-used - print "[free blocks] capacity=%d, used=%d" % (capacity, used) + print "[dvd+rw-mediainfo] free blocks capacity=%d, used=%d" % (capacity, used) + elif line.find("Disc status:") > -1: + if line.find("blank") > -1: + print "[dvd+rw-mediainfo] Disc status blank capacity=%d, used=0" % (capacity) + capacity = used + used = 0 + elif line.find("complete") > -1 and formatted_capacity == 0: + print "[dvd+rw-mediainfo] Disc status complete capacity=0, used=%d" % (capacity) + used = read_capacity + capacity = 1 + else: + capacity = formatted_capacity infotext += line+'\n' + if capacity and used > capacity: + used = read_capacity or capacity + capacity = formatted_capacity or capacity self["details"].setText(infotext) if self.formattable: self["key_yellow"].text = _("Format") -- cgit v1.2.3 From 1915c7f7dbbec39c4d5592d9a0bee5454e4c452c Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Nov 2009 08:34:03 +0100 Subject: add missing file --- lib/python/Screens/RecordPaths.py | 194 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 lib/python/Screens/RecordPaths.py (limited to 'lib/python') diff --git a/lib/python/Screens/RecordPaths.py b/lib/python/Screens/RecordPaths.py new file mode 100644 index 00000000..c833266f --- /dev/null +++ b/lib/python/Screens/RecordPaths.py @@ -0,0 +1,194 @@ +from Screens.Screen import Screen +from Screens.LocationBox import MovieLocationBox, TimeshiftLocationBox +from Screens.MessageBox import MessageBox +from Components.Label import Label +from Components.config import config, ConfigSelection, getConfigListEntry, configfile +from Components.ConfigList import ConfigListScreen +from Components.ActionMap import ActionMap +from Tools.Directories import fileExists + + +class RecordPathsSettings(Screen,ConfigListScreen): + skin = """ + + + + + + + """ + + def __init__(self, session): + from Components.Sources.StaticText import StaticText + Screen.__init__(self, session) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + ConfigListScreen.__init__(self, []) + self.initConfigList() + + self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], + { + "green": self.save, + "red": self.cancel, + "cancel": self.cancel, + "ok": self.ok, + }, -2) + + def checkReadWriteDir(self, configele): + print "checkReadWrite: ", configele.value + if configele.value in [x[0] for x in self.styles] or fileExists(configele.value, "w"): + configele.last_value = configele.value + return True + else: + dir = configele.value + configele.value = configele.last_value + self.session.open( + MessageBox, + _("The directory %s is not writable.\nMake sure you select a writable directory instead.")%dir, + type = MessageBox.TYPE_ERROR + ) + return False + + def initConfigList(self): + self.styles = [ ("", _("")), ("", _("")), ("", _("")) ] + styles_keys = [x[0] for x in self.styles] + tmp = config.movielist.videodirs.value + default = config.usage.default_path.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + print "DefaultPath: ", default, tmp + self.default_dirname = ConfigSelection(default = default, choices = tmp) + tmp = config.movielist.videodirs.value + default = config.usage.timer_path.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + print "TimerPath: ", default, tmp + self.timer_dirname = ConfigSelection(default = default, choices = self.styles+tmp) + tmp = config.movielist.videodirs.value + default = config.usage.instantrec_path.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + print "InstantrecPath: ", default, tmp + self.instantrec_dirname = ConfigSelection(default = default, choices = self.styles+tmp) + default = config.usage.timeshift_path.value + tmp = config.usage.allowed_timeshift_paths.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + print "TimeshiftPath: ", default, tmp + self.timeshift_dirname = ConfigSelection(default = default, choices = tmp) + self.default_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.timer_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.instantrec_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.timeshift_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + + self.list = [] + if config.usage.setup_level.index >= 2: + self.default_entry = getConfigListEntry(_("Default movie location"), self.default_dirname) + self.list.append(self.default_entry) + self.timer_entry = getConfigListEntry(_("Timer record location"), self.timer_dirname) + self.list.append(self.timer_entry) + self.instantrec_entry = getConfigListEntry(_("Instant record location"), self.instantrec_dirname) + self.list.append(self.instantrec_entry) + else: + self.default_entry = getConfigListEntry(_("Movie location"), self.default_dirname) + self.list.append(self.default_entry) + self.timeshift_entry = getConfigListEntry(_("Timeshift location"), self.timeshift_dirname) + self.list.append(self.timeshift_entry) + self["config"].setList(self.list) + + def ok(self): + currentry = self["config"].getCurrent() + self.lastvideodirs = config.movielist.videodirs.value + self.lasttimeshiftdirs = config.usage.allowed_timeshift_paths.value + if config.usage.setup_level.index >= 2: + txt = _("Default movie location") + else: + txt = _("Movie location") + if currentry == self.default_entry: + self.entrydirname = self.default_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + txt, + self.default_dirname.value + ) + elif currentry == self.timer_entry: + self.entrydirname = self.timer_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + _("Initial location in new timers"), + self.timer_dirname.value + ) + elif currentry == self.instantrec_entry: + self.entrydirname = self.instantrec_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + _("Location for instant recordings"), + self.instantrec_dirname.value + ) + elif currentry == self.timeshift_entry: + self.entrydirname = self.timeshift_dirname + config.usage.timeshift_path.value = self.timeshift_dirname.value + self.session.openWithCallback( + self.dirnameSelected, + TimeshiftLocationBox + ) + + def dirnameSelected(self, res): + if res is not None: + self.entrydirname.value = res + if config.movielist.videodirs.value != self.lastvideodirs: + styles_keys = [x[0] for x in self.styles] + tmp = config.movielist.videodirs.value + default = self.default_dirname.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + self.default_dirname.setChoices(tmp, default=default) + tmp = config.movielist.videodirs.value + default = self.timer_dirname.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + self.timer_dirname.setChoices(self.styles+tmp, default=default) + tmp = config.movielist.videodirs.value + default = self.instantrec_dirname.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + self.instantrec_dirname.setChoices(self.styles+tmp, default=default) + self.entrydirname.value = res + if config.usage.allowed_timeshift_paths.value != self.lasttimeshiftdirs: + tmp = config.usage.allowed_timeshift_paths.value + default = self.instantrec_dirname.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + self.timeshift_dirname.setChoices(tmp, default=default) + self.entrydirname.value = res + if self.entrydirname.last_value != res: + self.checkReadWriteDir(self.entrydirname) + + def save(self): + currentry = self["config"].getCurrent() + if self.checkReadWriteDir(currentry[1]): + config.usage.default_path.value = self.default_dirname.value + config.usage.timer_path.value = self.timer_dirname.value + config.usage.instantrec_path.value = self.instantrec_dirname.value + config.usage.timeshift_path.value = self.timeshift_dirname.value + config.usage.default_path.save() + config.usage.timer_path.save() + config.usage.instantrec_path.save() + config.usage.timeshift_path.save() + self.close() + + def cancel(self): + self.close() + -- cgit v1.2.3 From e66d0ee5f86946cf2d0c3dc5a0ea369917e0cfd3 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 11:43:37 +0100 Subject: Revert "small fix" This reverts commit 1c954ba161bc3cd4b838b3c5a423d41847f0382a. --- lib/python/Screens/InfoBarGenerics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index df853218..9a6a099c 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -910,8 +910,8 @@ class InfoBarSeek: def seekFwd(self): seek = self.getSeek() - if seek and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return @@ -945,8 +945,8 @@ class InfoBarSeek: def seekBack(self): seek = self.getSeek() - if seek and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return -- cgit v1.2.3 From 37e3c1814cc8ea6ef4eaef9a4bbc5d757d98972f Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 11:44:06 +0100 Subject: Revert "disable fast winding for non TS mediafiles until we have a usable solution for this.." This reverts commit b643641e2c6288eff61d0346a3dda82bd820b3b7. --- .../Extensions/DVDPlayer/src/servicedvd.cpp | 2 +- lib/python/Screens/InfoBarGenerics.py | 14 ------------ lib/service/servicedvb.cpp | 2 +- lib/service/servicemp3.cpp | 26 +--------------------- lib/service/servicexine.cpp | 2 +- 5 files changed, 4 insertions(+), 42 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 0372c497..94f2ee38 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -696,7 +696,7 @@ RESULT eServiceDVD::setTrickmode(int /*trick*/) RESULT eServiceDVD::isCurrentlySeekable() { - return m_state == stRunning ? 3 : 0; + return m_state == stRunning; } RESULT eServiceDVD::keyPressed(int key) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 9a6a099c..b98cd469 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -691,7 +691,6 @@ class InfoBarSeek: iPlayableService.evEOF: self.__evEOF, iPlayableService.evSOF: self.__evSOF, }) - self.fast_winding_hint_message_showed = False class InfoBarSeekActionMap(HelpableActionMap): def __init__(self, screen, *args, **kwargs): @@ -818,7 +817,6 @@ class InfoBarSeek: # print "seekable" def __serviceStarted(self): - self.fast_winding_hint_message_showed = False self.seekstate = self.SEEK_STATE_PLAY self.__seekableStatusChanged() @@ -909,12 +907,6 @@ class InfoBarSeek: self.showAfterSeek() def seekFwd(self): - seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: - self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) - self.fast_winding_hint_message_showed = True - return if self.seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateForward(int(config.seek.enter_forward.value))) elif self.seekstate == self.SEEK_STATE_PAUSE: @@ -944,12 +936,6 @@ class InfoBarSeek: self.setSeekState(self.makeStateSlowMotion(speed)) def seekBack(self): - seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: - self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) - self.fast_winding_hint_message_showed = True - return seekstate = self.seekstate if seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index ddc675e6..1a28fbdd 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1370,7 +1370,7 @@ RESULT eDVBServicePlay::setTrickmode(int trick) RESULT eDVBServicePlay::isCurrentlySeekable() { - return m_is_pvr || m_timeshift_active ? 3 : 0; // fast forward/backward possible and seeking possible + return m_is_pvr || m_timeshift_active; } RESULT eDVBServicePlay::frontendInfo(ePtr &ptr) diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 52f2bc99..c95609a3 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -641,31 +641,7 @@ RESULT eServiceMP3::setTrickmode(int trick) RESULT eServiceMP3::isCurrentlySeekable() { - int ret = 3; // seeking and fast/slow winding possible - GstElement *sink; - - if (!m_gst_playbin) - return 0; - if (m_state != stRunning) - return 0; - - g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); - - // disable fast winding yet when a dvbvideosink or dvbaudiosink is used - // for this we must do some changes on different places.. (gstreamer.. our sinks.. enigma2) - if (sink) { - ret &= ~2; // only seeking possible - gst_object_unref(sink); - } - else { - g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); - if (sink) { - ret &= ~2; // only seeking possible - gst_object_unref(sink); - } - } - - return ret; + return 1; } RESULT eServiceMP3::info(ePtr&i) diff --git a/lib/service/servicexine.cpp b/lib/service/servicexine.cpp index 6b9adfb9..44e6a6e0 100644 --- a/lib/service/servicexine.cpp +++ b/lib/service/servicexine.cpp @@ -315,7 +315,7 @@ RESULT eServiceXine::setTrickmode(int trick) RESULT eServiceXine::isCurrentlySeekable() { - return 3; + return 1; } RESULT eServiceXine::info(ePtr&i) -- cgit v1.2.3 From 43115f56227db0f655402fef45d1a2fc60533f86 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 12:16:16 +0100 Subject: Revert "bug #258" This reverts commit 65ae5578663b82ddf54926047682ec1b6afdf4b6. its broken yet... --- lib/python/Components/config.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 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 100755 new mode 100644 -- cgit v1.2.3 From 3c8f046e30595b284a2b9c391a7ee7bdf662a284 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 12:16:56 +0100 Subject: Revert "bug #258" This reverts commit 0bc4d77344f249d7e3c0adb2b2ea58d74f2d02ea. its broken yet --- lib/python/Components/config.py | 5 +---- 1 file changed, 1 insertion(+), 4 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 d9f2104e..876e3a34 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1184,10 +1184,7 @@ class ConfigSatlist(ConfigSelection): def __init__(self, list, default = None): if default is not None: default = str(default) - choices = [(str(orbpos), desc) for (orbpos, desc, flags) in list] - choices.sort(key = lambda x: int(x[0])) - - ConfigSelection.__init__(self, choices = choices, default = default) + ConfigSelection.__init__(self, choices = [(str(orbpos), desc) for (orbpos, desc, flags) in list], default = default) def getOrbitalPosition(self): if self.value == "": -- cgit v1.2.3 From 4e08450f3d15c875231a264dfeec4fa0bcfa8997 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 9 Nov 2009 17:38:21 +0100 Subject: WirelessLan/plugin.py: - properly escape spaces inside an SSID name when returning the ConfigString. This fixes #175 --- lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 74520dcc..9f6a13fe 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -276,8 +276,15 @@ def configStrings(iface): return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -Dralink\n post-down wpa_cli terminate" if driver == 'madwifi': if config.plugins.wlan.essid.value == "hidden...": - return " pre-up iwconfig "+iface+" essid "+config.plugins.wlan.hiddenessid.value+"\n pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate" - return " pre-up iwconfig "+iface+" essid "+config.plugins.wlan.essid.value+"\n pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate" + if ' ' in config.plugins.wlan.hiddenessid.value: + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + else: + return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.hiddenessid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + else: + if ' ' in config.plugins.wlan.essid.value: + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + else: + return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.essid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' if driver == 'zydas': return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dzydas\n post-down wpa_cli terminate" -- cgit v1.2.3 From a87dcad83a4096c1d29ccdf5cda873ee43629f70 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 11 Nov 2009 18:34:04 +0100 Subject: WirelessLan/plugin.py: - always use quotes for the ssid name, small cleanup --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 9f6a13fe..b7a64b9a 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -271,22 +271,14 @@ def callFunction(iface): def configStrings(iface): driver = iNetwork.detectWlanModule() - print "WLAN-MODULE",driver - if driver == 'ralink': - return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -Dralink\n post-down wpa_cli terminate" - if driver == 'madwifi': + print "Found WLAN-Driver:",driver + if driver in ('ralink', 'zydas'): + return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate" + else: if config.plugins.wlan.essid.value == "hidden...": - if ' ' in config.plugins.wlan.hiddenessid.value: - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' - else: - return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.hiddenessid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' else: - if ' ' in config.plugins.wlan.essid.value: - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' - else: - return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.essid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' - if driver == 'zydas': - return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dzydas\n post-down wpa_cli terminate" + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' def Plugins(**kwargs): return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."}) -- cgit v1.2.3 From 58d96b9ff49080139dbe98546a7fe78953fca987 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 10 Nov 2009 16:35:00 +0100 Subject: fixes bug #281 add "yes to all" and "no to all" to "Delete no more configured satellite" dialog if orbpos isn't needed anymore in current sat config --- lib/python/Screens/Satconfig.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 8b5089a3..e24e4636 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -8,6 +8,7 @@ from Components.NimManager import nimmanager from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement from Components.Sources.List import List from Screens.MessageBox import MessageBox +from Screens.ChoiceBox import ChoiceBox from time import mktime, localtime from datetime import datetime @@ -342,10 +343,10 @@ class NimSetup(Screen, ConfigListScreen): new_configured_sats = nimmanager.getConfiguredSats() self.unconfed_sats = old_configured_sats - new_configured_sats self.satpos_to_remove = None - self.deleteConfirmed(False) + self.deleteConfirmed((None, "no")) def deleteConfirmed(self, confirmed): - if confirmed: + if confirmed[1] == "yes" or confirmed[1] == "yestoall": eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove) if self.satpos_to_remove is not None: @@ -365,11 +366,15 @@ class NimSetup(Screen, ConfigListScreen): else: h = _("E") sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10) - self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Delete no more configured satellite\n%s?") %(sat_name)) + + if confirmed[1] == "yes" or confirmed[1] == "no": + self.session.openWithCallback(self.deleteConfirmed, ChoiceBox, _("Delete no more configured satellite\n%s?") %(sat_name), [(_("Yes"), "yes"), (_("No"), "no"), (_("Yes to all"), "yestoall"), (_("No to all"), "notoall")]) + if confirmed[1] == "yestoall" or confirmed[1] == "notoall": + self.deleteConfirmed(confirmed) break if not self.satpos_to_remove: self.close() - + def __init__(self, session, slotid): Screen.__init__(self, session) self.list = [ ] -- cgit v1.2.3 From b01b4beb24bab09840bf11e2f7ca06cccfd5677c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 7 Nov 2009 12:21:25 +0100 Subject: fixes bug #280 don't allow scanning on a nim configured as advanced with no LNB assigned to any sat --- lib/python/Screens/ScanSetup.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index bea08724..fa787a70 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -524,6 +524,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): for n in nimmanager.nim_slots: if n.config_mode == "nothing": continue + if n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1: + continue if n.config_mode in ("loopthrough", "satposdepends"): root_id = nimmanager.sec.getRoot(n.slot_id, int(n.config.connectedTo.value)) if n.type == nimmanager.nim_slots[root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa -- cgit v1.2.3 From 58965c6783464b3390b7ad0687f4ed4a559f9ce2 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 16 Nov 2009 19:03:34 +0100 Subject: fixes bug #291 don't crash if auto scart switching is enabled and the scart voltage is high on enigma2 startup not the best solution since the whole scart switching stuff is broken by design, but this fix prevents the crash --- lib/python/Screens/MessageBox.py | 4 +++- lib/python/Screens/Scart.py | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py index 86bf07d3..f3538b7b 100644 --- a/lib/python/Screens/MessageBox.py +++ b/lib/python/Screens/MessageBox.py @@ -12,9 +12,11 @@ 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, enable_input = True): + def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True, msgBoxID = None): self.type = type Screen.__init__(self, session) + + self.msgBoxID = msgBoxID self["text"] = Label(text) self["Text"] = StaticText(text) diff --git a/lib/python/Screens/Scart.py b/lib/python/Screens/Scart.py index dc511448..00e78593 100644 --- a/lib/python/Screens/Scart.py +++ b/lib/python/Screens/Scart.py @@ -1,10 +1,13 @@ from Screen import Screen from MessageBox import MessageBox from Components.AVSwitch import AVSwitch +from Tools import Notifications class Scart(Screen): def __init__(self, session, start_visible=True): Screen.__init__(self, session) + self.msgBox = None + self.notificationVisible = None self.avswitch = AVSwitch() @@ -22,7 +25,11 @@ class Scart(Screen): if not self.msgVisible: self.msgVisible = True self.avswitch.setInput("SCART") - self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR) + if not self.session.in_exec: + self.notificationVisible = True + Notifications.AddNotificationWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR, msgBoxID = "scart_msgbox") + else: + self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR) def MsgBoxClosed(self, *val): self.msgBox = None @@ -35,3 +42,13 @@ class Scart(Screen): return self.avswitch.setInput("ENCODER") self.msgVisible = False + if self.notificationVisible: + self.avswitch.setInput("ENCODER") + self.notificationVisible = False + for notification in Notifications.current_notifications: + try: + if notification[1].msgBoxID == "scart_msgbox": + notification[1].close() + except: + print "other notification is open. try another one." + \ No newline at end of file -- cgit v1.2.3 From 3823b59986d6d47a8ca4b5db642c426f2e2b2652 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 19 Nov 2009 08:48:37 +0100 Subject: config.py: fix set/getValue for ConfigSelectionNumber --- lib/python/Components/config.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 876e3a34..a6007b10 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1034,13 +1034,13 @@ class ConfigSelectionNumber(ConfigSelection): step += stepwidth ConfigSelection.__init__(self, choices, default) - + def getValue(self): - return int(self.text) + return int(ConfigSelection.getValue(self)) def setValue(self, val): - self.text = str(val) - + ConfigSelection.setValue(self, str(val)) + def handleKey(self, key): if not self.wraparound: if key == KEY_RIGHT: @@ -1050,8 +1050,6 @@ class ConfigSelectionNumber(ConfigSelection): if self.choices.index(self.value) == 0: return ConfigSelection.handleKey(self, key) - - class ConfigNumber(ConfigText): def __init__(self, default = 0): -- cgit v1.2.3 From a30169eba9644afe90859835be314055209fa3c1 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 19 Nov 2009 11:13:17 +0100 Subject: Components/About.py: fix /etc/image-version parser..now we also show image type (release/experimental) and major minor revision --- lib/python/Components/About.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py index bb2d7568..58d67dc9 100644 --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -19,11 +19,20 @@ class About: #0120 2005 11 29 01 16 #0123 4567 89 01 23 45 version = splitted[1] + image_type = version[0] # 0 = release, 1 = experimental + major = version[1] + minor = version[2] + revision = version[3] year = version[4:8] month = version[8:10] day = version[10:12] - - return '-'.join(("dev", year, month, day)) + if image_type == '0': + image_type = "Release" + else: + image_type = "Experimental" + date = '-'.join((year, month, day)) + version = '.'.join((major, minor, revision)) + return ' '.join((image_type, version, date)) file.close() except IOError: pass -- cgit v1.2.3 From 78c9520c9cc8030a7a14a895fb1775d5965d7a7e Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 20 Nov 2009 13:06:50 +0100 Subject: lib/python/Components/About.py: dont show version information for Experimental images.. only show date here.. --- lib/python/Components/About.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py index 58d67dc9..8e332e33 100644 --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -26,13 +26,14 @@ class About: year = version[4:8] month = version[8:10] day = version[10:12] + date = '-'.join((year, month, day)) if image_type == '0': image_type = "Release" + version = '.'.join((major, minor, revision)) + return ' '.join((image_type, version, date)) else: image_type = "Experimental" - date = '-'.join((year, month, day)) - version = '.'.join((major, minor, revision)) - return ' '.join((image_type, version, date)) + return ' '.join((image_type, date)) file.close() except IOError: pass -- cgit v1.2.3 From c72b0788e404a940f29888a696756d6b4cd6644f Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 1 Dec 2009 10:32:01 +0100 Subject: Components/Lcd.py: use 1 instead of 0 for Oled standby default value (with new drivers the oled is completely disabled on lowest step) --- lib/python/Components/Lcd.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 0e501237..7d27c097 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -42,9 +42,18 @@ def InitLcd(): def setLCDinverted(configElement): ilcd.setInverted(configElement.value); + standby_default = 0 + ilcd = LCD() - config.lcd.standby = ConfigSlider(default=0, limits=(0, 10)) + if not ilcd.isOled(): + config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20)) + config.lcd.contrast.addNotifier(setLCDcontrast); + else: + config.lcd.contrast = ConfigNothing() + standby_default = 1 + + config.lcd.standby = ConfigSlider(default=standby_default, limits=(0, 10)) config.lcd.standby.addNotifier(setLCDbright); config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby) @@ -53,12 +62,6 @@ def InitLcd(): 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)) - config.lcd.contrast.addNotifier(setLCDcontrast); - else: - config.lcd.contrast = ConfigNothing() - config.lcd.invert = ConfigYesNo(default=False) config.lcd.invert.addNotifier(setLCDinverted); else: -- cgit v1.2.3 From b79bdb964320dabf4180ef6820a1ce335afccaa5 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 15:23:41 +0100 Subject: Plugins/Plugin.py, InfoBarGenerics.py: add WHERE_AUDIOMENU for plugins .. requested by Tode for the AudioSync Plugin fixes bug #305 --- lib/python/Plugins/Plugin.py | 2 ++ lib/python/Screens/InfoBarGenerics.py | 47 ++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 9 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index d7fc6898..dc68ebf3 100755 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -52,6 +52,8 @@ class PluginDescriptor: # reason (True: Networkconfig read finished, False: Networkconfig reload initiated ) WHERE_NETWORKCONFIG_READ = 12 + WHERE_AUDIOMENU = 13 + 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 b98cd469..b672b682 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1663,17 +1663,46 @@ class InfoBarAudioSelection: else: break + availableKeys = [] + usedKeys = [] + if SystemInfo["CanDownmixAC3"]: - tlist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), - ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), - ("--", "")] + tlist - keys = [ "red", "green", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n - selection += 3 - else: - tlist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist - keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n + flist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), + ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] + usedKeys.extend(["red", "green"]) + availableKeys.extend(["yellow", "blue"]) selection += 2 - self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") + else: + flist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] + usedKeys.extend(["red"]) + availableKeys.extend(["green", "yellow", "blue"]) + selection += 1 + + if hasattr(self, "runPlugin"): + class PluginCaller: + def __init__(self, fnc, *args): + self.fnc = fnc + self.args = args + def __call__(self, *args, **kwargs): + self.fnc(*self.args) + + Plugins = [ (p.name, PluginCaller(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] + + for p in Plugins: + selection += 1 + flist.append((p[0], "CALLFUNC", p[1])) + if availableKeys: + usedKeys.append(availableKeys[0]) + del availableKeys[0] + else: + usedKeys.append("") + + flist.append(("--", "")) + usedKeys.append("") + selection += 1 + + keys = usedKeys + [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ] + [""] * n + self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = flist + tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") else: del self.audioTracks -- cgit v1.2.3 From 44fb489521cf6ad1defba93311366df08d7938a4 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 16:37:52 +0100 Subject: Components/SystemInfo.py: add new SystemInfo entry "DeepstandbySupport" --- lib/python/Components/SystemInfo.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/SystemInfo.py b/lib/python/Components/SystemInfo.py index d2b405a2..f9c4065f 100644 --- a/lib/python/Components/SystemInfo.py +++ b/lib/python/Components/SystemInfo.py @@ -1,5 +1,6 @@ from enigma import eDVBResourceManager from Tools.Directories import fileExists +from Tools.HardwareInfo import HardwareInfo SystemInfo = { } @@ -27,3 +28,4 @@ def countFrontpanelLEDs(): SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs() SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0") SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0") +SystemInfo["DeepstandbySupport"] = HardwareInfo().get_device_name() != "dm800" -- cgit v1.2.3 From 1d05937cd1d720c4b23fb852ad8fcf3d9466ec4a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 16:40:44 +0100 Subject: Menu.py: add possibility to use the exclamation mark as NOT indicator in menu/setup.xml for requires entries (thx to Moritz Venn) --- lib/python/Screens/Menu.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py index 5f2032f1..bb0709e5 100644 --- a/lib/python/Screens/Menu.py +++ b/lib/python/Screens/Menu.py @@ -97,8 +97,12 @@ class Menu(Screen): def addMenu(self, destList, node): requires = node.get("requires") - if requires and not SystemInfo.get(requires, False): - return + if requires: + if requires[0] == '!': + if SystemInfo.get(requires[1:], False): + return + elif not SystemInfo.get(requires, False): + return MenuTitle = _(node.get("text", "??").encode("UTF-8")) entryID = node.get("entryID", "undefined") weight = node.get("weight", 50) @@ -120,8 +124,12 @@ class Menu(Screen): def addItem(self, destList, node): requires = node.get("requires") - if requires and not SystemInfo.get(requires, False): - return + if requires: + if requires[0] == '!': + if SystemInfo.get(requires[1:], False): + return + elif not SystemInfo.get(requires, False): + return item_text = node.get("text", "").encode("UTF-8") entryID = node.get("entryID", "undefined") weight = node.get("weight", 50) -- cgit v1.2.3 From 9fba96095af3d4a6b1b596893f4e005dc0b6f16d Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 16:46:01 +0100 Subject: use new DeepstandbySupport SystemInfo entry at some places... this fixes bug #307 Conflicts: lib/python/Screens/TimerEntry.py --- data/menu.xml | 3 ++- lib/python/Screens/SleepTimerEdit.py | 7 ++++++- lib/python/Screens/TaskView.py | 7 ++++++- lib/python/Screens/TimerEntry.py | 7 ++++++- 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/data/menu.xml b/data/menu.xml index 403e0b81..59195f15 100644 --- a/data/menu.xml +++ b/data/menu.xml @@ -104,6 +104,7 @@ self.session.openWithCallback(msgClosed, FactoryReset) 2 3 - 1 + 1 + 1 diff --git a/lib/python/Screens/SleepTimerEdit.py b/lib/python/Screens/SleepTimerEdit.py index ff061d88..e5e7af4e 100644 --- a/lib/python/Screens/SleepTimerEdit.py +++ b/lib/python/Screens/SleepTimerEdit.py @@ -5,6 +5,7 @@ from Components.Input import Input from Components.Label import Label from Components.Pixmap import Pixmap from Components.config import config, ConfigInteger +from Components.SystemInfo import SystemInfo from enigma import eEPGCache from SleepTimer import SleepTimer from time import time @@ -77,7 +78,11 @@ class SleepTimerEdit(Screen): self["red_text"].setText(_("Action:") + " " + _("Disable timer")) if config.SleepTimer.action.value == "shutdown": - self["green_text"].setText(_("Sleep timer action:") + " " + _("Deep Standby")) + if SystemInfo["DeepstandbySupport"]: + shutdownString = _("Deep Standby") + else: + shutdownString = _("Shutdown") + self["green_text"].setText(_("Sleep timer action:") + " " + shutdownString) elif config.SleepTimer.action.value == "standby": self["green_text"].setText(_("Sleep timer action:") + " " + _("Standby")) diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 1453c05f..eb926ca3 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -1,6 +1,7 @@ from Screen import Screen from Components.ConfigList import ConfigListScreen from Components.config import config, ConfigSubsection, ConfigSelection, getConfigListEntry +from Components.SystemInfo import SystemInfo from InfoBarGenerics import InfoBarNotifications import Screens.Standby from Tools import Notifications @@ -44,7 +45,11 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): self.afterevents = [ "nothing", "standby", "deepstandby", "close" ] self.settings = ConfigSubsection() - self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby"))], default = self.afterevents[afterEvent]) + if SystemInfo["DeepstandbySupport"]: + shutdownString = _("go to deep standby") + else: + shutdownString = _("shut down") + self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.afterevents[afterEvent]) self.setupList() self.state_changed() diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index 5813bac5..42a3195c 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -9,6 +9,7 @@ from Components.Button import Button from Components.Label import Label from Components.Pixmap import Pixmap from Components.UsageConfig import defaultMoviePath +from Components.SystemInfo import SystemInfo from Screens.MovieSelection import getPreferredTagEditor from Screens.LocationBox import MovieLocationBox from Screens.ChoiceBox import ChoiceBox @@ -93,7 +94,11 @@ class TimerEntry(Screen, ConfigListScreen): day[weekday] = 1 self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay]) - self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent) + if SystemInfo["DeepstandbySupport"]: + shutdownString = _("go to deep standby") + else: + shutdownString = _("shut down") + self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent) self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type) self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False) self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False) -- cgit v1.2.3 From 15b64dc4fbead7b5c15cb309a82914f79ae78b0a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Nov 2009 11:37:29 +0100 Subject: disable fast winding for non TS mediafiles until we have a usable solution for this.. --- .../Extensions/DVDPlayer/src/servicedvd.cpp | 2 +- lib/python/Screens/InfoBarGenerics.py | 14 ++++++++++++ lib/service/servicedvb.cpp | 2 +- lib/service/servicemp3.cpp | 26 +++++++++++++++++++++- lib/service/servicexine.cpp | 2 +- 5 files changed, 42 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 94f2ee38..0372c497 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -696,7 +696,7 @@ RESULT eServiceDVD::setTrickmode(int /*trick*/) RESULT eServiceDVD::isCurrentlySeekable() { - return m_state == stRunning; + return m_state == stRunning ? 3 : 0; } RESULT eServiceDVD::keyPressed(int key) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index b672b682..24ebada7 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -691,6 +691,7 @@ class InfoBarSeek: iPlayableService.evEOF: self.__evEOF, iPlayableService.evSOF: self.__evSOF, }) + self.fast_winding_hint_message_showed = False class InfoBarSeekActionMap(HelpableActionMap): def __init__(self, screen, *args, **kwargs): @@ -817,6 +818,7 @@ class InfoBarSeek: # print "seekable" def __serviceStarted(self): + self.fast_winding_hint_message_showed = False self.seekstate = self.SEEK_STATE_PLAY self.__seekableStatusChanged() @@ -907,6 +909,12 @@ class InfoBarSeek: self.showAfterSeek() def seekFwd(self): + seek = self.getSeek() + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: + self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) + self.fast_winding_hint_message_showed = True + return if self.seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateForward(int(config.seek.enter_forward.value))) elif self.seekstate == self.SEEK_STATE_PAUSE: @@ -936,6 +944,12 @@ class InfoBarSeek: self.setSeekState(self.makeStateSlowMotion(speed)) def seekBack(self): + seek = self.getSeek() + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: + self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) + self.fast_winding_hint_message_showed = True + return seekstate = self.seekstate if seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index f85ce9cc..16d09bc6 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1385,7 +1385,7 @@ RESULT eDVBServicePlay::setTrickmode(int trick) RESULT eDVBServicePlay::isCurrentlySeekable() { - return m_is_pvr || m_timeshift_active; + return m_is_pvr || m_timeshift_active ? 3 : 0; // fast forward/backward possible and seeking possible } RESULT eDVBServicePlay::frontendInfo(ePtr &ptr) diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 0f604b84..c0ae42fd 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -641,7 +641,31 @@ RESULT eServiceMP3::setTrickmode(int trick) RESULT eServiceMP3::isCurrentlySeekable() { - return 1; + int ret = 3; // seeking and fast/slow winding possible + GstElement *sink; + + if (!m_gst_playbin) + return 0; + if (m_state != stRunning) + return 0; + + g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); + + // disable fast winding yet when a dvbvideosink or dvbaudiosink is used + // for this we must do some changes on different places.. (gstreamer.. our sinks.. enigma2) + if (sink) { + ret &= ~2; // only seeking possible + gst_object_unref(sink); + } + else { + g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); + if (sink) { + ret &= ~2; // only seeking possible + gst_object_unref(sink); + } + } + + return ret; } RESULT eServiceMP3::info(ePtr&i) diff --git a/lib/service/servicexine.cpp b/lib/service/servicexine.cpp index 44e6a6e0..6b9adfb9 100644 --- a/lib/service/servicexine.cpp +++ b/lib/service/servicexine.cpp @@ -315,7 +315,7 @@ RESULT eServiceXine::setTrickmode(int trick) RESULT eServiceXine::isCurrentlySeekable() { - return 1; + return 3; } RESULT eServiceXine::info(ePtr&i) -- cgit v1.2.3 From 870613c85f6569ac1d04a387d0a164357a7289ba Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Nov 2009 11:43:01 +0100 Subject: small fix --- lib/python/Screens/InfoBarGenerics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 24ebada7..5d240138 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -910,8 +910,8 @@ class InfoBarSeek: def seekFwd(self): seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: + if seek and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return @@ -945,8 +945,8 @@ class InfoBarSeek: def seekBack(self): seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: + if seek and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return -- cgit v1.2.3 From d4426631ae17978c6bb8121e1ca826e16eccc6de Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Dec 2009 15:47:56 +0100 Subject: fix skip backward from live to timeshift --- lib/python/Screens/InfoBarGenerics.py | 3 --- lib/service/servicedvb.cpp | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 5d240138..58cee9f3 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1220,10 +1220,7 @@ class InfoBarTimeshift: self.setSeekState(self.SEEK_STATE_PAUSE) if back: - self.doSeek(-5) # seek some gops before end self.ts_rewind_timer.start(200, 1) - else: - self.doSeek(-1) # seek 1 gop before end def rewindService(self): self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 16d09bc6..c8e64b80 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2285,12 +2285,13 @@ void eDVBServicePlay::switchToTimeshift() r.path = m_timeshift_file; m_cue = new eCueSheet(); + m_cue->seekTo(0, -1000); m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ eDebug("eDVBServicePlay::switchToTimeshift, in pause mode now."); pause(); updateDecoder(); /* mainly to switch off PCR, and to set pause */ - + m_event((iPlayableService*)this, evSeekableStatusChanged); } -- cgit v1.2.3 From 46b2ddde6868639c2c437f1bed6d6db27a71038d Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 14 Dec 2009 10:27:38 +0100 Subject: Bugfix by Anders Holst: A bug was detected in the recent recordpath patch. It could cause a crash when using the green or yellow button to select a tag in the movielist. --- lib/python/Screens/MovieSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/MovieSelection.py b/lib/python/Screens/MovieSelection.py index 15f6b465..0468f8a0 100644 --- a/lib/python/Screens/MovieSelection.py +++ b/lib/python/Screens/MovieSelection.py @@ -398,7 +398,7 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo): def showTagsN(self, tagele): if not self.tags: self.showTagWarning() - elif not tagele or tagele.value in self.selected_tags or not tagele.value in self.tags: + elif not tagele or (self.selected_tags and tagele.value in self.selected_tags) or not tagele.value in self.tags: self.showTagsMenu(tagele) else: self.selected_tags_ele = tagele -- cgit v1.2.3 From 1eb03ca87ad5537ec41506a84f32c90774a66f1b Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 15 Dec 2009 19:33:32 +0100 Subject: fix merge conflict. --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 2000 ++++++++++++++++---- 1 file changed, 1666 insertions(+), 334 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 6bfaec52..8aafd9a7 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,402 +1,1734 @@ -from enigma import eTimer +from Plugins.Plugin import PluginDescriptor +from Screens.Console import Console +from Screens.ChoiceBox import ChoiceBox +from Screens.MessageBox import MessageBox from Screens.Screen import Screen +from Screens.Ipkg import Ipkg from Components.ActionMap import ActionMap, NumberActionMap -from Components.Pixmap import Pixmap,MultiPixmap -from Components.Label import Label +from Components.Input import Input +from Components.Ipkg import IpkgComponent from Components.Sources.StaticText import StaticText -from Components.Sources.List import List +from Components.ScrollLabel import ScrollLabel +from Components.Pixmap import Pixmap from Components.MenuList import MenuList -from Components.config import config, getConfigListEntry, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword -from Components.ConfigList import ConfigListScreen -from Components.Network import Network, iNetwork +from Components.Sources.List import List +from Components.Slider import Slider +from Components.Harddisk import harddiskmanager +from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations from Components.Console import Console -from Plugins.Plugin import PluginDescriptor -from os import system, path as os_path, listdir -from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE +from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest +from Components.SelectionList import SelectionList +from Components.PluginComponent import plugins +from Components.About import about +from Components.DreamInfoHandler import DreamInfoHandler +from Components.Language import language +from Components.AVSwitch import AVSwitch +from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR from Tools.LoadPixmap import LoadPixmap -from Wlan import Wlan, wpaSupplicant, iStatus +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad +from cPickle import dump, load +from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK +from time import time, gmtime, strftime, localtime +from stat import ST_MTIME +from datetime import date +from twisted.web import client +from twisted.internet import reactor -plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan" +from ImageWizard import ImageWizard +from BackupRestore import BackupSelection, RestoreMenu, BackupScreen, RestoreScreen, getBackupPath, getBackupFilename +#from SoftwareTools import extensions -list = [] -list.append("WEP") -list.append("WPA") -list.append("WPA2") -list.append("WPA/WPA2") +config.plugins.configurationbackup = ConfigSubsection() +config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) +config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) -weplist = [] -weplist.append("ASCII") -weplist.append("HEX") +def write_cache(cache_file, cache_data): + #Does a cPickle dump + if not os_path.isdir( os_path.dirname(cache_file) ): + try: + mkdir( os_path.dirname(cache_file) ) + except OSError: + print os_path.dirname(cache_file), 'is a file' + fd = open(cache_file, 'w') + dump(cache_data, fd, -1) + fd.close() -config.plugins.wlan = ConfigSubsection() -config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False)) -config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False)) +def valid_cache(cache_file, cache_ttl): + #See if the cache file exists and is still living + try: + mtime = stat(cache_file)[ST_MTIME] + except: + return 0 + curr_time = time() + if (curr_time - mtime) > cache_ttl: + return 0 + else: + return 1 -config.plugins.wlan.encryption = ConfigSubsection() -config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False)) -config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" )) -config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII")) -config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False)) +def load_cache(cache_file): + #Does a cPickle load + fd = open(cache_file) + cache_data = load(fd) + fd.close() + return cache_data -class WlanStatus(Screen): +class UpdatePluginMenu(Screen): skin = """ - + - - - - - - - - - - - - - - - - - - - - + + + + {"template": [ + MultiContentEntryText(pos = (2, 2), size = (290, 22), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText, + ], + "fonts": [gFont("Regular", 20)], + "itemHeight": 25 + } + + + + + {"template": [ + MultiContentEntryText(pos = (2, 2), size = (240, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, + ], + "fonts": [gFont("Regular", 20)], + "itemHeight": 300 + } + + """ - - def __init__(self, session, iface): + + def __init__(self, session, args = 0): Screen.__init__(self, session) - self.session = session - self.iface = iface - - self["LabelBSSID"] = StaticText(_('Accesspoint:')) - self["LabelESSID"] = StaticText(_('SSID:')) - self["LabelQuality"] = StaticText(_('Link Quality:')) - self["LabelSignal"] = StaticText(_('Signal Strength:')) - self["LabelBitrate"] = StaticText(_('Bitrate:')) - self["LabelEnc"] = StaticText(_('Encryption:')) - - self["BSSID"] = StaticText() - self["ESSID"] = StaticText() - self["quality"] = StaticText() - self["signal"] = StaticText() - self["bitrate"] = StaticText() - self["enc"] = StaticText() - - self["IFtext"] = StaticText() - self["IF"] = StaticText() - self["Statustext"] = StaticText() - self["statuspic"] = MultiPixmap() - self["statuspic"].hide() + self.skin_path = plugin_path + self.menu = args + self.list = [] + self.oktext = _("\nPress OK on your remote control to continue.") + self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) + if self.menu == 0: + self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None)) + self.list.append(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + self.oktext, None)) + self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None)) + self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None)) + self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None)) + self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext, None)) + for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): + if p.__call__.has_key("SoftwareSupported"): + callFnc = p.__call__["SoftwareSupported"](None) + if callFnc is not None: + if p.__call__.has_key("menuEntryName"): + menuEntryName = p.__call__["menuEntryName"](None) + else: + menuEntryName = _('Extended Software') + if p.__call__.has_key("menuEntryDescription"): + menuEntryDescription = p.__call__["menuEntryDescription"](None) + else: + menuEntryDescription = _('Extended Software Plugin') + self.list.append(('default-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) + if config.usage.setup_level.index >= 2: # expert+ + self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext, None)) + elif self.menu == 1: + self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) + self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) + self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None)) + if config.usage.setup_level.index >= 2: # expert+ + self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) + self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) + for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): + if p.__call__.has_key("AdvancedSoftwareSupported"): + callFnc = p.__call__["AdvancedSoftwareSupported"](None) + if callFnc is not None: + if p.__call__.has_key("menuEntryName"): + menuEntryName = p.__call__["menuEntryName"](None) + else: + menuEntryName = _('Advanced Software') + if p.__call__.has_key("menuEntryDescription"): + menuEntryDescription = p.__call__["menuEntryDescription"](None) + else: + menuEntryDescription = _('Advanced Software Plugin') + self.list.append(('advanced-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) + + self["menu"] = List(self.list) self["key_red"] = StaticText(_("Close")) - self.resetList() - self.updateStatusbar() - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions", "ShortcutActions"], + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { - "ok": self.exit, - "back": self.exit, - "red": self.exit, + "ok": self.go, + "back": self.close, + "red": self.close, }, -1) - self.timer = eTimer() - self.timer.timeout.get().append(self.resetList) - self.onShown.append(lambda: self.timer.start(5000)) + self.onLayoutFinish.append(self.layoutFinished) - self.onClose.append(self.cleanup) + self.backuppath = getBackupPath() + self.backupfile = getBackupFilename() + self.fullbackupfilename = self.backuppath + "/" + self.backupfile + self.onShown.append(self.setWindowTitle) + + def layoutFinished(self): + idx = 0 + self["menu"].index = idx + + def setWindowTitle(self): + self.setTitle(_("Software manager")) - def cleanup(self): - iStatus.stopWlanConsole() + def go(self): + current = self["menu"].getCurrent() + if current: + currentEntry = current[0] + if self.menu == 0: + if (currentEntry == "software-update"): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!")) + elif (currentEntry == "software-restore"): + self.session.open(ImageWizard) + elif (currentEntry == "install-plugins"): + self.session.open(PluginManager, self.skin_path) + elif (currentEntry == "system-backup"): + self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True) + elif (currentEntry == "system-restore"): + if os_path.exists(self.fullbackupfilename): + self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore")) + else: + self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10) + elif (currentEntry == "ipkg-install"): + try: + from Plugins.Extensions.MediaScanner.plugin import main + main(self.session) + except: + self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO, timeout = 10) + elif (currentEntry == "default-plugin"): + self.extended = current[3] + self.extended(self.session, None) + elif (currentEntry == "advanced"): + self.session.open(UpdatePluginMenu, 1) + elif self.menu == 1: + if (currentEntry == "ipkg-manager"): + self.session.open(PacketManager, self.skin_path) + elif (currentEntry == "backuplocation"): + parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)] + for x in parts: + if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/': + parts.remove(x) + for x in parts: + if x[1].startswith('/autofs/'): + parts.remove(x) + if len(parts): + self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts) + elif (currentEntry == "backupfiles"): + self.session.openWithCallback(self.backupfiles_choosen,BackupSelection) + elif (currentEntry == "advancedrestore"): + self.session.open(RestoreMenu, self.skin_path) + elif (currentEntry == "ipkg-source"): + self.session.open(IPKGMenu, self.skin_path) + elif (currentEntry == "advanced-plugin"): + self.extended = current[3] + self.extended(self.session, None) + + def backupfiles_choosen(self, ret): + self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) + + def backuplocation_choosen(self, option): + if option is not None: + config.plugins.configurationbackup.backuplocation.value = str(option[1]) + config.plugins.configurationbackup.backuplocation.save() + config.plugins.configurationbackup.save() + config.save() + self.createBackupfolders() + + def runUpgrade(self, result): + if result: + self.session.open(UpdatePlugin, self.skin_path) + + def createBackupfolders(self): + print "Creating backup folder if not already there..." + self.backuppath = getBackupPath() + try: + if (os_path.exists(self.backuppath) == False): + makedirs(self.backuppath) + except OSError: + self.session.open(MessageBox, _("Sorry, your backup destination is not writeable.\n\nPlease choose another one."), MessageBox.TYPE_INFO, timeout = 10) + + def backupDone(self,retval = None): + if retval is True: + self.session.open(MessageBox, _("Backup done."), MessageBox.TYPE_INFO, timeout = 10) + else: + self.session.open(MessageBox, _("Backup failed."), MessageBox.TYPE_INFO, timeout = 10) + + def startRestore(self, ret = False): + if (ret == True): + self.exe = True + self.session.open(RestoreScreen, runRestore = True) + +class IPKGMenu(Screen): + skin = """ + + + + + + + """ + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.skin_path = plugin_path + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Edit")) + + self.sel = [] + self.val = [] + self.entry = False + self.exe = False + self.path = "" + + self["actions"] = NumberActionMap(["SetupActions"], + { + "ok": self.KeyOk, + "cancel": self.keyCancel + }, -1) + + self["shortcuts"] = ActionMap(["ShortcutActions"], + { + "red": self.keyCancel, + "green": self.KeyOk, + }) + self.flist = [] + self["filelist"] = MenuList(self.flist) + self.fill_list() + self.onLayoutFinish.append(self.layoutFinished) + def layoutFinished(self): - self.setTitle(_("Wireless Network State")) + self.setWindowTitle() + + def setWindowTitle(self): + self.setTitle(_("Select upgrade source to edit.")) + + def fill_list(self): + self.flist = [] + self.path = '/etc/ipkg/' + if (os_path.exists(self.path) == False): + self.entry = False + return + for file in listdir(self.path): + if (file.endswith(".conf")): + if file != 'arch.conf': + self.flist.append((file)) + self.entry = True + self["filelist"].l.setList(self.flist) + + def KeyOk(self): + if (self.exe == False) and (self.entry == True): + self.sel = self["filelist"].getCurrent() + self.val = self.path + self.sel + self.session.open(IPKGSource, self.val) + + def keyCancel(self): + self.close() + + def Exit(self): + self.close() + + +class IPKGSource(Screen): + skin = """ + + + + + + + """ + + def __init__(self, session, configfile = None): + Screen.__init__(self, session) + self.session = session + self.configfile = configfile + text = "" + if self.configfile: + try: + fp = file(configfile, 'r') + sources = fp.readlines() + if sources: + text = sources[0] + fp.close() + except IOError: + pass + + desk = getDesktop(0) + x= int(desk.size().width()) + y= int(desk.size().height()) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + if (y>=720): + self["text"] = Input(text, maxSize=False, type=Input.TEXT) + else: + self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], + { + "ok": self.go, + "back": self.close, + "red": self.close, + "green": self.go, + "left": self.keyLeft, + "right": self.keyRight, + "home": self.keyHome, + "end": self.keyEnd, + "deleteForward": self.keyDeleteForward, + "deleteBackward": self.keyDeleteBackward, + "1": self.keyNumberGlobal, + "2": self.keyNumberGlobal, + "3": self.keyNumberGlobal, + "4": self.keyNumberGlobal, + "5": self.keyNumberGlobal, + "6": self.keyNumberGlobal, + "7": self.keyNumberGlobal, + "8": self.keyNumberGlobal, + "9": self.keyNumberGlobal, + "0": self.keyNumberGlobal + }, -1) + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + self["text"].right() + + def setWindowTitle(self): + self.setTitle(_("Edit upgrade source url.")) + + def go(self): + text = self["text"].getText() + if text: + fp = file(self.configfile, 'w') + fp.write(text) + fp.write("\n") + fp.close() + self.close() + + def keyLeft(self): + self["text"].left() + + def keyRight(self): + self["text"].right() + + def keyHome(self): + self["text"].home() + + def keyEnd(self): + self["text"].end() + + def keyDeleteForward(self): + self["text"].delete() + + def keyDeleteBackward(self): + self["text"].deleteBackward() + + def keyNumberGlobal(self, number): + self["text"].number(number) + + +class PacketManager(Screen): + skin = """ + + + + + + + + {"template": [ + MultiContentEntryText(pos = (5, 1), size = (440, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (5, 26), size = (440, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description + MultiContentEntryPixmapAlphaTest(pos = (445, 2), size = (48, 48), png = 4), # index 4 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (5, 50), size = (510, 2), png = 5), # index 4 is the div pixmap + ], + "fonts": [gFont("Regular", 22),gFont("Regular", 14)], + "itemHeight": 52 + } + + + """ - def resetList(self): - iStatus.getDataForInterface(self.iface,self.getInfoCB) + def __init__(self, session, plugin_path, args = None): + Screen.__init__(self, session) + self.session = session + self.skin_path = plugin_path + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + { + "ok": self.go, + "back": self.exit, + "red": self.exit, + "green": self.reload, + }, -1) - def getInfoCB(self,data,status): - if data is not None: - if data is True: - if status is not None: - self["BSSID"].setText(status[self.iface]["acesspoint"]) - self["ESSID"].setText(status[self.iface]["essid"]) - self["quality"].setText(status[self.iface]["quality"]+"%") - self["signal"].setText(status[self.iface]["signal"]) - self["bitrate"].setText(status[self.iface]["bitrate"]) - self["enc"].setText(status[self.iface]["encryption"]) - self.updateStatusLink(status) + self.list = [] + self.statuslist = [] + self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Reload")) + + self.list_updating = True + self.packetlist = [] + self.installed_packetlist = {} + self.Console = Console() + self.cmdList = [] + self.cachelist = [] + self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs) + self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory + self.oktext = _("\nAfter pressing OK, please wait!") + self.unwanted_extensions = ('-dbg', '-dev', '-doc', 'busybox') + + self.ipkg = IpkgComponent() + self.ipkg.addCallback(self.ipkgCallback) + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) def exit(self): - self.timer.stop() - self.close(True) - - def updateStatusbar(self): - self["BSSID"].setText(_("Please wait...")) - self["ESSID"].setText(_("Please wait...")) - self["quality"].setText(_("Please wait...")) - self["signal"].setText(_("Please wait...")) - self["bitrate"].setText(_("Please wait...")) - self["enc"].setText(_("Please wait...")) - self["IFtext"].setText(_("Network:")) - self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) - self["Statustext"].setText(_("Link:")) - - def updateStatusLink(self,status): - 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["statuspic"].setPixmapNum(1) - else: - self["statuspic"].setPixmapNum(0) - self["statuspic"].show() + self.ipkg.stop() + if self.Console is not None: + if len(self.Console.appContainers): + for name in self.Console.appContainers.keys(): + self.Console.kill(name) + self.close() + + def reload(self): + if (os_path.exists(self.cache_file) == True): + remove(self.cache_file) + self.list_updating = True + self.rebuildList() + + def setWindowTitle(self): + self.setTitle(_("Packet manager")) + + def setStatus(self,status = None): + if status: + self.statuslist = [] + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if status == 'update': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'',statuspng, divpng )) + self['list'].setList(self.statuslist) + elif status == 'error': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'',statuspng, divpng )) + self['list'].setList(self.statuslist) + + def rebuildList(self): + self.setStatus('update') + self.inv_cache = 0 + self.vc = valid_cache(self.cache_file, self.cache_ttl) + if self.cache_ttl > 0 and self.vc != 0: + try: + self.buildPacketList() + except: + self.inv_cache = 1 + if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: + self.run = 0 + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + + def go(self, returnValue = None): + cur = self["list"].getCurrent() + if cur: + status = cur[3] + package = cur[0] + self.cmdList = [] + if status == 'installed': + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package })) + if len(self.cmdList): + self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + package + "\n" + self.oktext) + elif status == 'upgradeable': + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) + if len(self.cmdList): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to upgrade the package:\n") + package + "\n" + self.oktext) + elif status == "installable": + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) + if len(self.cmdList): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + package + "\n" + self.oktext) + + def runRemove(self, result): + if result: + self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) + + def runRemoveFinished(self): + self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def RemoveReboot(self, result): + if result is None: + return + if result is False: + cur = self["list"].getCurrent() + if cur: + item = self['list'].getIndex() + self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installable') + self.cachelist[item] = [cur[0], cur[1], cur[2], 'installable'] + self['list'].setList(self.list) + write_cache(self.cache_file, self.cachelist) + self.reloadPluginlist() + if result: + quitMainloop(3) + + def runUpgrade(self, result): + if result: + self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) + + def runUpgradeFinished(self): + self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def UpgradeReboot(self, result): + if result is None: + return + if result is False: + cur = self["list"].getCurrent() + if cur: + item = self['list'].getIndex() + self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installed') + self.cachelist[item] = [cur[0], cur[1], cur[2], 'installed'] + self['list'].setList(self.list) + write_cache(self.cache_file, self.cachelist) + self.reloadPluginlist() + if result: + quitMainloop(3) + + def ipkgCallback(self, event, param): + if event == IpkgComponent.EVENT_ERROR: + self.list_updating = False + self.setStatus('error') + elif event == IpkgComponent.EVENT_DONE: + if self.list_updating: + self.list_updating = False + if not self.Console: + self.Console = Console() + cmd = "ipkg list" + self.Console.ePopen(cmd, self.IpkgList_Finished) + #print event, "-", param + pass + + def IpkgList_Finished(self, result, retval, extra_args = None): + if len(result): + self.packetlist = [] + for x in result.splitlines(): + split = x.split(' - ') #self.blacklisted_packages + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()]) + if not self.Console: + self.Console = Console() + cmd = "ipkg list_installed" + self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) + + def IpkgListInstalled_Finished(self, result, retval, extra_args = None): + if len(result): + self.installed_packetlist = {} + for x in result.splitlines(): + split = x.split(' - ') + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.installed_packetlist[split[0].strip()] = split[1].strip() + self.buildPacketList() + + def buildEntryComponent(self, name, version, description, state): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if state == 'installed': + installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) + return((name, version, description, state, installedpng, divpng)) + elif state == 'upgradeable': + upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgradeable.png")) + return((name, version, description, state, upgradeablepng, divpng)) + else: + installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) + return((name, version, description, state, installablepng, divpng)) + + def buildPacketList(self): + self.list = [] + self.cachelist = [] + + if self.cache_ttl > 0 and self.vc != 0: + print 'Loading packagelist cache from ',self.cache_file + try: + self.cachelist = load_cache(self.cache_file) + if len(self.cachelist) > 0: + for x in self.cachelist: + self.list.append(self.buildEntryComponent(x[0], x[1], x[2], x[3])) + self['list'].setList(self.list) + except: + self.inv_cache = 1 + + if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: + print 'rebuilding fresh package list' + for x in self.packetlist: + status = "" + if self.installed_packetlist.has_key(x[0].strip()): + if self.installed_packetlist[x[0].strip()] == x[1].strip(): + status = "installed" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) + else: + status = "upgradeable" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) + else: + status = "installable" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) + if not any(x[0].strip().endswith(x) for x in self.unwanted_extensions): + self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status]) + write_cache(self.cache_file, self.cachelist) + self['list'].setList(self.list) + + def reloadPluginlist(self): + plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) + + +class PluginManager(Screen, DreamInfoHandler): + + lastDownloadDate = None -class WlanScan(Screen): skin = """ - + + - + + + + {"templates": + {"default": (51,[ + MultiContentEntryText(pos = (30, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (30, 25), size = (470, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description + MultiContentEntryPixmapAlphaTest(pos = (475, 0), size = (48, 48), png = 5), # index 5 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 6), # index 6 is the div pixmap + ]), + "category": (40,[ + MultiContentEntryText(pos = (30, 0), size = (500, 22), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (30, 22), size = (500, 16), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the description + MultiContentEntryPixmapAlphaTest(pos = (0, 38), size = (550, 2), png = 3), # index 3 is the div pixmap + ]) + }, + "fonts": [gFont("Regular", 22),gFont("Regular", 16)], + "itemHeight": 52 + } + + + + """ + + def __init__(self, session, plugin_path, args = None): + Screen.__init__(self, session) + self.session = session + self.skin_path = plugin_path + aboutInfo = about.getImageVersionString() + if aboutInfo.startswith("dev-"): + self.ImageVersion = 'Experimental' + else: + self.ImageVersion = 'Stable' + self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" + + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) + self.directory = resolveFilename(SCOPE_METADIR) + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "HelpActions" ], + { + "ok": self.handleCurrent, + "back": self.exit, + "red": self.exit, + "green": self.handleCurrent, + "yellow": self.handleSelected, + "showEventInfo": self.handleSelected, + "displayHelp": self.handleHelp, + }, -1) + + self.list = [] + self.statuslist = [] + self.selectedFiles = [] + self.categoryList = [] + self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText("") + self["key_yellow"] = StaticText("") + self["key_blue"] = StaticText("") + self["status"] = StaticText("") + + self.list_updating = True + self.packetlist = [] + self.installed_packetlist = {} + self.available_packetlist = [] + self.available_updates = 0 + self.Console = Console() + self.cmdList = [] + self.oktext = _("\nAfter pressing OK, please wait!") + self.unwanted_extensions = ('-dbg', '-dev', '-doc') + + self.ipkg = IpkgComponent() + self.ipkg.addCallback(self.ipkgCallback) + if not self.selectionChanged in self["list"].onSelectionChanged: + self["list"].onSelectionChanged.append(self.selectionChanged) + + self.currList = "" + self.currentSelectedTag = None + self.currentSelectedIndex = None + + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) + + def setWindowTitle(self): + self.setTitle(_("Plugin manager")) + + def exit(self): + if self.currList == "packages": + self.currList = "category" + self.currentSelectedTag = None + self["list"].style = "category" + self['list'].setList(self.categoryList) + self["list"].setIndex(self.currentSelectedIndex) + self["list"].updateList(self.categoryList) + self.selectionChanged() + else: + self.ipkg.stop() + if self.Console is not None: + if len(self.Console.appContainers): + for name in self.Console.appContainers.keys(): + self.Console.kill(name) + self.prepareInstall() + if len(self.cmdList): + self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) + else: + self.close() + + def handleHelp(self): + if self.currList != "status": + self.session.open(PluginManagerHelp, self.skin_path) + + def setState(self,status = None): + if status: + self.currList = "status" + self.statuslist = [] + self["key_green"].setText("") + self["key_blue"].setText("") + self["key_yellow"].setText("") + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if status == 'update': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'', '', statuspng, divpng, None, '' )) + self["list"].style = "default" + self['list'].setList(self.statuslist) + elif status == 'sync': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) + self["list"].style = "default" + self['list'].setList(self.statuslist) + elif status == 'error': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) + self["list"].style = "default" + self['list'].setList(self.statuslist) + + def statusCallback(self, status, progress): + pass + + def selectionChanged(self): + current = self["list"].getCurrent() + self["status"].setText("") + if current: + if self.currList == "packages": + self["key_red"].setText(_("Back")) + if current[4] == 'installed': + self["key_green"].setText(_("Remove")) + elif current[4] == 'installable': + self["key_green"].setText(_("Install")) + elif current[4] == 'remove': + self["key_green"].setText(_("Undo\nRemove")) + elif current[4] == 'install': + self["key_green"].setText(_("Undo\nInstall")) + self["key_yellow"].setText(_("View details")) + self["key_blue"].setText("") + if len(self.selectedFiles) == 0 and self.available_updates is not 0: + self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) + elif len(self.selectedFiles) is not 0: + self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) + else: + self["status"].setText(_("There is nothing to be done.")) + elif self.currList == "category": + self["key_red"].setText(_("Close")) + self["key_green"].setText("") + self["key_yellow"].setText("") + self["key_blue"].setText("") + if len(self.selectedFiles) == 0 and self.available_updates is not 0: + self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) + self["key_yellow"].setText(_("Update")) + elif len(self.selectedFiles) is not 0: + self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) + self["key_yellow"].setText(_("Process")) + else: + self["status"].setText(_("There is nothing to be done.")) + + def getSelectionState(self, detailsFile): + for entry in self.selectedFiles: + if entry[0] == detailsFile: + return True + return False + + def rebuildList(self): + self.setState('update') + if not PluginManager.lastDownloadDate or (time() - PluginManager.lastDownloadDate) > 3600: + # Only update from internet once per hour + PluginManager.lastDownloadDate = time() + print "last update time > 1h" + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + else: + print "last update time < 1h" + self.startIpkgList() + + def ipkgCallback(self, event, param): + if event == IpkgComponent.EVENT_ERROR: + self.list_updating = False + self.setState('error') + elif event == IpkgComponent.EVENT_DONE: + self.startIpkgList() + pass + + def startIpkgList(self): + if self.list_updating: + if not self.Console: + self.Console = Console() + cmd = "ipkg list" + self.Console.ePopen(cmd, self.IpkgList_Finished) + + def IpkgList_Finished(self, result, retval, extra_args = None): + if len(result): + self.available_packetlist = [] + for x in result.splitlines(): + split = x.split(' - ') + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.available_packetlist.append([split[0].strip(), split[1].strip(), split[2].strip()]) + self.startInstallMetaPackage() + + def startInstallMetaPackage(self): + if self.list_updating: + self.list_updating = False + if not self.Console: + self.Console = Console() + cmd = "ipkg install enigma2-meta enigma2-plugins-meta enigma2-skins-meta" + self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) + + def InstallMetaPackage_Finished(self, result, retval, extra_args = None): + if len(result): + self.fillPackagesIndexList() + if not self.Console: + self.Console = Console() + self.setState('sync') + cmd = "ipkg list_installed" + self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) + + def IpkgListInstalled_Finished(self, result, retval, extra_args = None): + if len(result): + self.installed_packetlist = {} + for x in result.splitlines(): + split = x.split(' - ') + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.installed_packetlist[split[0].strip()] = split[1].strip() + self.countUpdates() + if self.currentSelectedTag is None: + self.buildCategoryList() + else: + self.buildPacketList(self.currentSelectedTag) + + def countUpdates(self): + self.available_updates = 0 + for package in self.packagesIndexlist[:]: + attributes = package[0]["attributes"] + packagename = attributes["packagename"] + for x in self.available_packetlist: + if x[0].strip() == packagename: + if self.installed_packetlist.has_key(packagename): + if self.installed_packetlist[packagename] != x[1].strip(): + self.available_updates +=1 + + def handleCurrent(self): + current = self["list"].getCurrent() + if current: + if self.currList == "category": + self.currentSelectedIndex = self["list"].index + selectedTag = current[2] + self.buildPacketList(selectedTag) + elif self.currList == "packages": + if current[7] is not '': + idx = self["list"].getIndex() + detailsFile = self.list[idx][1] + if self.list[idx][7] == True: + for entry in self.selectedFiles: + if entry[0] == detailsFile: + self.selectedFiles.remove(entry) + else: + alreadyinList = False + for entry in self.selectedFiles: + if entry[0] == detailsFile: + alreadyinList = True + if not alreadyinList: + self.selectedFiles.append((detailsFile,current[4],current[3])) + if current[4] == 'installed': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'remove', True) + elif current[4] == 'installable': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'install', True) + elif current[4] == 'remove': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installed', False) + elif current[4] == 'install': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installable',False) + self["list"].setList(self.list) + self["list"].setIndex(idx) + self["list"].updateList(self.list) + self.selectionChanged() + + def handleSelected(self): + current = self["list"].getCurrent() + if current: + if self.currList == "packages": + if current[7] is not '': + detailsfile = self.directory[0] + "/" + current[1] + if (os_path.exists(detailsfile) == True): + self.session.openWithCallback(self.detailsClosed, PluginDetails, self.skin_path, current) + else: + self.session.open(MessageBox, _("Sorry, no Details available!"), MessageBox.TYPE_INFO, timeout = 10) + elif self.currList == "category": + self.prepareInstall() + if len(self.cmdList): + self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) + + def detailsClosed(self, result): + if result: + if not self.Console: + self.Console = Console() + self.setState('sync') + PluginManager.lastDownloadDate = time() + self.selectedFiles = [] + cmd = "ipkg update" + self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) + + def buildEntryComponent(self, name, details, description, packagename, state, selected = False): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if state == 'installed': + installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) + return((name, details, description, packagename, state, installedpng, divpng, selected)) + elif state == 'installable': + installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) + return((name, details, description, packagename, state, installablepng, divpng, selected)) + elif state == 'remove': + removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + return((name, details, description, packagename, state, removepng, divpng, selected)) + elif state == 'install': + installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) + return((name, details, description, packagename, state, installpng, divpng, selected)) + + def buildPacketList(self, categorytag = None): + if categorytag is not None: + self.currList = "packages" + self.currentSelectedTag = categorytag + self.packetlist = [] + for package in self.packagesIndexlist[:]: + prerequisites = package[0]["prerequisites"] + if prerequisites.has_key("tag"): + for foundtag in prerequisites["tag"]: + if categorytag == foundtag: + attributes = package[0]["attributes"] + if attributes.has_key("packagetype"): + if attributes["packagetype"] == "internal": + continue + self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) + else: + self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) + self.list = [] + for x in self.packetlist: + status = "" + selectState = self.getSelectionState(x[1].strip()) + if self.installed_packetlist.has_key(x[3].strip()): + if selectState == True: + status = "remove" + else: + status = "installed" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) + else: + if selectState == True: + status = "install" + else: + status = "installable" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) + if len(self.list): + self.list.sort(key=lambda x: x[0]) + self["list"].style = "default" + self['list'].setList(self.list) + self["list"].updateList(self.list) + self.selectionChanged() + + def buildCategoryList(self): + self.currList = "category" + self.categories = [] + self.categoryList = [] + for package in self.packagesIndexlist[:]: + prerequisites = package[0]["prerequisites"] + if prerequisites.has_key("tag"): + for foundtag in prerequisites["tag"]: + attributes = package[0]["attributes"] + if foundtag not in self.categories: + self.categories.append(foundtag) + self.categoryList.append(self.buildCategoryComponent(foundtag)) + self.categoryList.sort(key=lambda x: x[0]) + self["list"].style = "category" + self['list'].setList(self.categoryList) + self["list"].updateList(self.categoryList) + self.selectionChanged() + + def buildCategoryComponent(self, tag = None): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if tag is not None: + if tag == 'System': + return(( _("System"), _("View list of available system extensions" ), tag, divpng )) + elif tag == 'Skin': + return(( _("Skins"), _("View list of available skins" ), tag, divpng )) + elif tag == 'Recording': + return(( _("Recordings"), _("View list of available recording extensions" ), tag, divpng )) + elif tag == 'Network': + return(( _("Network"), _("View list of available networking extensions" ), tag, divpng )) + elif tag == 'CI': + return(( _("CommonInterface"), _("View list of available CommonInterface extensions" ), tag, divpng )) + elif tag == 'Default': + return(( _("Default Settings"), _("View list of available default settings" ), tag, divpng )) + elif tag == 'SAT': + return(( _("Satteliteequipment"), _("View list of available Satteliteequipment extensions." ), tag, divpng )) + elif tag == 'Software': + return(( _("Software"), _("View list of available software extensions" ), tag, divpng )) + elif tag == 'Multimedia': + return(( _("Multimedia"), _("View list of available multimedia extensions." ), tag, divpng )) + elif tag == 'Display': + return(( _("Display and Userinterface"), _("View list of available Display and Userinterface extensions." ), tag, divpng )) + elif tag == 'EPG': + return(( _("Electronic Program Guide"), _("View list of available EPG extensions." ), tag, divpng )) + elif tag == 'Communication': + return(( _("Communication"), _("View list of available communication extensions." ), tag, divpng )) + else: # dynamically generate non existent tags + return(( str(tag), _("View list of available ") + str(tag) + _(" extensions." ), tag, divpng )) + + def prepareInstall(self): + self.cmdList = [] + if self.available_updates > 0: + self.cmdList.append((IpkgComponent.CMD_UPGRADE, { "test_only": False })) + if self.selectedFiles and len(self.selectedFiles): + for plugin in self.selectedFiles: + detailsfile = self.directory[0] + "/" + plugin[0] + if (os_path.exists(detailsfile) == True): + self.fillPackageDetails(plugin[0]) + self.package = self.packageDetails[0] + if self.package[0].has_key("attributes"): + self.attributes = self.package[0]["attributes"] + if self.attributes.has_key("package"): + self.packagefiles = self.attributes["package"] + if plugin[1] == 'installed': + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) + else: + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) + else: + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) + else: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) + else: + if plugin[1] == 'installed': + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) + else: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) + + def runExecute(self, result): + if result: + self.session.openWithCallback(self.runExecuteFinished, Ipkg, cmdList = self.cmdList) + else: + self.close() + + def runExecuteFinished(self): + self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def ExecuteReboot(self, result): + if result is None: + return + if result is False: + self.reloadPluginlist() + self.detailsClosed(True) + if result: + quitMainloop(3) + + def reloadPluginlist(self): + plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) + + +class PluginManagerInfo(Screen): + skin = """ + + + + + + {"template": [ - MultiContentEntryText(pos = (0, 0), size = (550, 30), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the essid - MultiContentEntryText(pos = (0, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 5), # index 5 is the interface - MultiContentEntryText(pos = (175, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 4), # index 0 is the encryption - MultiContentEntryText(pos = (350, 0), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 0 is the signal - MultiContentEntryText(pos = (350, 30), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 3), # index 0 is the maxrate - MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (550, 2), png = 6), # index 6 is the div pixmap + MultiContentEntryText(pos = (50, 1), size = (150, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state + MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap ], - "fonts": [gFont("Regular", 28),gFont("Regular", 18)], - "itemHeight": 54 + "fonts": [gFont("Regular", 22),gFont("Regular", 18)], + "itemHeight": 52 } - - + + """ - def __init__(self, session, iface): + def __init__(self, session, plugin_path, cmdlist = None): Screen.__init__(self, session) self.session = session - self.iface = iface self.skin_path = plugin_path - self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") - self.APList = None - self.newAPList = None - self.WlanList = None - self.cleanList = None - self.oldlist = None - self.listLenght = None - self.rescanTimer = eTimer() - self.rescanTimer.callback.append(self.rescanTimerFired) - - self["info"] = StaticText() - + self.cmdlist = cmdlist + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + { + "ok": self.process, + "back": self.exit, + "red": self.exit, + "green": self.process, + }, -1) + self.list = [] self["list"] = List(self.list) - - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Connect")) - self["key_yellow"] = StaticText() - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"], + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Continue")) + self["status"] = StaticText(_("Following tasks will be done after you press continue!")) + + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) + + def setWindowTitle(self): + self.setTitle(_("Plugin manager activity information")) + + def rebuildList(self): + self.list = [] + if self.cmdlist is not None: + for entry in self.cmdlist: + action = "" + info = "" + cmd = entry[0] + if cmd == 0: + action = 'install' + elif cmd == 2: + action = 'remove' + else: + action = 'upgrade' + args = entry[1] + if cmd == 0: + info = args['package'] + elif cmd == 2: + info = args['package'] + else: + info = _("Dreambox software because updates are available.") + + self.list.append(self.buildEntryComponent(action,info)) + self['list'].setList(self.list) + self['list'].updateList(self.list) + + def buildEntryComponent(self, action,info): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) + removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + if action == 'install': + return(( _('Installing'), info, installpng, divpng)) + elif action == 'remove': + return(( _('Removing'), info, removepng, divpng)) + else: + return(( _('Upgrading'), info, upgradepng, divpng)) + + def exit(self): + self.close(False) + + def process(self): + self.close(True) + + +class PluginManagerHelp(Screen): + skin = """ + + + + + + {"template": [ + MultiContentEntryText(pos = (50, 1), size = (540, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state + MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap + ], + "fonts": [gFont("Regular", 22),gFont("Regular", 18)], + "itemHeight": 52 + } + + + + + """ + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.session = session + self.skin_path = plugin_path + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { - "ok": self.select, - "back": self.cancel, + "back": self.exit, + "red": self.exit, }, -1) - - self["shortcuts"] = ActionMap(["ShortcutActions"], + + self.list = [] + self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) + self["status"] = StaticText(_("A small overview of the available icon states and actions.")) + + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) + + def setWindowTitle(self): + self.setTitle(_("Plugin manager help")) + + def rebuildList(self): + self.list = [] + self.list.append(self.buildEntryComponent('install')) + self.list.append(self.buildEntryComponent('installable')) + self.list.append(self.buildEntryComponent('installed')) + self.list.append(self.buildEntryComponent('remove')) + self['list'].setList(self.list) + self['list'].updateList(self.list) + + def buildEntryComponent(self, state): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) + installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) + removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) + + if state == 'installed': + return(( _('This plugin is installed.'), _('You can remove this plugin.'), installedpng, divpng)) + elif state == 'installable': + return(( _('This plugin is not installed.'), _('You can install this plugin.'), installablepng, divpng)) + elif state == 'install': + return(( _('This plugin will be installed.'), _('You can cancel the installation.'), installpng, divpng)) + elif state == 'remove': + return(( _('This plugin will be removed.'), _('You can cancel the removal.'), removepng, divpng)) + + def exit(self): + self.close() + + +class PluginDetails(Screen, DreamInfoHandler): + skin = """ + + + + + + + + + + + """ + def __init__(self, session, plugin_path, packagedata = None): + Screen.__init__(self, session) + self.skin_path = plugin_path + self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" + self.attributes = None + self.translatedAttributes = None + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language) + self.directory = resolveFilename(SCOPE_METADIR) + if packagedata: + self.pluginname = packagedata[0] + self.details = packagedata[1] + self.pluginstate = packagedata[4] + self.statuspicinstance = packagedata[5] + self.divpicinstance = packagedata[6] + self.fillPackageDetails(self.details) + + self.thumbnail = "" + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { - "red": self.cancel, - "green": self.select, - }) - self.onLayoutFinish.append(self.layoutFinished) - self.getAccessPoints(refresh = False) - - def layoutFinished(self): - self.setTitle(_("Choose a wireless network")) - - def select(self): - cur = self["list"].getCurrent() - if cur is not None: - self.rescanTimer.stop() - del self.rescanTimer - if cur[1] is not None: - essid = cur[1] - self.close(essid,self.getWlanList()) - else: - self.close(None,None) - else: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None,None) - - def WlanSetupClosed(self, *ret): - if ret[0] == 2: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None) - - def cancel(self): - if self.oldInterfaceState is False: - iNetwork.setAdapterAttribute(self.iface, "up", False) - iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB) + "back": self.exit, + "red": self.exit, + "green": self.go, + "up": self.pageUp, + "down": self.pageDown, + "left": self.pageUp, + "right": self.pageDown, + }, -1) + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText("") + self["author"] = StaticText() + self["statuspic"] = Pixmap() + self["divpic"] = Pixmap() + self["screenshot"] = Pixmap() + self["detailtext"] = ScrollLabel() + + self["statuspic"].hide() + self["screenshot"].hide() + self["divpic"].hide() + + self.package = self.packageDetails[0] + if self.package[0].has_key("attributes"): + self.attributes = self.package[0]["attributes"] + if self.package[0].has_key("translation"): + self.translatedAttributes = self.package[0]["translation"] + + self.cmdList = [] + self.oktext = _("\nAfter pressing OK, please wait!") + self.picload = ePicLoad() + self.picload.PictureData.get().append(self.paintScreenshotPixmapCB) + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.setInfos) + + def setWindowTitle(self): + self.setTitle(_("Package details for: " + self.pluginname)) + + def exit(self): + self.close(False) + + def pageUp(self): + self["detailtext"].pageUp() + + def pageDown(self): + self["detailtext"].pageDown() + + def statusCallback(self, status, progress): + pass + + def setInfos(self): + if self.translatedAttributes.has_key("name"): + self.pluginname = self.translatedAttributes["name"] + elif self.attributes.has_key("name"): + self.pluginname = self.attributes["name"] else: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None) - - def deactivateInterfaceCB(self,data): - if data is not None: - if data is True: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None) - - def rescanTimerFired(self): - self.rescanTimer.stop() - self.updateAPList() - - def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal): -<<<<<<< HEAD:lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py - print "buildEntryComponent",essid - print "buildEntryComponent",bssid -======= ->>>>>>> origin/bug_203_fix_wrong_networkstate:lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png")) - encryption = encrypted and _("Yes") or _("No") - if bssid == 'hidden...': - return((essid, bssid, None, None, None, None, divpng)) - else: - return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng)) - - def updateAPList(self): - self.oldlist = [] - self.oldlist = self.cleanList - self.newAPList = [] - newList = [] - tmpList = [] - newListIndex = None - currentListEntry = None - currentListIndex = None - newList = self.getAccessPoints(refresh = True) - - for oldentry in self.oldlist: - if oldentry not in newList: - newList.append(oldentry) - - for newentry in newList: - if newentry[1] == "hidden...": - continue - tmpList.append(newentry) - - if len(tmpList): - if "hidden..." not in tmpList: - tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) - - for entry in tmpList: - self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) - - currentListEntry = self["list"].getCurrent() - idx = 0 - for entry in self.newAPList: - if entry == currentListEntry: - newListIndex = idx - idx +=1 - self['list'].setList(self.newAPList) - self["list"].setIndex(newListIndex) - self["list"].updateList(self.newAPList) - self.listLenght = len(self.newAPList) - self.buildWlanList() - self.setInfo() - - def getAccessPoints(self, refresh = False): - self.APList = [] - self.cleanList = [] - self.w = Wlan(self.iface) - aps = self.w.getNetworkList() - if aps is not None: - print "[NetworkWizard.py] got Accespoints!" - tmpList = [] - compList = [] - for ap in aps: - a = aps[ap] - if a['active']: - tmpList.append( (a['essid'], a['bssid']) ) - compList.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) ) - - for entry in tmpList: - if entry[0] == "": - for compentry in compList: - if compentry[1] == entry[1]: - compList.remove(compentry) - for entry in compList: - self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) ) - - if "hidden..." not in self.cleanList: - self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) + self.pluginname = _("unknown") - for entry in self.cleanList: - self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) - - if refresh is False: - self['list'].setList(self.APList) - self.listLenght = len(self.APList) - self.setInfo() - self.rescanTimer.start(5000) - return self.cleanList - - def setInfo(self): - length = self.getLength() - if length == 0: - self["info"].setText(_("No wireless networks found! Please refresh.")) - elif length == 1: - self["info"].setText(_("1 wireless network found!")) + if self.translatedAttributes.has_key("author"): + self.author = self.translatedAttributes["author"] + elif self.attributes.has_key("author"): + self.author = self.attributes["author"] else: - self["info"].setText(str(length)+_(" wireless networks found!")) + self.author = _("unknown") - def buildWlanList(self): - self.WlanList = [] - currList = [] - currList = self['list'].list - for entry in currList: - self.WlanList.append( (entry[1], entry[0]) ) + if self.translatedAttributes.has_key("description"): + self.description = self.translatedAttributes["description"] + elif self.attributes.has_key("description"): + self.description = self.attributes["description"] + else: + self.description = _("No description available.") - def getLength(self): - return self.listLenght + if self.translatedAttributes.has_key("screenshot"): + self.loadThumbnail(self.translatedAttributes) + else: + self.loadThumbnail(self.attributes) - def getWlanList(self): - return self.WlanList + self["author"].setText(_("Author: ") + self.author) + self["detailtext"].setText(self.description.strip()) + if self.pluginstate == 'installable': + self["key_green"].setText(_("Install")) + else: + self["key_green"].setText(_("Remove")) + def loadThumbnail(self, entry): + thumbnailUrl = None + if entry.has_key("screenshot"): + thumbnailUrl = entry["screenshot"] + if thumbnailUrl is not None: + self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1] + print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail + client.downloadPage(thumbnailUrl,self.thumbnail).addCallback(self.setThumbnail).addErrback(self.fetchFailed) + else: + self.setThumbnail(noScreenshot = True) -def WlanStatusScreenMain(session, iface): - session.open(WlanStatus, iface) + def setThumbnail(self, noScreenshot = False): + if not noScreenshot: + filename = self.thumbnail + else: + filename = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/noprev.png") + sc = AVSwitch().getFramebufferScale() + self.picload.setPara((self["screenshot"].instance.size().width(), self["screenshot"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000")) + self.picload.startDecode(filename) -def callFunction(iface): - w = Wlan(iface) - i = w.getWirelessInterfaces() - if i: - if iface in i: - return WlanStatusScreenMain - return None + if self.statuspicinstance != None: + self["statuspic"].instance.setPixmap(self.statuspicinstance.__deref__()) + self["statuspic"].show() + if self.divpicinstance != None: + self["divpic"].instance.setPixmap(self.divpicinstance.__deref__()) + self["divpic"].show() + def paintScreenshotPixmapCB(self, picInfo=None): + ptr = self.picload.getData() + if ptr != None: + self["screenshot"].instance.setPixmap(ptr.__deref__()) + self["screenshot"].show() + else: + self.setThumbnail(noScreenshot = True) -def configStrings(iface): - driver = iNetwork.detectWlanModule() - print "Found WLAN-Driver:",driver - if driver in ('ralink', 'zydas'): - return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate" - else: - if config.plugins.wlan.essid.value == "hidden...": - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' + def go(self): + if self.attributes.has_key("package"): + self.packagefiles = self.attributes["package"] + self.cmdList = [] + if self.pluginstate == 'installed': + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) + if len(self.cmdList): + self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + self.pluginname + "\n" + self.oktext) else: - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) + if len(self.cmdList): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext) + + def runUpgrade(self, result): + if result: + self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) + + def runUpgradeFinished(self): + self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def UpgradeReboot(self, result): + if result is None: + return + if result is False: + self.close(True) + if result: + quitMainloop(3) + + def runRemove(self, result): + if result: + self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) + + def runRemoveFinished(self): + self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def RemoveReboot(self, result): + if result is None: + return + if result is False: + self.close(True) + if result: + quitMainloop(3) + + def reloadPluginlist(self): + plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) + + def fetchFailed(self,string): + self.setThumbnail(noScreenshot = True) + print "[PluginDetails] fetch failed " + string.getErrorMessage() + + +class UpdatePlugin(Screen): + skin = """ + + + + + + """ + + def __init__(self, session, args = None): + Screen.__init__(self, session) + + self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 } + + self.slider = Slider(0, 4) + self["slider"] = self.slider + self.activityslider = Slider(0, 100) + self["activityslider"] = self.activityslider + self.status = StaticText(_("Upgrading Dreambox... Please wait")) + self["status"] = self.status + self.package = StaticText() + self["package"] = self.package + + self.packages = 0 + self.error = 0 + + self.activity = 0 + self.activityTimer = eTimer() + self.activityTimer.callback.append(self.doActivityTimer) + self.activityTimer.start(100, False) + + self.ipkg = IpkgComponent() + self.ipkg.addCallback(self.ipkgCallback) + + self.updating = True + self.package.setText(_("Package list update")) + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.exit, + "back": self.exit + }, -1) + + def doActivityTimer(self): + self.activity += 1 + if self.activity == 100: + self.activity = 0 + self.activityslider.setValue(self.activity) + + def ipkgCallback(self, event, param): + if event == IpkgComponent.EVENT_DOWNLOAD: + self.status.setText(_("Downloading")) + elif event == IpkgComponent.EVENT_UPGRADE: + if self.sliderPackages.has_key(param): + self.slider.setValue(self.sliderPackages[param]) + self.package.setText(param) + self.status.setText(_("Upgrading")) + self.packages += 1 + elif event == IpkgComponent.EVENT_INSTALL: + self.package.setText(param) + self.status.setText(_("Installing")) + self.packages += 1 + elif event == IpkgComponent.EVENT_CONFIGURING: + self.package.setText(param) + self.status.setText(_("Configuring")) + elif event == IpkgComponent.EVENT_MODIFIED: + self.session.openWithCallback( + self.modificationCallback, + MessageBox, + _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) + ) + elif event == IpkgComponent.EVENT_ERROR: + self.error += 1 + elif event == IpkgComponent.EVENT_DONE: + if self.updating: + self.updating = False + self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False}) + elif self.error == 0: + self.slider.setValue(4) + + self.activityTimer.stop() + self.activityslider.setValue(0) + + self.package.setText("") + self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages) + else: + self.activityTimer.stop() + self.activityslider.setValue(0) + error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.") + if self.packages == 0: + error = _("No packages were upgraded yet. So you can check your network and try again.") + if self.updating: + error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.") + self.status.setText(_("Error") + " - " + error) + #print event, "-", param + pass + + def modificationCallback(self, res): + self.ipkg.write(res and "N" or "Y") + + def exit(self): + if not self.ipkg.isRunning(): + if self.packages != 0 and self.error == 0: + self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?")) + else: + self.close() + + def exitAnswer(self, result): + if result is not None and result: + quitMainloop(2) + self.close() + + +class IpkgInstaller(Screen): + skin = """ + + + + + + + + + """ + + def __init__(self, session, list): + Screen.__init__(self, session) + + self.list = SelectionList() + self["list"] = self.list + for listindex in range(len(list)): + self.list.addSelection(list[listindex], list[listindex], listindex, True) + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Install")) + self["introduction"] = StaticText(_("Press OK to toggle the selection.")) + + self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], + { + "ok": self.list.toggleSelection, + "cancel": self.close, + "red": self.close, + "green": self.install + }, -1) + + def install(self): + list = self.list.getSelectionsList() + cmdList = [] + for item in list: + cmdList.append((IpkgComponent.CMD_INSTALL, { "package": item[1] })) + self.session.open(Ipkg, cmdList = cmdList) + + +def filescan_open(list, session, **kwargs): + filelist = [x.path for x in list] + session.open(IpkgInstaller, filelist) # list + +def filescan(**kwargs): + from Components.Scanner import Scanner, ScanPath + return \ + Scanner(mimetypes = ["application/x-debian-package"], + paths_to_scan = + [ + ScanPath(path = "ipk", with_subdirs = True), + ScanPath(path = "", with_subdirs = False), + ], + name = "Ipkg", + description = _("Install extensions."), + openfnc = filescan_open, ) + + + +def UpgradeMain(session, **kwargs): + session.open(UpdatePluginMenu) + +def startSetup(menuid): + if menuid != "setup": + return [ ] + return [(_("Software manager"), UpgradeMain, "software_manager", 50)] -def Plugins(**kwargs): - return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."}) - \ No newline at end of file +def Plugins(path, **kwargs): + global plugin_path + plugin_path = path + list = [ + PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), + PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) + ] + if config.usage.setup_level.index >= 2: # expert+ + list.append(PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=UpgradeMain)) + return list -- cgit v1.2.3 From e198493e29c22e49dff1da47e83a989cdbd1d913 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 15 Dec 2009 19:35:25 +0100 Subject: fix wrong fix ;-( --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 1994 ++++---------------- 1 file changed, 328 insertions(+), 1666 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 8aafd9a7..6873ffa4 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,1734 +1,396 @@ -from Plugins.Plugin import PluginDescriptor -from Screens.Console import Console -from Screens.ChoiceBox import ChoiceBox -from Screens.MessageBox import MessageBox +from enigma import eTimer from Screens.Screen import Screen -from Screens.Ipkg import Ipkg from Components.ActionMap import ActionMap, NumberActionMap -from Components.Input import Input -from Components.Ipkg import IpkgComponent +from Components.Pixmap import Pixmap,MultiPixmap +from Components.Label import Label from Components.Sources.StaticText import StaticText -from Components.ScrollLabel import ScrollLabel -from Components.Pixmap import Pixmap -from Components.MenuList import MenuList from Components.Sources.List import List -from Components.Slider import Slider -from Components.Harddisk import harddiskmanager -from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations +from Components.MenuList import MenuList +from Components.config import config, getConfigListEntry, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword +from Components.ConfigList import ConfigListScreen +from Components.Network import Network, iNetwork from Components.Console import Console -from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest -from Components.SelectionList import SelectionList -from Components.PluginComponent import plugins -from Components.About import about -from Components.DreamInfoHandler import DreamInfoHandler -from Components.Language import language -from Components.AVSwitch import AVSwitch -from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR +from Plugins.Plugin import PluginDescriptor +from os import system, path as os_path, listdir +from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad -from cPickle import dump, load -from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK -from time import time, gmtime, strftime, localtime -from stat import ST_MTIME -from datetime import date -from twisted.web import client -from twisted.internet import reactor - -from ImageWizard import ImageWizard -from BackupRestore import BackupSelection, RestoreMenu, BackupScreen, RestoreScreen, getBackupPath, getBackupFilename -#from SoftwareTools import extensions - -config.plugins.configurationbackup = ConfigSubsection() -config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) -config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) - -def write_cache(cache_file, cache_data): - #Does a cPickle dump - if not os_path.isdir( os_path.dirname(cache_file) ): - try: - mkdir( os_path.dirname(cache_file) ) - except OSError: - print os_path.dirname(cache_file), 'is a file' - fd = open(cache_file, 'w') - dump(cache_data, fd, -1) - fd.close() - -def valid_cache(cache_file, cache_ttl): - #See if the cache file exists and is still living - try: - mtime = stat(cache_file)[ST_MTIME] - except: - return 0 - curr_time = time() - if (curr_time - mtime) > cache_ttl: - return 0 - else: - return 1 - -def load_cache(cache_file): - #Does a cPickle load - fd = open(cache_file) - cache_data = load(fd) - fd.close() - return cache_data - - -class UpdatePluginMenu(Screen): - skin = """ - - - - - - - {"template": [ - MultiContentEntryText(pos = (2, 2), size = (290, 22), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText, - ], - "fonts": [gFont("Regular", 20)], - "itemHeight": 25 - } - - - - - {"template": [ - MultiContentEntryText(pos = (2, 2), size = (240, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, - ], - "fonts": [gFont("Regular", 20)], - "itemHeight": 300 - } - - - """ - - def __init__(self, session, args = 0): - Screen.__init__(self, session) - self.skin_path = plugin_path - self.menu = args - self.list = [] - self.oktext = _("\nPress OK on your remote control to continue.") - self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) - if self.menu == 0: - self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None)) - self.list.append(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + self.oktext, None)) - self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None)) - self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None)) - self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None)) - self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext, None)) - for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): - if p.__call__.has_key("SoftwareSupported"): - callFnc = p.__call__["SoftwareSupported"](None) - if callFnc is not None: - if p.__call__.has_key("menuEntryName"): - menuEntryName = p.__call__["menuEntryName"](None) - else: - menuEntryName = _('Extended Software') - if p.__call__.has_key("menuEntryDescription"): - menuEntryDescription = p.__call__["menuEntryDescription"](None) - else: - menuEntryDescription = _('Extended Software Plugin') - self.list.append(('default-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) - if config.usage.setup_level.index >= 2: # expert+ - self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext, None)) - elif self.menu == 1: - self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) - self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) - self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None)) - if config.usage.setup_level.index >= 2: # expert+ - self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) - self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) - for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): - if p.__call__.has_key("AdvancedSoftwareSupported"): - callFnc = p.__call__["AdvancedSoftwareSupported"](None) - if callFnc is not None: - if p.__call__.has_key("menuEntryName"): - menuEntryName = p.__call__["menuEntryName"](None) - else: - menuEntryName = _('Advanced Software') - if p.__call__.has_key("menuEntryDescription"): - menuEntryDescription = p.__call__["menuEntryDescription"](None) - else: - menuEntryDescription = _('Advanced Software Plugin') - self.list.append(('advanced-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) - - self["menu"] = List(self.list) - self["key_red"] = StaticText(_("Close")) - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "ok": self.go, - "back": self.close, - "red": self.close, - }, -1) - - self.onLayoutFinish.append(self.layoutFinished) - self.backuppath = getBackupPath() - self.backupfile = getBackupFilename() - self.fullbackupfilename = self.backuppath + "/" + self.backupfile - self.onShown.append(self.setWindowTitle) - - def layoutFinished(self): - idx = 0 - self["menu"].index = idx - - def setWindowTitle(self): - self.setTitle(_("Software manager")) +from Wlan import Wlan, wpaSupplicant, iStatus - def go(self): - current = self["menu"].getCurrent() - if current: - currentEntry = current[0] - if self.menu == 0: - if (currentEntry == "software-update"): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!")) - elif (currentEntry == "software-restore"): - self.session.open(ImageWizard) - elif (currentEntry == "install-plugins"): - self.session.open(PluginManager, self.skin_path) - elif (currentEntry == "system-backup"): - self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True) - elif (currentEntry == "system-restore"): - if os_path.exists(self.fullbackupfilename): - self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore")) - else: - self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10) - elif (currentEntry == "ipkg-install"): - try: - from Plugins.Extensions.MediaScanner.plugin import main - main(self.session) - except: - self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO, timeout = 10) - elif (currentEntry == "default-plugin"): - self.extended = current[3] - self.extended(self.session, None) - elif (currentEntry == "advanced"): - self.session.open(UpdatePluginMenu, 1) - elif self.menu == 1: - if (currentEntry == "ipkg-manager"): - self.session.open(PacketManager, self.skin_path) - elif (currentEntry == "backuplocation"): - parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)] - for x in parts: - if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/': - parts.remove(x) - for x in parts: - if x[1].startswith('/autofs/'): - parts.remove(x) - if len(parts): - self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts) - elif (currentEntry == "backupfiles"): - self.session.openWithCallback(self.backupfiles_choosen,BackupSelection) - elif (currentEntry == "advancedrestore"): - self.session.open(RestoreMenu, self.skin_path) - elif (currentEntry == "ipkg-source"): - self.session.open(IPKGMenu, self.skin_path) - elif (currentEntry == "advanced-plugin"): - self.extended = current[3] - self.extended(self.session, None) +plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan" - def backupfiles_choosen(self, ret): - self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) +list = [] +list.append("WEP") +list.append("WPA") +list.append("WPA2") +list.append("WPA/WPA2") - def backuplocation_choosen(self, option): - if option is not None: - config.plugins.configurationbackup.backuplocation.value = str(option[1]) - config.plugins.configurationbackup.backuplocation.save() - config.plugins.configurationbackup.save() - config.save() - self.createBackupfolders() +weplist = [] +weplist.append("ASCII") +weplist.append("HEX") - def runUpgrade(self, result): - if result: - self.session.open(UpdatePlugin, self.skin_path) +config.plugins.wlan = ConfigSubsection() +config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False)) +config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False)) - def createBackupfolders(self): - print "Creating backup folder if not already there..." - self.backuppath = getBackupPath() - try: - if (os_path.exists(self.backuppath) == False): - makedirs(self.backuppath) - except OSError: - self.session.open(MessageBox, _("Sorry, your backup destination is not writeable.\n\nPlease choose another one."), MessageBox.TYPE_INFO, timeout = 10) +config.plugins.wlan.encryption = ConfigSubsection() +config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False)) +config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" )) +config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII")) +config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False)) - def backupDone(self,retval = None): - if retval is True: - self.session.open(MessageBox, _("Backup done."), MessageBox.TYPE_INFO, timeout = 10) - else: - self.session.open(MessageBox, _("Backup failed."), MessageBox.TYPE_INFO, timeout = 10) - - def startRestore(self, ret = False): - if (ret == True): - self.exe = True - self.session.open(RestoreScreen, runRestore = True) -class IPKGMenu(Screen): +class WlanStatus(Screen): skin = """ - + - - - - """ - - def __init__(self, session, plugin_path): - Screen.__init__(self, session) - self.skin_path = plugin_path - - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Edit")) - - self.sel = [] - self.val = [] - self.entry = False - self.exe = False - - self.path = "" - - self["actions"] = NumberActionMap(["SetupActions"], - { - "ok": self.KeyOk, - "cancel": self.keyCancel - }, -1) - - self["shortcuts"] = ActionMap(["ShortcutActions"], - { - "red": self.keyCancel, - "green": self.KeyOk, - }) - self.flist = [] - self["filelist"] = MenuList(self.flist) - self.fill_list() - self.onLayoutFinish.append(self.layoutFinished) - - def layoutFinished(self): - self.setWindowTitle() - - def setWindowTitle(self): - self.setTitle(_("Select upgrade source to edit.")) - - def fill_list(self): - self.flist = [] - self.path = '/etc/ipkg/' - if (os_path.exists(self.path) == False): - self.entry = False - return - for file in listdir(self.path): - if (file.endswith(".conf")): - if file != 'arch.conf': - self.flist.append((file)) - self.entry = True - self["filelist"].l.setList(self.flist) - - def KeyOk(self): - if (self.exe == False) and (self.entry == True): - self.sel = self["filelist"].getCurrent() - self.val = self.path + self.sel - self.session.open(IPKGSource, self.val) - - def keyCancel(self): - self.close() - - def Exit(self): - self.close() - - -class IPKGSource(Screen): - skin = """ - - - - - - - """ - - def __init__(self, session, configfile = None): - Screen.__init__(self, session) - self.session = session - self.configfile = configfile - text = "" - if self.configfile: - try: - fp = file(configfile, 'r') - sources = fp.readlines() - if sources: - text = sources[0] - fp.close() - except IOError: - pass - - desk = getDesktop(0) - x= int(desk.size().width()) - y= int(desk.size().height()) - - self["key_red"] = StaticText(_("Cancel")) - self["key_green"] = StaticText(_("Save")) - - if (y>=720): - self["text"] = Input(text, maxSize=False, type=Input.TEXT) - else: - self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], - { - "ok": self.go, - "back": self.close, - "red": self.close, - "green": self.go, - "left": self.keyLeft, - "right": self.keyRight, - "home": self.keyHome, - "end": self.keyEnd, - "deleteForward": self.keyDeleteForward, - "deleteBackward": self.keyDeleteBackward, - "1": self.keyNumberGlobal, - "2": self.keyNumberGlobal, - "3": self.keyNumberGlobal, - "4": self.keyNumberGlobal, - "5": self.keyNumberGlobal, - "6": self.keyNumberGlobal, - "7": self.keyNumberGlobal, - "8": self.keyNumberGlobal, - "9": self.keyNumberGlobal, - "0": self.keyNumberGlobal - }, -1) - - self.onLayoutFinish.append(self.layoutFinished) - - def layoutFinished(self): - self.setWindowTitle() - self["text"].right() - - def setWindowTitle(self): - self.setTitle(_("Edit upgrade source url.")) - - def go(self): - text = self["text"].getText() - if text: - fp = file(self.configfile, 'w') - fp.write(text) - fp.write("\n") - fp.close() - self.close() - - def keyLeft(self): - self["text"].left() - - def keyRight(self): - self["text"].right() - def keyHome(self): - self["text"].home() - - def keyEnd(self): - self["text"].end() - - def keyDeleteForward(self): - self["text"].delete() - - def keyDeleteBackward(self): - self["text"].deleteBackward() + + + + + + + + + + + + + - def keyNumberGlobal(self, number): - self["text"].number(number) - - -class PacketManager(Screen): - skin = """ - - - - - - - - {"template": [ - MultiContentEntryText(pos = (5, 1), size = (440, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (5, 26), size = (440, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description - MultiContentEntryPixmapAlphaTest(pos = (445, 2), size = (48, 48), png = 4), # index 4 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (5, 50), size = (510, 2), png = 5), # index 4 is the div pixmap - ], - "fonts": [gFont("Regular", 22),gFont("Regular", 14)], - "itemHeight": 52 - } - - + + + + + """ - - def __init__(self, session, plugin_path, args = None): + + def __init__(self, session, iface): Screen.__init__(self, session) self.session = session - self.skin_path = plugin_path - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "ok": self.go, - "back": self.exit, - "red": self.exit, - "green": self.reload, - }, -1) - - self.list = [] - self.statuslist = [] - self["list"] = List(self.list) - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Reload")) - - self.list_updating = True - self.packetlist = [] - self.installed_packetlist = {} - self.Console = Console() - self.cmdList = [] - self.cachelist = [] - self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs) - self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory - self.oktext = _("\nAfter pressing OK, please wait!") - self.unwanted_extensions = ('-dbg', '-dev', '-doc', 'busybox') - - self.ipkg = IpkgComponent() - self.ipkg.addCallback(self.ipkgCallback) - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def exit(self): - self.ipkg.stop() - if self.Console is not None: - if len(self.Console.appContainers): - for name in self.Console.appContainers.keys(): - self.Console.kill(name) - self.close() - - def reload(self): - if (os_path.exists(self.cache_file) == True): - remove(self.cache_file) - self.list_updating = True - self.rebuildList() + self.iface = iface + + self["LabelBSSID"] = StaticText(_('Accesspoint:')) + self["LabelESSID"] = StaticText(_('SSID:')) + self["LabelQuality"] = StaticText(_('Link Quality:')) + self["LabelSignal"] = StaticText(_('Signal Strength:')) + self["LabelBitrate"] = StaticText(_('Bitrate:')) + self["LabelEnc"] = StaticText(_('Encryption:')) - def setWindowTitle(self): - self.setTitle(_("Packet manager")) - - def setStatus(self,status = None): - if status: - self.statuslist = [] - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if status == 'update': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'',statuspng, divpng )) - self['list'].setList(self.statuslist) - elif status == 'error': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'',statuspng, divpng )) - self['list'].setList(self.statuslist) - - def rebuildList(self): - self.setStatus('update') - self.inv_cache = 0 - self.vc = valid_cache(self.cache_file, self.cache_ttl) - if self.cache_ttl > 0 and self.vc != 0: - try: - self.buildPacketList() - except: - self.inv_cache = 1 - if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: - self.run = 0 - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - - def go(self, returnValue = None): - cur = self["list"].getCurrent() - if cur: - status = cur[3] - package = cur[0] - self.cmdList = [] - if status == 'installed': - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package })) - if len(self.cmdList): - self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + package + "\n" + self.oktext) - elif status == 'upgradeable': - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) - if len(self.cmdList): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to upgrade the package:\n") + package + "\n" + self.oktext) - elif status == "installable": - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) - if len(self.cmdList): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + package + "\n" + self.oktext) - - def runRemove(self, result): - if result: - self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) - - def runRemoveFinished(self): - self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def RemoveReboot(self, result): - if result is None: - return - if result is False: - cur = self["list"].getCurrent() - if cur: - item = self['list'].getIndex() - self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installable') - self.cachelist[item] = [cur[0], cur[1], cur[2], 'installable'] - self['list'].setList(self.list) - write_cache(self.cache_file, self.cachelist) - self.reloadPluginlist() - if result: - quitMainloop(3) - - def runUpgrade(self, result): - if result: - self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) + self["BSSID"] = StaticText() + self["ESSID"] = StaticText() + self["quality"] = StaticText() + self["signal"] = StaticText() + self["bitrate"] = StaticText() + self["enc"] = StaticText() + + self["IFtext"] = StaticText() + self["IF"] = StaticText() + self["Statustext"] = StaticText() + self["statuspic"] = MultiPixmap() + self["statuspic"].hide() + self["key_red"] = StaticText(_("Close")) - def runUpgradeFinished(self): - self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + self.resetList() + self.updateStatusbar() - def UpgradeReboot(self, result): - if result is None: - return - if result is False: - cur = self["list"].getCurrent() - if cur: - item = self['list'].getIndex() - self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installed') - self.cachelist[item] = [cur[0], cur[1], cur[2], 'installed'] - self['list'].setList(self.list) - write_cache(self.cache_file, self.cachelist) - self.reloadPluginlist() - if result: - quitMainloop(3) - - def ipkgCallback(self, event, param): - if event == IpkgComponent.EVENT_ERROR: - self.list_updating = False - self.setStatus('error') - elif event == IpkgComponent.EVENT_DONE: - if self.list_updating: - self.list_updating = False - if not self.Console: - self.Console = Console() - cmd = "ipkg list" - self.Console.ePopen(cmd, self.IpkgList_Finished) - #print event, "-", param - pass - - def IpkgList_Finished(self, result, retval, extra_args = None): - if len(result): - self.packetlist = [] - for x in result.splitlines(): - split = x.split(' - ') #self.blacklisted_packages - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()]) - if not self.Console: - self.Console = Console() - cmd = "ipkg list_installed" - self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) - - def IpkgListInstalled_Finished(self, result, retval, extra_args = None): - if len(result): - self.installed_packetlist = {} - for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.installed_packetlist[split[0].strip()] = split[1].strip() - self.buildPacketList() - - def buildEntryComponent(self, name, version, description, state): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if state == 'installed': - installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) - return((name, version, description, state, installedpng, divpng)) - elif state == 'upgradeable': - upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgradeable.png")) - return((name, version, description, state, upgradeablepng, divpng)) - else: - installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) - return((name, version, description, state, installablepng, divpng)) - - def buildPacketList(self): - self.list = [] - self.cachelist = [] - - if self.cache_ttl > 0 and self.vc != 0: - print 'Loading packagelist cache from ',self.cache_file - try: - self.cachelist = load_cache(self.cache_file) - if len(self.cachelist) > 0: - for x in self.cachelist: - self.list.append(self.buildEntryComponent(x[0], x[1], x[2], x[3])) - self['list'].setList(self.list) - except: - self.inv_cache = 1 - - if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: - print 'rebuilding fresh package list' - for x in self.packetlist: - status = "" - if self.installed_packetlist.has_key(x[0].strip()): - if self.installed_packetlist[x[0].strip()] == x[1].strip(): - status = "installed" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) - else: - status = "upgradeable" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) - else: - status = "installable" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) - if not any(x[0].strip().endswith(x) for x in self.unwanted_extensions): - self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status]) - write_cache(self.cache_file, self.cachelist) - self['list'].setList(self.list) - - def reloadPluginlist(self): - plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) - - -class PluginManager(Screen, DreamInfoHandler): - - lastDownloadDate = None - - skin = """ - - - - - - - - - - - - {"templates": - {"default": (51,[ - MultiContentEntryText(pos = (30, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (30, 25), size = (470, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description - MultiContentEntryPixmapAlphaTest(pos = (475, 0), size = (48, 48), png = 5), # index 5 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 6), # index 6 is the div pixmap - ]), - "category": (40,[ - MultiContentEntryText(pos = (30, 0), size = (500, 22), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (30, 22), size = (500, 16), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the description - MultiContentEntryPixmapAlphaTest(pos = (0, 38), size = (550, 2), png = 3), # index 3 is the div pixmap - ]) - }, - "fonts": [gFont("Regular", 22),gFont("Regular", 16)], - "itemHeight": 52 - } - - - - """ - - def __init__(self, session, plugin_path, args = None): - Screen.__init__(self, session) - self.session = session - self.skin_path = plugin_path - aboutInfo = about.getImageVersionString() - if aboutInfo.startswith("dev-"): - self.ImageVersion = 'Experimental' - else: - self.ImageVersion = 'Stable' - self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" - - DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) - self.directory = resolveFilename(SCOPE_METADIR) - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "HelpActions" ], + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions", "ShortcutActions"], { - "ok": self.handleCurrent, + "ok": self.exit, "back": self.exit, "red": self.exit, - "green": self.handleCurrent, - "yellow": self.handleSelected, - "showEventInfo": self.handleSelected, - "displayHelp": self.handleHelp, }, -1) + self.timer = eTimer() + self.timer.timeout.get().append(self.resetList) + self.onShown.append(lambda: self.timer.start(5000)) + self.onLayoutFinish.append(self.layoutFinished) + self.onClose.append(self.cleanup) - self.list = [] - self.statuslist = [] - self.selectedFiles = [] - self.categoryList = [] - self["list"] = List(self.list) - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText("") - self["key_yellow"] = StaticText("") - self["key_blue"] = StaticText("") - self["status"] = StaticText("") - - self.list_updating = True - self.packetlist = [] - self.installed_packetlist = {} - self.available_packetlist = [] - self.available_updates = 0 - self.Console = Console() - self.cmdList = [] - self.oktext = _("\nAfter pressing OK, please wait!") - self.unwanted_extensions = ('-dbg', '-dev', '-doc') - - self.ipkg = IpkgComponent() - self.ipkg.addCallback(self.ipkgCallback) - if not self.selectionChanged in self["list"].onSelectionChanged: - self["list"].onSelectionChanged.append(self.selectionChanged) - - self.currList = "" - self.currentSelectedTag = None - self.currentSelectedIndex = None - - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def setWindowTitle(self): - self.setTitle(_("Plugin manager")) + def cleanup(self): + iStatus.stopWlanConsole() + + def layoutFinished(self): + self.setTitle(_("Wireless Network State")) + + def resetList(self): + iStatus.getDataForInterface(self.iface,self.getInfoCB) + + def getInfoCB(self,data,status): + if data is not None: + if data is True: + if status is not None: + self["BSSID"].setText(status[self.iface]["acesspoint"]) + self["ESSID"].setText(status[self.iface]["essid"]) + self["quality"].setText(status[self.iface]["quality"]+"%") + self["signal"].setText(status[self.iface]["signal"]) + self["bitrate"].setText(status[self.iface]["bitrate"]) + self["enc"].setText(status[self.iface]["encryption"]) + self.updateStatusLink(status) def exit(self): - if self.currList == "packages": - self.currList = "category" - self.currentSelectedTag = None - self["list"].style = "category" - self['list'].setList(self.categoryList) - self["list"].setIndex(self.currentSelectedIndex) - self["list"].updateList(self.categoryList) - self.selectionChanged() - else: - self.ipkg.stop() - if self.Console is not None: - if len(self.Console.appContainers): - for name in self.Console.appContainers.keys(): - self.Console.kill(name) - self.prepareInstall() - if len(self.cmdList): - self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) + self.timer.stop() + self.close(True) + + def updateStatusbar(self): + self["BSSID"].setText(_("Please wait...")) + self["ESSID"].setText(_("Please wait...")) + self["quality"].setText(_("Please wait...")) + self["signal"].setText(_("Please wait...")) + self["bitrate"].setText(_("Please wait...")) + self["enc"].setText(_("Please wait...")) + self["IFtext"].setText(_("Network:")) + self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) + self["Statustext"].setText(_("Link:")) + + def updateStatusLink(self,status): + 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["statuspic"].setPixmapNum(1) else: - self.close() - - def handleHelp(self): - if self.currList != "status": - self.session.open(PluginManagerHelp, self.skin_path) - - def setState(self,status = None): - if status: - self.currList = "status" - self.statuslist = [] - self["key_green"].setText("") - self["key_blue"].setText("") - self["key_yellow"].setText("") - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if status == 'update': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) - elif status == 'sync': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) - elif status == 'error': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) - - def statusCallback(self, status, progress): - pass + self["statuspic"].setPixmapNum(0) + self["statuspic"].show() - def selectionChanged(self): - current = self["list"].getCurrent() - self["status"].setText("") - if current: - if self.currList == "packages": - self["key_red"].setText(_("Back")) - if current[4] == 'installed': - self["key_green"].setText(_("Remove")) - elif current[4] == 'installable': - self["key_green"].setText(_("Install")) - elif current[4] == 'remove': - self["key_green"].setText(_("Undo\nRemove")) - elif current[4] == 'install': - self["key_green"].setText(_("Undo\nInstall")) - self["key_yellow"].setText(_("View details")) - self["key_blue"].setText("") - if len(self.selectedFiles) == 0 and self.available_updates is not 0: - self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) - elif len(self.selectedFiles) is not 0: - self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) - else: - self["status"].setText(_("There is nothing to be done.")) - elif self.currList == "category": - self["key_red"].setText(_("Close")) - self["key_green"].setText("") - self["key_yellow"].setText("") - self["key_blue"].setText("") - if len(self.selectedFiles) == 0 and self.available_updates is not 0: - self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) - self["key_yellow"].setText(_("Update")) - elif len(self.selectedFiles) is not 0: - self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) - self["key_yellow"].setText(_("Process")) - else: - self["status"].setText(_("There is nothing to be done.")) - - def getSelectionState(self, detailsFile): - for entry in self.selectedFiles: - if entry[0] == detailsFile: - return True - return False - - def rebuildList(self): - self.setState('update') - if not PluginManager.lastDownloadDate or (time() - PluginManager.lastDownloadDate) > 3600: - # Only update from internet once per hour - PluginManager.lastDownloadDate = time() - print "last update time > 1h" - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - else: - print "last update time < 1h" - self.startIpkgList() - - def ipkgCallback(self, event, param): - if event == IpkgComponent.EVENT_ERROR: - self.list_updating = False - self.setState('error') - elif event == IpkgComponent.EVENT_DONE: - self.startIpkgList() - pass - - def startIpkgList(self): - if self.list_updating: - if not self.Console: - self.Console = Console() - cmd = "ipkg list" - self.Console.ePopen(cmd, self.IpkgList_Finished) - - def IpkgList_Finished(self, result, retval, extra_args = None): - if len(result): - self.available_packetlist = [] - for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.available_packetlist.append([split[0].strip(), split[1].strip(), split[2].strip()]) - self.startInstallMetaPackage() - - def startInstallMetaPackage(self): - if self.list_updating: - self.list_updating = False - if not self.Console: - self.Console = Console() - cmd = "ipkg install enigma2-meta enigma2-plugins-meta enigma2-skins-meta" - self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) - - def InstallMetaPackage_Finished(self, result, retval, extra_args = None): - if len(result): - self.fillPackagesIndexList() - if not self.Console: - self.Console = Console() - self.setState('sync') - cmd = "ipkg list_installed" - self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) - - def IpkgListInstalled_Finished(self, result, retval, extra_args = None): - if len(result): - self.installed_packetlist = {} - for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.installed_packetlist[split[0].strip()] = split[1].strip() - self.countUpdates() - if self.currentSelectedTag is None: - self.buildCategoryList() - else: - self.buildPacketList(self.currentSelectedTag) - - def countUpdates(self): - self.available_updates = 0 - for package in self.packagesIndexlist[:]: - attributes = package[0]["attributes"] - packagename = attributes["packagename"] - for x in self.available_packetlist: - if x[0].strip() == packagename: - if self.installed_packetlist.has_key(packagename): - if self.installed_packetlist[packagename] != x[1].strip(): - self.available_updates +=1 - - def handleCurrent(self): - current = self["list"].getCurrent() - if current: - if self.currList == "category": - self.currentSelectedIndex = self["list"].index - selectedTag = current[2] - self.buildPacketList(selectedTag) - elif self.currList == "packages": - if current[7] is not '': - idx = self["list"].getIndex() - detailsFile = self.list[idx][1] - if self.list[idx][7] == True: - for entry in self.selectedFiles: - if entry[0] == detailsFile: - self.selectedFiles.remove(entry) - else: - alreadyinList = False - for entry in self.selectedFiles: - if entry[0] == detailsFile: - alreadyinList = True - if not alreadyinList: - self.selectedFiles.append((detailsFile,current[4],current[3])) - if current[4] == 'installed': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'remove', True) - elif current[4] == 'installable': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'install', True) - elif current[4] == 'remove': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installed', False) - elif current[4] == 'install': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installable',False) - self["list"].setList(self.list) - self["list"].setIndex(idx) - self["list"].updateList(self.list) - self.selectionChanged() - - def handleSelected(self): - current = self["list"].getCurrent() - if current: - if self.currList == "packages": - if current[7] is not '': - detailsfile = self.directory[0] + "/" + current[1] - if (os_path.exists(detailsfile) == True): - self.session.openWithCallback(self.detailsClosed, PluginDetails, self.skin_path, current) - else: - self.session.open(MessageBox, _("Sorry, no Details available!"), MessageBox.TYPE_INFO, timeout = 10) - elif self.currList == "category": - self.prepareInstall() - if len(self.cmdList): - self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) - - def detailsClosed(self, result): - if result: - if not self.Console: - self.Console = Console() - self.setState('sync') - PluginManager.lastDownloadDate = time() - self.selectedFiles = [] - cmd = "ipkg update" - self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) - - def buildEntryComponent(self, name, details, description, packagename, state, selected = False): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if state == 'installed': - installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) - return((name, details, description, packagename, state, installedpng, divpng, selected)) - elif state == 'installable': - installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) - return((name, details, description, packagename, state, installablepng, divpng, selected)) - elif state == 'remove': - removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - return((name, details, description, packagename, state, removepng, divpng, selected)) - elif state == 'install': - installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) - return((name, details, description, packagename, state, installpng, divpng, selected)) - - def buildPacketList(self, categorytag = None): - if categorytag is not None: - self.currList = "packages" - self.currentSelectedTag = categorytag - self.packetlist = [] - for package in self.packagesIndexlist[:]: - prerequisites = package[0]["prerequisites"] - if prerequisites.has_key("tag"): - for foundtag in prerequisites["tag"]: - if categorytag == foundtag: - attributes = package[0]["attributes"] - if attributes.has_key("packagetype"): - if attributes["packagetype"] == "internal": - continue - self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) - else: - self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) - self.list = [] - for x in self.packetlist: - status = "" - selectState = self.getSelectionState(x[1].strip()) - if self.installed_packetlist.has_key(x[3].strip()): - if selectState == True: - status = "remove" - else: - status = "installed" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) - else: - if selectState == True: - status = "install" - else: - status = "installable" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) - if len(self.list): - self.list.sort(key=lambda x: x[0]) - self["list"].style = "default" - self['list'].setList(self.list) - self["list"].updateList(self.list) - self.selectionChanged() - - def buildCategoryList(self): - self.currList = "category" - self.categories = [] - self.categoryList = [] - for package in self.packagesIndexlist[:]: - prerequisites = package[0]["prerequisites"] - if prerequisites.has_key("tag"): - for foundtag in prerequisites["tag"]: - attributes = package[0]["attributes"] - if foundtag not in self.categories: - self.categories.append(foundtag) - self.categoryList.append(self.buildCategoryComponent(foundtag)) - self.categoryList.sort(key=lambda x: x[0]) - self["list"].style = "category" - self['list'].setList(self.categoryList) - self["list"].updateList(self.categoryList) - self.selectionChanged() - - def buildCategoryComponent(self, tag = None): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if tag is not None: - if tag == 'System': - return(( _("System"), _("View list of available system extensions" ), tag, divpng )) - elif tag == 'Skin': - return(( _("Skins"), _("View list of available skins" ), tag, divpng )) - elif tag == 'Recording': - return(( _("Recordings"), _("View list of available recording extensions" ), tag, divpng )) - elif tag == 'Network': - return(( _("Network"), _("View list of available networking extensions" ), tag, divpng )) - elif tag == 'CI': - return(( _("CommonInterface"), _("View list of available CommonInterface extensions" ), tag, divpng )) - elif tag == 'Default': - return(( _("Default Settings"), _("View list of available default settings" ), tag, divpng )) - elif tag == 'SAT': - return(( _("Satteliteequipment"), _("View list of available Satteliteequipment extensions." ), tag, divpng )) - elif tag == 'Software': - return(( _("Software"), _("View list of available software extensions" ), tag, divpng )) - elif tag == 'Multimedia': - return(( _("Multimedia"), _("View list of available multimedia extensions." ), tag, divpng )) - elif tag == 'Display': - return(( _("Display and Userinterface"), _("View list of available Display and Userinterface extensions." ), tag, divpng )) - elif tag == 'EPG': - return(( _("Electronic Program Guide"), _("View list of available EPG extensions." ), tag, divpng )) - elif tag == 'Communication': - return(( _("Communication"), _("View list of available communication extensions." ), tag, divpng )) - else: # dynamically generate non existent tags - return(( str(tag), _("View list of available ") + str(tag) + _(" extensions." ), tag, divpng )) - - def prepareInstall(self): - self.cmdList = [] - if self.available_updates > 0: - self.cmdList.append((IpkgComponent.CMD_UPGRADE, { "test_only": False })) - if self.selectedFiles and len(self.selectedFiles): - for plugin in self.selectedFiles: - detailsfile = self.directory[0] + "/" + plugin[0] - if (os_path.exists(detailsfile) == True): - self.fillPackageDetails(plugin[0]) - self.package = self.packageDetails[0] - if self.package[0].has_key("attributes"): - self.attributes = self.package[0]["attributes"] - if self.attributes.has_key("package"): - self.packagefiles = self.attributes["package"] - if plugin[1] == 'installed': - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) - else: - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) - else: - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) - else: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) - else: - if plugin[1] == 'installed': - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) - else: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) - - def runExecute(self, result): - if result: - self.session.openWithCallback(self.runExecuteFinished, Ipkg, cmdList = self.cmdList) - else: - self.close() - - def runExecuteFinished(self): - self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def ExecuteReboot(self, result): - if result is None: - return - if result is False: - self.reloadPluginlist() - self.detailsClosed(True) - if result: - quitMainloop(3) - - def reloadPluginlist(self): - plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) - - -class PluginManagerInfo(Screen): +class WlanScan(Screen): skin = """ - + + - - - {"template": [ - MultiContentEntryText(pos = (50, 1), size = (150, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state - MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap - ], - "fonts": [gFont("Regular", 22),gFont("Regular", 18)], - "itemHeight": 52 - } - - - - - """ - - def __init__(self, session, plugin_path, cmdlist = None): - Screen.__init__(self, session) - self.session = session - self.skin_path = plugin_path - self.cmdlist = cmdlist - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "ok": self.process, - "back": self.exit, - "red": self.exit, - "green": self.process, - }, -1) - - self.list = [] - self["list"] = List(self.list) - self["key_red"] = StaticText(_("Cancel")) - self["key_green"] = StaticText(_("Continue")) - self["status"] = StaticText(_("Following tasks will be done after you press continue!")) - - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def setWindowTitle(self): - self.setTitle(_("Plugin manager activity information")) - - def rebuildList(self): - self.list = [] - if self.cmdlist is not None: - for entry in self.cmdlist: - action = "" - info = "" - cmd = entry[0] - if cmd == 0: - action = 'install' - elif cmd == 2: - action = 'remove' - else: - action = 'upgrade' - args = entry[1] - if cmd == 0: - info = args['package'] - elif cmd == 2: - info = args['package'] - else: - info = _("Dreambox software because updates are available.") - - self.list.append(self.buildEntryComponent(action,info)) - self['list'].setList(self.list) - self['list'].updateList(self.list) - - def buildEntryComponent(self, action,info): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) - removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - if action == 'install': - return(( _('Installing'), info, installpng, divpng)) - elif action == 'remove': - return(( _('Removing'), info, removepng, divpng)) - else: - return(( _('Upgrading'), info, upgradepng, divpng)) - - def exit(self): - self.close(False) - - def process(self): - self.close(True) - - -class PluginManagerHelp(Screen): - skin = """ - - - - + + {"template": [ - MultiContentEntryText(pos = (50, 1), size = (540, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state - MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap + MultiContentEntryText(pos = (0, 0), size = (550, 30), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the essid + MultiContentEntryText(pos = (0, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 5), # index 5 is the interface + MultiContentEntryText(pos = (175, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 4), # index 0 is the encryption + MultiContentEntryText(pos = (350, 0), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 0 is the signal + MultiContentEntryText(pos = (350, 30), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 3), # index 0 is the maxrate + MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (550, 2), png = 6), # index 6 is the div pixmap ], - "fonts": [gFont("Regular", 22),gFont("Regular", 18)], - "itemHeight": 52 + "fonts": [gFont("Regular", 28),gFont("Regular", 18)], + "itemHeight": 54 } - - + + """ - def __init__(self, session, plugin_path): + def __init__(self, session, iface): Screen.__init__(self, session) self.session = session + self.iface = iface self.skin_path = plugin_path - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "back": self.exit, - "red": self.exit, - }, -1) - + self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") + self.APList = None + self.newAPList = None + self.WlanList = None + self.cleanList = None + self.oldlist = None + self.listLenght = None + self.rescanTimer = eTimer() + self.rescanTimer.callback.append(self.rescanTimerFired) + + self["info"] = StaticText() + self.list = [] self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) - self["status"] = StaticText(_("A small overview of the available icon states and actions.")) - - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def setWindowTitle(self): - self.setTitle(_("Plugin manager help")) - - def rebuildList(self): - self.list = [] - self.list.append(self.buildEntryComponent('install')) - self.list.append(self.buildEntryComponent('installable')) - self.list.append(self.buildEntryComponent('installed')) - self.list.append(self.buildEntryComponent('remove')) - self['list'].setList(self.list) - self['list'].updateList(self.list) - - def buildEntryComponent(self, state): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) - installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) - removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) - - if state == 'installed': - return(( _('This plugin is installed.'), _('You can remove this plugin.'), installedpng, divpng)) - elif state == 'installable': - return(( _('This plugin is not installed.'), _('You can install this plugin.'), installablepng, divpng)) - elif state == 'install': - return(( _('This plugin will be installed.'), _('You can cancel the installation.'), installpng, divpng)) - elif state == 'remove': - return(( _('This plugin will be removed.'), _('You can cancel the removal.'), removepng, divpng)) - - def exit(self): - self.close() - - -class PluginDetails(Screen, DreamInfoHandler): - skin = """ - - - - - - - - - - - """ - def __init__(self, session, plugin_path, packagedata = None): - Screen.__init__(self, session) - self.skin_path = plugin_path - self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" - self.attributes = None - self.translatedAttributes = None - DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language) - self.directory = resolveFilename(SCOPE_METADIR) - if packagedata: - self.pluginname = packagedata[0] - self.details = packagedata[1] - self.pluginstate = packagedata[4] - self.statuspicinstance = packagedata[5] - self.divpicinstance = packagedata[6] - self.fillPackageDetails(self.details) - - self.thumbnail = "" - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + self["key_green"] = StaticText(_("Connect")) + self["key_yellow"] = StaticText() + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"], { - "back": self.exit, - "red": self.exit, - "green": self.go, - "up": self.pageUp, - "down": self.pageDown, - "left": self.pageUp, - "right": self.pageDown, + "ok": self.select, + "back": self.cancel, }, -1) - - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText("") - self["author"] = StaticText() - self["statuspic"] = Pixmap() - self["divpic"] = Pixmap() - self["screenshot"] = Pixmap() - self["detailtext"] = ScrollLabel() - - self["statuspic"].hide() - self["screenshot"].hide() - self["divpic"].hide() - - self.package = self.packageDetails[0] - if self.package[0].has_key("attributes"): - self.attributes = self.package[0]["attributes"] - if self.package[0].has_key("translation"): - self.translatedAttributes = self.package[0]["translation"] - - self.cmdList = [] - self.oktext = _("\nAfter pressing OK, please wait!") - self.picload = ePicLoad() - self.picload.PictureData.get().append(self.paintScreenshotPixmapCB) - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.setInfos) - - def setWindowTitle(self): - self.setTitle(_("Package details for: " + self.pluginname)) - - def exit(self): - self.close(False) - - def pageUp(self): - self["detailtext"].pageUp() - - def pageDown(self): - self["detailtext"].pageDown() - - def statusCallback(self, status, progress): - pass - - def setInfos(self): - if self.translatedAttributes.has_key("name"): - self.pluginname = self.translatedAttributes["name"] - elif self.attributes.has_key("name"): - self.pluginname = self.attributes["name"] - else: - self.pluginname = _("unknown") - - if self.translatedAttributes.has_key("author"): - self.author = self.translatedAttributes["author"] - elif self.attributes.has_key("author"): - self.author = self.attributes["author"] - else: - self.author = _("unknown") - - if self.translatedAttributes.has_key("description"): - self.description = self.translatedAttributes["description"] - elif self.attributes.has_key("description"): - self.description = self.attributes["description"] - else: - self.description = _("No description available.") - - if self.translatedAttributes.has_key("screenshot"): - self.loadThumbnail(self.translatedAttributes) - else: - self.loadThumbnail(self.attributes) - - self["author"].setText(_("Author: ") + self.author) - self["detailtext"].setText(self.description.strip()) - if self.pluginstate == 'installable': - self["key_green"].setText(_("Install")) - else: - self["key_green"].setText(_("Remove")) - - def loadThumbnail(self, entry): - thumbnailUrl = None - if entry.has_key("screenshot"): - thumbnailUrl = entry["screenshot"] - if thumbnailUrl is not None: - self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1] - print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail - client.downloadPage(thumbnailUrl,self.thumbnail).addCallback(self.setThumbnail).addErrback(self.fetchFailed) - else: - self.setThumbnail(noScreenshot = True) - - def setThumbnail(self, noScreenshot = False): - if not noScreenshot: - filename = self.thumbnail - else: - filename = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/noprev.png") - - sc = AVSwitch().getFramebufferScale() - self.picload.setPara((self["screenshot"].instance.size().width(), self["screenshot"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000")) - self.picload.startDecode(filename) - - if self.statuspicinstance != None: - self["statuspic"].instance.setPixmap(self.statuspicinstance.__deref__()) - self["statuspic"].show() - if self.divpicinstance != None: - self["divpic"].instance.setPixmap(self.divpicinstance.__deref__()) - self["divpic"].show() - - def paintScreenshotPixmapCB(self, picInfo=None): - ptr = self.picload.getData() - if ptr != None: - self["screenshot"].instance.setPixmap(ptr.__deref__()) - self["screenshot"].show() - else: - self.setThumbnail(noScreenshot = True) - - def go(self): - if self.attributes.has_key("package"): - self.packagefiles = self.attributes["package"] - self.cmdList = [] - if self.pluginstate == 'installed': - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) - if len(self.cmdList): - self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + self.pluginname + "\n" + self.oktext) - else: - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) - if len(self.cmdList): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext) - - def runUpgrade(self, result): - if result: - self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) - - def runUpgradeFinished(self): - self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def UpgradeReboot(self, result): - if result is None: - return - if result is False: - self.close(True) - if result: - quitMainloop(3) - - def runRemove(self, result): - if result: - self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) - - def runRemoveFinished(self): - self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def RemoveReboot(self, result): - if result is None: - return - if result is False: - self.close(True) - if result: - quitMainloop(3) - - def reloadPluginlist(self): - plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) - - def fetchFailed(self,string): - self.setThumbnail(noScreenshot = True) - print "[PluginDetails] fetch failed " + string.getErrorMessage() - - -class UpdatePlugin(Screen): - skin = """ - - - - - - """ - - def __init__(self, session, args = None): - Screen.__init__(self, session) - - self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 } - - self.slider = Slider(0, 4) - self["slider"] = self.slider - self.activityslider = Slider(0, 100) - self["activityslider"] = self.activityslider - self.status = StaticText(_("Upgrading Dreambox... Please wait")) - self["status"] = self.status - self.package = StaticText() - self["package"] = self.package - - self.packages = 0 - self.error = 0 - - self.activity = 0 - self.activityTimer = eTimer() - self.activityTimer.callback.append(self.doActivityTimer) - self.activityTimer.start(100, False) - - self.ipkg = IpkgComponent() - self.ipkg.addCallback(self.ipkgCallback) - - self.updating = True - self.package.setText(_("Package list update")) - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - - self["actions"] = ActionMap(["WizardActions"], + + self["shortcuts"] = ActionMap(["ShortcutActions"], { - "ok": self.exit, - "back": self.exit - }, -1) - - def doActivityTimer(self): - self.activity += 1 - if self.activity == 100: - self.activity = 0 - self.activityslider.setValue(self.activity) - - def ipkgCallback(self, event, param): - if event == IpkgComponent.EVENT_DOWNLOAD: - self.status.setText(_("Downloading")) - elif event == IpkgComponent.EVENT_UPGRADE: - if self.sliderPackages.has_key(param): - self.slider.setValue(self.sliderPackages[param]) - self.package.setText(param) - self.status.setText(_("Upgrading")) - self.packages += 1 - elif event == IpkgComponent.EVENT_INSTALL: - self.package.setText(param) - self.status.setText(_("Installing")) - self.packages += 1 - elif event == IpkgComponent.EVENT_CONFIGURING: - self.package.setText(param) - self.status.setText(_("Configuring")) - elif event == IpkgComponent.EVENT_MODIFIED: - self.session.openWithCallback( - self.modificationCallback, - MessageBox, - _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) - ) - elif event == IpkgComponent.EVENT_ERROR: - self.error += 1 - elif event == IpkgComponent.EVENT_DONE: - if self.updating: - self.updating = False - self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False}) - elif self.error == 0: - self.slider.setValue(4) - - self.activityTimer.stop() - self.activityslider.setValue(0) - - self.package.setText("") - self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages) - else: - self.activityTimer.stop() - self.activityslider.setValue(0) - error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.") - if self.packages == 0: - error = _("No packages were upgraded yet. So you can check your network and try again.") - if self.updating: - error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.") - self.status.setText(_("Error") + " - " + error) - #print event, "-", param - pass - - def modificationCallback(self, res): - self.ipkg.write(res and "N" or "Y") - - def exit(self): - if not self.ipkg.isRunning(): - if self.packages != 0 and self.error == 0: - self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?")) + "red": self.cancel, + "green": self.select, + }) + self.onLayoutFinish.append(self.layoutFinished) + self.getAccessPoints(refresh = False) + + def layoutFinished(self): + self.setTitle(_("Choose a wireless network")) + + def select(self): + cur = self["list"].getCurrent() + if cur is not None: + self.rescanTimer.stop() + del self.rescanTimer + if cur[1] is not None: + essid = cur[1] + self.close(essid,self.getWlanList()) else: - self.close() - - def exitAnswer(self, result): - if result is not None and result: - quitMainloop(2) - self.close() - - -class IpkgInstaller(Screen): - skin = """ - - - - - - - - - """ + self.close(None,None) + else: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None,None) - def __init__(self, session, list): - Screen.__init__(self, session) - - self.list = SelectionList() - self["list"] = self.list - for listindex in range(len(list)): - self.list.addSelection(list[listindex], list[listindex], listindex, True) + def WlanSetupClosed(self, *ret): + if ret[0] == 2: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None) + + def cancel(self): + if self.oldInterfaceState is False: + iNetwork.setAdapterAttribute(self.iface, "up", False) + iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB) + else: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None) + + def deactivateInterfaceCB(self,data): + if data is not None: + if data is True: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None) + + def rescanTimerFired(self): + self.rescanTimer.stop() + self.updateAPList() + + def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png")) + encryption = encrypted and _("Yes") or _("No") + if bssid == 'hidden...': + return((essid, bssid, None, None, None, None, divpng)) + else: + return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng)) + + def updateAPList(self): + self.oldlist = [] + self.oldlist = self.cleanList + self.newAPList = [] + newList = [] + tmpList = [] + newListIndex = None + currentListEntry = None + currentListIndex = None + newList = self.getAccessPoints(refresh = True) + + for oldentry in self.oldlist: + if oldentry not in newList: + newList.append(oldentry) + + for newentry in newList: + if newentry[1] == "hidden...": + continue + tmpList.append(newentry) + + if len(tmpList): + if "hidden..." not in tmpList: + tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) + + for entry in tmpList: + self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) + + currentListEntry = self["list"].getCurrent() + idx = 0 + for entry in self.newAPList: + if entry == currentListEntry: + newListIndex = idx + idx +=1 + self['list'].setList(self.newAPList) + self["list"].setIndex(newListIndex) + self["list"].updateList(self.newAPList) + self.listLenght = len(self.newAPList) + self.buildWlanList() + self.setInfo() + + def getAccessPoints(self, refresh = False): + self.APList = [] + self.cleanList = [] + self.w = Wlan(self.iface) + aps = self.w.getNetworkList() + if aps is not None: + print "[NetworkWizard.py] got Accespoints!" + tmpList = [] + compList = [] + for ap in aps: + a = aps[ap] + if a['active']: + tmpList.append( (a['essid'], a['bssid']) ) + compList.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) ) + + for entry in tmpList: + if entry[0] == "": + for compentry in compList: + if compentry[1] == entry[1]: + compList.remove(compentry) + for entry in compList: + self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) ) + + if "hidden..." not in self.cleanList: + self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Install")) - self["introduction"] = StaticText(_("Press OK to toggle the selection.")) + for entry in self.cleanList: + self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) - self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], - { - "ok": self.list.toggleSelection, - "cancel": self.close, - "red": self.close, - "green": self.install - }, -1) + if refresh is False: + self['list'].setList(self.APList) + self.listLenght = len(self.APList) + self.setInfo() + self.rescanTimer.start(5000) + return self.cleanList + + def setInfo(self): + length = self.getLength() + if length == 0: + self["info"].setText(_("No wireless networks found! Please refresh.")) + elif length == 1: + self["info"].setText(_("1 wireless network found!")) + else: + self["info"].setText(str(length)+_(" wireless networks found!")) + + def buildWlanList(self): + self.WlanList = [] + currList = [] + currList = self['list'].list + for entry in currList: + self.WlanList.append( (entry[1], entry[0]) ) - def install(self): - list = self.list.getSelectionsList() - cmdList = [] - for item in list: - cmdList.append((IpkgComponent.CMD_INSTALL, { "package": item[1] })) - self.session.open(Ipkg, cmdList = cmdList) + def getLength(self): + return self.listLenght + def getWlanList(self): + return self.WlanList -def filescan_open(list, session, **kwargs): - filelist = [x.path for x in list] - session.open(IpkgInstaller, filelist) # list -def filescan(**kwargs): - from Components.Scanner import Scanner, ScanPath - return \ - Scanner(mimetypes = ["application/x-debian-package"], - paths_to_scan = - [ - ScanPath(path = "ipk", with_subdirs = True), - ScanPath(path = "", with_subdirs = False), - ], - name = "Ipkg", - description = _("Install extensions."), - openfnc = filescan_open, ) +def WlanStatusScreenMain(session, iface): + session.open(WlanStatus, iface) +def callFunction(iface): + w = Wlan(iface) + i = w.getWirelessInterfaces() + if i: + if iface in i: + return WlanStatusScreenMain + return None -def UpgradeMain(session, **kwargs): - session.open(UpdatePluginMenu) -def startSetup(menuid): - if menuid != "setup": - return [ ] - return [(_("Software manager"), UpgradeMain, "software_manager", 50)] +def configStrings(iface): + driver = iNetwork.detectWlanModule() + print "Found WLAN-Driver:",driver + if driver in ('ralink', 'zydas'): + return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate" + else: + if config.plugins.wlan.essid.value == "hidden...": + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' + else: + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' -def Plugins(path, **kwargs): - global plugin_path - plugin_path = path - list = [ - PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), - PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) - ] - if config.usage.setup_level.index >= 2: # expert+ - list.append(PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=UpgradeMain)) - return list +def Plugins(**kwargs): + return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."}) -- cgit v1.2.3 From d9d9b21f1b6dae099a07cb50e7fcbbb4a4d3f2ee Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 13 Dec 2009 12:35:54 +0100 Subject: CutListEditor: always restart service on cutlist editor close --- lib/python/Plugins/Extensions/CutListEditor/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index efe9f761..abd606d6 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -195,7 +195,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He self.onClose.append(self.__onClose) def __onClose(self): - self.session.nav.playService(self.old_service) + self.session.nav.playService(self.old_service, forceRestart=True) def updateStateLabel(self, state): self["SeekState"].setText(state[3].strip()) -- cgit v1.2.3 From 41b99d4a2d737817b75c93c8331f038326d13862 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 22 Dec 2009 14:18:00 +0100 Subject: NimManager.py: increased delay after enable voltage before send motor diseqc command... this fixes bug #261 --- 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 78e17bb7..d374f7e7 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -899,7 +899,7 @@ def InitSecParams(): x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER, configElement.value)) config.sec.delay_after_voltage_change_before_measure_idle_inputpower = x - x = ConfigInteger(default=750, limits = (0, 9999)) + x = ConfigInteger(default=900, limits = (0, 9999)) x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD, configElement.value)) config.sec.delay_after_enable_voltage_before_motor_command = x -- cgit v1.2.3 From 2701861d66fd17ed825de7bbfdea8e000fdb30b4 Mon Sep 17 00:00:00 2001 From: thedoc Date: Wed, 23 Dec 2009 11:42:22 +0100 Subject: fixes bug #322 change default visibility of blinking dish icon to true --- lib/python/Components/UsageConfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 680b5944..60827107 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -7,7 +7,7 @@ import os def InitUsageConfig(): config.usage = ConfigSubsection(); - config.usage.showdish = ConfigYesNo(default = False) + config.usage.showdish = ConfigYesNo(default = True) config.usage.multibouquet = ConfigYesNo(default = False) config.usage.quickzap_bouquet_change = ConfigYesNo(default = False) config.usage.e1like_radio_mode = ConfigYesNo(default = False) -- cgit v1.2.3 From dc5f101d2790968876caee8bba4ce8ab9210aa2e Mon Sep 17 00:00:00 2001 From: thedoc Date: Tue, 15 Dec 2009 15:38:30 +0100 Subject: fixes bug #269 add "activate picture in picture" to ChannelSelection context menu to activate PiP for the currently selected service --- lib/python/Screens/ChannelSelection.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 0432823b..d4a098c3 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -25,6 +25,7 @@ from Screens.InputBox import InputBox, PinInput from Screens.MessageBox import MessageBox from Screens.ServiceInfo import ServiceInfo profile("ChannelSelection.py 4") +from Screens.PictureInPicture import PictureInPicture from Screens.RdsDisplay import RassInteractive from ServiceReference import ServiceReference from Tools.BoundFunction import boundFunction @@ -101,6 +102,7 @@ class ChannelContextMenu(Screen): if not inBouquetRootList: isPlayable = not (current_sel_flags & (eServiceReference.isMarker|eServiceReference.isDirectory)) if isPlayable: + append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0) if config.ParentalControl.configured.value: if parentalControl.getProtectionLevel(csel.getCurrentSelection().toCompareString()) == -1: append_when_current_valid(current, menu, (_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection())), level = 0) @@ -189,6 +191,21 @@ class ChannelContextMenu(Screen): self.close() else: self.session.openWithCallback(self.close, MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR) + + def showServiceInPiP(self): + if self.session.pipshown: + del self.session.pip + self.session.pip = self.session.instantiateDialog(PictureInPicture) + self.session.pip.show() + newservice = self.csel.servicelist.getCurrent() + if self.session.pip.playService(newservice): + self.session.pipshown = True + self.session.pip.servicePath = self.csel.getCurrentServicePath() + self.close() + else: + self.session.pipshown = False + del self.session.pip + self.session.openWithCallback(self.close, MessageBox, _("Could not open Picture in Picture"), MessageBox.TYPE_ERROR) def addServiceToBouquetSelected(self): bouquets = self.csel.getBouquetList() -- cgit v1.2.3 From a88994b2d0bab5d8a5d0b38b5a66f374372b0830 Mon Sep 17 00:00:00 2001 From: thedoc Date: Tue, 15 Dec 2009 16:18:52 +0100 Subject: fixes bug #354 change MenuList to ChoiceList in ChannelContext and assign Blue button to PiP activation --- data/skin_default.xml | 4 ++-- lib/python/Components/ChoiceList.py | 2 +- lib/python/Screens/ChannelSelection.py | 27 +++++++++++++++++---------- 3 files changed, 20 insertions(+), 13 deletions(-) (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml index 71f579cb..7aaff38f 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -70,8 +70,8 @@ - - + + diff --git a/lib/python/Components/ChoiceList.py b/lib/python/Components/ChoiceList.py index 4700e9e6..33868d61 100755 --- a/lib/python/Components/ChoiceList.py +++ b/lib/python/Components/ChoiceList.py @@ -3,7 +3,7 @@ from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont from Tools.LoadPixmap import LoadPixmap -def ChoiceEntryComponent(key, text): +def ChoiceEntryComponent(key = "", text = ["--"]): res = [ text ] if text[0] == "--": res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 00, 800, 25, 0, RT_HALIGN_LEFT, "-"*200)) diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index d4a098c3..e8bbce15 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -21,6 +21,7 @@ profile("ChannelSelection.py 2.3") from Components.Input import Input profile("ChannelSelection.py 3") from Components.ParentalControl import parentalControl +from Components.ChoiceList import ChoiceList, ChoiceEntryComponent from Screens.InputBox import InputBox, PinInput from Screens.MessageBox import MessageBox from Screens.ServiceInfo import ServiceInfo @@ -70,9 +71,9 @@ OFF = 0 EDIT_BOUQUET = 1 EDIT_ALTERNATIVES = 2 -def append_when_current_valid(current, menu, args, level = 0): +def append_when_current_valid(current, menu, args, level = 0, key = ""): if current and current.valid() and level <= config.usage.setup_level.index: - menu.append(args) + menu.append(ChoiceEntryComponent(key, args)) class ChannelContextMenu(Screen): def __init__(self, session, csel): @@ -81,13 +82,15 @@ class ChannelContextMenu(Screen): self.csel = csel self.bsel = None - self["actions"] = ActionMap(["OkCancelActions"], + self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "NumberActions"], { "ok": self.okbuttonClick, - "cancel": self.cancelClick + "cancel": self.cancelClick, + "blue": self.showServiceInPiP }) menu = [ ] + self.pipAvailable = False current = csel.getCurrentSelection() current_root = csel.getRoot() current_sel_path = current.getPath() @@ -102,7 +105,6 @@ class ChannelContextMenu(Screen): if not inBouquetRootList: isPlayable = not (current_sel_flags & (eServiceReference.isMarker|eServiceReference.isDirectory)) if isPlayable: - append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0) if config.ParentalControl.configured.value: if parentalControl.getProtectionLevel(csel.getCurrentSelection().toCompareString()) == -1: append_when_current_valid(current, menu, (_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection())), level = 0) @@ -124,8 +126,11 @@ class ChannelContextMenu(Screen): append_when_current_valid(current, menu, (_("remove entry"), self.removeCurrentService), level = 0) if current_root and current_root.getPath().find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1: append_when_current_valid(current, menu, (_("remove new found flag"), self.removeNewFoundFlag), level = 0) + if isPlayable: + append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0, key = "blue") + self.pipAvailable = True else: - menu.append((_("add bouquet"), self.showBouquetInputBox)) + menu.append(ChoiceEntryComponent(text = (_("add bouquet"), self.showBouquetInputBox))) append_when_current_valid(current, menu, (_("remove entry"), self.removeBouquet), level = 0) if inBouquet: # current list is editable? @@ -133,7 +138,7 @@ class ChannelContextMenu(Screen): if not csel.movemode: append_when_current_valid(current, menu, (_("enable move mode"), self.toggleMoveMode), level = 1) if not inBouquetRootList and current_root and not (current_root.flags & eServiceReference.isGroup): - menu.append((_("add marker"), self.showMarkerInputBox)) + menu.append(ChoiceEntryComponent(text = (_("add marker"), self.showMarkerInputBox))) if haveBouquets: append_when_current_valid(current, menu, (_("enable bouquet edit"), self.bouquetMarkStart), level = 0) else: @@ -158,11 +163,11 @@ class ChannelContextMenu(Screen): append_when_current_valid(current, menu, (_("end alternatives edit"), self.bouquetMarkEnd), level = 0) append_when_current_valid(current, menu, (_("abort alternatives edit"), self.bouquetMarkAbort), level = 0) - menu.append((_("back"), self.cancelClick)) - self["menu"] = MenuList(menu) + menu.append(ChoiceEntryComponent(text = (_("back"), self.cancelClick))) + self["menu"] = ChoiceList(menu) def okbuttonClick(self): - self["menu"].getCurrent()[1]() + self["menu"].getCurrent()[0][1]() def cancelClick(self): self.close(False) @@ -193,6 +198,8 @@ class ChannelContextMenu(Screen): self.session.openWithCallback(self.close, MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR) def showServiceInPiP(self): + if not self.pipAvailable: + return if self.session.pipshown: del self.session.pip self.session.pip = self.session.instantiateDialog(PictureInPicture) -- cgit v1.2.3 From a03c8f3703decf54844695107ddce289df77a0aa Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 23 Dec 2009 21:56:03 +0100 Subject: NimManager.py/Satconfig.py: add possibility to change the tone amplitide (22Khz amplitude) in Tunerconfig for Alps BSBE2 tuners when the usage level is configured as expert --- lib/python/Components/NimManager.py | 12 ++++++++++++ lib/python/Screens/Satconfig.py | 2 ++ 2 files changed, 14 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index d374f7e7..613305d0 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1213,10 +1213,21 @@ def InitNimManager(nimmgr): tmp.lnb = lnb nim.advanced.sat[x] = tmp + def toneAmplitudeChanged(configElement): + fe_id = configElement.fe_id + slot_id = configElement.slot_id + if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2': + open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value) + + empty_slots = 0 for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] if slot.isCompatible("DVB-S"): + nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7") + nim.toneAmplitude.fe_id = x - empty_slots + nim.toneAmplitude.slot_id = x + nim.toneAmplitude.addNotifier(toneAmplitudeChanged) nim.diseqc13V = ConfigYesNo(False) nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b") nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) @@ -1306,6 +1317,7 @@ def InitNimManager(nimmgr): nim.terrestrial = ConfigSelection(choices = list) nim.terrestrial_5V = ConfigOnOff() else: + empty_slots += 1 nim.configMode = ConfigSelection(choices = { "nothing": _("disabled") }, default="nothing"); if slot.type is not None: print "pls add support for this frontend type!", slot.type diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index e24e4636..634d231a 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -145,6 +145,8 @@ class NimSetup(Screen, ConfigListScreen): currSat = self.nimConfig.advanced.sat[cur_orb_pos] self.fillListWithAdvancedSatEntrys(currSat) self.have_advanced = True + if self.nim.description == "Alps BSBE2" and config.usage.setup_level.index >= 2: # expert + self.list.append(getConfigListEntry(_("Tone Amplitude"), self.nimConfig.toneAmplitude)) elif self.nim.isCompatible("DVB-C"): self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode) self.list.append(self.configMode) -- cgit v1.2.3 From a285571e31b3b1a99764a674319621f0298833c2 Mon Sep 17 00:00:00 2001 From: thedoc Date: Wed, 23 Dec 2009 21:57:24 +0100 Subject: fixes bug #273 add a quick shortcut to switch to "nothing connected" in the sat config screen for remote debugging purposes (undocumented) --- data/keymap.xml | 4 ++++ lib/python/Screens/Satconfig.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/data/keymap.xml b/data/keymap.xml index 25538f87..9461d509 100755 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -98,6 +98,10 @@ + + + + diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 634d231a..d5249b99 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -5,7 +5,8 @@ from Components.ActionMap import ActionMap from Components.ConfigList import ConfigListScreen from Components.MenuList import MenuList from Components.NimManager import nimmanager -from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement +from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement,\ + ConfigSatlist from Components.Sources.List import List from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox @@ -383,10 +384,11 @@ class NimSetup(Screen, ConfigListScreen): ConfigListScreen.__init__(self, self.list) - self["actions"] = ActionMap(["SetupActions"], + self["actions"] = ActionMap(["SetupActions", "SatlistShortcutAction"], { "ok": self.keySave, "cancel": self.keyCancel, + "nothingconnected": self.nothingConnectedShortcut }, -2) self.slotid = slotid @@ -423,6 +425,11 @@ class NimSetup(Screen, ConfigListScreen): # we need to call saveAll to reset the connectedTo choices self.saveAll() self.close() + + def nothingConnectedShortcut(self): + if type(self["config"].getCurrent()[1]) is ConfigSatlist: + self["config"].getCurrent()[1].setValue("3601") + self["config"].invalidateCurrent() class NimSelection(Screen): def __init__(self, session): -- cgit v1.2.3 From abc94b7a0600bc3580102f28d26c27b25ffbdba1 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 29 Dec 2009 13:30:18 +0100 Subject: import SystemInfo one time is enough --- lib/python/Screens/TimerEntry.py | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index d7ba73d7..b231b568 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -10,7 +10,6 @@ from Components.Label import Label from Components.Pixmap import Pixmap from Components.SystemInfo import SystemInfo from Components.UsageConfig import defaultMoviePath -from Components.SystemInfo import SystemInfo from Screens.MovieSelection import getPreferredTagEditor from Screens.LocationBox import MovieLocationBox from Screens.ChoiceBox import ChoiceBox -- cgit v1.2.3 From df11647105be3033f3f6222ed83f69b0a1c3c3df Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 30 Dec 2009 11:13:26 +0100 Subject: no more ask for 50hz in videowizzard when 720p/1080i is selected.. and now multi is used as default for 720p and 1080i this fixes bug #262 --- lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py | 7 +++++-- lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index cd1529aa..49b5d53d 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -131,8 +131,11 @@ class VideoWizard(WizardLanguage, Rc): def modeSelect(self, mode): ratesList = self.listRates(mode) print "ratesList:", ratesList - self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) - + if self.port == "DVI" and mode in ("720p", "1080i"): + self.hw.setMode(port = self.port, mode = mode, rate = "multi") + else: + self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) + def listRates(self, querymode = None): if querymode is None: querymode = self.mode diff --git a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml index 29ac4297..5dea661d 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml +++ b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml @@ -20,7 +20,7 @@ self.selectKey("DOWN") self["portpic"].hide() - + self.condition = (self.port != "DVI" or self.mode == "PC") @@ -33,7 +33,7 @@ self.selectKey("UP") self.selectKey("DOWN") - + self.hw.saveMode(self.port, self.mode, self.rate) -- cgit v1.2.3 From 148af18dacd5f36aa785277d11126d03118e9437 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 30 Dec 2009 17:11:58 +0100 Subject: show a short symbol when a unhandled key is pressed this fixes bug #293 --- data/skin_default.xml | 4 ++++ data/skin_default/Makefile.am | 1 + data/skin_default/unhandled-key.png | Bin 0 -> 1335 bytes lib/python/Screens/InfoBar.py | 6 ++--- lib/python/Screens/InfoBarGenerics.py | 41 +++++++++++++++++++++++++++++++++- lib/python/Screens/Makefile.am | 2 +- lib/python/Screens/UnhandledKey.py | 7 ++++++ 7 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 data/skin_default/unhandled-key.png create mode 100644 lib/python/Screens/UnhandledKey.py (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml index 71f579cb..bf21b715 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -253,6 +253,10 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count > 7 and 2 or 3) + + + + diff --git a/data/skin_default/Makefile.am b/data/skin_default/Makefile.am index e2d2abcc..3106af97 100644 --- a/data/skin_default/Makefile.am +++ b/data/skin_default/Makefile.am @@ -50,6 +50,7 @@ dist_install_DATA = \ sleeptimer.png \ timeline-now.png \ timeline.png \ + unhandled-key.png \ verticalline-plugins.png \ vkey_backspace.png \ vkey_bg.png \ diff --git a/data/skin_default/unhandled-key.png b/data/skin_default/unhandled-key.png new file mode 100644 index 00000000..8e543498 Binary files /dev/null and b/data/skin_default/unhandled-key.png differ diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index a15c7ac1..5b061245 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -12,7 +12,7 @@ profile("LOAD:InfoBarGenerics") from Screens.InfoBarGenerics import InfoBarShowHide, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \ InfoBarEPG, InfoBarSeek, InfoBarInstantRecord, \ - InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \ + InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey, \ InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \ InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \ @@ -29,7 +29,7 @@ from Screens.HelpMenu import HelpableScreen class InfoBar(InfoBarBase, InfoBarShowHide, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, InfoBarInstantRecord, InfoBarAudioSelection, - HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, + HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey, InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarServiceErrorPopupSupport, InfoBarJobman, @@ -52,7 +52,7 @@ class InfoBar(InfoBarBase, InfoBarShowHide, for x in HelpableScreen, \ InfoBarBase, InfoBarShowHide, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \ - InfoBarInstantRecord, InfoBarAudioSelection, \ + InfoBarInstantRecord, InfoBarAudioSelection, InfoBarUnhandledKey, \ InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \ InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \ InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \ diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index a3e56a40..c8aa00cb 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -26,13 +26,14 @@ from Screens.PictureInPicture import PictureInPicture from Screens.SubtitleDisplay import SubtitleDisplay from Screens.RdsDisplay import RdsInfoDisplay, RassInteractive from Screens.TimeDateInput import TimeDateInput +from Screens.UnhandledKey import UnhandledKey from ServiceReference import ServiceReference from Tools import Notifications from Tools.Directories import fileExists from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \ - iPlayableService, eServiceReference, eEPGCache + iPlayableService, eServiceReference, eEPGCache, eActionMap from time import time, localtime, strftime from os import stat as os_stat @@ -47,6 +48,44 @@ class InfoBarDish: def __init__(self): self.dishDialog = self.session.instantiateDialog(Dish) +class InfoBarUnhandledKey: + def __init__(self): + self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey) + self.hideTimer = eTimer() + self.hideTimer.callback.append(self.unhandledKeyDialog.hide) + self.checkUnusedTimer = eTimer() + self.checkUnusedTimer.callback.append(self.checkUnused) + self.onLayoutFinish.append(self.unhandledKeyDialog.hide) + eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.actionA) #highest prio + eActionMap.getInstance().bindAction('', 0x7FFFFFFF, self.actionB) #lowest prio + self.key = -1; + self.flags = 0; + self.uflags = 0; + + #this function is called on every keypress! + def actionA(self, key, flag): + if flag != 4: + if self.key != key: + if self.checkUnusedTimer.isActive(): + self.checkUnusedTimer.stop() + self.checkUnused() + self.key = key + self.flags = self.uflags = 0 + self.flags |= (1< Date: Wed, 30 Dec 2009 17:53:10 +0100 Subject: save multi framerate even to configfile --- lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 49b5d53d..512bcec3 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -132,6 +132,7 @@ class VideoWizard(WizardLanguage, Rc): ratesList = self.listRates(mode) print "ratesList:", ratesList if self.port == "DVI" and mode in ("720p", "1080i"): + self.rate = "multi" self.hw.setMode(port = self.port, mode = mode, rate = "multi") else: self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) -- cgit v1.2.3 From 9e9404e05b7b080b2e4b752794656bf68b629f16 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 30 Dec 2009 18:08:16 +0100 Subject: InfoBarGenerics.py: small cleanup --- lib/python/Screens/InfoBarGenerics.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 8c96c76b..95b0e8c1 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -66,9 +66,6 @@ class InfoBarUnhandledKey: def actionA(self, key, flag): if flag != 4: if self.key != key: - if self.checkUnusedTimer.isActive(): - self.checkUnusedTimer.stop() - self.checkUnused() self.key = key self.flags = self.uflags = 0 self.flags |= (1< Date: Wed, 30 Dec 2009 18:35:59 +0100 Subject: InfoBarGenerics.py: fix handling for unused key indication when two times the same key is pressed, small cleanup --- lib/python/Screens/InfoBarGenerics.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 95b0e8c1..471b2510 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -58,15 +58,13 @@ class InfoBarUnhandledKey: self.onLayoutFinish.append(self.unhandledKeyDialog.hide) eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.actionA) #highest prio eActionMap.getInstance().bindAction('', 0x7FFFFFFF, self.actionB) #lowest prio - self.key = -1; - self.flags = 0; + self.flags = (1<<1); self.uflags = 0; #this function is called on every keypress! def actionA(self, key, flag): if flag != 4: - if self.key != key: - self.key = key + if self.flags & (1<<1): self.flags = self.uflags = 0 self.flags |= (1< Date: Thu, 31 Dec 2009 09:55:18 +0100 Subject: InfoBarGenerics.py: rename timer to fix automatic infobar hide after channel change --- lib/python/Screens/InfoBarGenerics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 471b2510..7ae0b123 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -51,8 +51,8 @@ class InfoBarDish: class InfoBarUnhandledKey: def __init__(self): self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey) - self.hideTimer = eTimer() - self.hideTimer.callback.append(self.unhandledKeyDialog.hide) + self.hideUnhandledKeySymbolTimer = eTimer() + self.hideUnhandledKeySymbolTimer.callback.append(self.unhandledKeyDialog.hide) self.checkUnusedTimer = eTimer() self.checkUnusedTimer.callback.append(self.checkUnused) self.onLayoutFinish.append(self.unhandledKeyDialog.hide) @@ -79,7 +79,7 @@ class InfoBarUnhandledKey: def checkUnused(self): if self.flags == self.uflags: self.unhandledKeyDialog.show() - self.hideTimer.start(2000, True) + self.hideUnhandledKeySymbolTimer.start(2000, True) class InfoBarShowHide: """ InfoBar show/hide control, accepts toggleShow and hide actions, might start -- cgit v1.2.3 From c9315c0737c473abd384dc8950b4c6bbd16dcccc Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 1 Jan 2010 14:00:47 +0100 Subject: fixes bug #362 allow assigning standby function to long power button press --- lib/python/Components/UsageConfig.py | 3 ++- mytest.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 60827107..f133f9f6 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -51,7 +51,8 @@ def InitUsageConfig(): config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [ ("show_menu", _("show shutdown menu")), - ("shutdown", _("immediate shutdown")) ] ) + ("shutdown", _("immediate shutdown")), + ("standby", _("Standby")) ] ) config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [ ("0", "DVB-S/-C/-T"), diff --git a/mytest.py b/mytest.py index c748538a..7eb045ee 100755 --- a/mytest.py +++ b/mytest.py @@ -380,6 +380,8 @@ class PowerKey: menu_screen = self.session.openWithCallback(self.MenuClosed, MainMenu, x) menu_screen.setTitle(_("Standby / Restart")) return + elif action == "standby": + self.standby() def powerdown(self): self.standbyblocked = 0 -- cgit v1.2.3 From b6f95a8f5457c60ccc14192a4d13d3c05fa608be Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 1 Jan 2010 14:07:03 +0100 Subject: fixes bug #362 allow configuring short power button action to shutdown, standby, menu --- data/setup.xml | 1 + lib/python/Components/UsageConfig.py | 6 ++++++ mytest.py | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/data/setup.xml b/data/setup.xml index 9425afda..92bbc0f1 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -31,6 +31,7 @@ config.usage.quickzap_bouquet_change config.usage.e1like_radio_mode config.usage.on_long_powerpress + config.usage.on_short_powerpress config.usage.infobar_timeout config.usage.output_12V config.usage.show_infobar_on_zap diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index f133f9f6..21478e90 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -53,6 +53,12 @@ def InitUsageConfig(): ("show_menu", _("show shutdown menu")), ("shutdown", _("immediate shutdown")), ("standby", _("Standby")) ] ) + + config.usage.on_short_powerpress = ConfigSelection(default = "standby", choices = [ + ("show_menu", _("show shutdown menu")), + ("shutdown", _("immediate shutdown")), + ("standby", _("Standby")) ] ) + config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [ ("0", "DVB-S/-C/-T"), diff --git a/mytest.py b/mytest.py index 7eb045ee..4b687e05 100755 --- a/mytest.py +++ b/mytest.py @@ -363,9 +363,10 @@ class PowerKey: def powerlong(self): if Screens.Standby.inTryQuitMainloop or (self.session.current_dialog and not self.session.current_dialog.ALLOW_SUSPEND): return + self.doAction(action = config.usage.on_long_powerpress.value) + def doAction(self, action): self.standbyblocked = 1 - action = config.usage.on_long_powerpress.value if action == "shutdown": self.shutdown() elif action == "show_menu": @@ -388,8 +389,7 @@ class PowerKey: def powerup(self): if self.standbyblocked == 0: - self.standbyblocked = 1 - self.standby() + self.doAction(action = config.usage.on_short_powerpress.value) def standby(self): if not Screens.Standby.inStandby and self.session.current_dialog and self.session.current_dialog.ALLOW_SUSPEND and self.session.in_exec: -- cgit v1.2.3 From 91c9f9216cc8fcb1d8f6d8cea9f0cf6a23632aec Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 1 Jan 2010 14:43:26 +0100 Subject: fixes bug #369 close ChannelSelection after PiP is activated --- lib/python/Screens/ChannelSelection.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index e8bbce15..36a54e77 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -208,7 +208,7 @@ class ChannelContextMenu(Screen): if self.session.pip.playService(newservice): self.session.pipshown = True self.session.pip.servicePath = self.csel.getCurrentServicePath() - self.close() + self.close(True) else: self.session.pipshown = False del self.session.pip @@ -672,7 +672,11 @@ class ChannelSelectionEdit: self.entry_marked = True def doContext(self): - self.session.open(ChannelContextMenu, self) + self.session.openWithCallback(self.exitContext, ChannelContextMenu, self) + + def exitContext(self, close = False): + if close: + self.cancel() MODE_TV = 0 MODE_RADIO = 1 -- cgit v1.2.3 From 541bb75365f3594dccea757a8183df6ac0e8e5e8 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 2 Jan 2010 09:49:01 +0100 Subject: only show pip option in contextmenu when the hardware can handle pip --- lib/python/Screens/ChannelSelection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 36a54e77..5fbfd591 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -22,6 +22,7 @@ from Components.Input import Input profile("ChannelSelection.py 3") from Components.ParentalControl import parentalControl from Components.ChoiceList import ChoiceList, ChoiceEntryComponent +from Components.SystemInfo import SystemInfo from Screens.InputBox import InputBox, PinInput from Screens.MessageBox import MessageBox from Screens.ServiceInfo import ServiceInfo @@ -126,7 +127,7 @@ class ChannelContextMenu(Screen): append_when_current_valid(current, menu, (_("remove entry"), self.removeCurrentService), level = 0) if current_root and current_root.getPath().find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1: append_when_current_valid(current, menu, (_("remove new found flag"), self.removeNewFoundFlag), level = 0) - if isPlayable: + if isPlayable and SystemInfo.get("NumVideoDecoders", 1) > 1: append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0, key = "blue") self.pipAvailable = True else: -- cgit v1.2.3 From 08413feb6f7217a4ddb598dfc0ab46e80adb5f99 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 2 Jan 2010 13:48:36 +0100 Subject: Components/config.py: dont show configtext input help in ConfigDirectory's --- lib/python/Components/config.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index a6007b10..471b59ec 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1138,6 +1138,9 @@ class ConfigDirectory(ConfigText): else: return ConfigText.getMulti(self, selected) + def onSelect(self, session): + self.allmarked = (self.value != "") + # a slider. class ConfigSlider(ConfigElement): def __init__(self, default = 0, increment = 1, limits = (0, 100)): -- cgit v1.2.3 From e7d3f74e6679c23d3f6174e2d8857b5788748af9 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 5 Jan 2010 14:41:54 +0100 Subject: bug #238 added m4v file extension to media player capabilities Conflicts: lib/python/Plugins/Extensions/MediaPlayer/plugin.py --- lib/python/Components/FileList.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 222512ea..841a2fe5 100755 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -23,6 +23,7 @@ EXTENSIONS = { "ts": "movie", "avi": "movie", "divx": "movie", + "m4v": "movie", "mpg": "movie", "mpeg": "movie", "mkv": "movie", -- cgit v1.2.3 From 2b8451631894b48330eee673493c1dd84e87916c Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 10 Jan 2010 13:45:57 +0100 Subject: Screen.py: add missing dict.__init__ call --- lib/python/Screens/Screen.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py index 7ac7841c..f0bf773d 100644 --- a/lib/python/Screens/Screen.py +++ b/lib/python/Screens/Screen.py @@ -15,6 +15,7 @@ class Screen(dict, GUISkin): global_screen = None def __init__(self, session, parent = None): + dict.__init__(self) self.skinName = self.__class__.__name__ self.session = session self.parent = parent -- cgit v1.2.3 From 547ecaf9bfda061aca736aefb04ca0743a6395cc Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 14 Jan 2010 14:11:20 +0100 Subject: fixes bug #393 change DVI picture to HDMI picture for dm500hd --- lib/python/Plugins/SystemPlugins/Videomode/HDMI.png | Bin 0 -> 4098 bytes lib/python/Plugins/SystemPlugins/Videomode/Makefile.am | 4 +++- .../Plugins/SystemPlugins/Videomode/VideoWizard.py | 5 ++++- lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png | Bin 0 -> 261 bytes 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 lib/python/Plugins/SystemPlugins/Videomode/HDMI.png create mode 100644 lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png b/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png new file mode 100644 index 00000000..5aa83047 Binary files /dev/null and b/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png differ diff --git a/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am b/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am index 2ec0b335..1ac1d5dd 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am @@ -16,4 +16,6 @@ dist_install_DATA = \ LICENSE \ Scart.png \ videowizard.xml \ - YPbPr.png + YPbPr.png \ + HDMI.png \ + lcd_HDMI.png diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 512bcec3..15f4d516 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -99,7 +99,10 @@ class VideoWizard(WizardLanguage, Rc): print "input selection moved:", self.selection self.inputSelect(self.selection) if self["portpic"].instance is not None: - self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png")) + picname = self.selection + if picname == "DVI" and HardwareInfo().get_device_name() == "dm500hd": + picname = "HDMI" + self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + picname + ".png")) def inputSelect(self, port): print "inputSelect:", port diff --git a/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png b/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png new file mode 100644 index 00000000..425da5c3 Binary files /dev/null and b/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png differ -- cgit v1.2.3 From 0f01de80dad98af94f07fe4d912791831eacff6a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 21 Jan 2010 11:32:40 +0100 Subject: fix cutlist editor for HD skins --- lib/python/Plugins/Extensions/CutListEditor/plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index abd606d6..0627df3b 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -10,7 +10,7 @@ from Components.VideoWindow import VideoWindow from Components.Label import Label from Screens.InfoBarGenerics import InfoBarSeek, InfoBarCueSheetSupport from Components.GUIComponent import GUIComponent -from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService, RT_HALIGN_RIGHT +from enigma import eListboxPythonMultiContent, eListbox, getDesktop, gFont, iPlayableService, RT_HALIGN_RIGHT from Screens.FixedMenu import FixedMenu from Screens.HelpMenu import HelpableScreen from ServiceReference import ServiceReference @@ -167,7 +167,8 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He self.onPlayStateChanged.append(self.updateStateLabel) self.updateStateLabel(self.seekstate) - self["Video"] = VideoWindow(decoder = 0) + desktopSize = getDesktop(0).size() + self["Video"] = VideoWindow(decoder = 0, fb_width=desktopSize.width(), fb_height=desktopSize.height()) self["actions"] = HelpableActionMap(self, "CutListEditorActions", { -- cgit v1.2.3 From 6551b5fbbed0acb407e3eba5c9c510ca74e352f7 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 21 Jan 2010 11:33:45 +0100 Subject: show Multi EPG in epg selection list --- lib/python/Screens/InfoBarGenerics.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 7ae0b123..f2aff6c6 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -598,6 +598,7 @@ class InfoBarEPG: if list: list.append((_("show single service EPG..."), self.openSingleServiceEPG)) + list.append((_("Multi EPG"), self.openMultiServiceEPG)) self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list, skin_name = "EPGExtensionsList") else: self.openSingleServiceEPG() -- cgit v1.2.3 From 2d2f681283ecec948254e21180e61aa5152ebc2c Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 23 Jan 2010 13:42:01 +0100 Subject: lib/python/Screens/RecordPaths.py: fix spinners in some conditions this fixes bug #414 --- lib/python/Screens/RecordPaths.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/RecordPaths.py b/lib/python/Screens/RecordPaths.py index c833266f..22ca9fcf 100644 --- a/lib/python/Screens/RecordPaths.py +++ b/lib/python/Screens/RecordPaths.py @@ -6,7 +6,7 @@ from Components.config import config, ConfigSelection, getConfigListEntry, confi from Components.ConfigList import ConfigListScreen from Components.ActionMap import ActionMap from Tools.Directories import fileExists - +from Components.UsageConfig import preferredPath class RecordPathsSettings(Screen,ConfigListScreen): skin = """ @@ -115,7 +115,7 @@ class RecordPathsSettings(Screen,ConfigListScreen): self.dirnameSelected, MovieLocationBox, txt, - self.default_dirname.value + preferredPath(self.default_dirname.value) ) elif currentry == self.timer_entry: self.entrydirname = self.timer_dirname @@ -123,7 +123,7 @@ class RecordPathsSettings(Screen,ConfigListScreen): self.dirnameSelected, MovieLocationBox, _("Initial location in new timers"), - self.timer_dirname.value + preferredPath(self.timer_dirname.value) ) elif currentry == self.instantrec_entry: self.entrydirname = self.instantrec_dirname @@ -131,7 +131,7 @@ class RecordPathsSettings(Screen,ConfigListScreen): self.dirnameSelected, MovieLocationBox, _("Location for instant recordings"), - self.instantrec_dirname.value + preferredPath(self.instantrec_dirname.value) ) elif currentry == self.timeshift_entry: self.entrydirname = self.timeshift_dirname -- cgit v1.2.3 From 6b1138ae6ea57dfb1a345d2a4ad393ba0bc587c8 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sun, 24 Jan 2010 12:23:42 +0100 Subject: fixes bug #380 stop service when entering tuner setup (and ask to restore afterwards) --- lib/python/Screens/Makefile.am | 2 +- lib/python/Screens/Satconfig.py | 16 +++++++++++++--- lib/python/Screens/ServiceStopScreen.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 lib/python/Screens/ServiceStopScreen.py (limited to 'lib/python') diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index 5457bf64..d96b491e 100755 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -14,5 +14,5 @@ install_PYTHON = \ 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 VirtualKeyBoard.py \ - TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py + TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py ServiceStopScreen.py diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index d5249b99..62480b5f 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -10,11 +10,12 @@ from Components.config import getConfigListEntry, config, ConfigNothing, ConfigS from Components.Sources.List import List from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox +from Screens.ServiceStopScreen import ServiceStopScreen from time import mktime, localtime from datetime import datetime -class NimSetup(Screen, ConfigListScreen): +class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): def createSimpleSetup(self, list, mode): nim = self.nimConfig if mode == "single": @@ -376,11 +377,14 @@ class NimSetup(Screen, ConfigListScreen): self.deleteConfirmed(confirmed) break if not self.satpos_to_remove: - self.close() + self.restoreService(_("Zap back to service before tuner setup?")) def __init__(self, session, slotid): Screen.__init__(self, session) self.list = [ ] + + ServiceStopScreen.__init__(self) + self.stopService() ConfigListScreen.__init__(self, self.list) @@ -405,6 +409,12 @@ class NimSetup(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) self.newConfig() + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?")) + else: + self.restoreService(_("Zap back to service before tuner setup?")) + def saveAll(self): if self.nim.isCompatible("DVB-S"): # reset connectedTo to all choices to properly store the default value @@ -424,7 +434,7 @@ class NimSetup(Screen, ConfigListScreen): x[1].cancel() # we need to call saveAll to reset the connectedTo choices self.saveAll() - self.close() + self.restoreService(_("Zap back to service before tuner setup?")) def nothingConnectedShortcut(self): if type(self["config"].getCurrent()[1]) is ConfigSatlist: diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py new file mode 100644 index 00000000..3b3dda88 --- /dev/null +++ b/lib/python/Screens/ServiceStopScreen.py @@ -0,0 +1,29 @@ +from Screens.MessageBox import MessageBox + +class ServiceStopScreen: + def __init__(self): + try: + self.session + except: + print "[ServiceStopScreen] ERROR: no self.session set" + + self.oldref = None + self.onClose.append(self.__onClose) + + def stopService(self): + self.oldref = self.session.nav.getCurrentlyPlayingServiceReference() + self.session.nav.stopService() + + def __onClose(self): + self.session.nav.playService(self.oldref) + + def restoreService(self, msg = _("Zap back to previously tuned service?")): + if self.oldref: + self.session.openWithCallback(self.restartPrevService, MessageBox, msg, MessageBox.TYPE_YESNO) + else: + self.restartPrevService(False) + + def restartPrevService(self, yesno): + if not yesno: + self.oldref=None + self.close() \ No newline at end of file -- cgit v1.2.3 From 6c77c3ab8156d72dfd616d83c276ef7f3ca1b1a7 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sun, 24 Jan 2010 13:24:37 +0100 Subject: fixes bug #288 last playing position for recorded services was stored only if between 1% and 99% of the recording's length. this lead to voodoo for the user, since long recordings naturally have a longer 1% than short ones. so the 1% rule is gone now and we display the position of the marker in the message box, asking the user if playing should continue at this position. --- lib/python/Screens/InfoBarGenerics.py | 4 +++- lib/service/servicedvb.cpp | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index f2aff6c6..87631086 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -2015,8 +2015,10 @@ class InfoBarCueSheetSupport: if last is not None: self.resume_point = last + + l = last / 90000 if config.usage.on_movie_start.value == "ask": - Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?"), timeout=10) + Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?") + "\n" + (_("Resume position at %s") % ("%d:%02d:%02d" % (l/3600, l%3600/60, l%60))), timeout=10) elif config.usage.on_movie_start.value == "resume": # TRANSLATORS: The string "Resuming playback" flashes for a moment # TRANSLATORS: at the start of a movie, when the user has selected diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 9f10644c..558bf0c2 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1128,11 +1128,7 @@ RESULT eDVBServicePlay::stop() if (length) { - int perc = play_position * 100LL / length; - - /* only store last play position when between 1% and 99% */ - if ((1 < perc) && (perc < 99)) - m_cue_entries.insert(cueEntry(play_position, 3)); /* last play position */ + m_cue_entries.insert(cueEntry(play_position, 3)); /* last play position */ } m_cuesheet_changed = 1; } -- cgit v1.2.3 From 7a3d4cb061893cf157d980b164a0635706f70aa5 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 12:11:34 +0100 Subject: disabe fan on enter standby, restart fan on leave standby this fixes bug #418 --- lib/python/Components/FanControl.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index cc133ac0..cee0523e 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -11,6 +11,20 @@ class FanControl: else: self.fancount = 0 self.createConfig() + config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False) + + def leaveStandby(self): + for fanid in range(self.getFanCount()): + cfg = self.getConfig(fanid) + self.setVoltage(fanid, cfg.vlt.value) + self.setPWM(fanid, cfg.pwm.value) + + def standbyCounterChanged(self, configElement): + from Screens.Standby import inStandby + inStandby.onClose.append(self.leaveStandby) + for fanid in range(self.getFanCount()): + self.setVoltage(fanid, 0) + self.setPWM(fanid, 0) def createConfig(self): def setVlt(fancontrol, fanid, configElement): -- cgit v1.2.3 From c50a4697aa4a47d93f9ac7c3526758ff5a7ace26 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 12:14:14 +0100 Subject: cleanup lcd code --- lib/python/Components/Lcd.py | 11 +++++++++++ lib/python/Screens/Standby.py | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 7d27c097..dde158b6 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -28,6 +28,14 @@ class LCD: def isOled(self): return eDBoxLCD.getInstance().isOled() +def leaveStandby(): + config.lcd.bright.apply() + +def standbyCounterChanged(configElement): + from Screens.Standby import inStandby + inStandby.onClose.append(leaveStandby) + config.lcd.standby.apply() + def InitLcd(): detected = eDBoxLCD.getInstance().detected() SystemInfo["Display"] = detected @@ -72,3 +80,6 @@ def InitLcd(): config.lcd.standby = ConfigNothing() config.lcd.bright.apply = lambda : doNothing() config.lcd.standby.apply = lambda : doNothing() + + config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False) + diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index c598b545..406b87cb 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -15,8 +15,6 @@ class Standby(Screen): #restart last played service #unmute adc self.leaveMute() - #set brightness of lcd - config.lcd.bright.apply() #kill me self.close(True) @@ -63,8 +61,6 @@ class Standby(Screen): self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") - #set lcd brightness to standby value - config.lcd.standby.apply() self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose) -- cgit v1.2.3 From 547807d59d64f24305afbbfd071b71a691c64c18 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 15:22:28 +0100 Subject: speedup closing the servicelist in some cases this fixes bug #421 --- lib/python/Screens/ChannelSelection.py | 58 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 5fbfd591..8ac53867 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -31,7 +31,6 @@ from Screens.PictureInPicture import PictureInPicture from Screens.RdsDisplay import RassInteractive from ServiceReference import ServiceReference from Tools.BoundFunction import boundFunction -from re import compile from os import remove profile("ChannelSelection.py after imports") @@ -713,6 +712,7 @@ class ChannelSelectionBase(Screen): self.servicePathTV = [ ] self.servicePathRadio = [ ] self.servicePath = [ ] + self.rootChanged = False self.mode = MODE_TV @@ -819,6 +819,7 @@ class ChannelSelectionBase(Screen): else: self.servicelist.setMode(ServiceList.MODE_NORMAL) self.servicelist.setRoot(root, justSet) + self.rootChanged = True self.buildTitleString() def removeModeStr(self, str): @@ -1303,19 +1304,21 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.lastroot.save() def restoreRoot(self): - self.clearPath() - re = compile('.+?;') - tmp = re.findall(self.lastroot.value) - cnt = 0 - for i in tmp: - self.servicePath.append(eServiceReference(i[:-1])) - cnt += 1 - if cnt: - path = self.servicePath.pop() - self.enterPath(path) - else: - self.showFavourites() - self.saveRoot() + tmp = [x for x in self.lastroot.value.split(';') if x != ''] + current = [x.toString() for x in self.servicePath] + if tmp != current or self.rootChanged: + self.clearPath() + cnt = 0 + for i in tmp: + self.servicePath.append(eServiceReference(i)) + cnt += 1 + if cnt: + path = self.servicePath.pop() + self.enterPath(path) + else: + self.showFavourites() + self.saveRoot() + self.rootChanged = False def preEnterPath(self, refstr): if self.servicePath and self.servicePath[0] != eServiceReference(refstr): @@ -1463,19 +1466,20 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS config.radio.lastroot.save() def restoreRoot(self): - self.clearPath() - re = compile('.+?;') - tmp = re.findall(config.radio.lastroot.value) - cnt = 0 - for i in tmp: - self.servicePathRadio.append(eServiceReference(i[:-1])) - cnt += 1 - if cnt: - path = self.servicePathRadio.pop() - self.enterPath(path) - else: - self.showFavourites() - self.saveRoot() + tmp = [x for x in self.lastroot.value.split(';') if x != ''] + current = [x.toString() for x in self.servicePath] + if tmp != current or self.rootChanged: + cnt = 0 + for i in tmp: + self.servicePathRadio.append(eServiceReference(i)) + cnt += 1 + if cnt: + path = self.servicePathRadio.pop() + self.enterPath(path) + else: + self.showFavourites() + self.saveRoot() + self.rootChanged = False def preEnterPath(self, refstr): if self.servicePathRadio and self.servicePathRadio[0] != eServiceReference(refstr): -- cgit v1.2.3 From e9412ee5133233df673d5a2b9f43fa2675a7526c Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 19:59:42 +0100 Subject: ChannelSelection.py: small fix for bug #420 --- lib/python/Screens/ChannelSelection.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 8ac53867..eb03ee65 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1181,6 +1181,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.servicelist.setPlayableIgnoreService(eServiceReference()) def setMode(self): + self.rootChanged = True self.restoreRoot() lastservice=eServiceReference(self.lastservice.value) if lastservice.valid(): -- cgit v1.2.3 From c372fb3326e2c8386eb34723ea7cf354642aaa99 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 23:30:01 +0100 Subject: ChannelSelection.py: another small fix for bug #420 --- lib/python/Screens/ChannelSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index eb03ee65..4ca6fa39 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1467,7 +1467,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS config.radio.lastroot.save() def restoreRoot(self): - tmp = [x for x in self.lastroot.value.split(';') if x != ''] + tmp = [x for x in config.radio.lastroot.value.split(';') if x != ''] current = [x.toString() for x in self.servicePath] if tmp != current or self.rootChanged: cnt = 0 -- cgit v1.2.3 From 1ff71d24c512a57686d8cdbef41bc0112ca9be72 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 29 Jan 2010 00:49:43 +0100 Subject: don't use string concatenation within translation brackets --- lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index d9ccab57..dcff3ca2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -252,7 +252,7 @@ class RestoreMenu(Screen): if (self.exe == False) and (self.entry == True): self.sel = self["filelist"].getCurrent() self.val = self.path + "/" + self.sel - self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n" + self.sel + "\nSystem will restart after the restore!")) + self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!")) def keyCancel(self): self.close() -- cgit v1.2.3 From 3c28b6e8cb29946dceefc70cad16154c84f38e54 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 3 Feb 2010 23:59:59 +0100 Subject: fixes bug #435 add support for INVERSION_AUTO parameter returned by the cable scan tool --- lib/python/Screens/ScanSetup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index fa787a70..1dbc1505 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -138,7 +138,8 @@ class CableTransponderSearchSupport: "QAM128" : parm.Modulation_QAM128, "QAM256" : parm.Modulation_QAM256 } inv = { "INVERSION_OFF" : parm.Inversion_Off, - "INVERSION_ON" : parm.Inversion_On } + "INVERSION_ON" : parm.Inversion_On, + "INVERSION_AUTO" : parm.Inversion_Unknown } fec = { "FEC_AUTO" : parm.FEC_Auto, "FEC_1_2" : parm.FEC_1_2, "FEC_2_3" : parm.FEC_2_3, -- cgit v1.2.3 From 9c0372ef21e444e5196174dce77583c8ab906de4 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 4 Feb 2010 01:11:33 +0100 Subject: fixes bug #380 don't spawn countless "zap back to service" message boxes on removing >1 orbital positions --- lib/python/Screens/Satconfig.py | 3 +-- lib/python/Screens/ServiceStopScreen.py | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 62480b5f..156f7780 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -347,6 +347,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): new_configured_sats = nimmanager.getConfiguredSats() self.unconfed_sats = old_configured_sats - new_configured_sats self.satpos_to_remove = None + self.restoreService(_("Zap back to service before tuner setup?")) self.deleteConfirmed((None, "no")) def deleteConfirmed(self, confirmed): @@ -376,8 +377,6 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): if confirmed[1] == "yestoall" or confirmed[1] == "notoall": self.deleteConfirmed(confirmed) break - if not self.satpos_to_remove: - self.restoreService(_("Zap back to service before tuner setup?")) def __init__(self, session, slotid): Screen.__init__(self, session) diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py index 3b3dda88..7f0d26a5 100644 --- a/lib/python/Screens/ServiceStopScreen.py +++ b/lib/python/Screens/ServiceStopScreen.py @@ -13,6 +13,9 @@ class ServiceStopScreen: def stopService(self): self.oldref = self.session.nav.getCurrentlyPlayingServiceReference() self.session.nav.stopService() + if self.session.pipshown: # try to disable pip + self.session.pipshown = False + del self.session.pip def __onClose(self): self.session.nav.playService(self.oldref) -- cgit v1.2.3 From ee589820f97c969057e01c33f99b68c72851f20f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 4 Feb 2010 14:04:20 +0100 Subject: fixes bug #380 pip is'n available in every state of e2, so don't try to get the status if it's not available --- lib/python/Screens/ServiceStopScreen.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py index 7f0d26a5..628a93a5 100644 --- a/lib/python/Screens/ServiceStopScreen.py +++ b/lib/python/Screens/ServiceStopScreen.py @@ -6,16 +6,26 @@ class ServiceStopScreen: self.session except: print "[ServiceStopScreen] ERROR: no self.session set" - + self.oldref = None self.onClose.append(self.__onClose) + def pipAvailable(self): + # pip isn't available in every state of e2 + try: + self.session.pipshown + pipavailable = True + except: + pipavailable = False + return pipavailable + def stopService(self): self.oldref = self.session.nav.getCurrentlyPlayingServiceReference() self.session.nav.stopService() - if self.session.pipshown: # try to disable pip - self.session.pipshown = False - del self.session.pip + if self.pipAvailable(): + if self.session.pipshown: # try to disable pip + self.session.pipshown = False + del self.session.pip def __onClose(self): self.session.nav.playService(self.oldref) -- cgit v1.2.3 From 07546e9555132554de255826213f52e456b5ee1e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Feb 2010 14:26:01 +0100 Subject: lib/python/Plugins/Extensions/DVDPlayer/plugin.py: also check with upper case --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index e895a141..6e4d9cc6 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -736,6 +736,7 @@ def filescan(**kwargs): paths_to_scan = [ ScanPath(path = "video_ts", with_subdirs = False), + ScanPath(path = "VIDEO_TS", with_subdirs = False), ScanPath(path = "", with_subdirs = False), ], name = "DVD", -- cgit v1.2.3 From a57f7724f413c42aa22c87331c986eeac45ac957 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Feb 2010 14:26:35 +0100 Subject: lib/python/Tools/HardwareInfo.py: remove debug output --- lib/python/Tools/HardwareInfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Tools/HardwareInfo.py b/lib/python/Tools/HardwareInfo.py index 612a565f..e72d2912 100644 --- a/lib/python/Tools/HardwareInfo.py +++ b/lib/python/Tools/HardwareInfo.py @@ -3,7 +3,7 @@ class HardwareInfo: def __init__(self): if HardwareInfo.device_name is not None: - print "using cached result" +# print "using cached result" return HardwareInfo.device_name = "unknown" -- cgit v1.2.3 From e50f482422a4d0f1d08f0970dc7988e2e3ebc78e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Feb 2010 19:45:42 +0100 Subject: lib/python/Plugins/SystemPlugins/SoftwareManager: more robust code this i.e. fixes: Traceback (most recent call last): File "/usr/lib/enigma2/python/Tools/BoundFunction.py", line 9, in __call__ return self.fnc(*self.args + args, **newkwargs) File "/usr/lib/enigma2/python/Components/Console.py", line 56, in finishedCB self.callbacks[name](data,retval,extra_args) File "/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py", line 108, in IpkgListAvailableCB SoftwareTools.available_packetlist.append([name, split[1].strip(), split[2].strip()]) File "/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py", line 108, in IpkgListAvailableCB SoftwareTools.available_packetlist.append([name, split[1].strip(), split[2].strip()]) ref bug #383 --- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 25 +++++++++++++--------- .../SystemPlugins/SoftwareManager/plugin.py | 25 ++++++++++++++-------- 2 files changed, 31 insertions(+), 19 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index 4e7591ef..e8cf6dc2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -94,14 +94,17 @@ class SoftwareTools(DreamInfoHandler): def IpkgListAvailableCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: if SoftwareTools.list_updating: SoftwareTools.available_packetlist = [] for x in result.splitlines(): - split = x.split(' - ') - name = split[0].strip() + tokens = x.split(' - ') + name = tokens[0].strip() if not any(name.endswith(x) for x in self.unwanted_extensions): - SoftwareTools.available_packetlist.append([name, split[1].strip(), split[2].strip()]) + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + descr = l > 2 and tokens[2].strip() or "" + SoftwareTools.available_packetlist.append([name, version, descr]) if callback is None: self.startInstallMetaPackage() else: @@ -126,7 +129,7 @@ class SoftwareTools(DreamInfoHandler): def InstallMetaPackageCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: self.fillPackagesIndexList() if callback is None: self.startIpkgListInstalled() @@ -152,13 +155,15 @@ class SoftwareTools(DreamInfoHandler): def IpkgListInstalledCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: SoftwareTools.installed_packetlist = {} for x in result.splitlines(): - split = x.split(' - ') - name = split[0].strip() + tokens = x.split(' - ') + name = tokens[0].strip() if not any(name.endswith(x) for x in self.unwanted_extensions): - SoftwareTools.installed_packetlist[name] = split[1].strip() + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + SoftwareTools.installed_packetlist[name] = version if callback is None: self.countUpdates() else: @@ -203,7 +208,7 @@ class SoftwareTools(DreamInfoHandler): def IpkgUpdateCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: if self.Console: if len(self.Console.appContainers) == 0: if callback is not None: diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index b20ba51e..4dbe7f70 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -1558,24 +1558,31 @@ class PacketManager(Screen): pass def IpkgList_Finished(self, result, retval, extra_args = None): - if len(result): + if result: self.packetlist = [] for x in result.splitlines(): - split = x.split(' - ') #self.blacklisted_packages - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()]) + tokens = x.split(' - ') #self.blacklisted_packages + name = tokens[0].strip() + if not any(name.endswith(x) for x in self.unwanted_extensions): + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + descr = l > 2 and tokens[2].strip() or "" + self.packetlist.append([name, version, descr]) if not self.Console: self.Console = Console() cmd = "ipkg list_installed" self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) def IpkgListInstalled_Finished(self, result, retval, extra_args = None): - if len(result): + if result: self.installed_packetlist = {} for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.installed_packetlist[split[0].strip()] = split[1].strip() + tokens = x.split(' - ') #self.blacklisted_packages + name = tokens[0].strip() + if not any(name.endswith(x) for x in self.unwanted_extensions): + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + self.installed_packetlist[name] = version self.buildPacketList() def buildEntryComponent(self, name, version, description, state): @@ -1703,7 +1710,7 @@ def Plugins(path, **kwargs): plugin_path = path list = [ PluginDescriptor(where = [PluginDescriptor.WHERE_NETWORKCONFIG_READ], fnc = autostart), - PluginDescriptor(name=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), + PluginDescriptor(name=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) ] if config.usage.setup_level.index >= 2: # expert+ -- cgit v1.2.3 From 30eb05e6ba834df51db97db306bfb1cab94c9b20 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 11 Feb 2010 14:15:33 +0100 Subject: NetworkWizard/NetworkWizard.py: * fix automatic interface selection if only one network adapter is available in some situations. refs #218 --- lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py index 150dba9d..a8b34acd 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py @@ -104,6 +104,9 @@ class NetworkWizard(WizardLanguage, Rc): self.rescanTimer.stop() self.Adapterlist = iNetwork.getAdapterList() self.InstalledInterfaceCount = len(self.Adapterlist) + if self.Adapterlist is not None: + if self.InstalledInterfaceCount == 1 and self.selectedInterface is None: + self.selectedInterface = self.Adapterlist[0] self.originalAth0State = iNetwork.getAdapterAttribute('ath0', 'up') self.originalEth0State = iNetwork.getAdapterAttribute('eth0', 'up') self.originalWlan0State = iNetwork.getAdapterAttribute('wlan0', 'up') -- cgit v1.2.3 From e058cb26c1fe4a6352ac5987c94694c0ecc1ff98 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 11 Feb 2010 14:27:16 +0100 Subject: WirelessLan/plugin.py: * fix sometimes not correctly returned ssid name from wlanscan screen. * don't count the hidden network helper entry as found network. * some small optimizations. refs #204 --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 6873ffa4..a3f5d225 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -151,6 +151,7 @@ class WlanStatus(Screen): self["statuspic"].setPixmapNum(0) self["statuspic"].show() + class WlanScan(Screen): skin = """ @@ -190,7 +191,7 @@ class WlanScan(Screen): self.WlanList = None self.cleanList = None self.oldlist = None - self.listLenght = None + self.listLength = None self.rescanTimer = eTimer() self.rescanTimer.callback.append(self.rescanTimerFired) @@ -226,7 +227,10 @@ class WlanScan(Screen): self.rescanTimer.stop() del self.rescanTimer if cur[1] is not None: - essid = cur[1] + if cur[1] == 'hidden...': + essid = cur[1] + else: + essid = cur[0] self.close(essid,self.getWlanList()) else: self.close(None,None) @@ -305,7 +309,7 @@ class WlanScan(Screen): self['list'].setList(self.newAPList) self["list"].setIndex(newListIndex) self["list"].updateList(self.newAPList) - self.listLenght = len(self.newAPList) + self.listLength = len(self.newAPList) self.buildWlanList() self.setInfo() @@ -315,7 +319,7 @@ class WlanScan(Screen): self.w = Wlan(self.iface) aps = self.w.getNetworkList() if aps is not None: - print "[NetworkWizard.py] got Accespoints!" + print "[WirelessLan.py] got Accespoints!" tmpList = [] compList = [] for ap in aps: @@ -340,31 +344,34 @@ class WlanScan(Screen): if refresh is False: self['list'].setList(self.APList) - self.listLenght = len(self.APList) + self.listLength = len(self.APList) self.setInfo() self.rescanTimer.start(5000) return self.cleanList def setInfo(self): length = self.getLength() - if length == 0: + if length <= 1: self["info"].setText(_("No wireless networks found! Please refresh.")) - elif length == 1: + elif length == 2: self["info"].setText(_("1 wireless network found!")) else: - self["info"].setText(str(length)+_(" wireless networks found!")) + self["info"].setText(str(length-1)+_(" wireless networks found!")) def buildWlanList(self): self.WlanList = [] - currList = [] - currList = self['list'].list - for entry in currList: - self.WlanList.append( (entry[1], entry[0]) ) + for entry in self['list'].list: + if entry[1] == "hidden...": + self.WlanList.append(( "hidden...",_("enter hidden network SSID") ))#continue + else: + self.WlanList.append( (entry[0], entry[0]) ) def getLength(self): - return self.listLenght + return self.listLength def getWlanList(self): + if self.WlanList is None: + self.buildWlanList() return self.WlanList -- cgit v1.2.3 From 7c2f35aa189b8e3d4d5e3fece3362d71ee160762 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 11 Feb 2010 23:12:47 +0100 Subject: add possibility to disable/enable listbox selection in multicontent templates fixes bug #443 --- .../Components/Converter/TemplatedMultiContent.py | 20 +++++++++++--------- lib/python/Components/Renderer/Listbox.py | 4 ++++ lib/python/Components/Sources/List.py | 5 +++-- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Converter/TemplatedMultiContent.py b/lib/python/Components/Converter/TemplatedMultiContent.py index b86d94bf..b5a98449 100644 --- a/lib/python/Components/Converter/TemplatedMultiContent.py +++ b/lib/python/Components/Converter/TemplatedMultiContent.py @@ -10,8 +10,8 @@ class TemplatedMultiContent(StringList): del l["self"] # cleanup locals a bit del l["args"] - self.template = eval(args, {}, l) self.active_style = None + self.template = eval(args, {}, l) assert "fonts" in self.template assert "itemHeight" in self.template assert "template" in self.template or "templates" in self.template @@ -25,7 +25,6 @@ class TemplatedMultiContent(StringList): if not self.content: from enigma import eListboxPythonMultiContent self.content = eListboxPythonMultiContent() - self.setTemplate() # also setup fonts (also given by source) index = 0 @@ -35,30 +34,33 @@ class TemplatedMultiContent(StringList): # if only template changed, don't reload list if what[0] == self.CHANGED_SPECIFIC and what[1] == "style": - self.setTemplate() - return - - if self.source: + pass + elif self.source: self.content.setList(self.source.list) - self.setTemplate() + self.setTemplate() self.downstream_elements.changed(what) def setTemplate(self): if self.source: style = self.source.style + if style == self.active_style: - return # style did not change + return # if skin defined "templates", that means that it defines multiple styles in a dict. template should still be a default templates = self.template.get("templates") template = self.template.get("template") itemheight = self.template["itemHeight"] + selectionEnabled = self.template.get("selectionEnabled", True) if templates and style and style in templates: # if we have a custom style defined in the source, and different templates in the skin, look it up template = templates[style][1] itemheight = templates[style][0] + if len(templates[style]) > 2: + selectionEnabled = templates[style][2] self.content.setTemplate(template) - self.content.setItemHeight(itemheight) + self.selectionEnabled = selectionEnabled + self.active_style = style diff --git a/lib/python/Components/Renderer/Listbox.py b/lib/python/Components/Renderer/Listbox.py index 7a895330..640121e1 100644 --- a/lib/python/Components/Renderer/Listbox.py +++ b/lib/python/Components/Renderer/Listbox.py @@ -77,6 +77,10 @@ class Listbox(Renderer, object): selection_enabled = property(lambda self: self.__selection_enabled, setSelectionEnabled) def changed(self, what): + if hasattr(self.source, "selectionEnabled"): + self.selection_enabled = self.source.selectionEnabled + if len(what) > 1 and isinstance(what[1], str) and what[1] == "style": + return self.content = self.source.content def entry_changed(self, index): diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py index 1eab32b2..6f0670a1 100644 --- a/lib/python/Components/Sources/List.py +++ b/lib/python/Components/Sources/List.py @@ -91,8 +91,9 @@ to generate HTML.""" return self.__style def setStyle(self, style): - self.__style = style - self.changed((self.CHANGED_SPECIFIC, "style")) + if self.__style != style: + self.__style = style + self.changed((self.CHANGED_SPECIFIC, "style")) style = property(getStyle, setStyle) -- cgit v1.2.3 From 01d75322e7f2c56a3fc67db645440a5a71ef3d1e Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 15 Feb 2010 10:25:34 +0100 Subject: lib/python/Components/PluginsComponent.py: even allow .pyo files --- lib/python/Components/PluginComponent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index c91d6ad5..5e439fdf 100755 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -46,7 +46,7 @@ class PluginComponent: for pluginname in os_listdir(directory_category): path = directory_category + "/" + pluginname if os_path.isdir(path): - if fileExists(path + "/plugin.pyc") or fileExists(path + "/plugin.py"): + if fileExists(path + "/plugin.pyc") or fileExists(path + "/plugin.pyo") or fileExists(path + "/plugin.py"): try: plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"])) -- cgit v1.2.3 From e87c31487053cf0273a1bc82867c58bce99ed5f3 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Sat, 20 Feb 2010 08:35:07 +0100 Subject: WirelessLan/plugin.py: * use dict to store already found entries. This avoids increasing entries inside WLAN-Scan in new 1.6 Images. this fixes #448 --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index a9f7bf43..a687714d 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -190,7 +190,7 @@ class WlanScan(Screen): self.newAPList = None self.WlanList = None self.cleanList = None - self.oldlist = None + self.oldlist = {} self.listLength = None self.rescanTimer = eTimer() self.rescanTimer.callback.append(self.rescanTimerFired) @@ -274,24 +274,18 @@ class WlanScan(Screen): return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng)) def updateAPList(self): - self.oldlist = [] - self.oldlist = self.cleanList - self.newAPList = [] newList = [] + newList = self.getAccessPoints(refresh = True) + self.newAPList = [] tmpList = [] newListIndex = None currentListEntry = None currentListIndex = None - newList = self.getAccessPoints(refresh = True) - - for oldentry in self.oldlist: - if oldentry not in newList: - newList.append(oldentry) - for newentry in newList: - if newentry[1] == "hidden...": - continue - tmpList.append(newentry) + for ap in self.oldlist.keys(): + data = self.oldlist[ap]['data'] + if data is not None: + tmpList.append(data) if len(tmpList): if "hidden..." not in tmpList: @@ -303,7 +297,7 @@ class WlanScan(Screen): currentListEntry = self["list"].getCurrent() idx = 0 for entry in self.newAPList: - if entry == currentListEntry: + if entry[0] == currentListEntry[0]: newListIndex = idx idx +=1 self['list'].setList(self.newAPList) @@ -335,6 +329,10 @@ class WlanScan(Screen): compList.remove(compentry) for entry in compList: self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) ) + if not self.oldlist.has_key(entry[0]): + self.oldlist[entry[0]] = { 'data': entry } + else: + self.oldlist[entry[0]]['data'] = entry if "hidden..." not in self.cleanList: self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) -- cgit v1.2.3 From abd1ad03da2989e3f57a999b9e50be0c95833891 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 5 Feb 2010 00:18:33 +0100 Subject: fixes bug #436 add support for mixed nims --- lib/python/Components/NimManager.py | 47 ++++++++++++++++++++++++++++++++++--- lib/python/Screens/Satconfig.py | 18 +++++++++++++- 2 files changed, 61 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 613305d0..6650c717 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -444,7 +444,7 @@ class SecConfigure: self.update() class NIM(object): - def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None): + def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}): self.slot = slot if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None): @@ -455,6 +455,7 @@ class NIM(object): self.description = description self.has_outputs = has_outputs self.internally_connectable = internally_connectable + self.multi_type = multi_type def isCompatible(self, what): compatible = { @@ -466,6 +467,9 @@ class NIM(object): } return what in compatible[self.type] + def getType(self): + return self.type + def connectableTo(self): connectable = { "DVB-S": ("DVB-S", "DVB-S2"), @@ -491,6 +495,13 @@ class NIM(object): def internallyConnectableTo(self): return self.internally_connectable + + def isMultiType(self): + return (len(self.multi_type) > 0) + + # returns dict {: } + def getMultiTypeList(self): + return self.multi_type slot_id = property(getSlotID) @@ -636,7 +647,15 @@ class NimManager: entries[current_slot]["has_outputs"] = (input == "yes") elif line.strip().startswith("Internally_Connectable:"): input = int(line.strip()[len("Internally_Connectable:") + 1:]) - entries[current_slot]["internally_connectable"] = input + entries[current_slot]["internally_connectable"] = input + elif line.strip().startswith("Mode"): + # "Mode 0: DVB-T" -> ["Mode 0", " DVB-T"] + split = line.strip().split(":") + # "Mode 0" -> ["Mode, "0"] + split2 = split[0].split(" ") + modes = entries[current_slot].get("multi_type", {}) + modes[split2[1]] = split[1].strip() + entries[current_slot]["multi_type"] = modes elif line.strip().startswith("empty"): entries[current_slot]["type"] = None entries[current_slot]["name"] = _("N/A") @@ -650,12 +669,17 @@ class NimManager: entry["has_outputs"] = True if not (entry.has_key("internally_connectable")): entry["internally_connectable"] = None - self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"])) + if not (entry.has_key("multi_type")): + entry["multi_type"] = {} + self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"])) def hasNimType(self, chktype): for slot in self.nim_slots: if slot.isCompatible(chktype): return True + for type in slot.getMultiTypeList().values(): + if chktype == type: + return True return False def getNimType(self, slotid): @@ -1218,11 +1242,28 @@ def InitNimManager(nimmgr): slot_id = configElement.slot_id if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2': open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value) + + def tunerTypeChanged(configElement): + fe_id = configElement.fe_id + open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) empty_slots = 0 for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] + if slot.isMultiType(): + typeList = [] + value = None + for id in slot.getMultiTypeList().keys(): + type = slot.getMultiTypeList()[id] + typeList.append((id, type)) + if type == slot.getType(): + value = id + nim.multiType = ConfigSelection(typeList, "0") + nim.multiType.value = value + nim.multiType.fe_id = x - empty_slots + nim.multiType.addNotifier(tunerTypeChanged) + if slot.isCompatible("DVB-S"): nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7") nim.toneAmplitude.fe_id = x - empty_slots diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 156f7780..0d10a2c0 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -94,6 +94,11 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType = None self.advancedManufacturer = None self.advancedSCR = None + + if self.nim.isMultiType(): + multiType = self.nimConfig.multiType + self.multiType = getConfigListEntry(_("Tuner type"), multiType) + self.list.append(self.multiType) if self.nim.isCompatible("DVB-S"): self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode) @@ -200,10 +205,19 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, \ self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, \ self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ - self.uncommittedDiseqcCommand, self.cableScanType) + self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) + if self["config"].getCurrent() == self.multiType: + print "enumerating:" + nimmanager.enumerateNIMs() + print "mode value:", self.multiType[1].value + from Components.NimManager import InitNimManager + InitNimManager(nimmanager) + self.nim = nimmanager.nim_slots[self.slotid] + self.nimConfig = self.nim.config for x in checkList: if self["config"].getCurrent() == x: self.createSetup() + break def run(self): if self.have_advanced and self.nim.config_mode == "advanced": @@ -511,6 +525,8 @@ class NimSelection(Screen): text = _("nothing connected") elif nimConfig.configMode.value == "enabled": text = _("enabled") + if x.isMultiType(): + text = _("Switchable tuner types:") + "(" + ','.join(x.getMultiTypeList().values()) + ")" + "\n" + text self.list.append((slotid, x.friendly_full_description, text, x)) self["nimlist"].setList(self.list) -- cgit v1.2.3 From 1ebcd01ce9cb0e279e6f51e3629427c1964210ca Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 5 Feb 2010 00:32:41 +0100 Subject: fixes bug #436 remove some debug code fix multiType entry for non multiType nims --- lib/python/Screens/Satconfig.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 0d10a2c0..047bde23 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -76,6 +76,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): print "Creating setup" self.list = [ ] + self.multiType = None self.configMode = None self.diseqcModeEntry = None self.advancedSatsEntry = None @@ -207,9 +208,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) if self["config"].getCurrent() == self.multiType: - print "enumerating:" nimmanager.enumerateNIMs() - print "mode value:", self.multiType[1].value from Components.NimManager import InitNimManager InitNimManager(nimmanager) self.nim = nimmanager.nim_slots[self.slotid] -- cgit v1.2.3 From 4d9387347a30e364546f0310f87e523dd2764932 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 23 Feb 2010 21:34:11 +0100 Subject: Components/Network.py: *fix usb wlan module recognition for new 1.6 oe images. This fixes #449 --- lib/python/Components/Network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 4b0213d4..29491cb0 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -580,11 +580,11 @@ class Network: self.wlanmodule = 'madwifi' if os_path.exists(rt73_dir): rtfiles = listdir(rt73_dir) - if len(rtfiles) == 2: + if len(rtfiles) == 2 or len(rtfiles) == 5: self.wlanmodule = 'ralink' if os_path.exists(zd1211b_dir): zdfiles = listdir(zd1211b_dir) - if len(zdfiles) == 1: + if len(zdfiles) == 1 or len(zdfiles) == 5: self.wlanmodule = 'zydas' return self.wlanmodule -- cgit v1.2.3 From bdea0dd8ac75294737564b1c2a4178a32ba3d284 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 23 Feb 2010 22:57:29 +0100 Subject: lib/python/Components/Ipkg.py: small fix for opkg --- lib/python/Components/Ipkg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Ipkg.py b/lib/python/Components/Ipkg.py index 0ba1165c..71447775 100755 --- a/lib/python/Components/Ipkg.py +++ b/lib/python/Components/Ipkg.py @@ -1,4 +1,5 @@ from enigma import eConsoleAppContainer +from Tools.Directories import fileExists class IpkgComponent: EVENT_INSTALL = 0 @@ -20,7 +21,7 @@ class IpkgComponent: def __init__(self, ipkg = '/usr/bin/ipkg'): self.ipkg = ipkg - + self.opkgAvail = fileExists('/usr/bin/opkg') self.cmd = eConsoleAppContainer() self.cache = None self.callbackList = [] @@ -89,7 +90,10 @@ class IpkgComponent: if data.find('Downloading') == 0: self.callCallbacks(self.EVENT_DOWNLOAD, data.split(' ', 5)[1].strip()) elif data.find('Upgrading') == 0: - self.callCallbacks(self.EVENT_UPGRADE, data.split(' ', 1)[1].split(' ')[0]) + if self.opkgAvail: + self.callCallbacks(self.EVENT_UPGRADE, data.split(' ', 1)[1].split(' ')[0]) + else: + self.callCallbacks(self.EVENT_UPGRADE, data.split(' ', 1)[1].split(' ')[0]) elif data.find('Installing') == 0: self.callCallbacks(self.EVENT_INSTALL, data.split(' ', 1)[1].split(' ')[0]) elif data.find('Removing') == 0: -- cgit v1.2.3 From eca33f89346b4ad0e7bbaef7438e8a87daa963a9 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 11 Jan 2010 19:18:34 +0100 Subject: Add some parental control improvements (made by Tode) --- data/skin_default/Makefile.am | 4 + data/skin_default/lock.png | Bin 0 -> 1053 bytes data/skin_default/lockBouquet.png | Bin 0 -> 1176 bytes data/skin_default/unlock.png | Bin 0 -> 965 bytes data/skin_default/unlockBouquet.png | Bin 0 -> 1141 bytes lib/python/Components/ParentalControl.py | 316 +++++++++++++++++++-------- lib/python/Components/ParentalControlList.py | 29 ++- lib/python/Screens/ParentalControlSetup.py | 79 +++++-- 8 files changed, 320 insertions(+), 108 deletions(-) create mode 100644 data/skin_default/lock.png create mode 100644 data/skin_default/lockBouquet.png create mode 100644 data/skin_default/unlock.png create mode 100644 data/skin_default/unlockBouquet.png mode change 100755 => 100644 lib/python/Components/ParentalControl.py mode change 100755 => 100644 lib/python/Screens/ParentalControlSetup.py (limited to 'lib/python') diff --git a/data/skin_default/Makefile.am b/data/skin_default/Makefile.am index 9e9b7cd4..85bb800d 100755 --- a/data/skin_default/Makefile.am +++ b/data/skin_default/Makefile.am @@ -32,6 +32,8 @@ dist_install_DATA = \ expanded-plugins.png \ info-bg_mp.png \ info-bg.png \ + lock.png \ + lockBouquet.png \ mediaplayer_bg.png \ mute.png \ nim_active.png \ @@ -52,6 +54,8 @@ dist_install_DATA = \ timeline-now.png \ timeline.png \ unhandled-key.png \ + unlock.png \ + unlockBouquet.png \ verticalline-plugins.png \ vkey_backspace.png \ vkey_bg.png \ diff --git a/data/skin_default/lock.png b/data/skin_default/lock.png new file mode 100644 index 00000000..d0ae7f64 Binary files /dev/null and b/data/skin_default/lock.png differ diff --git a/data/skin_default/lockBouquet.png b/data/skin_default/lockBouquet.png new file mode 100644 index 00000000..d503dd2b Binary files /dev/null and b/data/skin_default/lockBouquet.png differ diff --git a/data/skin_default/unlock.png b/data/skin_default/unlock.png new file mode 100644 index 00000000..bd4486e9 Binary files /dev/null and b/data/skin_default/unlock.png differ diff --git a/data/skin_default/unlockBouquet.png b/data/skin_default/unlockBouquet.png new file mode 100644 index 00000000..c5d146d7 Binary files /dev/null and b/data/skin_default/unlockBouquet.png differ diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py old mode 100755 new mode 100644 index d68e01ff..4830d20a --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -1,19 +1,34 @@ -from Components.config import config, ConfigSubsection, ConfigSelection, ConfigPIN, ConfigYesNo, ConfigSubList, ConfigInteger +from Components.config import config, ConfigSubsection, ConfigSelection, ConfigPIN, ConfigText, ConfigYesNo, ConfigSubList, ConfigInteger +#from Screens.ChannelSelection import service_types_tv from Screens.InputBox import PinInput from Screens.MessageBox import MessageBox from Tools.BoundFunction import boundFunction from ServiceReference import ServiceReference from Tools import Notifications from Tools.Directories import resolveFilename, SCOPE_CONFIG +from enigma import eTimer +import time + +TYPE_SERVICE = "SERVICE" +TYPE_BOUQUETSERVICE = "BOUQUETSERVICE" +TYPE_BOUQUET = "BOUQUET" +LIST_BLACKLIST = "blacklist" +LIST_WHITELIST = "whitelist" + +IMG_WHITESERVICE = LIST_WHITELIST + "-" + TYPE_SERVICE +IMG_WHITEBOUQUET = LIST_WHITELIST + "-" + TYPE_BOUQUET +IMG_BLACKSERVICE = LIST_BLACKLIST + "-" + TYPE_SERVICE +IMG_BLACKBOUQUET = LIST_BLACKLIST + "-" + TYPE_BOUQUET def InitParentalControl(): config.ParentalControl = ConfigSubsection() config.ParentalControl.configured = ConfigYesNo(default = False) config.ParentalControl.mode = ConfigSelection(default = "simple", choices = [("simple", _("simple")), ("complex", _("complex"))]) - config.ParentalControl.storeservicepin = ConfigSelection(default = "never", choices = [("never", _("never")), ("5_minutes", _("5 minutes")), ("30_minutes", _("30 minutes")), ("60_minutes", _("60 minutes")), ("restart", _("until restart"))]) + config.ParentalControl.storeservicepin = ConfigSelection(default = "never", choices = [("never", _("never")), ("5", _("5 minutes")), ("30", _("30 minutes")), ("60", _("60 minutes")), ("standby", _("until standby/restart"))]) + config.ParentalControl.storeservicepincancel = ConfigSelection(default = "never", choices = [("never", _("never")), ("5", _("5 minutes")), ("30", _("30 minutes")), ("60", _("60 minutes")), ("standby", _("until standby/restart"))]) config.ParentalControl.servicepinactive = ConfigYesNo(default = False) config.ParentalControl.setuppinactive = ConfigYesNo(default = False) - config.ParentalControl.type = ConfigSelection(default = "blacklist", choices = [("whitelist", _("whitelist")), ("blacklist", _("blacklist"))]) + config.ParentalControl.type = ConfigSelection(default = "blacklist", choices = [(LIST_WHITELIST, _("whitelist")), (LIST_BLACKLIST, _("blacklist"))]) config.ParentalControl.setuppin = ConfigPIN(default = -1) config.ParentalControl.retries = ConfigSubsection() @@ -39,40 +54,58 @@ def InitParentalControl(): class ParentalControl: def __init__(self): - self.open() + #Do not call open on init, because bouquets are not ready at that moment +# self.open() self.serviceLevel = {} - - def addWhitelistService(self, service): - self.whitelist.append(service) + #Instead: Use Flags to see, if we already initialized config and called open + self.configInitialized = False + self.filesOpened = False + #This is the timer that is used to see, if the time for caching the pin is over + #Of course we could also work without a timer and compare the times every + #time we call isServicePlayable. But this might probably slow down zapping, + #That's why I decided to use a timer + self.sessionPinTimer = eTimer() + self.sessionPinTimer.callback.append(self.resetSessionPin) - def addBlacklistService(self, service): - self.blacklist.append(service) - - def setServiceLevel(self, service, level): - self.serviceLevel[service] = level - - def deleteWhitelistService(self, service): - self.whitelist.remove(service) - if self.serviceLevel.has_key(service): - self.serviceLevel.remove(service) + def serviceMethodWrapper(self, service, method, *args): + #This method is used to call all functions that need a service as Parameter: + #It takes either a Service- Reference or a Bouquet- Reference and passes + #Either the service or all services contained in the bouquet to the method given + #That way all other functions do not need to distinguish between service and bouquet. + if "FROM BOUQUET" in service: + method( service , TYPE_BOUQUET , *args ) + servicelist = self.readServicesFromBouquet(service,"C") + for ref in servicelist: + sRef = str(ref[0]) + method( sRef , TYPE_BOUQUETSERVICE , *args ) + else: + ref = ServiceReference(service) + sRef = str(ref) + method( sRef , TYPE_SERVICE , *args ) - def deleteBlacklistService(self, service): - self.blacklist.remove(service) - if self.serviceLevel.has_key(service): - self.serviceLevel.remove(service) + def setServiceLevel(self, service, type, level): + self.serviceLevel[service] = level def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True - #print "whitelist:", self.whitelist - #print "blacklist:", self.blacklist - #print "config.ParentalControl.type.value:", config.ParentalControl.type.value - #print "not in whitelist:", (service not in self.whitelist) - #print "checking parental control for service:", ref.toString() + #Check if we already read the whitelists and blacklists. If not: call open + if self.filesOpened == False: + self.open() + #Check if configuration has already been read or if the significant values have changed. + #If true: read the configuration + if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value or self.storeServicePinCancel != config.ParentalControl.storeservicepincancel.value: + self.getConfigValues() service = ref.toCompareString() - if (config.ParentalControl.type.value == "whitelist" and service not in self.whitelist) or (config.ParentalControl.type.value == "blacklist" and service in self.blacklist): + if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)): + #Check if the session pin is cached and return the cached value, if it is. + if self.sessionPinCached == True: + #As we can cache successful pin- entries as well as canceled pin- entries, + #We give back the last action + return self.sessionPinCachedValue self.callback = callback - #print "service:", ServiceReference(service).getServiceName() + #Someone started to implement different levels of protection. Seems they were never completed + #I did not throw out this code, although it is of no use at the moment levelNeeded = 0 if self.serviceLevel.has_key(service): levelNeeded = self.serviceLevel[service] @@ -83,103 +116,214 @@ class ParentalControl: return True def protectService(self, service): - #print "protect" - #print "config.ParentalControl.type.value:", config.ParentalControl.type.value - if config.ParentalControl.type.value == "whitelist": - if service in self.whitelist: - self.deleteWhitelistService(service) + if config.ParentalControl.type.value == LIST_WHITELIST: + if self.whitelist.has_key(service): + self.serviceMethodWrapper(service, self.removeServiceFromList, self.whitelist) + #self.deleteWhitelistService(service) else: # blacklist - if service not in self.blacklist: - self.addBlacklistService(service) + if not self.blacklist.has_key(service): + self.serviceMethodWrapper(service, self.addServiceToList, self.blacklist) + #self.addBlacklistService(service) #print "whitelist:", self.whitelist #print "blacklist:", self.blacklist - def unProtectService(self, service): #print "unprotect" #print "config.ParentalControl.type.value:", config.ParentalControl.type.value - if config.ParentalControl.type.value == "whitelist": - if service not in self.whitelist: - self.addWhitelistService(service) + if config.ParentalControl.type.value == LIST_WHITELIST: + if not self.whitelist.has_key(service): + self.serviceMethodWrapper(service, self.addServiceToList, self.whitelist) + #self.addWhitelistService(service) else: # blacklist - if service in self.blacklist: - self.deleteBlacklistService(service) + if self.blacklist.has_key(service): + self.serviceMethodWrapper(service, self.removeServiceFromList, self.blacklist) + #self.deleteBlacklistService(service) #print "whitelist:", self.whitelist #print "blacklist:", self.blacklist def getProtectionLevel(self, service): - if (config.ParentalControl.type.value == "whitelist" and service not in self.whitelist) or (config.ParentalControl.type.value == "blacklist" and service in self.blacklist): + if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)): if self.serviceLevel.has_key(service): return self.serviceLevel[service] else: return 0 else: return -1 + + def getProtectionType(self, service): + #New method used in ParentalControlList: This method does not only return + #if a service is protected or not, it also returns, why (whitelist or blacklist, service or bouquet) + if self.filesOpened == False: + self.open() + sImage = "" + if (config.ParentalControl.type.value == LIST_WHITELIST): + if self.whitelist.has_key(service): + if TYPE_SERVICE in self.whitelist[service]: + sImage = IMG_WHITESERVICE + else: + sImage = IMG_WHITEBOUQUET + elif (config.ParentalControl.type.value == LIST_BLACKLIST): + if self.blacklist.has_key(service): + if TYPE_SERVICE in self.blacklist[service]: + sImage = IMG_BLACKSERVICE + else: + sImage = IMG_BLACKBOUQUET + bLocked = self.getProtectionLevel(service) != -1 + return (bLocked,sImage) + + def getConfigValues(self): + #Read all values from configuration + self.checkPinInterval = False + self.checkPinIntervalCancel = False + self.checkSessionPin = False + self.checkSessionPinCancel = False + + self.sessionPinCached = False + self.pinIntervalSeconds = 0 + self.pinIntervalSecondsCancel = 0 + + self.storeServicePin = config.ParentalControl.storeservicepin.value + self.storeServicePinCancel = config.ParentalControl.storeservicepincancel.value + + if self.storeServicePin == "never": + pass + elif self.storeServicePin == "standby": + self.checkSessionPin = True + else: + self.checkPinInterval = True + iMinutes = float(self.storeServicePin) + iSeconds = iMinutes*60 + self.pinIntervalSeconds = iSeconds + + if self.storeServicePinCancel == "never": + pass + elif self.storeServicePinCancel == "standby": + self.checkSessionPinCancel = True + else: + self.checkPinIntervalCancel = True + iMinutes = float(self.storeServicePinCancel) + iSeconds = iMinutes*60 + self.pinIntervalSecondsCancel = iSeconds + self.configInitialized = True + # Reset PIN cache on standby: Use StandbyCounter- Config- Callback + config.misc.standbyCounter.addNotifier(self.standbyCounterCallback, initial_call = False) + + def standbyCounterCallback(self, configElement): + self.resetSessionPin() + + def resetSessionPin(self): + #Reset the session pin, stop the timer + self.sessionPinCached = False + self.sessionPinTimer.stop() + + def getCurrentTimeStamp(self): + return time.time() + def getPinList(self): return [ x.value for x in config.ParentalControl.servicepin ] - + def servicePinEntered(self, service, result): -# levelNeeded = 0 - #if self.serviceLevel.has_key(service): - #levelNeeded = self.serviceLevel[service] -# - #print "getPinList():", self.getPinList() - #pinList = self.getPinList()[:levelNeeded + 1] - #print "pinList:", pinList -# -# print "pin entered for service", service, "and pin was", pin - #if pin is not None and int(pin) in pinList: + if result is not None and result: - #print "pin ok, playing service" + #This is the new function of caching the service pin + #save last session and time of last entered pin... + if self.checkSessionPin == True: + self.sessionPinCached = True + self.sessionPinCachedValue = True + if self.checkPinInterval == True: + self.sessionPinCached = True + self.sessionPinCachedValue = True + self.sessionPinTimer.start(self.pinIntervalSeconds*1000,1) self.callback(ref = service) else: + #This is the new function of caching cancelling of service pin if result is not None: Notifications.AddNotification(MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR) - #print "wrong pin entered" + else: + if self.checkSessionPinCancel == True: + self.sessionPinCached = True + self.sessionPinCachedValue = False + if self.checkPinIntervalCancel == True: + self.sessionPinCached = True + self.sessionPinCachedValue = False + self.sessionPinTimer.start(self.pinIntervalSecondsCancel*1000,1) - def saveWhitelist(self): - file = open(resolveFilename(SCOPE_CONFIG, "whitelist"), 'w') - for x in self.whitelist: - file.write(x + "\n") - file.close - - def openWhitelist(self): - self.whitelist = [] - try: - file = open(resolveFilename(SCOPE_CONFIG, "whitelist"), 'r') - lines = file.readlines() - for x in lines: - ref = ServiceReference(x.strip()) - self.whitelist.append(str(ref)) - file.close - except: - pass - - def saveBlacklist(self): - file = open(resolveFilename(SCOPE_CONFIG, "blacklist"), 'w') - for x in self.blacklist: - file.write(x + "\n") + def saveListToFile(self,sWhichList): + #Replaces saveWhiteList and saveBlackList: + #I don't like to have two functions with identical code... + if sWhichList == LIST_BLACKLIST: + vList = self.blacklist + else: + vList = self.whitelist + file = open(resolveFilename(SCOPE_CONFIG, sWhichList), 'w') + for sService,sType in vList.iteritems(): + #Only Services that are selected directly and Bouqets are saved. + #Services that are added by a bouquet are not saved. + #This is the reason for the change in self.whitelist and self.blacklist + if TYPE_SERVICE in sType or TYPE_BOUQUET in sType: + file.write(str(sService) + "\n") file.close - def openBlacklist(self): - self.blacklist = [] + def openListFromFile(self,sWhichList): + #Replaces openWhiteList and openBlackList: + #I don't like to have two functions with identical code... + if sWhichList == LIST_BLACKLIST: + self.blacklist = {} + vList = self.blacklist + else: + self.whitelist = {} + vList = self.whitelist try: - file = open(resolveFilename(SCOPE_CONFIG, "blacklist"), 'r') + file = open(resolveFilename(SCOPE_CONFIG, sWhichList ), 'r') lines = file.readlines() for x in lines: - ref = ServiceReference(x.strip()) - self.blacklist.append(str(ref)) + sPlain = x.strip() + self.serviceMethodWrapper(sPlain, self.addServiceToList, vList) file.close except: pass + + def addServiceToList(self, service, type, vList): + #Replaces addWhitelistService and addBlacklistService + #The lists are not only lists of service references any more. + #They are named lists with the service as key and an array of types as value: + + if vList.has_key(service): + if not type in vList[service]: + vList[service].append(type) + else: + vList[service] = [type] + + def removeServiceFromList(self, service, type, vList): + #Replaces deleteWhitelistService and deleteBlacklistService + if vList.has_key(service): + if type in vList[service]: + vList[service].remove(type) + if not vList[service]: + del vList[service] + if self.serviceLevel.has_key(service): + self.serviceLevel.remove(service) + + def readServicesFromBouquet(self,sBouquetSelection,formatstring): + #This method gives back a list of services for a given bouquet + from enigma import eServiceCenter, eServiceReference + from Screens.ChannelSelection import service_types_tv + serviceHandler = eServiceCenter.getInstance() + refstr = sBouquetSelection + root = eServiceReference(refstr) + list = serviceHandler.list(root) + if list is not None: + services = list.getContent("CN", True) #(servicecomparestring, name) + return services def save(self): - self.saveBlacklist() - self.saveWhitelist() + self.saveListToFile(LIST_BLACKLIST) + self.saveListToFile(LIST_WHITELIST) def open(self): - self.openBlacklist() - self.openWhitelist() + self.openListFromFile(LIST_BLACKLIST) + self.openListFromFile(LIST_WHITELIST) + self.filesOpened = True parentalControl = ParentalControl() diff --git a/lib/python/Components/ParentalControlList.py b/lib/python/Components/ParentalControlList.py index 128e6d3e..797ea391 100644 --- a/lib/python/Components/ParentalControlList.py +++ b/lib/python/Components/ParentalControlList.py @@ -1,19 +1,28 @@ from MenuList import MenuList -from Components.ParentalControl import parentalControl +from Components.ParentalControl import parentalControl, IMG_WHITESERVICE, IMG_WHITEBOUQUET, IMG_BLACKSERVICE, IMG_BLACKBOUQUET from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT from Tools.LoadPixmap import LoadPixmap -lockPicture = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png")) +#Now there is a list of pictures instead of one... +entryPicture = {} -def ParentalControlEntryComponent(service, name, locked = True): +entryPicture[IMG_BLACKSERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png")) +entryPicture[IMG_BLACKBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lockBouquet.png")) +entryPicture[IMG_WHITESERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlock.png")) +entryPicture[IMG_WHITEBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlockBouquet.png")) + +def ParentalControlEntryComponent(service, name, protectionType): + locked = protectionType[0] + sImage = protectionType[1] res = [ (service, name, locked), (eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name) ] - if locked: - res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture)) + #Changed logic: The image is defined by sImage, not by locked anymore + if sImage != "": + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, entryPicture[sImage])) return res class ParentalControlList(MenuList): @@ -25,9 +34,11 @@ class ParentalControlList(MenuList): def toggleSelectedLock(self): print "self.l.getCurrentSelection():", self.l.getCurrentSelection() print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex() - self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]); - if self.l.getCurrentSelection()[0][2]: - parentalControl.protectService(self.l.getCurrentSelection()[0][0]) + curSel = self.l.getCurrentSelection() + if curSel[0][2]: + parentalControl.unProtectService(self.l.getCurrentSelection()[0][0]) else: - parentalControl.unProtectService(self.l.getCurrentSelection()[0][0]) + parentalControl.protectService(self.l.getCurrentSelection()[0][0]) + #Instead of just negating the locked- flag, now I call the getProtectionType every time... + self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0])) self.l.setList(self.list) diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py old mode 100755 new mode 100644 index a123d2d3..2bf4841e --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -16,7 +16,7 @@ from operator import itemgetter class ProtectedScreen: def __init__(self): if self.isProtected(): - self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.protectedWithPin()], triesEntry = self.getTriesEntry(), title = self.getPinText(), windowTitle = _("Change pin code"))) + self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.protectedWithPin()], triesEntry = self.getTriesEntry(), title = self.getPinText(), windowTitle = _("Enter pin code"))) def getTriesEntry(self): return config.ParentalControl.retries.setuppin @@ -48,11 +48,11 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): self.list = [] ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) self.createSetup() - + self["actions"] = NumberActionMap(["SetupActions"], { - "cancel": self.keyCancel, - "save": self.keyCancel + "cancel": self.keyCancel, + "save": self.keyCancel }, -2) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) @@ -63,12 +63,12 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): def isProtected(self): return config.ParentalControl.setuppinactive.value and config.ParentalControl.configured.value - + def createSetup(self): self.editListEntry = None self.changePin = None self.changeSetupPin = None - + self.list = [] self.list.append(getConfigListEntry(_("Enable parental control"), config.ParentalControl.configured)) print "config.ParentalControl.configured.value", config.ParentalControl.configured.value @@ -87,10 +87,19 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): elif config.ParentalControl.mode.value == "simple": self.changePin = getConfigListEntry(_("Change service pin"), NoSave(ConfigNothing())) self.list.append(self.changePin) - #self.list.append(getConfigListEntry(_("Remember service pin"), config.ParentalControl.storeservicepin)) + #Added Option to remember the service pin + self.list.append(getConfigListEntry(_("Remember service pin"), config.ParentalControl.storeservicepin)) + #Added Option to remember the cancellation of service pin entry + self.list.append(getConfigListEntry(_("Remember service pin cancel"), config.ParentalControl.storeservicepincancel)) self.editListEntry = getConfigListEntry(_("Edit services list"), NoSave(ConfigNothing())) self.list.append(self.editListEntry) - + #New funtion: Possibility to add Bouquets to whitelist / blacklist + self.editBouquetListEntry = getConfigListEntry(_("Edit bouquets list"), NoSave(ConfigNothing())) + self.list.append(self.editBouquetListEntry) + #New option to reload service lists (for example if bouquets have changed) + self.reloadLists = getConfigListEntry(_("Reload Black-/Whitelists"), NoSave(ConfigNothing())) + self.list.append(self.reloadLists) + self["config"].list = self.list self["config"].setList(self.list) @@ -98,6 +107,8 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): print "self[\"config\"].l.getCurrentSelection()", self["config"].l.getCurrentSelection() if self["config"].l.getCurrentSelection() == self.editListEntry: self.session.open(ParentalControlEditor) + elif self["config"].l.getCurrentSelection() == self.editBouquetListEntry: + self.session.open(ParentalControlBouquetEditor) elif self["config"].l.getCurrentSelection() == self.changePin: if config.ParentalControl.mode.value == "complex": pass @@ -105,6 +116,8 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): self.session.open(ParentalControlChangePin, config.ParentalControl.servicepin[0], _("service pin")) elif self["config"].l.getCurrentSelection() == self.changeSetupPin: self.session.open(ParentalControlChangePin, config.ParentalControl.setuppin, _("setup pin")) + elif self["config"].l.getCurrentSelection() == self.reloadLists: + parentalControl.open() else: ConfigListScreen.keyRight(self) print "current selection:", self["config"].l.getCurrentSelection() @@ -149,6 +162,7 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): def keyNumberGlobal(self, number): pass + # for summary: def changedEntry(self): for x in self.onChangedEntry: @@ -224,13 +238,13 @@ class ParentalControlEditor(Screen): if not self.servicesList.has_key(key): self.servicesList[key] = [] self.servicesList[key].append(s) - + def chooseLetter(self): print "choose letter" mylist = [] for x in self.servicesList.keys(): if x == chr(SPECIAL_CHAR): - x = ("special characters", x) + x = (_("special characters"), x) else: x = (x, x) mylist.append(x) @@ -242,12 +256,51 @@ class ParentalControlEditor(Screen): if result is not None: print "result:", result self.currentLetter = result[1] - self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionLevel(x[0]) != -1) for x in self.servicesList[result[1]]] + #Replace getProtectionLevel by new getProtectionType + self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.servicesList[result[1]]] self.servicelist.setList(self.list) else: parentalControl.save() self.close() +class ParentalControlBouquetEditor(Screen): + #This new class allows adding complete bouquets to black- and whitelists + #The servicereference that is stored for bouquets is their refstr as listed in bouquets.tv + def __init__(self, session): + Screen.__init__(self, session) + self.skinName = "ParentalControlEditor" + self.list = [] + self.bouquetslist = ParentalControlList(self.list) + self["servicelist"] = self.bouquetslist; + self.readBouquetList() + self.onLayoutFinish.append(self.selectBouquet) + + self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"], + { + "ok": self.select, + "cancel": self.cancel + }, -1) + + def cancel(self): + parentalControl.save() + self.close() + + def select(self): + self.bouquetslist.toggleSelectedLock() + + def readBouquetList(self): + serviceHandler = eServiceCenter.getInstance() + refstr = '1:134:1:0:0:0:0:0:0:0:FROM BOUQUET \"bouquets.tv\" ORDER BY bouquet' + bouquetroot = eServiceReference(refstr) + self.bouquetlist = {} + list = serviceHandler.list(bouquetroot) + if list is not None: + self.bouquetlist = list.getContent("CN", True) + + def selectBouquet(self): + self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.bouquetlist] + self.bouquetslist.setList(self.list) + class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): def __init__(self, session, pin, pinname): Screen.__init__(self, session) @@ -264,12 +317,12 @@ class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2)) self.list.append(getConfigListEntry(_("New pin"), NoSave(self.pin1))) self.list.append(getConfigListEntry(_("Reenter new pin"), NoSave(self.pin2))) - ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) + ConfigListScreen.__init__(self, self.list) # print "old pin:", pin #if pin.value != "aaaa": #self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.pin.value], title = _("please enter the old pin"), windowTitle = _("Change pin code"))) ProtectedScreen.__init__(self) - + self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"], { "cancel": self.cancel, -- cgit v1.2.3 From 31037f2bac27fb9a592d63a09e1e9ef2792f8e7e Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 1 Mar 2010 01:47:26 +0100 Subject: fixes bug #381 some small fixes for the parental control functions --- lib/python/Components/ParentalControl.py | 3 +++ lib/python/Screens/ParentalControlSetup.py | 2 ++ 2 files changed, 5 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index 4830d20a..9942bca7 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -318,6 +318,9 @@ class ParentalControl: return services def save(self): + # we need to open the files in case we havent's read them yet + if not self.filesOpened: + self.open() self.saveListToFile(LIST_BLACKLIST) self.saveListToFile(LIST_WHITELIST) diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py index 2bf4841e..eae12da4 100644 --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -72,6 +72,8 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): self.list = [] self.list.append(getConfigListEntry(_("Enable parental control"), config.ParentalControl.configured)) print "config.ParentalControl.configured.value", config.ParentalControl.configured.value + self.editBouquetListEntry = -1 + self.reloadLists = -1 if config.ParentalControl.configured.value: #self.list.append(getConfigListEntry(_("Configuration mode"), config.ParentalControl.mode)) self.list.append(getConfigListEntry(_("Protect setup"), config.ParentalControl.setuppinactive)) -- cgit v1.2.3 From f9ebb7117c782cd7687523abc8bdccfe8153290e Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 1 Mar 2010 19:37:57 +0100 Subject: fix no more turning positioner after leave positioner setup in some cases this fixes bug #321 --- lib/dvb/frontend.cpp | 19 +++++++++++++++++-- lib/dvb/frontend.h | 1 + lib/dvb/sec.cpp | 5 +++++ lib/python/Components/TuneTest.py | 5 +++-- .../Plugins/SystemPlugins/PositionerSetup/plugin.py | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index c0263fb4..f85a37fe 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -455,7 +455,7 @@ int eDVBFrontend::PriorityOrder=0; eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) :m_simulate(simulate), m_enabled(false), m_type(-1), m_dvbid(fe), m_slotid(fe) - ,m_fd(-1), m_need_rotor_workaround(false), m_can_handle_dvbs2(false) + ,m_fd(-1), m_rotor_mode(false), m_need_rotor_workaround(false), m_can_handle_dvbs2(false) ,m_state(stateClosed), m_timeout(0), m_tuneTimer(0) #if HAVE_DVB_API_VERSION < 3 ,m_secfd(-1) @@ -692,7 +692,8 @@ void eDVBFrontend::feEvent(int w) { eDebug("stateLostLock"); state = stateLostLock; - sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = -1; // reset diseqc + if (!m_rotor_mode) + sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = -1; // reset diseqc } } if (m_state != state) @@ -2343,6 +2344,20 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) res = -EINVAL; goto tune_error; } + if (m_rotor_mode != feparm.no_rotor_command_on_tune && !feparm.no_rotor_command_on_tune) + { + eDVBFrontend *sec_fe = this; + long tmp = m_data[LINKED_PREV_PTR]; + while (tmp != -1) + { + eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*)tmp; + sec_fe = linked_fe->m_frontend; + sec_fe->getData(LINKED_NEXT_PTR, tmp); + } + eDebug("(fe%d) reset diseqc after leave rotor mode!", m_dvbid); + sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = sec_fe->m_data[ROTOR_CMD] = sec_fe->m_data[ROTOR_POS] = -1; // reset diseqc + } + m_rotor_mode = feparm.no_rotor_command_on_tune; if (!m_simulate) m_sec->setRotorMoving(m_slotid, false); res=prepare_sat(feparm, timeout); diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index bac27539..4cf05081 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -75,6 +75,7 @@ private: int m_dvbid; int m_slotid; int m_fd; + bool m_rotor_mode; bool m_need_rotor_workaround; bool m_can_handle_dvbs2; char m_filename[128]; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 91246889..44cbe709 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -156,6 +156,11 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite ret = 15000; } + if (sat.no_rotor_command_on_tune && !rotor) { + eSecDebugNoSimulate("no rotor but no_rotor_command_on_tune is set.. ignore lnb %d", idx); + continue; + } + eSecDebugNoSimulate("ret1 %d", ret); if (linked_in_use) diff --git a/lib/python/Components/TuneTest.py b/lib/python/Components/TuneTest.py index f9ab3edb..44b19091 100644 --- a/lib/python/Components/TuneTest.py +++ b/lib/python/Components/TuneTest.py @@ -1,8 +1,9 @@ from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParameters, eDVBResourceManager, eTimer class Tuner: - def __init__(self, frontend): + def __init__(self, frontend, ignore_rotor=False): self.frontend = frontend + self.ignore_rotor = ignore_rotor # transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, system, modulation, rolloff, pilot, tsid, onid) # 0 1 2 3 4 5 6 7 8 9 10 11 @@ -21,7 +22,7 @@ class Tuner: parm.rolloff = transponder[8] parm.pilot = transponder[9] feparm = eDVBFrontendParameters() - feparm.setDVBS(parm) + feparm.setDVBS(parm, self.ignore_rotor) self.lastparm = feparm self.frontend.tune(feparm) diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py index fa533c0b..3cc9e751 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py @@ -77,7 +77,7 @@ class PositionerSetup(Screen): self.frontendStatus = { } self.diseqc = Diseqc(self.frontend) - self.tuner = Tuner(self.frontend) + self.tuner = Tuner(self.frontend, True) #True means we dont like that the normal sec stuff sends commands to the rotor! tp = ( cur.get("frequency", 0) / 1000, cur.get("symbol_rate", 0) / 1000, -- cgit v1.2.3 From b9078822ea1ab5a65389532b3f34c2a26e4660bb Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 4 Mar 2010 00:19:21 +0100 Subject: fixes bug #460 allow setting a timer end time for zapping timers zapping timers with no end time set end right after the zapping timer was started now, so no conflicts with other timers occur that the user doesn't expect --- lib/python/Components/TimerList.py | 10 ++++++++-- lib/python/Screens/TimerEntry.py | 23 +++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py index 2a7405df..30097c96 100755 --- a/lib/python/Components/TimerList.py +++ b/lib/python/Components/TimerList.py @@ -33,12 +33,18 @@ class TimerList(HTMLComponent, GUIComponent, object): count += 1 flags = flags >> 1 if timer.justplay: - res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1])))) + if timer.end - timer.begin < 4: # rounding differences + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1])))) + else: + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s ... %s (%d " + _("mins") + ") ") % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) + _("(ZAP)"))) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)))) else: if timer.justplay: - res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin))))) + if timer.end - timer.begin < 4: + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin))))) + else: + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s ... %s (%d " + _("mins") + ") ") % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] + ((timer.end - timer.begin) / 60,))) + _("(ZAP)"))) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] + ((timer.end - timer.begin) / 60,))))) diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index b231b568..64fa9f19 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -106,10 +106,11 @@ class TimerEntry(Screen, ConfigListScreen): self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)]) self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))]) - + self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400) self.timerentry_starttime = ConfigClock(default = self.timer.begin) self.timerentry_endtime = ConfigClock(default = self.timer.end) + self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))]) default = self.timer.dirname or defaultMoviePath() tmp = config.movielist.videodirs.value @@ -172,11 +173,14 @@ class TimerEntry(Screen, ConfigListScreen): self.entryStartTime = getConfigListEntry(_("StartTime"), self.timerentry_starttime) self.list.append(self.entryStartTime) - if self.timerentry_justplay.value != "zap": - self.entryEndTime = getConfigListEntry(_("EndTime"), self.timerentry_endtime) + + self.entryShowEndTime = getConfigListEntry(_("Set End Time"), self.timerentry_showendtime) + if self.timerentry_justplay.value == "zap": + self.list.append(self.entryShowEndTime) + self.entryEndTime = getConfigListEntry(_("EndTime"), self.timerentry_endtime) + if self.timerentry_justplay.value != "zap" or self.timerentry_showendtime.value: self.list.append(self.entryEndTime) - else: - self.entryEndTime = None + self.channelEntry = getConfigListEntry(_("Channel"), self.timerentry_service) self.list.append(self.channelEntry) @@ -194,11 +198,7 @@ class TimerEntry(Screen, ConfigListScreen): def newConfig(self): print "newConfig", self["config"].getCurrent() - if self["config"].getCurrent() == self.timerTypeEntry: - self.createSetup("config") - if self["config"].getCurrent() == self.timerJustplayEntry: - self.createSetup("config") - if self["config"].getCurrent() == self.frequencyEntry: + if self["config"].getCurrent() in (self.timerTypeEntry, self.timerJustplayEntry, self.frequencyEntry, self.entryShowEndTime): self.createSetup("config") def keyLeft(self): @@ -268,6 +268,9 @@ class TimerEntry(Screen, ConfigListScreen): self.timer.name = self.timerentry_name.value self.timer.description = self.timerentry_description.value self.timer.justplay = self.timerentry_justplay.value == "zap" + if self.timerentry_justplay.value == "zap": + if not self.timerentry_showendtime.value: + self.timerentry_endtime.value = self.timerentry_starttime.value self.timer.resetRepeated() self.timer.afterEvent = { "nothing": AFTEREVENT.NONE, -- cgit v1.2.3 From 678d4adc636ce6effe3e4c7442dd1b19e868e570 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 13:33:36 +0100 Subject: fixes bug #465 don't install sub directory files --- lib/python/Plugins/Extensions/DVDPlayer/Makefile.am | 1 - lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am | 5 +++++ lib/python/Plugins/Extensions/SocketMMI/Makefile.am | 1 - lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am index d1a995ca..71ea7142 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am @@ -4,7 +4,6 @@ SUBDIRS = src meta installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer install_PYTHON = \ - src/servicedvd.so \ __init__.py \ plugin.py \ keymap.xml \ diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am index 774871e8..27c751cf 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am @@ -2,6 +2,11 @@ OBJS := servicedvd.cpp -include $(OBJS:.cpp=.d) +installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer + +install_PYTHON = \ + servicedvd.so + servicedvd.so: $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \ -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,servicedvd.so -o servicedvd.so \ diff --git a/lib/python/Plugins/Extensions/SocketMMI/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/Makefile.am index 808d8520..2af2c39b 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/Makefile.am +++ b/lib/python/Plugins/Extensions/SocketMMI/Makefile.am @@ -3,7 +3,6 @@ SUBDIRS = src meta installdir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI install_PYTHON = \ - src/socketmmi.so \ __init__.py \ plugin.py \ SocketMMI.py diff --git a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am index ad97d672..8e80e183 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am +++ b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am @@ -2,6 +2,11 @@ OBJS = socket_mmi.cpp -include $(OBJS:.cpp=.d) +installdir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI + +install_PYTHON = \ + socketmmi.so + socketmmi.so: socket_mmi.cpp socket_mmi.h $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \ -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,socketmmi.so -o socketmmi.so \ -- cgit v1.2.3 From a35c57a736086abaef5a82e2e117a12e3a79b273 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 15:40:35 +0100 Subject: refs bug #429 remove some absolute paths --- lib/python/Components/Harddisk.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 03f574f3..e8e612a4 100755 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -166,7 +166,7 @@ class Harddisk: lines = mounts.readlines() mounts.close() - cmd = "/bin/umount" + cmd = "umount" for line in lines: parts = line.strip().split(" ") @@ -177,12 +177,12 @@ class Harddisk: return (res >> 8) def createPartition(self): - cmd = 'printf "0,\n;\n;\n;\ny\n" | /sbin/sfdisk -f ' + self.disk_path + cmd = 'printf "0,\n;\n;\n;\ny\n" | sfdisk -f ' + self.disk_path res = system(cmd) return (res >> 8) def mkfs(self): - cmd = "/sbin/mkfs.ext3 " + cmd = "mkfs.ext3 " if self.diskSize() > 4 * 1024: cmd += "-T largefile " cmd += "-m0 -O dir_index " + self.partitionPath("1") @@ -202,7 +202,7 @@ class Harddisk: for line in lines: parts = line.strip().split(" ") if path.realpath(parts[0]) == self.partitionPath("1"): - cmd = "/bin/mount -t ext3 " + parts[0] + cmd = "mount -t ext3 " + parts[0] res = system(cmd) break @@ -218,7 +218,7 @@ class Harddisk: def fsck(self): # We autocorrect any failures # TODO: we could check if the fs is actually ext3 - cmd = "/sbin/fsck.ext3 -f -p " + self.partitionPath("1") + cmd = "fsck.ext3 -f -p " + self.partitionPath("1") res = system(cmd) return (res >> 8) @@ -226,7 +226,7 @@ class Harddisk: part = self.partitionPath(n) if access(part, 0): - cmd = '/bin/dd bs=512 count=3 if=/dev/zero of=' + part + cmd = 'dd bs=512 count=3 if=/dev/zero of=' + part res = system(cmd) else: res = 0 -- cgit v1.2.3 From bb4afcfbede3c7e04bc6c9213818cc5d9a60887c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 16:16:28 +0100 Subject: refs bug #429 use PATH variable to determine, if an executable file exists instead of just parsing the command string for a leading / --- lib/python/Components/Task.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index df94f8a6..86bd233e 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -370,12 +370,14 @@ class DiskspacePrecondition(Condition): class ToolExistsPrecondition(Condition): def check(self, task): import os - if task.cmd[0]=='/': - realpath = task.cmd - else: - realpath = task.cwd + '/' + task.cmd - self.realpath = realpath - return os.access(realpath, os.X_OK) + + self.realpath = task.cmd + path = os.environ.get('PATH', '').split(os.pathsep) + absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) + if len(absolutes) > 0: + self.realpath = task.cmd[0] + return True + return False def getErrorMessage(self, task): return _("A required tool (%s) was not found.") % (self.realpath) -- cgit v1.2.3 From 46987d3de4111d3ccdbfe615b9f3f9f489941b23 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 16:18:50 +0100 Subject: fixes bug #429 remove some absolute paths --- lib/python/Components/Network.py | 2 +- lib/python/Plugins/Extensions/DVDBurn/Process.py | 36 ++++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 29491cb0..b9da48d8 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -14,7 +14,7 @@ class Network: self.NetworkState = 0 self.DnsState = 0 self.nameservers = [] - self.ethtool_bin = "/usr/sbin/ethtool" + self.ethtool_bin = "ethtool" self.container = eConsoleAppContainer() self.Console = Console() self.LinkConsole = Console() diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 642a898d..f7f44db6 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -5,7 +5,7 @@ from Screens.MessageBox import MessageBox class png2yuvTask(Task): def __init__(self, job, inputfile, outputfile): Task.__init__(self, job, "Creating menu video") - self.setTool("/usr/bin/png2yuv") + self.setTool("png2yuv") self.args += ["-n1", "-Ip", "-f25", "-j", inputfile] self.dumpFile = outputfile self.weighting = 15 @@ -21,7 +21,7 @@ class png2yuvTask(Task): class mpeg2encTask(Task): def __init__(self, job, inputfile, outputfile): Task.__init__(self, job, "Encoding menu video") - self.setTool("/usr/bin/mpeg2enc") + self.setTool("mpeg2enc") self.args += ["-f8", "-np", "-a2", "-o", outputfile] self.inputFile = inputfile self.weighting = 25 @@ -36,7 +36,7 @@ class mpeg2encTask(Task): class spumuxTask(Task): def __init__(self, job, xmlfile, inputfile, outputfile): Task.__init__(self, job, "Muxing buttons into menu") - self.setTool("/usr/bin/spumux") + self.setTool("spumux") self.args += [xmlfile] self.inputFile = inputfile self.dumpFile = outputfile @@ -54,7 +54,7 @@ class spumuxTask(Task): class MakeFifoNode(Task): def __init__(self, job, number): Task.__init__(self, job, "Make FIFO nodes") - self.setTool("/bin/mknod") + self.setTool("mknod") nodename = self.job.workspace + "/dvd_title_%d" % number + ".mpg" self.args += [nodename, "p"] self.weighting = 10 @@ -62,14 +62,14 @@ class MakeFifoNode(Task): class LinkTS(Task): def __init__(self, job, sourcefile, link_name): Task.__init__(self, job, "Creating symlink for source titles") - self.setTool("/bin/ln") + self.setTool("ln") self.args += ["-s", sourcefile, link_name] self.weighting = 10 class CopyMeta(Task): def __init__(self, job, sourcefile): Task.__init__(self, job, "Copy title meta files") - self.setTool("/bin/cp") + self.setTool("cp") from os import listdir path, filename = sourcefile.rstrip("/").rsplit("/",1) tsfiles = listdir(path) @@ -84,7 +84,7 @@ class DemuxTask(Task): Task.__init__(self, job, "Demux video into ES") title = job.project.titles[job.i] self.global_preconditions.append(DiskspacePrecondition(title.estimatedDiskspace)) - self.setTool("/usr/bin/projectx") + self.setTool("projectx") self.args += [inputfile, "-demux", "-out", self.job.workspace ] self.end = 300 self.prog_state = 0 @@ -194,7 +194,7 @@ class MplexTask(Task): self.weighting = weighting self.demux_task = demux_task self.postconditions.append(MplexTaskPostcondition()) - self.setTool("/usr/bin/mplex") + self.setTool("mplex") self.args += ["-f8", "-o", outputfile, "-v1"] if inputfiles: self.args += inputfiles @@ -222,7 +222,7 @@ class RemoveESFiles(Task): def __init__(self, job, demux_task): Task.__init__(self, job, "Remove temp. files") self.demux_task = demux_task - self.setTool("/bin/rm") + self.setTool("rm") self.weighting = 10 def prepare(self): @@ -234,7 +234,7 @@ class DVDAuthorTask(Task): def __init__(self, job): Task.__init__(self, job, "Authoring DVD") self.weighting = 20 - self.setTool("/usr/bin/dvdauthor") + self.setTool("dvdauthor") self.CWD = self.job.workspace self.args += ["-x", self.job.workspace+"/dvdauthor.xml"] self.menupreview = job.menupreview @@ -255,7 +255,7 @@ class DVDAuthorTask(Task): class DVDAuthorFinalTask(Task): def __init__(self, job): Task.__init__(self, job, "dvdauthor finalize") - self.setTool("/usr/bin/dvdauthor") + self.setTool("dvdauthor") self.args += ["-T", "-o", self.job.workspace + "/dvd"] class WaitForResidentTasks(Task): @@ -292,7 +292,7 @@ class BurnTaskPostcondition(Condition): class BurnTask(Task): 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"): + def __init__(self, job, extra_args=[], tool="growisofs"): Task.__init__(self, job, job.name) self.weighting = 500 self.end = 120 # 100 for writing, 10 for buffer flush, 10 for closing disc @@ -357,7 +357,7 @@ class BurnTask(Task): class RemoveDVDFolder(Task): def __init__(self, job): Task.__init__(self, job, "Remove temp. files") - self.setTool("/bin/rm") + self.setTool("rm") self.args += ["-rf", self.job.workspace] self.weighting = 10 @@ -882,13 +882,13 @@ class DVDJob(Job): volName = self.project.settings.name.getValue() if output == "dvd": self.name = _("Burn DVD") - tool = "/bin/growisofs" + tool = "growisofs" burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] if self.project.size/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": self.name = _("Create DVD-ISO") - tool = "/usr/bin/mkisofs" + tool = "mkisofs" isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, self.workspace + "/dvd" ] @@ -920,14 +920,14 @@ class DVDdataJob(Job): output = self.project.settings.output.getValue() volName = self.project.settings.name.getValue() - tool = "/bin/growisofs" + tool = "growisofs" if output == "dvd": self.name = _("Burn DVD") burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] if self.project.size/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": - tool = "/usr/bin/mkisofs" + tool = "mkisofs" self.name = _("Create DVD-ISO") isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] @@ -959,5 +959,5 @@ class DVDisoJob(Job): if getSize(imagepath)/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, imagepath ] - tool = "/bin/growisofs" + tool = "growisofs" BurnTask(self, burnargs, tool) -- cgit v1.2.3 From d0509622a73b8b84edf260599b853cab72903402 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 17:25:37 +0100 Subject: refs bug #429 - allow absolute path names in Task.py but print a warning - search in task.cwd as well --- lib/python/Components/Task.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 86bd233e..a1e04bce 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -371,12 +371,18 @@ class ToolExistsPrecondition(Condition): def check(self, task): import os - self.realpath = task.cmd - path = os.environ.get('PATH', '').split(os.pathsep) - absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) - if len(absolutes) > 0: - self.realpath = task.cmd[0] - return True + if task.cmd[0]=='/': + self.realpath = task.cmd + print "[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!" + return os.access(self.realpath, os.X_OK) + else: + self.realpath = task.cmd + path = os.environ.get('PATH', '').split(os.pathsep) + path.append(task.cwd + '/') + absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) + if len(absolutes) > 0: + self.realpath = task.cmd[0] + return True return False def getErrorMessage(self, task): -- cgit v1.2.3 From a6f88303d6efb4e6669a6a491bec4cf3e751337a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 11 Mar 2010 13:54:33 +0100 Subject: lib/python/Plugins/Extensions/DVDPlayer/plugin.py: smaller fontsize for "DVD Player" text in LCD/Oled display --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 6e4d9cc6..e092e82f 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -93,7 +93,7 @@ class DVDSummary(Screen): Name - + Position -- cgit v1.2.3 From bb61a8a6ff402b248d1af83d138996259fb4641f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 11 Mar 2010 14:29:43 +0100 Subject: refs bug #429 change "mkisofs" to "genisoimage" since it is only a link to genisoimage in oe 1.5 and the link is'n set in oe 1.6 --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 4 ++-- 1 file changed, 2 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 f7f44db6..b64541b6 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -888,7 +888,7 @@ class DVDJob(Job): burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": self.name = _("Create DVD-ISO") - tool = "mkisofs" + tool = "genisoimage" isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, self.workspace + "/dvd" ] @@ -927,7 +927,7 @@ class DVDdataJob(Job): if self.project.size/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": - tool = "mkisofs" + tool = "genisoimage" self.name = _("Create DVD-ISO") isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] -- cgit v1.2.3 From 72bc8cf59d2f2192bcf1491758169a77b106190a Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 16 Feb 2010 14:53:12 +0100 Subject: fixes bug #445 show diseqc settings in NimSelection --- data/skin_default.xml | 6 +++--- lib/python/Screens/Satconfig.py | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml index 56d53dc3..0114349b 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -626,14 +626,14 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + {"template": [ MultiContentEntryText(pos = (10, 5), size = (360, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name, - MultiContentEntryText(pos = (50, 30), size = (320, 30), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, + MultiContentEntryText(pos = (50, 30), size = (320, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, ], "fonts": [gFont("Regular", 20), gFont("Regular", 15)], - "itemHeight": 70 + "itemHeight": 80 } diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 047bde23..647307d0 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -498,17 +498,25 @@ class NimSelection(Screen): text = _("nothing connected") elif nimConfig.configMode.value == "simple": if nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): - text = _("Sats") + ": " + text = {"single": _("Single"), "toneburst_a_b": _("Toneburst A/B"), "diseqc_a_b": _("DiSEqC A/B"), "diseqc_a_b_c_d": _("DiSEqC A/B/C/D")}[nimConfig.diseqcMode.value] + "\n" + text += _("Sats") + ": " + satnames = [] if nimConfig.diseqcA.orbital_position != 3601: - text += nimmanager.getSatName(int(nimConfig.diseqcA.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcA.value))) if nimConfig.diseqcMode.value in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): if nimConfig.diseqcB.orbital_position != 3601: - text += "," + nimmanager.getSatName(int(nimConfig.diseqcB.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcB.value))) if nimConfig.diseqcMode.value == "diseqc_a_b_c_d": if nimConfig.diseqcC.orbital_position != 3601: - text += "," + nimmanager.getSatName(int(nimConfig.diseqcC.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcC.value))) if nimConfig.diseqcD.orbital_position != 3601: - text += "," + nimmanager.getSatName(int(nimConfig.diseqcD.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcD.value))) + if len(satnames) <= 2: + text += ", ".join(satnames) + elif len(satnames) > 2: + # we need a newline here, since multi content lists don't support automtic line wrapping + text += ", ".join(satnames[:2]) + ",\n" + text += " " + ", ".join(satnames[2:]) elif nimConfig.diseqcMode.value == "positioner": text = _("Positioner") + ":" if nimConfig.positionerMode.value == "usals": -- cgit v1.2.3 From 83c9fa8a8b23dd75ac7941955d4528d9b9b64cfe Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 13 Mar 2010 14:13:20 +0100 Subject: fixes bug #342 change action map help text for long info button press --- lib/python/Screens/InfoBarGenerics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 87631086..b3bcc4a0 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -487,7 +487,7 @@ class InfoBarEPG: self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { "showEventInfo": (self.openEventView, _("show EPG...")), - "showEventInfoPlugin": (self.showEventInfoPlugins, _("show single service EPG...")), + "showEventInfoPlugin": (self.showEventInfoPlugins, _("list of EPG views...")), "showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible, }) -- cgit v1.2.3 From 9f8056cd2f459c5221e4af6e37b75bc671f14e8d Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 13 Mar 2010 14:57:54 +0100 Subject: fixes bug #343 change "nothing connected" to "not configured" to avoid confusion --- lib/python/Screens/Satconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 647307d0..7ba3a134 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -58,7 +58,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): def createConfigMode(self): if self.nim.isCompatible("DVB-S"): - choices = { "nothing": _("nothing connected"), + choices = { "nothing": _("not configured"), "simple": _("simple"), "advanced": _("advanced")} #if len(nimmanager.getNimListOfType(nimmanager.getNimType(self.slotid), exception = x)) > 0: @@ -495,7 +495,7 @@ class NimSelection(Screen): "satposdepends": _("second cable of motorized LNB") } [nimConfig.configMode.value] text += " " + _("Tuner") + " " + ["A", "B", "C", "D"][int(nimConfig.connectedTo.value)] elif nimConfig.configMode.value == "nothing": - text = _("nothing connected") + text = _("not configured") elif nimConfig.configMode.value == "simple": if nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): text = {"single": _("Single"), "toneburst_a_b": _("Toneburst A/B"), "diseqc_a_b": _("DiSEqC A/B"), "diseqc_a_b_c_d": _("DiSEqC A/B/C/D")}[nimConfig.diseqcMode.value] + "\n" -- cgit v1.2.3 From 20894cf99fd0ab6ecd6e3cf0aebc5b02c4193903 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 15 Mar 2010 12:14:19 +0100 Subject: [DVDBurn] allow burning of recordings that are currently playing in the background, fixes bug 367 --- lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py index 61152e8a..06ed1bab 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py @@ -52,6 +52,8 @@ class TitleCutter(CutListEditor): CutListEditor.grabFrame(self) def exit(self): + if self.t.VideoType == -1: + self.getPMTInfo() self.checkAndGrabThumb() self.session.nav.stopService() self.close(self.cut_list[:]) -- cgit v1.2.3 From ca5b57073d8ef83110e6956b71134f3c1a1589a6 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 18 Mar 2010 10:47:28 +0100 Subject: Converter/TemplatedMultiContent.py,Renderer/Listbox.py: * add possibility to set the ScrollbarMode per Style inside an TemplatedMultiContent List. This fixex #478 --- .../Components/Converter/TemplatedMultiContent.py | 24 ++++++++++++++-------- lib/python/Components/Renderer/Listbox.py | 19 +++++++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) mode change 100644 => 100755 lib/python/Components/Converter/TemplatedMultiContent.py mode change 100644 => 100755 lib/python/Components/Renderer/Listbox.py (limited to 'lib/python') diff --git a/lib/python/Components/Converter/TemplatedMultiContent.py b/lib/python/Components/Converter/TemplatedMultiContent.py old mode 100644 new mode 100755 index b86d94bf..b1d89f55 --- a/lib/python/Components/Converter/TemplatedMultiContent.py +++ b/lib/python/Components/Converter/TemplatedMultiContent.py @@ -10,8 +10,8 @@ class TemplatedMultiContent(StringList): del l["self"] # cleanup locals a bit del l["args"] - self.template = eval(args, {}, l) self.active_style = None + self.template = eval(args, {}, l) assert "fonts" in self.template assert "itemHeight" in self.template assert "template" in self.template or "templates" in self.template @@ -25,7 +25,6 @@ class TemplatedMultiContent(StringList): if not self.content: from enigma import eListboxPythonMultiContent self.content = eListboxPythonMultiContent() - self.setTemplate() # also setup fonts (also given by source) index = 0 @@ -35,30 +34,37 @@ class TemplatedMultiContent(StringList): # if only template changed, don't reload list if what[0] == self.CHANGED_SPECIFIC and what[1] == "style": - self.setTemplate() - return - - if self.source: + pass + elif self.source: self.content.setList(self.source.list) - self.setTemplate() + self.setTemplate() self.downstream_elements.changed(what) def setTemplate(self): if self.source: style = self.source.style + if style == self.active_style: - return # style did not change + return # if skin defined "templates", that means that it defines multiple styles in a dict. template should still be a default templates = self.template.get("templates") template = self.template.get("template") itemheight = self.template["itemHeight"] + selectionEnabled = self.template.get("selectionEnabled", True) + scrollbarMode = self.template.get("scrollbarMode", "showOnDemand") if templates and style and style in templates: # if we have a custom style defined in the source, and different templates in the skin, look it up template = templates[style][1] itemheight = templates[style][0] + if len(templates[style]) > 2: + selectionEnabled = templates[style][2] + if len(templates[style]) > 3: + scrollbarMode = templates[style][3] self.content.setTemplate(template) - self.content.setItemHeight(itemheight) + self.selectionEnabled = selectionEnabled + self.scrollbarMode = scrollbarMode + self.active_style = style diff --git a/lib/python/Components/Renderer/Listbox.py b/lib/python/Components/Renderer/Listbox.py old mode 100644 new mode 100755 index 7a895330..716fe445 --- a/lib/python/Components/Renderer/Listbox.py +++ b/lib/python/Components/Renderer/Listbox.py @@ -19,6 +19,7 @@ class Listbox(Renderer, object): self.__content = None self.__wrap_around = False self.__selection_enabled = True + self.__scrollbarMode = "showOnDemand" GUI_WIDGET = eListbox @@ -38,6 +39,7 @@ class Listbox(Renderer, object): instance.selectionChanged.get().append(self.selectionChanged) self.wrap_around = self.wrap_around # trigger self.selection_enabled = self.selection_enabled # trigger + self.scrollbarMode = self.scrollbarMode # trigger def preWidgetRemove(self, instance): instance.setContent(None) @@ -76,7 +78,24 @@ class Listbox(Renderer, object): selection_enabled = property(lambda self: self.__selection_enabled, setSelectionEnabled) + def setScrollbarMode(self, mode): + self.__scrollbarMode = mode + if self.instance is not None: + self.instance.setScrollbarMode(int( + { "showOnDemand": 0, + "showAlways": 1, + "showNever": 2, + }[mode])) + + scrollbarMode = property(lambda self: self.__scrollbarMode, setScrollbarMode) + def changed(self, what): + if hasattr(self.source, "selectionEnabled"): + self.selection_enabled = self.source.selectionEnabled + if hasattr(self.source, "scrollbarMode"): + self.scrollbarMode = self.source.scrollbarMode + if len(what) > 1 and isinstance(what[1], str) and what[1] == "style": + return self.content = self.source.content def entry_changed(self, index): -- cgit v1.2.3 From 4d01a8b971e7631cf999d4773891cce657b9aa27 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 11:29:50 +0100 Subject: add possibility to separately set fan voltage and fan pwm for standby and normal run when a recording starts in standby switch to normal mode and vice versa this fixes bug #430 (thx to Dr.Best) --- lib/python/Components/FanControl.py | 43 ++++++++++++++++++---- .../Plugins/SystemPlugins/TempFanControl/plugin.py | 22 +++++++---- 2 files changed, 50 insertions(+), 15 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index cee0523e..a993c396 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -3,6 +3,9 @@ import os from Components.config import config, ConfigSubList, ConfigSubsection, ConfigSlider from Tools.BoundFunction import boundFunction +import NavigationInstance +from enigma import iRecordableService + class FanControl: # ATM there's only support for one fan def __init__(self): @@ -13,18 +16,42 @@ class FanControl: self.createConfig() config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False) - def leaveStandby(self): + def setVoltage_PWM(self): for fanid in range(self.getFanCount()): cfg = self.getConfig(fanid) self.setVoltage(fanid, cfg.vlt.value) self.setPWM(fanid, cfg.pwm.value) + print "[FanControl]: setting fan values: fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt.value, cfg.pwm.value) + + def setVoltage_PWM_Standby(self): + for fanid in range(self.getFanCount()): + cfg = self.getConfig(fanid) + self.setVoltage(fanid, cfg.vlt_standby.value) + self.setPWM(fanid, cfg.pwm_standby.value) + print "[FanControl]: setting fan values (standby mode): fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt_standby.value, cfg.pwm_standby.value) + + def getRecordEvent(self, recservice, event): + recordings = len(NavigationInstance.instance.getRecordings()) + if event == iRecordableService.evEnd: + if recordings == 0: + self.setVoltage_PWM_Standby() + elif event == iRecordableService.evStart: + if recordings == 1: + self.setVoltage_PWM() + + def leaveStandby(self): + NavigationInstance.instance.record_event.remove(self.getRecordEvent) + recordings = NavigationInstance.instance.getRecordings() + if not recordings: + self.setVoltage_PWM() def standbyCounterChanged(self, configElement): from Screens.Standby import inStandby inStandby.onClose.append(self.leaveStandby) - for fanid in range(self.getFanCount()): - self.setVoltage(fanid, 0) - self.setPWM(fanid, 0) + recordings = NavigationInstance.instance.getRecordings() + NavigationInstance.instance.record_event.append(self.getRecordEvent) + if not recordings: + self.setVoltage_PWM_Standby() def createConfig(self): def setVlt(fancontrol, fanid, configElement): @@ -35,12 +62,14 @@ class FanControl: config.fans = ConfigSubList() for fanid in range(self.getFanCount()): fan = ConfigSubsection() - fan.vlt = ConfigSlider(default = 16, increment = 5, limits = (0, 255)) + fan.vlt = ConfigSlider(default = 15, increment = 5, limits = (0, 255)) fan.pwm = ConfigSlider(default = 0, increment = 5, limits = (0, 255)) + fan.vlt_standby = ConfigSlider(default = 5, increment = 5, limits = (0, 255)) + fan.pwm_standby = ConfigSlider(default = 0, increment = 5, limits = (0, 255)) fan.vlt.addNotifier(boundFunction(setVlt, self, fanid)) fan.pwm.addNotifier(boundFunction(setPWM, self, fanid)) config.fans.append(fan) - + def getConfig(self, fanid): return config.fans[fanid] @@ -85,4 +114,4 @@ class FanControl: f.write("%x" % value) f.close() -fancontrol = FanControl() \ No newline at end of file +fancontrol = FanControl() diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 38e343f9..c8af9cdd 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -12,7 +12,7 @@ from Components.FanControl import fancontrol class TempFanControl(Screen, ConfigListScreen): skin = """ - + @@ -22,7 +22,7 @@ class TempFanControl(Screen, ConfigListScreen): - + @@ -90,7 +90,7 @@ class TempFanControl(Screen, ConfigListScreen): """ - + def __init__(self, session, args = None): Screen.__init__(self, session) @@ -125,6 +125,9 @@ class TempFanControl(Screen, ConfigListScreen): for count in range(fancontrol.getFanCount()): self.list.append(getConfigListEntry(_("Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt)) self.list.append(getConfigListEntry(_("Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm)) + self.list.append(getConfigListEntry(_("Standby Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt_standby)) + self.list.append(getConfigListEntry(_("Standby Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm_standby)) + ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) @@ -136,28 +139,31 @@ class TempFanControl(Screen, ConfigListScreen): "red": self.revert, "green": self.save }, -1) - + def save(self): for count in range(fancontrol.getFanCount()): fancontrol.getConfig(count).vlt.save() fancontrol.getConfig(count).pwm.save() + fancontrol.getConfig(count).vlt_standby.save() + fancontrol.getConfig(count).pwm_standby.save() self.close() - + def revert(self): for count in range(fancontrol.getFanCount()): fancontrol.getConfig(count).vlt.load() fancontrol.getConfig(count).pwm.load() + fancontrol.getConfig(count).vlt_standby.load() + fancontrol.getConfig(count).pwm_standby.load() self.close() - + def main(session, **kwargs): session.open(TempFanControl) def startMenu(menuid): if menuid != "system": return [] - return [(_("Temperature and Fan control"), main, "tempfancontrol", 80)] def Plugins(**kwargs): return PluginDescriptor(name = "Temperature and Fan control", description = _("Temperature and Fan control"), where = PluginDescriptor.WHERE_MENU, fnc = startMenu) - \ No newline at end of file + -- cgit v1.2.3 From 1398385cff4a4fc4d770afa1e9d1f6d560431b23 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 15:17:39 +0100 Subject: add support for event progressbar per service in channelselection default this is disabled.. you can enable it in the Usage config this fixes bug #486 (patch by Dr.Best) --- data/setup.xml | 1 + data/skin_default/Makefile.am | 1 + data/skin_default/celserviceeventprogressbar.png | Bin 0 -> 1056 bytes lib/python/Components/ServiceList.py | 29 ++++++++-- lib/python/Components/UsageConfig.py | 2 + lib/service/listboxservice.cpp | 65 ++++++++++++++++++++--- lib/service/listboxservice.h | 6 +++ 7 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 data/skin_default/celserviceeventprogressbar.png mode change 100755 => 100644 lib/python/Components/ServiceList.py (limited to 'lib/python') diff --git a/data/setup.xml b/data/setup.xml index 92bbc0f1..705eaf33 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -34,6 +34,7 @@ config.usage.on_short_powerpress config.usage.infobar_timeout config.usage.output_12V + config.usage.show_event_progress_in_servicelist config.usage.show_infobar_on_zap config.usage.show_infobar_on_skip config.usage.show_infobar_on_event_change diff --git a/data/skin_default/Makefile.am b/data/skin_default/Makefile.am index 85bb800d..6038c2e9 100755 --- a/data/skin_default/Makefile.am +++ b/data/skin_default/Makefile.am @@ -23,6 +23,7 @@ dist_install_DATA = \ b_tl.png \ b_t.png \ b_tr.png \ + celserviceeventprogressbar.png \ div-h.png \ div-v.png \ epg_more.png \ diff --git a/data/skin_default/celserviceeventprogressbar.png b/data/skin_default/celserviceeventprogressbar.png new file mode 100644 index 00000000..7bf5c658 Binary files /dev/null and b/data/skin_default/celserviceeventprogressbar.png differ diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py old mode 100755 new mode 100644 index 6095812a..3452e27d --- a/lib/python/Components/ServiceList.py +++ b/lib/python/Components/ServiceList.py @@ -7,6 +7,8 @@ from Tools.LoadPixmap import LoadPixmap from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN +from Components.config import config + class ServiceList(HTMLComponent, GUIComponent): MODE_NORMAL = 0 MODE_FAVOURITES = 1 @@ -62,6 +64,18 @@ class ServiceList(HTMLComponent, GUIComponent): self.l.setColor(eListboxServiceContent.markedBackgroundSelected, parseColor(value)) elif attrib == "foregroundColorServiceNotAvail": self.l.setColor(eListboxServiceContent.serviceNotAvail, parseColor(value)) + elif attrib == "colorEventProgressbar": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarColor, parseColor(value)) + elif attrib == "colorEventProgressbarSelected": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarColorSelected, parseColor(value)) + elif attrib == "colorEventProgressbarBorder": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColor, parseColor(value)) + elif attrib == "colorEventProgressbarBorderSelected": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColorSelected, parseColor(value)) + elif attrib == "picServiceEventProgressbar": + pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, value)) + if pic: + self.l.setPixmap(self.l.picServiceEventProgressbar, pic) elif attrib == "serviceItemHeight": self.ItemHeight = int(value) elif attrib == "serviceNameFont": @@ -213,17 +227,24 @@ class ServiceList(HTMLComponent, GUIComponent): def setMode(self, mode): self.mode = mode + self.l.setItemHeight(self.ItemHeight) + self.l.setVisualMode(eListboxServiceContent.visModeComplex) if mode == self.MODE_NORMAL: - self.l.setItemHeight(self.ItemHeight) - self.l.setVisualMode(eListboxServiceContent.visModeComplex) + if config.usage.show_event_progress_in_servicelist.value: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 52, self.ItemHeight)) + else: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementPosition(self.l.celServiceName, eRect(0, 0, self.instance.size().width(), self.ItemHeight)) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) else: - self.l.setItemHeight(self.ItemHeight) - self.l.setVisualMode(eListboxServiceContent.visModeComplex) + if config.usage.show_event_progress_in_servicelist.value: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(60, 0, 52, self.ItemHeight)) + else: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(60, 0, 0, 0)) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, 50, self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementPosition(self.l.celServiceName, eRect(60, 0, self.instance.size().width()-60, self.ItemHeight)) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) + diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 21478e90..b86c1a13 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -68,6 +68,8 @@ def InitUsageConfig(): ("4", "DVB-T/-C/-S"), ("5", "DVB-T/-S/-C") ]) + config.usage.show_event_progress_in_servicelist = ConfigYesNo(default = False) + config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False) config.usage.show_message_when_recording_starts = ConfigYesNo(default = True) diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index 05aaf731..faee1ee6 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -526,7 +526,9 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const ePtr service_info; m_service_center->info(*m_cursor, service_info); eServiceReference ref = *m_cursor; - bool isPlayable = !(ref.flags & eServiceReference::isDirectory || ref.flags & eServiceReference::isMarker); + bool isMarker = ref.flags & eServiceReference::isMarker; + bool isPlayable = !(ref.flags & eServiceReference::isDirectory || isMarker); + ePtr evt; if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore)) { @@ -539,7 +541,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const if (selected && local_style && local_style->m_selection) painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST); - int xoffset=0; // used as offset when painting the folder/marker symbol + int xoffset=0; // used as offset when painting the folder/marker symbol or the serviceevent progress for (int e = 0; e < celElements; ++e) { @@ -583,8 +585,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const } case celServiceInfo: { - ePtr evt; - if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) ) + if ( isPlayable && evt ) { std::string name = evt->getEventName(); if (!name.length()) @@ -608,9 +609,9 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const { eRect bbox = para->getBoundBox(); int name_width = bbox.width()+8; - m_element_position[celServiceInfo].setLeft(area.left()+name_width); + m_element_position[celServiceInfo].setLeft(area.left()+name_width+xoffs); m_element_position[celServiceInfo].setTop(area.top()); - m_element_position[celServiceInfo].setWidth(area.width()-name_width); + m_element_position[celServiceInfo].setWidth(area.width()-(name_width+xoffs)); m_element_position[celServiceInfo].setHeight(area.height()); } @@ -678,8 +679,58 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const painter.clippop(); } } + else if (e == celServiceEventProgressbar) + { + int p = celServiceEventProgressbar; + eRect area = m_element_position[p]; + if (area.width() > 0 && (isPlayable || isMarker)) + { + + if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) ) + { + if (!selected && m_color_set[serviceEventProgressbarBorderColor]) + painter.setForegroundColor(m_color[serviceEventProgressbarBorderColor]); + else if (selected && m_color_set[serviceEventProgressbarBorderColorSelected]) + painter.setForegroundColor(m_color[serviceEventProgressbarBorderColorSelected]); + + int border = 1; + int progressH = 6; + int progressX = area.left() + offset.x(); + int progressW = area.width() - 2 * border; + int progressT = offset.y() + (m_itemsize.height() - progressH - 2*border) / 2; + + // paint progressbar frame + painter.fill(eRect(progressX, progressT, area.width(), border)); + painter.fill(eRect(progressX, progressT + border, border, progressH)); + painter.fill(eRect(progressX, progressT + progressH + border, area.width(), border)); + painter.fill(eRect(progressX + area.width() - border, progressT + border, border, progressH)); + + // calculate value + time_t now = time(0); + int value = progressW * (now - evt->getBeginTime()) / evt->getDuration(); + + eRect tmp = eRect(progressX + border, progressT + border, value, progressH); + ePtr &pixmap = m_pixmaps[picServiceEventProgressbar]; + if (pixmap) + { + area.moveBy(offset); + painter.clip(area); + painter.blit(pixmap, ePoint(progressX + border, progressT + border), tmp, gPainter::BT_ALPHATEST); + painter.clippop(); + } + else + { + if (!selected && m_color_set[serviceEventProgressbarColor]) + painter.setForegroundColor(m_color[serviceEventProgressbarColor]); + else if (selected && m_color_set[serviceEventProgressbarColorSelected]) + painter.setForegroundColor(m_color[serviceEventProgressbarColorSelected]); + painter.fill(tmp); + } + } + xoffset = area.width() + 10; + } + } } - if (selected && (!local_style || !local_style->m_selection)) style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry); } diff --git a/lib/service/listboxservice.h b/lib/service/listboxservice.h index 5228a2f2..982d7e14 100644 --- a/lib/service/listboxservice.h +++ b/lib/service/listboxservice.h @@ -49,6 +49,7 @@ public: celServiceNumber, celMarkerPixmap, celFolderPixmap, + celServiceEventProgressbar, celServiceName, celServiceTypePixmap, celServiceInfo, // "now" event @@ -62,6 +63,7 @@ public: picServiceGroup, picFolder, picMarker, + picServiceEventProgressbar, picElements }; @@ -84,6 +86,10 @@ public: markedBackground, markedBackgroundSelected, serviceNotAvail, + serviceEventProgressbarColor, + serviceEventProgressbarColorSelected, + serviceEventProgressbarBorderColor, + serviceEventProgressbarBorderColorSelected, colorElements }; -- cgit v1.2.3 From 0b41d21e11a9aa7f70f6e148490cc26a03d7d4d7 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 20:59:55 +0100 Subject: make channel selection service description color configurable this fixes bug #487 (patch by Dr.Best) --- lib/python/Components/ServiceList.py | 4 ++++ lib/service/listboxservice.cpp | 10 ++++++++++ lib/service/listboxservice.h | 2 ++ 3 files changed, 16 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py index 3452e27d..cd055a82 100644 --- a/lib/python/Components/ServiceList.py +++ b/lib/python/Components/ServiceList.py @@ -72,6 +72,10 @@ class ServiceList(HTMLComponent, GUIComponent): self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColor, parseColor(value)) elif attrib == "colorEventProgressbarBorderSelected": self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColorSelected, parseColor(value)) + elif attrib == "colorServiceDescription": + self.l.setColor(eListboxServiceContent.serviceDescriptionColor, parseColor(value)) + elif attrib == "colorServiceDescriptionSelected": + self.l.setColor(eListboxServiceContent.serviceDescriptionColorSelected, parseColor(value)) elif attrib == "picServiceEventProgressbar": pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, value)) if pic: diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index f8ac0ff2..cc8c32b5 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -531,12 +531,15 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const bool paintProgress = false; ePtr evt; + bool serviceAvail = true; + if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore)) { if (m_color_set[serviceNotAvail]) painter.setForegroundColor(m_color[serviceNotAvail]); else painter.setForegroundColor(gRGB(0xbbbbbb)); + serviceAvail = false; } if (selected && local_style && local_style->m_selection) @@ -592,6 +595,13 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const if (!name.length()) continue; text = '(' + evt->getEventName() + ')'; + if (serviceAvail) + { + if (!selected && m_color_set[serviceDescriptionColor]) + painter.setForegroundColor(m_color[serviceDescriptionColor]); + else if (selected && m_color_set[serviceDescriptionColorSelected]) + painter.setForegroundColor(m_color[serviceDescriptionColorSelected]); + } } else continue; diff --git a/lib/service/listboxservice.h b/lib/service/listboxservice.h index 982d7e14..589afba6 100644 --- a/lib/service/listboxservice.h +++ b/lib/service/listboxservice.h @@ -90,6 +90,8 @@ public: serviceEventProgressbarColorSelected, serviceEventProgressbarBorderColor, serviceEventProgressbarBorderColorSelected, + serviceDescriptionColor, + serviceDescriptionColorSelected, colorElements }; -- cgit v1.2.3 From 4e9abcf682b3aa8ff8ddf2fcb63e6d9f329f72fa Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 29 Mar 2010 12:16:38 +0200 Subject: ChannelSelection.py: fix typo --- lib/python/Screens/ChannelSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 4ca6fa39..0895c9c2 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -449,7 +449,7 @@ class ChannelSelectionEdit: if mutableAlternatives: mutableAlternatives.setListName(name) if mutableAlternatives.addService(cur_service.ref): - print "add", cur_service.toString(), "to new alternatives failed" + print "add", cur_service.ref.toString(), "to new alternatives failed" mutableAlternatives.flushChanges() self.servicelist.addService(new_ref.ref, True) self.servicelist.removeCurrent() -- cgit v1.2.3 From a031db45bbf074b66ee62da2d5ecad8785b5b156 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 29 Mar 2010 19:02:03 +0200 Subject: lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.h/cpp: add support for autoresolution plugins (needs new libdreamdvd) this fixes bug #302 --- .../Extensions/DVDPlayer/src/servicedvd.cpp | 47 +++++++++++++++++++--- .../Plugins/Extensions/DVDPlayer/src/servicedvd.h | 2 + 2 files changed, 43 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 0372c497..2ba53927 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -85,12 +85,9 @@ RESULT eServiceFactoryDVD::offlineOperations(const eServiceReference &, ePtr Date: Mon, 29 Mar 2010 22:44:29 +0200 Subject: show timeshift state widget even in state play this fixes bug #332 --- lib/python/Screens/InfoBarGenerics.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index b3bcc4a0..1c577eec 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1111,15 +1111,21 @@ class InfoBarPVRState: self.pvrStateDialog.hide() else: self._mayShow() - class InfoBarTimeshiftState(InfoBarPVRState): def __init__(self): InfoBarPVRState.__init__(self, screen=TimeshiftState, force_show = True) + self.__hideTimer = eTimer() + self.__hideTimer.callback.append(self.__hideTimeshiftState) def _mayShow(self): - if self.execing and self.timeshift_enabled and self.seekstate != self.SEEK_STATE_PLAY: + if self.execing and self.timeshift_enabled: self.pvrStateDialog.show() + if self.seekstate == self.SEEK_STATE_PLAY and not self.shown: + self.__hideTimer.start(5*1000, True) + + def __hideTimeshiftState(self): + self.pvrStateDialog.hide() class InfoBarShowMovies: -- cgit v1.2.3 From 5b48886f30532694e2bad8d5cc839b607293423d Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 30 Mar 2010 10:43:54 +0200 Subject: * disable PluginManagers ipkg update on e2 start, better do it when needed. This fixes #494 --- lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 4dbe7f70..4917855f 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -420,7 +420,7 @@ class PluginManager(Screen, DreamInfoHandler): def getUpdateInfos(self): self.setState('update') - iSoftwareTools.getUpdates(self.getUpdateInfosCB) + iSoftwareTools.startSoftwareTools(self.getUpdateInfosCB) def getUpdateInfosCB(self, retval = None): if retval is not None: @@ -429,9 +429,10 @@ class PluginManager(Screen, DreamInfoHandler): self["status"].setText(_("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")) else: self["status"].setText(_("There are no updates available.")) + self.rebuildList() elif retval is False: + self.setState('error') self["status"].setText(_("No network connection available.")) - self.rebuildList() def rebuildList(self, retval = None): if self.currentSelectedTag is None: @@ -1701,15 +1702,11 @@ def startSetup(menuid): return [ ] return [(_("Software management"), UpgradeMain, "software_manager", 50)] -def autostart(reason, **kwargs): - if reason is True: - iSoftwareTools.startSoftwareTools() def Plugins(path, **kwargs): global plugin_path plugin_path = path list = [ - PluginDescriptor(where = [PluginDescriptor.WHERE_NETWORKCONFIG_READ], fnc = autostart), PluginDescriptor(name=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) ] -- cgit v1.2.3 From 10f34153609f572dd6ff389fcd8362d420c4a4f5 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 30 Mar 2010 13:05:37 +0200 Subject: refs bug #485 start cxd1978 tool if such a tuner is used --- lib/python/Screens/ScanSetup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 1dbc1505..960b7f10 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -176,7 +176,11 @@ class CableTransponderSearchSupport: self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed) self.cable_search_container.dataAvail.append(self.getCableTransponderData) cableConfig = config.Nims[nim_idx].cable - cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus " + tunername = nimmanager.getNimName(nim_idx) + if tunername == "CXD1981": + cmd = "cxd1978 --init --scan --verbose --wakeup --inv 2 --bus " + else: + cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus " #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000 if nim_idx < 2: cmd += str(nim_idx) -- cgit v1.2.3 From aa7e54fc4db217a7732f208af6f3e5a2e0bd6773 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 15:37:07 +0200 Subject: [DVDBurn] usability improvements: title list layout, bottom info area, consistency of user interface, implement restoring of saved collections from xml (fixes #316) --- .../Plugins/Extensions/DVDBurn/DVDProject.py | 102 +++++++++++++------- lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py | 28 ++++-- .../Plugins/Extensions/DVDBurn/ProjectSettings.py | 23 +++-- .../Plugins/Extensions/DVDBurn/TitleCutter.py | 20 ++++ lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 105 +++++++++++++-------- .../Plugins/Extensions/DVDBurn/TitleProperties.py | 13 ++- 6 files changed, 201 insertions(+), 90 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 83672460..7f755db4 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py @@ -1,5 +1,7 @@ from Tools.Directories import fileExists from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigSubList +import DVDTitle +import xml.dom.minidom class ConfigColor(ConfigSequence): def __init__(self, default = [128,128,128]): @@ -10,7 +12,10 @@ class ConfigFilename(ConfigText): ConfigText.__init__(self, default = "", fixed_size = True, visible_width = False) def getMulti(self, selected): - filename = (self.text.rstrip("/").rsplit("/",1))[1].encode("utf-8")[:40] + " " + if self.text == "": + return ("mtext"[1-selected:], "", 0) + cut_len = min(len(self.text),40) + filename = (self.text.rstrip("/").rsplit("/",1))[1].encode("utf-8")[:cut_len] + " " if self.allmarked: mark = range(0, len(filename)) else: @@ -34,10 +39,11 @@ class DVDProject: self.settings.vmgm = ConfigFilename() self.filekeys = ["vmgm", "isopath", "menutemplate"] self.menutemplate = MenuTemplate() + self.error = "" + self.session = None def addService(self, service): - import DVDTitle - title = DVDTitle.DVDTitle() + title = DVDTitle.DVDTitle(self) title.addService(service) self.titles.append(title) return title @@ -100,47 +106,78 @@ class DVDProject: return ret def loadProject(self, filename): - import xml.dom.minidom - try: + #try: if not fileExists(filename): self.error = "xml file not found!" - raise AttributeError - else: - self.error = "" + #raise AttributeError file = open(filename, "r") data = file.read().decode("utf-8").replace('&',"&").encode("ascii",'xmlcharrefreplace') file.close() projectfiledom = xml.dom.minidom.parseString(data) - for project in projectfiledom.childNodes[0].childNodes: - if project.nodeType == xml.dom.minidom.Element.nodeType: - if project.tagName == 'settings': - i = 0 - if project.attributes.length < len(self.settings.dict())-1: - self.error = "project attributes missing" - raise AttributeError - while i < project.attributes.length: - item = project.attributes.item(i) - key = item.name.encode("utf-8") - try: - val = eval(item.nodeValue) - except (NameError, SyntaxError): - val = item.nodeValue.encode("utf-8") - try: - self.settings.dict()[key].setValue(val) - except (KeyError): - self.error = "unknown attribute '%s'" % (key) - raise AttributeError - i += 1 + for node in projectfiledom.childNodes[0].childNodes: + print "node:", node + if node.nodeType == xml.dom.minidom.Element.nodeType: + if node.tagName == 'settings': + self.xmlAttributesToConfig(node, self.settings) + elif node.tagName == 'titles': + self.xmlGetTitleNodeRecursive(node) + for key in self.filekeys: val = self.settings.dict()[key].getValue() if not fileExists(val): self.error += "\n%s '%s' not found" % (key, val) - if len(self.error): - raise AttributeError + #except AttributeError: + #print "loadProject AttributeError", self.error + #self.error += (" in project '%s'") % (filename) + #return False + return True + + def xmlAttributesToConfig(self, node, config): + try: + i = 0 + #if node.attributes.length < len(config.dict())-1: + #self.error = "project attributes missing" + #raise AttributeError + while i < node.attributes.length: + item = node.attributes.item(i) + key = item.name.encode("utf-8") + try: + val = eval(item.nodeValue) + except (NameError, SyntaxError): + val = item.nodeValue.encode("utf-8") + try: + print "config[%s].setValue(%s)" % (key, val) + config.dict()[key].setValue(val) + except (KeyError): + self.error = "unknown attribute '%s'" % (key) + print "KeyError", self.error + raise AttributeError + i += 1 except AttributeError: - self.error += (" in project '%s'") % (filename) + self.error += (" XML attribute error '%s'") % node.toxml() return False - return True + + def xmlGetTitleNodeRecursive(self, node, title_idx = -1): + print "[xmlGetTitleNodeRecursive]", title_idx, node + print node.childNodes + for subnode in node.childNodes: + print "xmlGetTitleNodeRecursive subnode:", subnode + if subnode.nodeType == xml.dom.minidom.Element.nodeType: + if subnode.tagName == 'title': + title_idx += 1 + title = DVDTitle.DVDTitle(self) + self.titles.append(title) + self.xmlGetTitleNodeRecursive(subnode, title_idx) + if subnode.tagName == 'path': + print "path:", subnode.firstChild.data + filename = subnode.firstChild.data + self.titles[title_idx].addFile(filename.encode("utf-8")) + if subnode.tagName == 'properties': + self.xmlAttributesToConfig(node, self.titles[title_idx].properties) + if subnode.tagName == 'audiotracks': + self.xmlGetTitleNodeRecursive(subnode, title_idx) + if subnode.tagName == 'audiotrack': + print "audiotrack...", subnode.toxml() def getSize(self): totalsize = 0 @@ -187,6 +224,7 @@ class MenuTemplate(DVDProject): self.filekeys = ["menubg", "menuaudio", "fontface_headline", "fontface_title", "fontface_subtitle"] from TitleProperties import languageChoices self.settings.menulang = ConfigSelection(choices = languageChoices.choices, default=languageChoices.choices[1][0]) + self.error = "" def loadTemplate(self, filename): ret = DVDProject.loadProject(self, filename) diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py index 660005e6..6dff00d6 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py @@ -1,4 +1,5 @@ from Components.config import config, ConfigSubsection, ConfigSubList, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigYesNo +import TitleCutter class ConfigFixedText(ConfigText): def __init__(self, text, visible_width=60): @@ -7,17 +8,17 @@ class ConfigFixedText(ConfigText): pass class DVDTitle: - def __init__(self): + def __init__(self, project): 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.autochapter = ConfigInteger(default = 0, limits = (0, 60)) self.properties.audiotracks = ConfigSubList() + self.DVBname = _("Title") + self.DVBdescr = _("Description") + self.DVBchannel = _("Channel") self.cuesheet = [ ] self.source = None self.filesize = 0 @@ -27,6 +28,8 @@ class DVDTitle: self.chaptermarks = [ ] self.timeCreate = None self.VideoType = -1 + self.project = project + self.length = 0 def addService(self, service): from os import path @@ -36,7 +39,7 @@ class DVDTitle: self.source = service serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(service) - sDescr = 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: @@ -49,9 +52,20 @@ class DVDTitle: self.filesize = path.getsize(self.inputfile) self.estimatedDiskspace = self.filesize self.length = info.getLength(service) + + def addFile(self, filename): + from enigma import eServiceReference + ref = eServiceReference(1, 0, filename) + self.addService(ref) + self.project.session.openWithCallback(self.titleEditDone, TitleCutter.CutlistReader, self) + + def titleEditDone(self, cutlist): + self.initDVDmenuText(len(self.project.titles)) + self.cuesheet = cutlist + self.produceFinalCuesheet() - def initDVDmenuText(self, project, track): - s = project.menutemplate.settings + def initDVDmenuText(self, track): + s = self.project.menutemplate.settings self.properties.menutitle.setValue(self.formatDVDmenuText(s.titleformat.getValue(), track)) self.properties.menusubtitle.setValue(self.formatDVDmenuText(s.subtitleformat.getValue(), track)) diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index a1c38842..39d7277e 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py +++ b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py @@ -92,10 +92,10 @@ class ProjectSettings(Screen,ConfigListScreen): - - - - + + + + @@ -233,10 +233,19 @@ class ProjectSettings(Screen,ConfigListScreen): else: self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) elif scope == "project": - if self.project.loadProject(path): - self.initConfigList() + self.path = path + print "len(self.titles)", len(self.project.titles) + if len(self.project.titles): + self.session.openWithCallback(self.askLoadCB, MessageBox,text = _("Your current collection will get lost!") + "\n" + _("Do you want to restore your settings?"), type = MessageBox.TYPE_YESNO) else: - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + self.askLoadCB(True) elif scope: configRef.setValue(path) self.initConfigList() + + def askLoadCB(self, answer): + if answer is not None and answer: + if self.project.loadProject(self.path): + self.initConfigList() + else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py index 06ed1bab..a52fad9f 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py @@ -59,8 +59,28 @@ class TitleCutter(CutListEditor): self.close(self.cut_list[:]) class CutlistReader(TitleCutter): + skin = """ + + + + + + + {"template": [ + MultiContentEntryText(text = 1), + MultiContentEntryText(text = 2) + ], + "fonts": [gFont("Regular", 18)], + "itemHeight": 20 + } + + + + """ + def __init__(self, session, t): TitleCutter.__init__(self, session, t) + self.skin = CutlistReader.skin def getPMTInfo(self): TitleCutter.getPMTInfo(self) diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index dbc988b1..35a95d52 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -16,33 +16,40 @@ from Tools.Directories import resolveFilename, SCOPE_PLUGINS class TitleList(Screen, HelpableScreen): skin = """ - + - - - - + + + + - - + + {"template": [ MultiContentEntryText(pos = (0, 0), size = (420, 20), font = 0, flags = RT_HALIGN_LEFT, text = 1), # index 1 Title, MultiContentEntryText(pos = (0, 20), size = (328, 17), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 description, - MultiContentEntryText(pos = (420, 6), size = (120, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 begin time, - MultiContentEntryText(pos = (328, 20), size = (154, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 channel, - MultiContentEntryText(pos = (482, 20), size = (58, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 4 channel, + MultiContentEntryText(pos = (418, 6), size = (120, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 channel, + MultiContentEntryText(pos = (326, 20), size = (154, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 begin time, + MultiContentEntryText(pos = (480, 20), size = (58, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 5 duration, ], "fonts": [gFont("Regular", 20), gFont("Regular", 14)], "itemHeight": 37 } - - + + + + + + + + + """ def __init__(self, session, project = None): @@ -75,17 +82,19 @@ class TitleList(Screen, HelpableScreen): self["title_label"] = StaticText() self["error_label"] = StaticText() - self["space_label"] = StaticText() - self["space_bar"] = Progress() + self["space_label_single"] = StaticText() + self["space_label_dual"] = StaticText() + self["hint"] = StaticText(_("Advanced Options")) + self["medium"] = StaticText() + self["space_bar_single"] = Progress() + self["space_bar_dual"] = Progress() + self["titles"] = List([]) + self.previous_size = 0 if project is not None: self.project = project else: self.newProject() - - self["titles"] = List([]) - self.updateTitleList() - self.previous_size = 0 self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): @@ -107,15 +116,16 @@ class TitleList(Screen, HelpableScreen): j = self.backgroundJob menu.append(("%s: %s (%d%%)" % (j.getStatustext(), j.name, int(100*j.progress/float(j.end))), self.showBackgroundJob)) menu.append((_("DVD media toolbox"), self.toolbox)) - menu.append((_("Preview menu"), self.previewMenu)) if self.project.settings.output.getValue() == "dvd": if len(self["titles"].list): menu.append((_("Burn DVD"), self.burnProject)) elif self.project.settings.output.getValue() == "iso": menu.append((_("Create DVD-ISO"), self.burnProject)) menu.append((_("Burn existing image to DVD"), self.selectImage)) - menu.append((_("Edit chapters of current title"), self.editTitle)) - menu.append((_("Reset and renumerate title names"), self.resetTitles)) + if len(self["titles"].list): + menu.append((_("Preview menu"), self.previewMenu)) + menu.append((_("Edit chapters of current title"), self.editTitle)) + menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Exit"), self.leave)) self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu) @@ -149,9 +159,9 @@ class TitleList(Screen, HelpableScreen): - - - + + + @@ -197,7 +207,7 @@ class TitleList(Screen, HelpableScreen): self.close(current) self.session.openWithCallback(self.selectedSource, DVDMovieSelection) - def selectedSource(self, source): + def selectedSource(self, source = None): if source is None: return None if not source.getPath().endswith(".ts"): @@ -228,7 +238,7 @@ class TitleList(Screen, HelpableScreen): def settingsCB(self, update=True): if not update: return - self["title_label"].text = _("Table of content for collection") + " \"" + self.project.settings.name.getValue() + "\":" + self.updateTitleList() def loadTemplate(self): filename = resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/DreamboxDVD.ddvdp.xml" @@ -281,9 +291,11 @@ class TitleList(Screen, HelpableScreen): if len(list): self["key_red"].text = _("Remove title") self["key_yellow"].text = _("Title properties") + self["title_label"].text = _("Table of content for collection") + " \"" + self.project.settings.name.getValue() + "\":" else: self["key_red"].text = "" self["key_yellow"].text = "" + self["title_label"].text = _("Please add titles to the compilation") def updateSize(self): size = self.project.size/(1024*1024) @@ -292,20 +304,29 @@ class TitleList(Screen, HelpableScreen): print "updateSize:", size, "MAX_DL:", MAX_DL, "MAX_SL:", MAX_SL if size > MAX_DL: percent = 100 * size / float(MAX_DL) - self["space_label"].text = "%d MB - " % size + _("exceeds dual layer medium!") + " (%.2f%% " % (100-percent) + _("free") + ")" - self["space_bar"].value = int(percent) + self["space_label_dual"].text = "%d MB (%.2f%%)" % (size, percent) + self["space_bar_dual"].value = int(percent) + self["space_bar_single"].value = 100 + self["space_label_single"].text = "" + self["medium"].text = _("exceeds dual layer medium!") if self.previous_size < MAX_DL: self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > MAX_SL: percent = 100 * size / float(MAX_DL) - self["space_label"].text = "%d MB " % size + _("of a DUAL layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" - self["space_bar"].value = int(percent) + self["space_label_dual"].text = "%d MB (%.2f%%)" % (size, percent) + self["space_bar_dual"].value = int(percent) + self["space_bar_single"].value = 100 + self["space_label_single"].text = "" + self["medium"].text = _("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free") if self.previous_size < MAX_SL: - self.session.open(MessageBox,text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), type = MessageBox.TYPE_INFO) + self.session.open(MessageBox, text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), timeout = 10, type = MessageBox.TYPE_INFO) elif size < MAX_SL: percent = 100 * size / float(MAX_SL) - self["space_label"].text = "%d MB " % size + _("of a SINGLE layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" - self["space_bar"].value = int(percent) + self["space_label_single"].text = "%d MB (%.2f%%)" % (size, percent) + self["space_bar_single"].value = int(percent) + self["space_bar_dual"].value = 0 + self["space_label_dual"].text = "" + self["medium"].text = _("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free") self.previous_size = size def getCurrentTitle(self): @@ -323,9 +344,7 @@ class TitleList(Screen, HelpableScreen): def titleEditDone(self, cutlist): t = self.current_edit_title - t.initDVDmenuText(self.project,len(self.project.titles)) - t.cuesheet = cutlist - t.produceFinalCuesheet() + t.titleEditDone(cutlist) if t.VideoType != 0: self.session.openWithCallback(self.DVDformatCB,MessageBox,text = _("The DVD standard doesn't support H.264 (HDTV) video streams. Do you want to create a Dreambox format data DVD (which will not play in stand-alone DVD players) instead?"), type = MessageBox.TYPE_YESNO) else: @@ -335,7 +354,7 @@ class TitleList(Screen, HelpableScreen): count = 0 for title in self.project.titles: count += 1 - title.initDVDmenuText(self.project,count) + title.initDVDmenuText(count) self.updateTitleList() def DVDformatCB(self, answer): @@ -346,5 +365,13 @@ class TitleList(Screen, HelpableScreen): else: self.removeTitle(t) - def leave(self): - self.close() + def leave(self, close = False): + if not len(self["titles"].list) or close: + self.close() + else: + self.session.openWithCallback(self.exitCB, MessageBox,text = _("Your current collection will get lost!") + "\n" + _("Do you really want to exit?"), type = MessageBox.TYPE_YESNO) + + def exitCB(self, answer): + print "exitCB", answer + if answer is not None and answer: + self.close() \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index 0a664eba..956f054d 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -21,10 +21,12 @@ class TitleProperties(Screen,ConfigListScreen): + - - - + + + + @@ -38,7 +40,8 @@ class TitleProperties(Screen,ConfigListScreen): self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) - self["key_blue"] = StaticText(_("Edit Title")) + self["key_yellow"] = StaticText(_("Edit Title")) + self["key_blue"] = StaticText() self["serviceinfo"] = StaticText() self["thumbnail"] = Pixmap() @@ -57,7 +60,7 @@ class TitleProperties(Screen,ConfigListScreen): { "green": self.exit, "red": self.cancel, - "blue": self.editTitle, + "yellow": self.editTitle, "cancel": self.cancel, "ok": self.ok, }, -2) -- cgit v1.2.3 From 58630f7b0de796e3589d2c1eaeb3e9d531d60d37 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 16:58:54 +0200 Subject: save supposed afterEvent config in class Job member (fixes #394 DVDBurn shutdown not being executed) --- lib/python/Components/Task.py | 1 + lib/python/Screens/TaskView.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index a1e04bce..2e4e757d 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -16,6 +16,7 @@ class Job(object): self.end = 100 self.__progress = 0 self.weightScale = 1 + self.afterEvent = None self.state_changed = CList() diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index eb926ca3..9907e2fb 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -7,7 +7,7 @@ import Screens.Standby from Tools import Notifications class JobView(InfoBarNotifications, Screen, ConfigListScreen): - def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True, afterEvent = 0): + def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True): from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean @@ -43,19 +43,20 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): "ok": self.ok, }, -2) - self.afterevents = [ "nothing", "standby", "deepstandby", "close" ] self.settings = ConfigSubsection() if SystemInfo["DeepstandbySupport"]: shutdownString = _("go to deep standby") else: shutdownString = _("shut down") - self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.afterevents[afterEvent]) + self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.job.afterEvent or "nothing") + self.job.afterEvent = self.settings.afterEvent.getValue() self.setupList() self.state_changed() def setupList(self): self["config"].setList( [ getConfigListEntry(_("After event"), self.settings.afterEvent) ]) - + self.job.afterEvent = self.settings.afterEvent.getValue() + def keyLeft(self): ConfigListScreen.keyLeft(self) self.setupList() -- cgit v1.2.3 From 525b031d2b8401750293fde4e334dfc8a5193517 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 17:49:15 +0200 Subject: add transfer bps to service interface (requires touching enigma_python.i) --- lib/python/Components/Converter/ServiceInfo.py | 4 ++++ lib/service/iservice.h | 2 ++ 2 files changed, 6 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py index 5014fde6..fa3518ce 100644 --- a/lib/python/Components/Converter/ServiceInfo.py +++ b/lib/python/Components/Converter/ServiceInfo.py @@ -19,6 +19,7 @@ class ServiceInfo(Converter, object): ONID = 13 SID = 14 FRAMERATE = 15 + TRANSFERBPS = 16 def __init__(self, type): @@ -40,6 +41,7 @@ class ServiceInfo(Converter, object): "OnId": (self.ONID, (iPlayableService.evUpdatedInfo,)), "Sid": (self.SID, (iPlayableService.evUpdatedInfo,)), "Framerate": (self.FRAMERATE, (iPlayableService.evVideoSizeChanged,iPlayableService.evUpdatedInfo,)), + "TransferBPS": (self.TRANSFERBPS, (iPlayableService.evUpdatedInfo,)), }[type] def getServiceInfoString(self, info, what, convert = lambda x: "%d" % x): @@ -112,6 +114,8 @@ class ServiceInfo(Converter, object): return self.getServiceInfoString(info, iServiceInformation.sSID) elif self.type == self.FRAMERATE: return self.getServiceInfoString(info, iServiceInformation.sFrameRate, lambda x: "%d fps" % ((x+500)/1000)) + elif self.type == self.TRANSFERBPS: + return self.getServiceInfoString(info, iServiceInformation.sTransferBPS, lambda x: "%d kB/s" % (x/1024)) return "" text = property(getText) diff --git a/lib/service/iservice.h b/lib/service/iservice.h index d80733df..2ba7cb46 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -356,6 +356,8 @@ public: sTagCRC, sTagChannelMode, + sTransferBPS, + sUser = 0x100 }; enum { -- cgit v1.2.3 From 54e03fa5099bfe1862dd8fd83761c64ce17d555b Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 30 Mar 2010 18:25:06 +0200 Subject: fixes bug #436 some improvements to the multi tuner type switching --- lib/dvb/frontend.cpp | 7 ++++++ lib/dvb/frontend.h | 1 + lib/dvb/idvb.h | 1 + lib/python/Components/NimManager.py | 46 +++++++++++++++++++++++++++---------- lib/python/Screens/Satconfig.py | 2 +- 5 files changed, 44 insertions(+), 13 deletions(-) (limited to 'lib/python') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index f85a37fe..8216eea0 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -483,6 +483,13 @@ eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) closeFrontend(); } +void eDVBFrontend::reopenFrontend() +{ + closeFrontend(); + m_type = -1; + openFrontend(); +} + int eDVBFrontend::openFrontend() { if (m_state != stateClosed) diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 4cf05081..bc31755c 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -146,6 +146,7 @@ public: static void setTypePriorityOrder(int val) { PriorityOrder = val; } static int getTypePriorityOrder() { return PriorityOrder; } + void reopenFrontend(); int openFrontend(); int closeFrontend(bool force=false); const char *getDescription() const { return m_description; } diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 4ef7efad..a3e87e35 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,6 +459,7 @@ class iDVBFrontend: public iDVBFrontend_ENUMS, public iObject public: virtual RESULT getFrontendType(int &SWIG_OUTPUT)=0; virtual RESULT tune(const iDVBFrontendParameters &where)=0; + virtual void reopenFrontend()=0; #ifndef SWIG virtual RESULT connectStateChange(const Slot1 &stateChange, ePtr &connection)=0; #endif diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 6650c717..6af4c52c 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1,4 +1,5 @@ from Tools.HardwareInfo import HardwareInfo +from Tools.BoundFunction import boundFunction from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, \ ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, \ @@ -13,6 +14,7 @@ from enigma import eDVBSatelliteEquipmentControl as secClass, \ from time import localtime, mktime from datetime import datetime +from Tools.BoundFunction import boundFunction def getConfigSatlist(orbpos, satlist): default_orbpos = None @@ -687,6 +689,9 @@ class NimManager: def getNimDescription(self, slotid): return self.nim_slots[slotid].friendly_full_description + + def getNimName(self, slotid): + return self.nim_slots[slotid].description def getNimListOfType(self, type, exception = -1): # returns a list of indexes for NIMs compatible to the given type, except for 'exception' @@ -962,12 +967,18 @@ def InitSecParams(): # the configElement should be only visible when diseqc 1.2 is disabled def InitNimManager(nimmgr): - InitSecParams() hw = HardwareInfo() + addNimConfig = False + try: + config.Nims + except: + addNimConfig = True - config.Nims = ConfigSubList() - for x in range(len(nimmgr.nim_slots)): - config.Nims.append(ConfigSubsection()) + if addNimConfig: + InitSecParams() + config.Nims = ConfigSubList() + for x in range(len(nimmgr.nim_slots)): + config.Nims.append(ConfigSubsection()) lnb_choices = { "universal_lnb": _("Universal LNB"), @@ -1243,27 +1254,38 @@ def InitNimManager(nimmgr): if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2': open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value) - def tunerTypeChanged(configElement): + def tunerTypeChanged(nimmgr, configElement): fe_id = configElement.fe_id + print "tunerTypeChanged feid %d to mode %s" % (fe_id, configElement.value) open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) - + frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend() + frontend.reopenFrontend() + nimmgr.enumerateNIMs() + empty_slots = 0 for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] - if slot.isMultiType(): + addMultiType = False + try: + nim.multiType + except: + addMultiType = True + if slot.isMultiType() and addMultiType: typeList = [] - value = None for id in slot.getMultiTypeList().keys(): type = slot.getMultiTypeList()[id] typeList.append((id, type)) - if type == slot.getType(): - value = id nim.multiType = ConfigSelection(typeList, "0") - nim.multiType.value = value + nim.multiType.fe_id = x - empty_slots - nim.multiType.addNotifier(tunerTypeChanged) + nim.multiType.addNotifier(boundFunction(tunerTypeChanged, nimmgr)) + empty_slots = 0 + for slot in nimmgr.nim_slots: + x = slot.slot + nim = config.Nims[x] + if slot.isCompatible("DVB-S"): nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7") nim.toneAmplitude.fe_id = x - empty_slots diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 7ba3a134..87d65e54 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -208,11 +208,11 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) if self["config"].getCurrent() == self.multiType: - nimmanager.enumerateNIMs() from Components.NimManager import InitNimManager InitNimManager(nimmanager) self.nim = nimmanager.nim_slots[self.slotid] self.nimConfig = self.nim.config + for x in checkList: if self["config"].getCurrent() == x: self.createSetup() -- cgit v1.2.3 From c15fe7a4031395509b94140764a79adc5ac678da Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 17:40:35 +0200 Subject: [DVDBurn] use multicolor lable for required medium type (add #316) --- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 35a95d52..ac60906b 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -11,6 +11,7 @@ from Components.Sources.List import List from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.MultiContent import MultiContentEntryText +from Components.Label import MultiColorLabel from enigma import gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT from Tools.Directories import resolveFilename, SCOPE_PLUGINS @@ -44,7 +45,7 @@ class TitleList(Screen, HelpableScreen): - + @@ -85,7 +86,7 @@ class TitleList(Screen, HelpableScreen): self["space_label_single"] = StaticText() self["space_label_dual"] = StaticText() self["hint"] = StaticText(_("Advanced Options")) - self["medium"] = StaticText() + self["medium_label"] = MultiColorLabel() self["space_bar_single"] = Progress() self["space_bar_dual"] = Progress() @@ -308,7 +309,8 @@ class TitleList(Screen, HelpableScreen): self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium"].text = _("exceeds dual layer medium!") + self["medium_label"].setText(_("exceeds dual layer medium!")) + self["medium_label"].setForegroundColorNum(2) if self.previous_size < MAX_DL: self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > MAX_SL: @@ -317,7 +319,8 @@ class TitleList(Screen, HelpableScreen): self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium"].text = _("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free") + self["medium_label"].setText(_("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free")) + self["medium_label"].setForegroundColorNum(1) if self.previous_size < MAX_SL: self.session.open(MessageBox, text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), timeout = 10, type = MessageBox.TYPE_INFO) elif size < MAX_SL: @@ -326,7 +329,8 @@ class TitleList(Screen, HelpableScreen): self["space_bar_single"].value = int(percent) self["space_bar_dual"].value = 0 self["space_label_dual"].text = "" - self["medium"].text = _("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free") + self["medium_label"].setText(_("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free")) + self["medium_label"].setForegroundColorNum(0) self.previous_size = size def getCurrentTitle(self): -- cgit v1.2.3 From 469203620ff992decefb8942a79eb4ebfacf32d1 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 17:18:07 +0200 Subject: [DVDBurn] remove "..." at menu entry string --- lib/python/Plugins/Extensions/DVDBurn/plugin.py | 2 +- po/de.po | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/plugin.py b/lib/python/Plugins/Extensions/DVDBurn/plugin.py index 45f438da..bd856b47 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/plugin.py +++ b/lib/python/Plugins/Extensions/DVDBurn/plugin.py @@ -12,6 +12,6 @@ def main_add(session, service, **kwargs): dvdburn.selectedSource(service) def Plugins(**kwargs): - descr = _("Burn to DVD...") + descr = _("Burn to DVD") return [PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_MOVIELIST, fnc=main_add, icon="dvdburn.png"), PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="dvdburn.png") ] diff --git a/po/de.po b/po/de.po index 90170425..4de23c16 100755 --- a/po/de.po +++ b/po/de.po @@ -725,8 +725,8 @@ msgstr "Brenne DVD" msgid "Burn existing image to DVD" msgstr "Vorhandenes Image auf DVD brennen" -msgid "Burn to DVD..." -msgstr "Auf DVD brennen..." +msgid "Burn to DVD" +msgstr "Auf DVD brennen" msgid "Bus: " msgstr "Bus:" -- cgit v1.2.3 From 04d23246dd5c88df949d523e0c149be8070a0a96 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 1 Feb 2010 23:30:36 +0100 Subject: fix screen layout, add configuration restore wizard code in flasher and fix crash when trying to use wizard with no .nfo file present, fixes bug #394 --- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 84 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 13 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index 860efc02..8986560b 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -63,10 +63,10 @@ class NFIFlash(Screen): - - - - + + + + @@ -95,6 +95,7 @@ class NFIFlash(Screen): { "green": self.ok, "yellow": self.reboot, + "blue": self.runWizard, "ok": self.ok, "left": self.left, "right": self.right, @@ -109,6 +110,43 @@ class NFIFlash(Screen): self.md5sum = "" self.job = None self.box = HardwareInfo().get_device_name() + self.configuration_restorable = None + self.wizard_mode = False + from enigma import eTimer + self.delayTimer = eTimer() + self.delayTimer.callback.append(self.runWizard) + self.delayTimer.start(50,1) + + def check_for_wizard(self): + if self["filelist"].getCurrentDirectory() is not None and fileExists(self["filelist"].getCurrentDirectory()+"wizard.nfo"): + self["key_blue"].text = _("USB stick wizard") + return True + else: + self["key_blue"].text = "" + return False + + def runWizard(self): + if not self.check_for_wizard(): + self.wizard_mode = False + return + wizardcontent = open(self["filelist"].getCurrentDirectory()+"/wizard.nfo", "r").readlines() + nfifile = None + for line in wizardcontent: + line = line.strip() + if line.startswith("image: "): + nfifile = self["filelist"].getCurrentDirectory()+line[7:] + if line.startswith("configuration: "): + backupfile = self["filelist"].getCurrentDirectory()+line[15:] + if fileExists(backupfile): + print "wizard configuration:", backupfile + self.configuration_restorable = backupfile + else: + self.configuration_restorable = None + if nfifile and fileExists(nfifile): + self.wizard_mode = True + print "wizard image:", nfifile + self.check_for_NFO(nfifile) + self.queryFlash() def closeCB(self): if ( self.job is None or self.job.status is not self.job.IN_PROGRESS ) and not self.no_autostart: @@ -133,12 +171,16 @@ class NFIFlash(Screen): self["filelist"].pageUp() self.check_for_NFO() - def check_for_NFO(self): + def check_for_NFO(self, nfifile=None): self.session.summary.setText(self["filelist"].getFilename()) - if self["filelist"].getFilename() is None: - return - if self["filelist"].getCurrentDirectory() is not None: - self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename() + if nfifile is None: + self.session.summary.setText(self["filelist"].getFilename()) + if self["filelist"].getFilename() is None: + return + if self["filelist"].getCurrentDirectory() is not None: + self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename() + else: + self.nfifile = nfifile if self.nfifile.upper().endswith(".NFI"): self["key_green"].text = _("Flash") @@ -152,7 +194,7 @@ class NFIFlash(Screen): else: self.md5sum = "" else: - self["infolabel"].text = _("No details for this image file") + ":\n" + self["filelist"].getFilename() + self["infolabel"].text = _("No details for this image file") + (self["filelist"].getFilename() or "") self.md5sum = "" else: self["infolabel"].text = "" @@ -164,6 +206,7 @@ class NFIFlash(Screen): self["filelist"].descent() self.session.summary.setText(self["filelist"].getFilename()) self.check_for_NFO() + self.check_for_wizard() else: self.queryFlash() @@ -192,7 +235,10 @@ class NFIFlash(Screen): def md5finished(self, retval): if retval==0: - self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO) + if self.wizard_mode: + self.session.openWithCallback(self.queryCB, MessageBox, _("Shall the USB stick wizard proceed and program the image file %s into flash memory?" % self.nfifile.rsplit('/',1)[-1]), MessageBox.TYPE_YESNO) + else: + self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO) else: self.session.openWithCallback(self.queryCB, MessageBox, _("The md5sum validation failed, the file may be corrupted! Are you sure that you want to burn this image to flash memory? You are doing this at your own risk!"), MessageBox.TYPE_YESNO) @@ -201,6 +247,7 @@ class NFIFlash(Screen): self.createJob() else: self["statusbar"].text = _("Please select .NFI flash image file from medium") + self.wizard_mode = False def createJob(self): self.job = Job("Image flashing job") @@ -240,6 +287,8 @@ class NFIFlash(Screen): elif j.status == j.FINISHED: self["statusbar"].text = _("Writing NFI image file to flash completed") self.session.summary.setText(_("NFI image flashing completed. Press Yellow to Reboot!")) + if self.wizard_mode: + self.restoreConfiguration() self["key_yellow"].text = _("Reboot") elif j.status == j.FAILED: @@ -250,10 +299,19 @@ class NFIFlash(Screen): print "[jobcb] %s %s %s" % (jobref, fasel, blubber) self["key_green"].text = _("Flash") - def reboot(self): + def reboot(self, ret=None): if self.job.status == self.job.FINISHED: self["statusbar"].text = ("rebooting...") TryQuitMainloop(self.session,2) - + + def restoreConfiguration(self): + if self.configuration_restorable: + from Screens.Console import Console + cmdlist = [ "mount /dev/mtdblock/3 /mnt/realroot -t jffs2", "tar -xzvf " + self.configuration_restorable + " -C /mnt/realroot/" ] + self.session.open(Console, title = "Restore running", cmdlist = cmdlist, finishedCallback = self.restore_finished, closeOnSuccess = True) + + def restore_finished(self): + self.session.openWithCallback(self.reboot, MessageBox, _("USB stick wizard finished. Your dreambox will now restart with your new image!"), MessageBox.TYPE_INFO) + def createSummary(self): return NFISummary -- cgit v1.2.3 From 16e2662171701ce64bf2e789168e8cee54dc8588 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 31 Mar 2010 15:26:23 +0200 Subject: [DVDBurn] fix up title list layout and change some more strings (add #316) --- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 20 ++++++++++---------- po/de.po | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index ac60906b..2cbeb633 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -31,11 +31,11 @@ class TitleList(Screen, HelpableScreen): {"template": [ - MultiContentEntryText(pos = (0, 0), size = (420, 20), font = 0, flags = RT_HALIGN_LEFT, text = 1), # index 1 Title, - MultiContentEntryText(pos = (0, 20), size = (328, 17), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 description, - MultiContentEntryText(pos = (418, 6), size = (120, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 channel, - MultiContentEntryText(pos = (326, 20), size = (154, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 begin time, - MultiContentEntryText(pos = (480, 20), size = (58, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 5 duration, + MultiContentEntryText(pos = (0, 0), size = (360, 20), font = 0, flags = RT_HALIGN_LEFT, text = 1), # index 1 Title, + MultiContentEntryText(pos = (0, 20), size = (360, 17), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 description, + MultiContentEntryText(pos = (366, 6), size = (152, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 channel, + MultiContentEntryText(pos = (366, 20), size = (102, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 begin time, + MultiContentEntryText(pos = (470, 20), size = (48, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 5 duration, ], "fonts": [gFont("Regular", 20), gFont("Regular", 14)], "itemHeight": 37 @@ -296,7 +296,7 @@ class TitleList(Screen, HelpableScreen): else: self["key_red"].text = "" self["key_yellow"].text = "" - self["title_label"].text = _("Please add titles to the compilation") + self["title_label"].text = _("Please add titles to the compilation.") def updateSize(self): size = self.project.size/(1024*1024) @@ -309,17 +309,17 @@ class TitleList(Screen, HelpableScreen): self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium_label"].setText(_("exceeds dual layer medium!")) + self["medium_label"].setText(_("Exceeds dual layer medium!")) self["medium_label"].setForegroundColorNum(2) if self.previous_size < MAX_DL: - self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) + self.session.open(MessageBox,text = _("Exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > MAX_SL: percent = 100 * size / float(MAX_DL) self["space_label_dual"].text = "%d MB (%.2f%%)" % (size, percent) self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium_label"].setText(_("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free")) + self["medium_label"].setText(_("Required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free")) self["medium_label"].setForegroundColorNum(1) if self.previous_size < MAX_SL: self.session.open(MessageBox, text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), timeout = 10, type = MessageBox.TYPE_INFO) @@ -329,7 +329,7 @@ class TitleList(Screen, HelpableScreen): self["space_bar_single"].value = int(percent) self["space_bar_dual"].value = 0 self["space_label_dual"].text = "" - self["medium_label"].setText(_("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free")) + self["medium_label"].setText(_("Required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free")) self["medium_label"].setForegroundColorNum(0) self.previous_size = size diff --git a/po/de.po b/po/de.po index 4de23c16..b83d5597 100755 --- a/po/de.po +++ b/po/de.po @@ -2957,7 +2957,7 @@ msgid "Process" msgstr "Aktivitätsanzeige" msgid "Properties of current title" -msgstr "Eigenschaften des ausgewählten Titels" +msgstr "Details zum ausgewählten Titel" msgid "Protect services" msgstr "Kanäle schützen" @@ -4173,7 +4173,7 @@ msgid "Title" msgstr "Titel" msgid "Title properties" -msgstr "Titeleigensch." +msgstr "Titeldetails" msgid "Titleset mode" msgstr "Titleset" @@ -5191,8 +5191,8 @@ msgstr "Versteckte Netzwerk SSID eingeben" msgid "equal to" msgstr "Gleich wie" -msgid "exceeds dual layer medium!" -msgstr "übersteigt Größe eines Dual-Layer-Mediums!" +msgid "Exceeds dual layer medium!" +msgstr "Übersteigt die Größe eines Dual-Layer-Mediums!" msgid "exit DVD player or return to file browser" msgstr "DVD Player verlassen oder zurück zum Dateimanager" @@ -5541,7 +5541,7 @@ msgstr "Wiederholung der Wiedergabeliste" msgid "repeated" msgstr "wiederholend" -msgid "required medium type:" +msgid "Required medium type:" msgstr "Benötigte Rohlingsorte:" msgid "rewind to the previous chapter" -- cgit v1.2.3 From 6c69f8d469e17ce1f07775574526b76a2edf60c8 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 31 Mar 2010 23:24:18 +0200 Subject: fixes bug #436 (again) multi tuner support: add a magic sleep(1) to workaround strange behaviour write a magic 0 into /sys/module/dvb_core/parameters/dvb_shutdown_timeout --- lib/dvb/frontend.cpp | 2 +- lib/dvb/idvb.h | 1 + lib/python/Components/NimManager.py | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 8216eea0..bc3a88da 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -485,7 +485,7 @@ eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) void eDVBFrontend::reopenFrontend() { - closeFrontend(); + sleep(1); m_type = -1; openFrontend(); } diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index a3e87e35..d20829bf 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,6 +459,7 @@ class iDVBFrontend: public iDVBFrontend_ENUMS, public iObject public: virtual RESULT getFrontendType(int &SWIG_OUTPUT)=0; virtual RESULT tune(const iDVBFrontendParameters &where)=0; + virtual int closeFrontend(bool force = false)=0; virtual void reopenFrontend()=0; #ifndef SWIG virtual RESULT connectStateChange(const Slot1 &stateChange, ePtr &connection)=0; diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 6af4c52c..c68e9404 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1257,9 +1257,19 @@ def InitNimManager(nimmgr): def tunerTypeChanged(nimmgr, configElement): fe_id = configElement.fe_id print "tunerTypeChanged feid %d to mode %s" % (fe_id, configElement.value) - open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) + try: + oldvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend() + frontend.closeFrontend() + open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) frontend.reopenFrontend() + try: + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(oldvalue) + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" nimmgr.enumerateNIMs() empty_slots = 0 -- cgit v1.2.3 From 3ba3cde02a677e536283fb8cf126f0f80d6c77b9 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 31 Mar 2010 23:48:38 +0200 Subject: fixes bug #436 write a magic 0 into /sys/module/dvb_core/parameters/dvb_shutdown_timeout before doing a service scan and restore the old value afterwards --- lib/python/Screens/ServiceScan.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ServiceScan.py b/lib/python/Screens/ServiceScan.py index 6ee35b84..1fd32e06 100644 --- a/lib/python/Screens/ServiceScan.py +++ b/lib/python/Screens/ServiceScan.py @@ -32,10 +32,25 @@ class ServiceScan(Screen): def ok(self): print "ok" if self["scan"].isDone(): + self.resetTimeout() self.close() def cancel(self): + self.resetTimeout() self.close() + + def setTimeout(self): + try: + self.oldtimeoutvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" + + def resetTimeout(self): + try: + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(self.oldtimeoutvalue) + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" def __init__(self, session, scanList): Screen.__init__(self, session) @@ -58,7 +73,9 @@ class ServiceScan(Screen): "ok": self.ok, "cancel": self.cancel }) - + + self.setTimeout() + self.onFirstExecBegin.append(self.doServiceScan) def doServiceScan(self): -- cgit v1.2.3 From 1e9d8bf4069337885f178c148a4069ba3e12b8b4 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 1 Apr 2010 00:22:03 +0200 Subject: refs bug #485 use --bus 2 as parameter on dm500hd for scan --- lib/python/Screens/ScanSetup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 960b7f10..869bec3c 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -8,6 +8,7 @@ from Components.ConfigList import ConfigListScreen from Components.NimManager import nimmanager, getConfigSatlist from Components.Label import Label from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITION +from Tools.HardwareInfo import HardwareInfo from Screens.MessageBox import MessageBox from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, \ eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, \ @@ -183,7 +184,10 @@ class CableTransponderSearchSupport: cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus " #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000 if nim_idx < 2: - cmd += str(nim_idx) + if HardwareInfo().get_device_name() == "dm500hd": + cmd += "2" + else: + cmd += str(nim_idx) else: if nim_idx == 2: cmd += "2" # first nim socket on DM8000 use /dev/i2c/2 -- cgit v1.2.3 From d5664b69fd79e1a5b5e179d817829ee97112713b Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 2 Apr 2010 18:39:04 +0200 Subject: refs bug #436 set/reset dvb_shutdown_timeout at a different position --- lib/python/Screens/ScanSetup.py | 15 +++++++++++++++ lib/python/Screens/ServiceScan.py | 19 +------------------ 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 869bec3c..f4828088 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -114,6 +114,7 @@ class CableTransponderSearchSupport: def cableTransponderSearchSessionClosed(self, *val): print "cableTransponderSearchSessionClosed, val", val + self.resetTimeout() self.cable_search_container.appClosed.remove(self.cableTransponderSearchClosed) self.cable_search_container.dataAvail.remove(self.getCableTransponderData) self.cable_search_container = None @@ -161,6 +162,19 @@ class CableTransponderSearchSupport: tmpstr += " kHz " tmpstr += data[0] self.cable_search_session["text"].setText(tmpstr) + + def setTimeout(self): + try: + self.oldtimeoutvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" + + def resetTimeout(self): + try: + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(self.oldtimeoutvalue) + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" def startCableTransponderSearch(self, nim_idx): if not self.tryGetRawFrontend(nim_idx): @@ -251,6 +265,7 @@ class CableTransponderSearchSupport: self.cable_search_container.execute(cmd) tmpstr = _("Try to find used transponders in cable network.. please wait...") tmpstr += "\n\n..." + self.setTimeout() self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO) class DefaultSatLists(DefaultWizard): diff --git a/lib/python/Screens/ServiceScan.py b/lib/python/Screens/ServiceScan.py index 1fd32e06..df427f99 100644 --- a/lib/python/Screens/ServiceScan.py +++ b/lib/python/Screens/ServiceScan.py @@ -32,26 +32,11 @@ class ServiceScan(Screen): def ok(self): print "ok" if self["scan"].isDone(): - self.resetTimeout() self.close() def cancel(self): - self.resetTimeout() self.close() - def setTimeout(self): - try: - self.oldtimeoutvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() - open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") - except: - print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" - - def resetTimeout(self): - try: - open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(self.oldtimeoutvalue) - except: - print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" - def __init__(self, session, scanList): Screen.__init__(self, session) @@ -73,9 +58,7 @@ class ServiceScan(Screen): "ok": self.ok, "cancel": self.cancel }) - - self.setTimeout() - + self.onFirstExecBegin.append(self.doServiceScan) def doServiceScan(self): -- cgit v1.2.3 From b10d0e67edef01beaae1504ddffa691fe69eec4a Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 5 Apr 2010 21:24:13 +0200 Subject: Softwaremanager: * notify if updatefeed is not available and also verify HardwarePrerequisites. Fixes #503 --- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 22 ++++++++++++++++++++++ .../SystemPlugins/SoftwareManager/plugin.py | 18 +++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index e8cf6dc2..a7c88c95 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -7,6 +7,7 @@ from Components.Sources.List import List from Components.Ipkg import IpkgComponent from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR +from Tools.HardwareInfo import HardwareInfo from time import time @@ -78,9 +79,12 @@ class SoftwareTools(DreamInfoHandler): def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_ERROR: SoftwareTools.list_updating = False + if self.NotifierCallback is not None: + self.NotifierCallback(False) elif event == IpkgComponent.EVENT_DONE: if SoftwareTools.list_updating: self.startIpkgListAvailable() + #print event, "-", param pass def startIpkgListAvailable(self, callback = None): @@ -164,6 +168,14 @@ class SoftwareTools(DreamInfoHandler): l = len(tokens) version = l > 1 and tokens[1].strip() or "" SoftwareTools.installed_packetlist[name] = version + for package in self.packagesIndexlist[:]: + if not self.verifyPrerequisites(package[0]["prerequisites"]): + self.packagesIndexlist.remove(package) + for package in self.packagesIndexlist[:]: + attributes = package[0]["attributes"] + if attributes.has_key("packagetype"): + if attributes["packagetype"] == "internal": + self.packagesIndexlist.remove(package) if callback is None: self.countUpdates() else: @@ -228,4 +240,14 @@ class SoftwareTools(DreamInfoHandler): for name in self.UpdateConsole.appContainers.keys(): self.UpdateConsole.kill(name) + def verifyPrerequisites(self, prerequisites): + if prerequisites.has_key("hardware"): + hardware_found = False + for hardware in prerequisites["hardware"]: + if hardware == self.hardware_info.device_name: + hardware_found = True + if not hardware_found: + return False + return True + iSoftwareTools = SoftwareTools() \ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 4917855f..1e0ed4d5 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -307,8 +307,8 @@ class PluginManager(Screen, DreamInfoHandler): {"templates": {"default": (51,[ - MultiContentEntryText(pos = (30, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (30, 25), size = (470, 24), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description + MultiContentEntryText(pos = (0, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (0, 25), size = (470, 24), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description MultiContentEntryPixmapAlphaTest(pos = (475, 0), size = (48, 48), png = 5), # index 5 is the status pixmap MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 6), # index 6 is the div pixmap ]), @@ -405,18 +405,15 @@ class PluginManager(Screen, DreamInfoHandler): if status == 'update': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Updating software catalog"), '', _("Searching for available updates. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) elif status == 'sync': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) elif status == 'error': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) + self["list"].style = "default" + self['list'].setList(self.statuslist) + def getUpdateInfos(self): self.setState('update') @@ -432,7 +429,10 @@ class PluginManager(Screen, DreamInfoHandler): self.rebuildList() elif retval is False: self.setState('error') - self["status"].setText(_("No network connection available.")) + if iSoftwareTools.NetworkConnectionAvailable: + self["status"].setText(_("Updatefeed not available.")) + else: + self["status"].setText(_("No network connection available.")) def rebuildList(self, retval = None): if self.currentSelectedTag is None: -- cgit v1.2.3 From 4b510799c728bca6d85823978d693c41d34bdc53 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 5 Apr 2010 22:26:29 +0200 Subject: Softwaremanager: *add missing define. refs #503 --- lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index a7c88c95..d4653cca 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -30,6 +30,7 @@ class SoftwareTools(DreamInfoHandler): self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) self.directory = resolveFilename(SCOPE_METADIR) + self.hardware_info = HardwareInfo() self.list = List([]) self.NotifierCallback = None self.Console = Console() -- cgit v1.2.3