From 2aaafed9667ed7fe91d01436a3a109d8ff3f7bbf 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) --- lib/python/Components/ServiceList.py | 29 +++++++++++++++++++++++++---- lib/python/Components/UsageConfig.py | 2 ++ 2 files changed, 27 insertions(+), 4 deletions(-) mode change 100755 => 100644 lib/python/Components/ServiceList.py (limited to 'lib/python') 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 60827107..572f47e0 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -61,6 +61,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) -- cgit v1.2.3 From 2a8f4bb347c3cf4075bfa45cae2220d4562f74ee 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 cf16247cbcaf1620ad597c24323c81ac3604cbda Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 29 Mar 2010 09:25:14 +0200 Subject: [DVDBurn] usability improvements: title list layout, bottom info area, consistency of user interface (fixes #316) --- .../Plugins/Extensions/DVDBurn/ProjectSettings.py | 8 +- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 99 ++++++++++++++-------- .../Plugins/Extensions/DVDBurn/TitleProperties.py | 13 +-- 3 files changed, 76 insertions(+), 44 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index a1c38842..0a0106bb 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): - - - - + + + + diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index dbc988b1..8cfc57e5 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): @@ -346,5 +367,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 = _("Are you sure you want to exit this wizard?"), 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 233b4b8d8791a0b79c368cdbeef6296f1c83fce7 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 33b03607a97f4d3b7baacaca632942570a54ac5c Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 14:17:41 +0200 Subject: Revert "[DVDBurn] usability improvements: title list layout, bottom info area, consistency of user interface (fixes #316)" This reverts commit cf16247cbcaf1620ad597c24323c81ac3604cbda. --- .../Plugins/Extensions/DVDBurn/ProjectSettings.py | 8 +- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 99 ++++++++-------------- .../Plugins/Extensions/DVDBurn/TitleProperties.py | 13 ++- 3 files changed, 44 insertions(+), 76 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index 0a0106bb..a1c38842 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): - - - - + + + + diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 8cfc57e5..dbc988b1 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -16,40 +16,33 @@ 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 = (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 = (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, ], "fonts": [gFont("Regular", 20), gFont("Regular", 14)], "itemHeight": 37 } - - - - - - - - - + + """ def __init__(self, session, project = None): @@ -82,19 +75,17 @@ class TitleList(Screen, HelpableScreen): self["title_label"] = StaticText() self["error_label"] = StaticText() - 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["space_label"] = StaticText() + self["space_bar"] = 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): @@ -116,16 +107,15 @@ 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)) - 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((_("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) @@ -159,9 +149,9 @@ class TitleList(Screen, HelpableScreen): - - - + + + @@ -207,7 +197,7 @@ class TitleList(Screen, HelpableScreen): self.close(current) self.session.openWithCallback(self.selectedSource, DVDMovieSelection) - def selectedSource(self, source = None): + def selectedSource(self, source): if source is None: return None if not source.getPath().endswith(".ts"): @@ -238,7 +228,7 @@ class TitleList(Screen, HelpableScreen): def settingsCB(self, update=True): if not update: return - self.updateTitleList() + self["title_label"].text = _("Table of content for collection") + " \"" + self.project.settings.name.getValue() + "\":" def loadTemplate(self): filename = resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/DreamboxDVD.ddvdp.xml" @@ -291,11 +281,9 @@ 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) @@ -304,29 +292,20 @@ 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_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!") + self["space_label"].text = "%d MB - " % size + _("exceeds dual layer medium!") + " (%.2f%% " % (100-percent) + _("free") + ")" + self["space_bar"].value = int(percent) 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_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") + self["space_label"].text = "%d MB " % size + _("of a DUAL layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" + self["space_bar"].value = int(percent) 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) + 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) elif size < MAX_SL: percent = 100 * size / float(MAX_SL) - 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["space_label"].text = "%d MB " % size + _("of a SINGLE layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" + self["space_bar"].value = int(percent) self.previous_size = size def getCurrentTitle(self): @@ -367,13 +346,5 @@ class TitleList(Screen, HelpableScreen): else: self.removeTitle(t) - def leave(self, close = False): - if not len(self["titles"].list) or close: - self.close() - else: - self.session.openWithCallback(self.exitCB, MessageBox,text = _("Are you sure you want to exit this wizard?"), 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 + def leave(self): + self.close() diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index 956f054d..0a664eba 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -21,12 +21,10 @@ class TitleProperties(Screen,ConfigListScreen): - - - - - + + + @@ -40,8 +38,7 @@ class TitleProperties(Screen,ConfigListScreen): self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) - self["key_yellow"] = StaticText(_("Edit Title")) - self["key_blue"] = StaticText() + self["key_blue"] = StaticText(_("Edit Title")) self["serviceinfo"] = StaticText() self["thumbnail"] = Pixmap() @@ -60,7 +57,7 @@ class TitleProperties(Screen,ConfigListScreen): { "green": self.exit, "red": self.cancel, - "yellow": self.editTitle, + "blue": self.editTitle, "cancel": self.cancel, "ok": self.ok, }, -2) -- cgit v1.2.3 From f9c85f244f88881da62c27b130a8675b1929ff8a 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 7fdfc2fd..3de125b9 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: @@ -482,7 +482,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 f439d95e68c5a31bf18b643916b60c272755d5a6 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 ca9ba550..4085e724 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 63473fb658a8a70a67d4c68eba2deb7850739f2e 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 00d06095..745cc730 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 3de125b9..f455e3c0 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": @@ -519,6 +533,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 1e198bfb36fa1ec5ec4ad5b14e9a73216d27086b 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 f455e3c0..7ba3a134 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 37727defa26822965967c2f26b5e181f19ba7e64 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 4085e724..f98d4c33 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1110,15 +1110,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 b3634186b1ede88201f68838e40a977c1beeff1a 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 ba3ca7624c0b05d5340ad5c08995a345a51384df 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 6249914820d4028175d86237fdac9b155d1834fa 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 999ce875c6e93272ffd5aa001c492ea4f3a27b06 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 551b34ac91b64f4532d60ce32e53bfeab51f7b60 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 08068420717613d1f0437ca51fb5a00039170ecc 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 fab31898f5892e9841b5c4f24fe505bd216e0ab2 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 1dbc8731f75dbae5a875871e3ed3d166f92b58de 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 0c83a45ce5ccfb416b7a38ba3167105408f31734 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 0c978089..c10cdbcb 100755 --- a/po/de.po +++ b/po/de.po @@ -698,8 +698,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 f4fb05eb60ba00cc91e7b955d7e228080c3ed1e0 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 c2a699ea42993e9dfeff987239258defec4b5c8e 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 c10cdbcb..ee215faf 100755 --- a/po/de.po +++ b/po/de.po @@ -2882,7 +2882,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" @@ -4072,7 +4072,7 @@ msgid "Title" msgstr "Titel" msgid "Title properties" -msgstr "Titeleigensch." +msgstr "Titeldetails" msgid "Titleset mode" msgstr "Titleset" @@ -5065,8 +5065,8 @@ msgstr "Verstecke 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" @@ -5418,7 +5418,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 85b69597116f1d9bcd52331c01f0d4fb4c6d3c60 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 745cc730..70ed7c4a 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 65e19ae2a40a7598987c3e831d4f1ff0e7a673c5 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 70ed7c4a..3c96fbb9 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 5807686a79350632f38e4161c942ae59cf2f63ce 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 ade31606f868b60e12458d3fc0d68a69094656e1 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 d77f925cce8e458cd1e794dcd583fad6be8f1abb 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 From 645ffd0c4b909edeaa31e12316d4b7f85f528238 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 a145e380dcf5aac25d54bd634f92e9312a791f84 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Mon, 26 Apr 2010 18:08:56 +0200 Subject: meta: remove trailing slash from installdirs --- lib/python/Plugins/Extensions/CutListEditor/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/DVDBurn/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/DVDPlayer/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/GraphMultiEPG/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/MediaPlayer/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/MediaScanner/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/PicturePlayer/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/SocketMMI/meta/Makefile.am | 2 +- lib/python/Plugins/Extensions/TuxboxPlugins/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/CleanupWizard/meta/Makefile.am | 2 +- .../Plugins/SystemPlugins/CommonInterfaceAssignment/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/Makefile.am | 2 +- .../Plugins/SystemPlugins/DefaultServicesScanner/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/DiseqcTester/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/NFIFlash/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/PositionerSetup/meta/Makefile.am | 2 +- .../Plugins/SystemPlugins/SatelliteEquipmentControl/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/Satfinder/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/SkinSelector/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/SoftwareManager/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/VideoTune/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/Videomode/meta/Makefile.am | 2 +- lib/python/Plugins/SystemPlugins/WirelessLan/meta/Makefile.am | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/CutListEditor/meta/Makefile.am b/lib/python/Plugins/Extensions/CutListEditor/meta/Makefile.am index ee18898d..e926e3ff 100755 --- a/lib/python/Plugins/Extensions/CutListEditor/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/CutListEditor/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_cutlisteditor.xml diff --git a/lib/python/Plugins/Extensions/DVDBurn/meta/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/meta/Makefile.am index 0b3be7d6..1a823b70 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDBurn/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_dvdburn.xml diff --git a/lib/python/Plugins/Extensions/DVDPlayer/meta/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/meta/Makefile.am index 12d13710..aa22b996 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDPlayer/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_dvdplayer.xml diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/Makefile.am b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/Makefile.am index 5766ff34..a11d35d0 100755 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_graphmultiepg.xml diff --git a/lib/python/Plugins/Extensions/MediaPlayer/meta/Makefile.am b/lib/python/Plugins/Extensions/MediaPlayer/meta/Makefile.am index 84e01672..e17f0bf5 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/MediaPlayer/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_mediaplayer.xml diff --git a/lib/python/Plugins/Extensions/MediaScanner/meta/Makefile.am b/lib/python/Plugins/Extensions/MediaScanner/meta/Makefile.am index d80b8c27..c4ab27d8 100755 --- a/lib/python/Plugins/Extensions/MediaScanner/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/MediaScanner/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_mediascanner.xml diff --git a/lib/python/Plugins/Extensions/PicturePlayer/meta/Makefile.am b/lib/python/Plugins/Extensions/PicturePlayer/meta/Makefile.am index 87b59f43..e501fb6f 100755 --- a/lib/python/Plugins/Extensions/PicturePlayer/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/PicturePlayer/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_pictureplayer.xml diff --git a/lib/python/Plugins/Extensions/SocketMMI/meta/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/meta/Makefile.am index 34ccbeb7..67388bc4 100755 --- a/lib/python/Plugins/Extensions/SocketMMI/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/SocketMMI/meta/Makefile.am @@ -1,3 +1,3 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_socketmmi.xml diff --git a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/Makefile.am b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/Makefile.am index ecdcac8a..1ab8aeea 100755 --- a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/Makefile.am +++ b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/Makefile.am @@ -1,3 +1,3 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_tuxboxplugins.xml diff --git a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/Makefile.am index d9d96bcf..8fc21e7f 100755 --- a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_cleanupwizard.xml diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/Makefile.am index 60d1d461..e0ce313e 100755 --- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_commoninterfaceassignment.xml diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/Makefile.am index aed728db..02655d5d 100755 --- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_crashlogautosubmit.xml diff --git a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/Makefile.am index 07dc1378..5e2d194c 100755 --- a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_defaultservicesscanner.xml diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/Makefile.am index 9b0a2ede..92a5473f 100755 --- a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_diseqctester.xml diff --git a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/Makefile.am index b1a93d3e..5ab313aa 100755 --- a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/Makefile.am @@ -1,3 +1,3 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_frontprocessorupgrade.xml diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile.am index a757b538..cf5608ba 100755 --- a/lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile.am @@ -1,3 +1,3 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_hotplug.xml diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/Makefile.am index 0633e7cf..598c0715 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_nfiflash.xml diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile.am index e8f738c6..db985bf7 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_networkwizard.xml diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/Makefile.am index 3bc5cb24..a6b296cf 100755 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_positionersetup.xml diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/Makefile.am index b31fa653..5dfb239a 100755 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_satelliteequipmentcontrol.xml diff --git a/lib/python/Plugins/SystemPlugins/Satfinder/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/Satfinder/meta/Makefile.am index ba035e86..23499a4e 100755 --- a/lib/python/Plugins/SystemPlugins/Satfinder/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Satfinder/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_satfinder.xml diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/Makefile.am index d29fb002..992f4b0e 100755 --- a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_skinselector.xml diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/Makefile.am index 05a87d5a..bf064c29 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_softwaremanager.xml diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/Makefile.am index 2e80f306..d08de4a0 100755 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_videoenhancement.xml diff --git a/lib/python/Plugins/SystemPlugins/VideoTune/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/VideoTune/meta/Makefile.am index d0368ed9..a8649058 100755 --- a/lib/python/Plugins/SystemPlugins/VideoTune/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/VideoTune/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_videotune.xml diff --git a/lib/python/Plugins/SystemPlugins/Videomode/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/Videomode/meta/Makefile.am index ef474435..ddcc18c9 100755 --- a/lib/python/Plugins/SystemPlugins/Videomode/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Videomode/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_videomode.xml diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/Makefile.am index 6bc4aab0..692d91aa 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(datadir)/meta/ +installdir = $(datadir)/meta dist_install_DATA = plugin_wirelesslan.xml -- cgit v1.2.3 From 11743a3babfd9e108eaea357354683aa11d7575f Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 May 2010 14:24:22 +0200 Subject: Network.py,NetworkSetup.py,skin_default.xml: * Introduce new unified naming for network interfaces. * Redesign NetworkadapterSelection Screen. * small cleanups. Refs #137 , Fixes #418 --- data/skin_default.xml | 14 +++- data/skin_default/icons/Makefile.am | 6 ++ data/skin_default/icons/network_wired-active.png | Bin 0 -> 2771 bytes data/skin_default/icons/network_wired-inactive.png | Bin 0 -> 2745 bytes data/skin_default/icons/network_wired.png | Bin 0 -> 2477 bytes .../skin_default/icons/network_wireless-active.png | Bin 0 -> 2821 bytes .../icons/network_wireless-inactive.png | Bin 0 -> 2745 bytes data/skin_default/icons/network_wireless.png | Bin 0 -> 2539 bytes lib/python/Components/Network.py | 51 ++++++++++-- lib/python/Screens/NetworkSetup.py | 90 ++++++++++++--------- 10 files changed, 114 insertions(+), 47 deletions(-) mode change 100644 => 100755 data/skin_default/icons/Makefile.am create mode 100755 data/skin_default/icons/network_wired-active.png create mode 100755 data/skin_default/icons/network_wired-inactive.png create mode 100755 data/skin_default/icons/network_wired.png create mode 100755 data/skin_default/icons/network_wireless-active.png create mode 100755 data/skin_default/icons/network_wireless-inactive.png create mode 100755 data/skin_default/icons/network_wireless.png (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml index 0114349b..497d33ac 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -577,7 +577,19 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + + + {"template": [ + MultiContentEntryText(pos = (85, 6), size = (440, 28), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1), # index 1 is the interfacename + MultiContentEntryText(pos = (85, 43), size = (440, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, text = 2), # index 2 is the description + MultiContentEntryPixmapAlphaTest(pos = (2, 8), size = (54, 54), png = 3), # index 3 is the interface pixmap + MultiContentEntryPixmapAlphaTest(pos = (63, 46), size = (15, 16), png = 4), # index 4 is the default pixmap + ], + "fonts": [gFont("Regular", 28),gFont("Regular", 20)], + "itemHeight": 70 + } + + diff --git a/data/skin_default/icons/Makefile.am b/data/skin_default/icons/Makefile.am old mode 100644 new mode 100755 index 8e2052b0..088556a6 --- a/data/skin_default/icons/Makefile.am +++ b/data/skin_default/icons/Makefile.am @@ -34,6 +34,12 @@ dist_install_DATA = \ lock.png \ marker.png \ mp_buttons.png \ + network_wired.png \ + network_wired-active.png \ + network_wired-inactive.png \ + network_wireless.png \ + network_wireless-active.png \ + network_wireless-inactive.png \ plugin.png \ rass_logo.png \ rass_page1.png \ diff --git a/data/skin_default/icons/network_wired-active.png b/data/skin_default/icons/network_wired-active.png new file mode 100755 index 00000000..d8efc9c8 Binary files /dev/null and b/data/skin_default/icons/network_wired-active.png differ diff --git a/data/skin_default/icons/network_wired-inactive.png b/data/skin_default/icons/network_wired-inactive.png new file mode 100755 index 00000000..18f2c70f Binary files /dev/null and b/data/skin_default/icons/network_wired-inactive.png differ diff --git a/data/skin_default/icons/network_wired.png b/data/skin_default/icons/network_wired.png new file mode 100755 index 00000000..db695ad5 Binary files /dev/null and b/data/skin_default/icons/network_wired.png differ diff --git a/data/skin_default/icons/network_wireless-active.png b/data/skin_default/icons/network_wireless-active.png new file mode 100755 index 00000000..07a21874 Binary files /dev/null and b/data/skin_default/icons/network_wireless-active.png differ diff --git a/data/skin_default/icons/network_wireless-inactive.png b/data/skin_default/icons/network_wireless-inactive.png new file mode 100755 index 00000000..5bd69f9d Binary files /dev/null and b/data/skin_default/icons/network_wireless-inactive.png differ diff --git a/data/skin_default/icons/network_wireless.png b/data/skin_default/icons/network_wireless.png new file mode 100755 index 00000000..629a05a6 Binary files /dev/null and b/data/skin_default/icons/network_wireless.png differ diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index b9da48d8..e8a3d459 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -26,6 +26,9 @@ class Network: self.DnsConsole = Console() self.PingConsole = Console() self.config_ready = None + self.friendlyNames = {} + self.lan_interfaces = [] + self.wlan_interfaces = [] self.getInterfaces() def onRemoteRootFS(self): @@ -309,13 +312,47 @@ class Network: return len(self.ifaces) def getFriendlyAdapterName(self, x): - # maybe this needs to be replaced by an external list. - friendlyNames = { - "eth0": _("Integrated Ethernet"), - "wlan0": _("Wireless"), - "ath0": _("Integrated Wireless") - } - return friendlyNames.get(x, x) # when we have no friendly name, use adapter name + if x in self.friendlyNames.keys(): + return self.friendlyNames.get(x, x) + else: + self.friendlyNames[x] = self.getFriendlyAdapterNaming(x) + return self.friendlyNames.get(x, x) # when we have no friendly name, use adapter name + + def getFriendlyAdapterNaming(self, iface): + if iface.startswith('eth'): + if iface not in self.lan_interfaces and len(self.lan_interfaces) == 0: + self.lan_interfaces.append(iface) + return _("LAN connection") + elif iface not in self.lan_interfaces and len(self.lan_interfaces) >= 1: + self.lan_interfaces.append(iface) + return _("LAN connection") + " " + str(len(self.lan_interfaces)) + else: + if iface not in self.wlan_interfaces and len(self.wlan_interfaces) == 0: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + elif iface not in self.wlan_interfaces and len(self.wlan_interfaces) >= 1: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + " " + str(len(self.wlan_interfaces)) + + def getFriendlyAdapterDescription(self, iface): + if iface == 'eth0': + return _("Internal LAN adapter.") + else: + classdir = "/sys/class/net/" + iface + "/device/" + driverdir = "/sys/class/net/" + iface + "/device/driver/" + if os_path.exists(classdir): + files = listdir(classdir) + if 'driver' in files: + if os_path.realpath(driverdir).endswith('ath_pci'): + return _("Atheros")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('zd1211b'): + return _("Zydas")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('rt73'): + return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + else: + return _("Unknown network adapter.") + else: + return _("Unknown network adapter.") def getAdapterName(self, iface): return iface diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index c0037f81..2e33ac3b 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -7,6 +7,7 @@ from Screens.HelpMenu import HelpableScreen from Components.Network import iNetwork from Components.Sources.StaticText import StaticText from Components.Sources.Boolean import Boolean +from Components.Sources.List import List from Components.Label import Label,MultiColorLabel from Components.Pixmap import Pixmap,MultiPixmap from Components.MenuList import MenuList @@ -23,32 +24,6 @@ from os import path as os_path, system as os_system, unlink from re import compile as re_compile, search as re_search -class InterfaceList(MenuList): - def __init__(self, list, enableWrapAround=False): - MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) - self.l.setFont(0, gFont("Regular", 20)) - self.l.setItemHeight(30) - -def InterfaceEntryComponent(index,name,default,active ): - res = [ - (index), - MultiContentEntryText(pos=(80, 5), size=(430, 25), font=0, text=name) - ] - num_configured_if = len(iNetwork.getConfiguredAdapters()) - if num_configured_if >= 2: - if default is True: - png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue.png")) - if default is False: - png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue_off.png")) - res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png)) - if active is True: - png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) - if active is False: - png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_error.png")) - res.append(MultiContentEntryPixmapAlphaTest(pos=(40, 1), size=(25, 25), png = png2)) - return res - - class NetworkAdapterSelection(Screen,HelpableScreen): def __init__(self, session): Screen.__init__(self, session) @@ -91,13 +66,49 @@ class NetworkAdapterSelection(Screen,HelpableScreen): }) self.list = [] - self["list"] = InterfaceList(self.list) + self["list"] = List(self.list) self.updateList() if len(self.adapters) == 1: self.onFirstExecBegin.append(self.okbuttonClick) self.onClose.append(self.cleanup) + def buildInterfaceList(self,iface,name,default,active ): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + defaultpng = None + activepng = None + description = None + interfacepng = None + + if iface in iNetwork.lan_interfaces: + if active is True: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired-active.png")) + elif active is False: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired-inactive.png")) + else: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired.png")) + elif iface in iNetwork.wlan_interfaces: + if active is True: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless-active.png")) + elif active is False: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless-inactive.png")) + else: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless.png")) + + num_configured_if = len(iNetwork.getConfiguredAdapters()) + if num_configured_if >= 2: + if default is True: + defaultpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue.png")) + elif default is False: + defaultpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue_off.png")) + if active is True: + activepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) + elif active is False: + activepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_error.png")) + + description = iNetwork.getFriendlyAdapterDescription(iface) + + return((iface, name, description, interfacepng, defaultpng, activepng, divpng)) def updateList(self): self.list = [] @@ -122,7 +133,7 @@ class NetworkAdapterSelection(Screen,HelpableScreen): default_gw = result if len(self.adapters) == 0: # no interface available => display only eth0 - self.list.append(InterfaceEntryComponent("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True )) + self.list.append(self.buildInterfaceList("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True )) else: for x in self.adapters: if x[1] == default_gw: @@ -133,11 +144,11 @@ class NetworkAdapterSelection(Screen,HelpableScreen): active_int = True else: active_int = False - self.list.append(InterfaceEntryComponent(index = x[1],name = _(x[0]),default=default_int,active=active_int )) + self.list.append(self.buildInterfaceList(x[1],_(x[0]),default_int,active_int )) if os_path.exists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")): self["key_blue"].setText(_("NetworkWizard")) - self["list"].l.setList(self.list) + self["list"].setList(self.list) def setDefaultInterface(self): selection = self["list"].getCurrent() @@ -253,7 +264,7 @@ class NameserverSetup(Screen, ConfigListScreen, HelpableScreen): self.list = [] ConfigListScreen.__init__(self, self.list) self.createSetup() - + def createConfig(self): self.nameservers = iNetwork.getNameserverList() self.nameserverEntries = [ NoSave(ConfigIP(default=nameserver)) for nameserver in self.nameservers] @@ -412,7 +423,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.wsconfig = None self.default = None - if self.iface == "wlan0" or self.iface == "ath0" : + if self.iface in iNetwork.wlan_interfaces: from Plugins.SystemPlugins.WirelessLan.Wlan import wpaSupplicant,Wlan self.w = Wlan(self.iface) self.ws = wpaSupplicant() @@ -535,7 +546,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.createSetup() if self["config"].getCurrent() == self.gatewayEntry: self.createSetup() - if self.iface == "wlan0" or self.iface == "ath0" : + if self.iface in iNetwork.wlan_interfaces: if self["config"].getCurrent() == self.wlanSSID: self.createSetup() if self["config"].getCurrent() == self.encryptionEnabled: @@ -731,7 +742,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def ok(self): self.cleanup() if self["menulist"].getCurrent()[1] == 'edit': - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless @@ -817,7 +828,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self["menulist"].getCurrent()[1] == 'dns': self["description"].setText(_("Edit the Nameserver configuration of your Dreambox.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'scanwlan': - self["description"].setText(_("Scan your network for wireless Access Points and connect to them using your selected wireless device.\n" ) + self.oktext ) + self["description"].setText(_("Scan your network for wireless access points and connect to them using your selected wireless device.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'wlanstatus': self["description"].setText(_("Shows the state of your wireless LAN connection.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'lanrestart': @@ -834,7 +845,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) self["Statustext"].setText(_("Link:")) - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except: @@ -884,7 +895,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def AdapterSetupClosed(self, *ret): if ret is not None and len(ret): - if ret[0] == 'ok' and (self.iface == 'wlan0' or self.iface == 'ath0') and iNetwork.getAdapterAttribute(self.iface, "up") is True: + if ret[0] == 'ok' and (self.iface in iNetwork.wlan_interfaces) and iNetwork.getAdapterAttribute(self.iface, "up") is True: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless @@ -1263,6 +1274,7 @@ class NetworkAdapterTest(Screen): self.nextStepTimer.stop() def layoutFinished(self): + self.setTitle(_("Network test: ") + iNetwork.getFriendlyAdapterName(self.iface) ) self["shortcutsyellow"].setEnabled(False) self["AdapterInfo_OK"].hide() self["NetworkInfo_Check"].hide() @@ -1282,7 +1294,7 @@ class NetworkAdapterTest(Screen): self["AdapterInfo_Text"] = MultiColorLabel(_("Show Info")) self["AdapterInfo_OK"] = Pixmap() - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: self["Networktext"] = MultiColorLabel(_("Wireless Network")) else: self["Networktext"] = MultiColorLabel(_("Local Network")) @@ -1321,7 +1333,7 @@ class NetworkAdapterTest(Screen): self["InfoText"] = Label() def getLinkState(self,iface): - if iface == 'wlan0' or iface == 'ath0': + if iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status except: -- cgit v1.2.3 From 0f6a9da7c79334369e536649a46e05e56ec09eed Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 7 May 2010 12:49:48 +0200 Subject: mytest.py: load bouquets before parental control init and remove strange hack in parental control this fixes bug #532 --- lib/python/Components/ParentalControl.py | 11 +---------- mytest.py | 6 ++++-- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index 9942bca7..63b5ccfb 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -55,11 +55,10 @@ def InitParentalControl(): class ParentalControl: def __init__(self): #Do not call open on init, because bouquets are not ready at that moment -# self.open() + self.open() self.serviceLevel = {} #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, @@ -89,9 +88,6 @@ class ParentalControl: def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True - #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: @@ -153,8 +149,6 @@ class ParentalControl: 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): @@ -319,14 +313,11 @@ class ParentalControl: 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) def open(self): self.openListFromFile(LIST_BLACKLIST) self.openListFromFile(LIST_WHITELIST) - self.filesOpened = True parentalControl = ParentalControl() diff --git a/mytest.py b/mytest.py index c748538a..0b9be523 100755 --- a/mytest.py +++ b/mytest.py @@ -30,6 +30,9 @@ from Screens.SimpleSummary import SimpleSummary from sys import stdout, exc_info +profile("Bouquets") +eDVBDB.getInstance().reloadBouquets() + profile("ParentalControl") from Components.ParentalControl import InitParentalControl InitParentalControl() @@ -45,8 +48,7 @@ from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, NoSave InitFallbackFiles() -profile("ReloadProfiles") -eDVBDB.getInstance().reloadBouquets() +profile("config.misc") config.misc.radiopic = ConfigText(default = resolveFilename(SCOPE_CURRENT_SKIN, "radio.mvi")) config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False) -- cgit v1.2.3 From 3f34006c270bc0b6de4d65edf7d46ae54c87774c Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 May 2010 11:14:01 +0200 Subject: lib/python/Screens/Satconfig.py: fixed crash on satconfig close in some conditions (thx to adenin) this fixes bug #533 --- lib/python/Screens/Satconfig.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 87d65e54..749c09db 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -360,7 +360,6 @@ 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): @@ -390,7 +389,9 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): if confirmed[1] == "yestoall" or confirmed[1] == "notoall": self.deleteConfirmed(confirmed) break - + else: + self.restoreService(_("Zap back to service before tuner setup?")) + def __init__(self, session, slotid): Screen.__init__(self, session) self.list = [ ] -- cgit v1.2.3 From 10db7be1b01656e6c5dec4954841ea803b73b884 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 12 May 2010 16:03:30 +0200 Subject: RecordTimer.py,RecordingConfig.py,setup.xml: *add possibility to change the default recording filename composition in expert mode. This allows now to have shorter recording filenames (Date-Name) or longer (DateTime-Channel-Name-Shortdescription) beside the default. This fixes #345 --- RecordTimer.py | 8 ++++++++ data/setup.xml | 1 + lib/python/Components/RecordingConfig.py | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) mode change 100644 => 100755 RecordTimer.py mode change 100644 => 100755 data/setup.xml mode change 100644 => 100755 lib/python/Components/RecordingConfig.py (limited to 'lib/python') diff --git a/RecordTimer.py b/RecordTimer.py old mode 100644 new mode 100755 index f670417a..04c3ff12 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -129,6 +129,7 @@ class RecordTimerEntry(timer.TimerEntry, object): def calculateFilename(self): service_name = self.service_ref.getServiceName() begin_date = strftime("%Y%m%d %H%M", localtime(self.begin)) + begin_shortdate = strftime("%Y%m%d", localtime(self.begin)) print "begin_date: ", begin_date print "service_name: ", service_name @@ -138,6 +139,13 @@ class RecordTimerEntry(timer.TimerEntry, object): filename = begin_date + " - " + service_name if self.name: filename += " - " + self.name + if config.usage.setup_level.index >= 2: # expert+ + if config.recording.filename_composition.value == "short": + filename = begin_shortdate + " - " + self.name + elif config.recording.filename_composition.value == "long": + filename = begin_date + " - " + service_name + " - " + self.name + " - " + self.description + else: + filename += " - " + self.name # standard if config.recording.ascii_filenames.value: filename = ASCIItranslit.legacyEncode(filename) diff --git a/data/setup.xml b/data/setup.xml old mode 100644 new mode 100755 index 9425afda..23338254 --- a/data/setup.xml +++ b/data/setup.xml @@ -70,6 +70,7 @@ config.usage.pip_zero_button config.usage.alternatives_priority config.recording.ascii_filenames + config.recording.filename_composition config.usage.hdd_standby diff --git a/lib/python/Components/RecordingConfig.py b/lib/python/Components/RecordingConfig.py old mode 100644 new mode 100755 index fe9284d9..40dfb2ca --- a/lib/python/Components/RecordingConfig.py +++ b/lib/python/Components/RecordingConfig.py @@ -1,4 +1,4 @@ -from config import ConfigNumber, ConfigYesNo, ConfigSubsection, config +from config import ConfigNumber, ConfigYesNo, ConfigSubsection, ConfigSelection, config def InitRecordingConfig(): config.recording = ConfigSubsection(); @@ -8,3 +8,7 @@ def InitRecordingConfig(): config.recording.margin_after = ConfigNumber(default=0) config.recording.debug = ConfigYesNo(default = False) config.recording.ascii_filenames = ConfigYesNo(default = False) + config.recording.filename_composition = ConfigSelection(default = "standard", choices = [ + ("standard", _("standard")), + ("short", _("Short filenames")), + ("long", _("Long filenames")) ] ) \ No newline at end of file -- cgit v1.2.3 From eedaa114b5af841f0e4442274d4408be98d956ce Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 26 May 2010 14:21:56 +0200 Subject: lib/python/Screens/Standby.py: ignore global actions in standby (i.e. mute/volume) this fixes bug #538 --- lib/python/Screens/Standby.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index 406b87cb..1a7ebbd1 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -3,6 +3,7 @@ from Components.ActionMap import ActionMap from Components.config import config from Components.AVSwitch import AVSwitch from Components.SystemInfo import SystemInfo +from GlobalActions import globalActionMap from enigma import eDVBVolumecontrol inStandby = None @@ -41,6 +42,8 @@ class Standby(Screen): "power": self.Power }, -1) + globalActionMap.setEnabled(False) + #mute adc self.setMute() @@ -72,6 +75,7 @@ class Standby(Screen): elif self.paused_service: self.paused_service.unPauseService() self.session.screen["Standby"].boolean = False + globalActionMap.setEnabled(True) def __onFirstExecBegin(self): global inStandby -- cgit v1.2.3 From db96b0766a1923d1fd4ba028c345c15b6a57dab5 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 29 Apr 2010 18:29:07 +0200 Subject: dm800se support --- data/defaults/Dream/Makefile.am | 2 ++ data/defaults/Dream/dm800se.info | 26 ++++++++++++++++++++++ data/defaults/Dream/settings.800se | 1 + lib/dvb/dvb.cpp | 4 +++- lib/dvb/dvb.h | 2 +- .../SystemPlugins/Videomode/VideoHardware.py | 4 ++-- .../Plugins/SystemPlugins/Videomode/VideoWizard.py | 4 ++-- 7 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 data/defaults/Dream/dm800se.info create mode 100644 data/defaults/Dream/settings.800se (limited to 'lib/python') diff --git a/data/defaults/Dream/Makefile.am b/data/defaults/Dream/Makefile.am index 31ba1c69..cda55835 100644 --- a/data/defaults/Dream/Makefile.am +++ b/data/defaults/Dream/Makefile.am @@ -4,10 +4,12 @@ installdir = $(pkgdatadir)/defaults/Dream dist_install_DATA = \ bouquets.tv \ + dm800se.info \ dm500hd.info \ dm7025.info \ dm8000.info \ dm800.info \ + settings.800se \ settings.500hd \ settings.7025 \ settings.800 \ diff --git a/data/defaults/Dream/dm800se.info b/data/defaults/Dream/dm800se.info new file mode 100644 index 00000000..6974b120 --- /dev/null +++ b/data/defaults/Dream/dm800se.info @@ -0,0 +1,26 @@ + + + + + + + + Dream Multimedia GmbH + Dream Multimedia Default + + + + + + + + + + + + diff --git a/data/defaults/Dream/settings.800se b/data/defaults/Dream/settings.800se new file mode 100644 index 00000000..ae2963bb --- /dev/null +++ b/data/defaults/Dream/settings.800se @@ -0,0 +1 @@ +config.misc.rcused=1 \ No newline at end of file diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 17712dde..688f1a13 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -96,6 +96,8 @@ eDVBResourceManager::eDVBResourceManager() m_boxtype = DM800; else if (!strncmp(tmp, "dm500hd\n", rd)) m_boxtype = DM500HD; + else if (!strncmp(tmp, "dm800se\n", rd)) + m_boxtype = DM800SE; else { eDebug("boxtype detection via /proc/stb/info not possible... use fallback via demux count!\n"); if (m_demux.size() == 3) @@ -455,7 +457,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr unused; - if (m_boxtype == DM800 || m_boxtype == DM500HD) // dm800 / 500hd + if (m_boxtype == DM800 || m_boxtype == DM500HD || m_boxtype == DM800SE) // dm800 / 500hd { cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux for (; i != m_demux.end(); ++i, ++n) diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 7b320006..9573bd48 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -135,7 +135,7 @@ class eDVBResourceManager: public iObject, public Object DECLARE_REF(eDVBResourceManager); int avail, busy; - enum { DM7025, DM800, DM500HD, DM8000 }; + enum { DM7025, DM800, DM500HD, DM800SE, DM8000 }; int m_boxtype; diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index e3b902f0..59c50476 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -239,9 +239,9 @@ class VideoHardware: portlist = self.getPortList() for port in portlist: descr = port - if descr == 'DVI' and hw_type == 'dm500hd': + if descr == 'DVI' and hw_type in ('dm500hd', 'dm800se'): descr = 'HDMI' - elif descr == 'DVI-PC' and hw_type == 'dm500hd': + elif descr == 'DVI-PC' and hw_type in ('dm500hd', 'dm800se'): descr = 'HDMI-PC' lst.append((port, descr)) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 15f4d516..3c76685e 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -82,7 +82,7 @@ class VideoWizard(WizardLanguage, Rc): for port in self.hw.getPortList(): if self.hw.isPortUsed(port): descr = port - if descr == 'DVI' and hw_type == 'dm500hd': + if descr == 'DVI' and hw_type in ('dm500hd', 'dm800se'): descr = 'HDMI' if port != "DVI-PC": list.append((descr,port)) @@ -100,7 +100,7 @@ class VideoWizard(WizardLanguage, Rc): self.inputSelect(self.selection) if self["portpic"].instance is not None: picname = self.selection - if picname == "DVI" and HardwareInfo().get_device_name() == "dm500hd": + if picname == "DVI" and HardwareInfo().get_device_name() in ("dm500hd", "dm800se"): picname = "HDMI" self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + picname + ".png")) -- cgit v1.2.3 From 62f0db333dd61a779e0545142a4f6d2c7daad52e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 8 Jun 2010 14:28:29 +0200 Subject: update unicable stuff (by adenin) --- data/Makefile.am | 3 +- data/unicable.xml | 172 ++++++++++++++++++++++++++++++++++ lib/dvb/frontend.cpp | 91 +++++++++--------- lib/dvb/frontend.h | 8 +- lib/dvb/idvb.h | 5 +- lib/dvb/sec.cpp | 82 +++++++++++++--- lib/dvb/sec.h | 13 ++- lib/python/Components/NimManager.py | 182 ++++++++++++++++++++++++------------ lib/python/Components/config.py | 3 +- lib/python/Screens/Satconfig.py | 15 ++- 10 files changed, 444 insertions(+), 130 deletions(-) create mode 100644 data/unicable.xml (limited to 'lib/python') diff --git a/data/Makefile.am b/data/Makefile.am index 84a59897..1ed9444b 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -14,4 +14,5 @@ dist_pkgdata_DATA = \ skin_default.xml \ skin.xml \ startwizard.xml \ - tutorialwizard.xml + tutorialwizard.xml \ + unicable.xml diff --git a/data/unicable.xml b/data/unicable.xml new file mode 100644 index 00000000..33951d7f --- /dev/null +++ b/data/unicable.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index bc3a88da..bd8f0028 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -582,7 +582,7 @@ int eDVBFrontend::openFrontend() return 0; } -int eDVBFrontend::closeFrontend(bool force) +int eDVBFrontend::closeFrontend(bool force, bool no_delayed) { if (!force && m_data[CUR_VOLTAGE] != -1 && m_data[CUR_VOLTAGE] != iDVBFrontend::voltageOff) { @@ -605,11 +605,34 @@ int eDVBFrontend::closeFrontend(bool force) eDebugNoSimulate("close frontend %d", m_dvbid); if (m_data[SATCR] != -1) { - turnOffSatCR(m_data[SATCR]); + if (!no_delayed) + { + m_sec->prepareTurnOffSatCR(*this, m_data[SATCR]); + m_tuneTimer->start(0, true); + if(!m_tuneTimer->isActive()) + { + int timeout=0; + eDebug("[turnOffSatCR] no mainloop"); + while(true) + { + timeout = tuneLoopInt(); + if (timeout == -1) + break; + usleep(timeout*1000); // blockierendes wait.. eTimer gibts ja nicht mehr + } + } + else + eDebug("[turnOffSatCR] running mainloop"); + return 0; + } + else + m_data[ROTOR_CMD] = -1; } + setTone(iDVBFrontend::toneOff); setVoltage(iDVBFrontend::voltageOff); m_tuneTimer->stop(); + if (m_sec && !m_simulate) m_sec->setRotorMoving(m_slotid, false); if (!::close(m_fd)) @@ -1486,9 +1509,14 @@ bool eDVBFrontend::setSecSequencePos(int steps) return true; } -void eDVBFrontend::tuneLoop() // called by m_tuneTimer +void eDVBFrontend::tuneLoop() +{ + tuneLoopInt(); +} + +int eDVBFrontend::tuneLoopInt() // called by m_tuneTimer { - int delay=0; + int delay=-1; eDVBFrontend *sec_fe = this; eDVBRegisteredFrontend *regFE = 0; long tmp = m_data[LINKED_PREV_PTR]; @@ -1518,6 +1546,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer { long *sec_fe_data = sec_fe->m_data; // eDebugNoSimulate("tuneLoop %d\n", m_sec_sequence.current()->cmd); + delay = 0; switch (m_sec_sequence.current()->cmd) { case eSecCommand::SLEEP: @@ -1844,6 +1873,13 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer ++m_sec_sequence.current(); break; } + case eSecCommand::DELAYED_CLOSE_FRONTEND: + { + eDebugNoSimulate("[SEC] delayed close frontend"); + closeFrontend(false, true); + ++m_sec_sequence.current(); + break; + } default: eDebugNoSimulate("[SEC] unhandled sec command %d", ++m_sec_sequence.current()->cmd); @@ -1856,6 +1892,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer regFE->dec_use(); if (m_simulate && m_sec_sequence.current() != m_sec_sequence.end()) tuneLoop(); + return delay; } void eDVBFrontend::setFrontend(bool recvEvents) @@ -2591,9 +2628,12 @@ RESULT eDVBFrontend::setSEC(iDVBSatelliteEquipmentControl *sec) return 0; } -RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list) +RESULT eDVBFrontend::setSecSequence(eSecCommandList &list) { - m_sec_sequence = list; + if (m_data[SATCR] != -1 && m_sec_sequence.current() != m_sec_sequence.end()) + m_sec_sequence.push_back(list); + else + m_sec_sequence = list; return 0; } @@ -2670,42 +2710,3 @@ arg_error: "eDVBFrontend::setSlotInfo must get a tuple with first param slotid, second param slot description and third param enabled boolean"); return false; } - -RESULT eDVBFrontend::turnOffSatCR(int satcr) -{ - eSecCommandList sec_sequence; - // check if voltage is disabled - eSecCommand::pair compare; - compare.steps = +9; //nothing to do - compare.voltage = iDVBFrontend::voltageOff; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50 ) ); - - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18_5) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) ); - - eDVBDiseqcCommand diseqc; - memset(diseqc.data, 0, MAX_DISEQC_LENGTH); - diseqc.len = 5; - diseqc.data[0] = 0xE0; - diseqc.data[1] = 0x10; - diseqc.data[2] = 0x5A; - diseqc.data[3] = satcr << 5; - diseqc.data[4] = 0x00; - - sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50+20+14*diseqc.len) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); - setSecSequence(sec_sequence); - return 0; -} - -RESULT eDVBFrontend::ScanSatCR() -{ - setFrontend(); - usleep(20000); - setTone(iDVBFrontend::toneOff); - return 0; -} diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index bc31755c..bef4a18f 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -110,6 +110,7 @@ private: void feEvent(int); void timeout(); void tuneLoop(); // called by m_tuneTimer + int tuneLoopInt(); void setFrontend(bool recvEvents=true); bool setSecSequencePos(int steps); static int PriorityOrder; @@ -130,7 +131,7 @@ public: RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc); RESULT sendToneburst(int burst); RESULT setSEC(iDVBSatelliteEquipmentControl *sec); - RESULT setSecSequence(const eSecCommandList &list); + RESULT setSecSequence(eSecCommandList &list); RESULT getData(int num, long &data); RESULT setData(int num, long val); @@ -148,12 +149,9 @@ public: void reopenFrontend(); int openFrontend(); - int closeFrontend(bool force=false); + int closeFrontend(bool force=false, bool no_delayed=false); const char *getDescription() const { return m_description; } bool is_simulate() const { return m_simulate; } - - RESULT turnOffSatCR(int satcr); - RESULT ScanSatCR(); }; #endif // SWIG diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index d20829bf..d00d1fc8 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,7 +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 int closeFrontend(bool force = false, bool no_delayed = false)=0; virtual void reopenFrontend()=0; #ifndef SWIG virtual RESULT connectStateChange(const Slot1 &stateChange, ePtr &connection)=0; @@ -471,7 +471,7 @@ public: virtual RESULT sendToneburst(int burst)=0; #ifndef SWIG virtual RESULT setSEC(iDVBSatelliteEquipmentControl *sec)=0; - virtual RESULT setSecSequence(const eSecCommandList &list)=0; + virtual RESULT setSecSequence(eSecCommandList &list)=0; #endif virtual int readFrontendData(int type)=0; virtual void getFrontendStatus(SWIG_PYOBJECT(ePyObject) dest)=0; @@ -491,6 +491,7 @@ class iDVBSatelliteEquipmentControl: public iObject { public: virtual RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id, unsigned int timeout)=0; + virtual void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr)=0; virtual int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *fe, int frontend_id, int *highest_score_lnb=0)=0; virtual void setRotorMoving(int slotid, bool)=0; }; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 0e3e7e0a..58fc5e39 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -108,6 +108,9 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite { bool rotor=false; eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx]; + bool is_unicable = lnb_param.SatCR_idx != -1; + bool is_unicable_position_switch = lnb_param.SatCR_positions > 1; + if ( lnb_param.m_slot_mask & slot_id ) // lnb for correct tuner? { int ret = 0; @@ -163,7 +166,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite eSecDebugNoSimulate("ret1 %d", ret); - if (linked_in_use) + if (linked_in_use && !is_unicable) { // compare tuner data if ( (csw != linked_csw) || @@ -176,7 +179,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite ret += 15; eSecDebugNoSimulate("ret2 %d", ret); } - else if (satpos_depends_ptr != -1) + else if ((satpos_depends_ptr != -1) && !(is_unicable && is_unicable_position_switch)) { eSecDebugNoSimulate("satpos depends"); eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) satpos_depends_ptr; @@ -209,7 +212,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite eSecDebugNoSimulate("ret5 %d", ret); - if (ret) + if (ret && lnb_param.SatCR_idx != -1) { int lof = sat.frequency > lnb_param.m_lof_threshold ? lnb_param.m_lof_hi : lnb_param.m_lof_lo; @@ -375,8 +378,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA { // calc Frequency local = abs(sat.frequency - - ((lof - (lof % 1000)) + ((lof % 1000)>500 ? 1000 : 0)) ); //TODO für den Mist mal ein Macro schreiben - parm.FREQUENCY = (local - (local % 125)) + ((local % 125)>62 ? 125 : 0); + - lof); + parm.FREQUENCY = ((((local * 2) / 125) + 1) / 2) * 125; frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - parm.FREQUENCY); if ( voltage_mode == eDVBSatelliteSwitchParameters::_14V @@ -396,20 +399,21 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA } else { - unsigned int tmp = abs(sat.frequency - - ((lof - (lof % 1000)) + ((lof % 1000)>500 ? 1000 : 0)) ) + int tmp1 = abs(sat.frequency + -lof) + lnb_param.SatCRvco - 1400000 + lnb_param.guard_offset; - parm.FREQUENCY = (lnb_param.SatCRvco - (tmp % 4000))+((tmp%4000)>2000?4000:0)+lnb_param.guard_offset; - lnb_param.UnicableTuningWord = (((tmp / 4000)+((tmp%4000)>2000?1:0)) + int tmp2 = ((((tmp1 * 2) / 4000) + 1) / 2) * 4000; + parm.FREQUENCY = lnb_param.SatCRvco - (tmp1-tmp2) + lnb_param.guard_offset; + lnb_param.UnicableTuningWord = ((tmp2 / 4000) | ((band & 1) ? 0x400 : 0) //HighLow | ((band & 2) ? 0x800 : 0) //VertHor | ((lnb_param.LNBNum & 1) ? 0 : 0x1000) //Umschaltung LNB1 LNB2 | (lnb_param.SatCR_idx << 13)); //Adresse des SatCR eDebug("[prepare] UnicableTuningWord %#04x",lnb_param.UnicableTuningWord); eDebug("[prepare] guard_offset %d",lnb_param.guard_offset); - frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - ((lnb_param.UnicableTuningWord & 0x3FF) *4000 + 1400000 - lnb_param.SatCRvco + lof)); + frontend.setData(eDVBFrontend::FREQ_OFFSET, (lnb_param.UnicableTuningWord & 0x3FF) *4000 + 1400000 + lof - (2 * (lnb_param.SatCRvco - (tmp1-tmp2))) ); } if (diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0) @@ -743,10 +747,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA diseqc.data[3] = RotorCmd; diseqc.data[4] = 0x00; } - if(lnb_param.SatCR_idx == -1) +// if(lnb_param.SatCR_idx == -1) { int mrt = m_params[MOTOR_RUNNING_TIMEOUT]; // in seconds! - if ( rotor_param.m_inputpower_parameters.m_use ) + if ( rotor_param.m_inputpower_parameters.m_use || lnb_param.SatCR_idx == -1) { // use measure rotor input power to detect rotor state bool turn_fast = need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed); eSecCommand::rotor cmd; @@ -950,6 +954,40 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA return -1; } +void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr) +{ + eSecCommandList sec_sequence; + + // check if voltage is disabled + eSecCommand::pair compare; + compare.steps = +9; //only close frontend + compare.voltage = iDVBFrontend::voltageOff; + + sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS]) ); + + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18_5) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS]) ); + + eDVBDiseqcCommand diseqc; + memset(diseqc.data, 0, MAX_DISEQC_LENGTH); + diseqc.len = 5; + diseqc.data[0] = 0xE0; + diseqc.data[1] = 0x10; + diseqc.data[2] = 0x5A; + diseqc.data[3] = satcr << 5; + diseqc.data[4] = 0x00; + + sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + sec_sequence.push_back( eSecCommand(eSecCommand::DELAYED_CLOSE_FRONTEND) ); + + frontend.setSecSequence(sec_sequence); +} + RESULT eDVBSatelliteEquipmentControl::clear() { eSecDebug("eDVBSatelliteEquipmentControl::clear()"); @@ -1254,6 +1292,26 @@ RESULT eDVBSatelliteEquipmentControl::setLNBSatCRvco(int SatCRvco) return -ENOENT; return 0; } + +RESULT eDVBSatelliteEquipmentControl::setLNBSatCRpositions(int SatCR_positions) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatCRpositions(%d)", SatCR_positions); + if(SatCR_positions < 1 || SatCR_positions > 2) + return -EPERM; + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].SatCR_positions = SatCR_positions; + else + return -ENOENT; + return 0; +} + +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRpositions() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCR_positions; + return -ENOENT; +} + RESULT eDVBSatelliteEquipmentControl::getLNBSatCR() { if ( currentLNBValid() ) diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index c50aee4d..b38671d2 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -25,7 +25,8 @@ public: IF_TONE_GOTO, IF_NOT_TONE_GOTO, START_TUNE_TIMEOUT, SET_ROTOR_MOVING, - SET_ROTOR_STOPPED + SET_ROTOR_STOPPED, + DELAYED_CLOSE_FRONTEND }; int cmd; struct rotor @@ -103,6 +104,11 @@ public: { secSequence.push_back(cmd); } + void push_back(eSecCommandList &list) + { + ASSERT(*this != list); + secSequence.splice(end(), list.secSequence); + } void clear() { secSequence.clear(); @@ -252,6 +258,7 @@ public: #define MAX_SATCR 8 #define MAX_LNBNUM 32 + int SatCR_positions; int SatCR_idx; unsigned int SatCRvco; unsigned int UnicableTuningWord; @@ -311,6 +318,7 @@ public: #ifndef SWIG eDVBSatelliteEquipmentControl(eSmartPtrList &avail_frontends, eSmartPtrList &avail_simulate_frontends); RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id, unsigned int tunetimeout); + void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr); // used for unicable int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id, int *highest_score_lnb=0); bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); } #endif @@ -346,9 +354,10 @@ public: /* Unicable Specific Parameters */ RESULT setLNBSatCR(int SatCR_idx); RESULT setLNBSatCRvco(int SatCRvco); -// RESULT checkGuardOffset(const eDVBFrontendParametersSatellite &sat); + RESULT setLNBSatCRpositions(int SatCR_positions); RESULT getLNBSatCR(); RESULT getLNBSatCRvco(); + RESULT getLNBSatCRpositions(); /* Satellite Specific Parameters */ RESULT addSatellite(int orbital_position); RESULT setVoltageMode(int mode); diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 3c96fbb9..de820160 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -16,6 +16,9 @@ from time import localtime, mktime from datetime import datetime from Tools.BoundFunction import boundFunction +from Tools import Directories +import xml.etree.cElementTree + def getConfigSatlist(orbpos, satlist): default_orbpos = None for x in satlist: @@ -234,6 +237,20 @@ class SecConfigure: print "sec config completed" def updateAdvanced(self, sec, slotid): + try: + if config.Nims[slotid].advanced.unicableconnected is not None: + if config.Nims[slotid].advanced.unicableconnected.value == True: + config.Nims[slotid].advanced.unicableconnectedTo.save_forced = True + self.linkNIMs(sec, slotid, int(config.Nims[slotid].advanced.unicableconnectedTo.value)) + connto = self.getRoot(slotid, int(config.Nims[slotid].advanced.unicableconnectedTo.value)) + if not self.linked.has_key(connto): + self.linked[connto] = [] + self.linked[connto].append(slotid) + else: + config.Nims[slotid].advanced.unicableconnectedTo.save_forced = False + except: + pass + lnbSat = {} for x in range(1,37): lnbSat[x] = [] @@ -276,24 +293,40 @@ class SecConfigure: sec.setLNBLOFH(10600000) sec.setLNBThreshold(11700000) elif currLnb.lof.value == "unicable": - sec.setLNBLOFL(9750000) - sec.setLNBLOFH(10600000) - sec.setLNBThreshold(11700000) if currLnb.unicable.value == "unicable_user": +#TODO satpositions for satcruser + sec.setLNBLOFL(currLnb.lofl.value * 1000) + sec.setLNBLOFH(currLnb.lofh.value * 1000) + sec.setLNBThreshold(currLnb.threshold.value * 1000) sec.setLNBSatCR(currLnb.satcruser.index) sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) + sec.setLNBSatCRpositions(1) #HACK elif currLnb.unicable.value == "unicable_matrix": manufacturer_name = currLnb.unicableMatrixManufacturer.value manufacturer = currLnb.unicableMatrix[manufacturer_name] product_name = manufacturer.product.value sec.setLNBSatCR(manufacturer.scr[product_name].index) sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) + sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) + sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) + sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) + sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) + currLnb.unicableMatrixManufacturer.save_forced = True + manufacturer.product.save_forced = True + manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True elif currLnb.unicable.value == "unicable_lnb": manufacturer_name = currLnb.unicableLnbManufacturer.value manufacturer = currLnb.unicableLnb[manufacturer_name] product_name = manufacturer.product.value sec.setLNBSatCR(manufacturer.scr[product_name].index) sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) + sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) + sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) + sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) + sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) + currLnb.unicableLnbManufacturer.save_forced = True + manufacturer.product.save_forced = True + manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True elif currLnb.lof.value == "c_band": sec.setLNBLOFL(5150000) sec.setLNBLOFH(5150000) @@ -988,55 +1021,57 @@ def InitNimManager(nimmgr): lnb_choices_default = "universal_lnb" - unicablelnbproducts = { - "Humax": {"150 SCR":("1210","1420","1680","2040")}, - "Inverto": {"IDLP-40UNIQD+S":("1680","1420","2040","1210")}, - "Kathrein": {"UAS481":("1400","1516","1632","1748")}, - "Kreiling": {"KR1440":("1680","1420","2040","1210")}, - "Radix": {"Unicable LNB":("1680","1420","2040","1210")}, - "Wisi": {"OC 05":("1210","1420","1680","2040")}} + unicablelnbproducts = {} + unicablematrixproducts = {} + doc = xml.etree.cElementTree.parse("/usr/share/enigma2/unicable.xml") + root = doc.getroot() + + entry = root.find("lnb") + for manufacturer in entry.getchildren(): + m={} + for product in manufacturer.getchildren(): + scr=[] + lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") + for i in range(len(lscr)): + scr.append(product.get(lscr[i],"0")) + for i in range(len(lscr)): + if scr[len(lscr)-i-1] == "0": + scr.pop() + else: + break; + lof=[] + lof.append(product.get("positions","1")) + lof.append(product.get("lofl","9750")) + lof.append(product.get("lofh","10600")) + lof.append(product.get("threshold","11700")) + scr.append(tuple(lof)) + m.update({product.get("name"):tuple(scr)}) + unicablelnbproducts.update({manufacturer.get("name"):m}) + + entry = root.find("matrix") + for manufacturer in entry.getchildren(): + m={} + for product in manufacturer.getchildren(): + scr=[] + lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") + for i in range(len(lscr)): + scr.append(product.get(lscr[i],"0")) + for i in range(len(lscr)): + if scr[len(lscr)-i-1] == "0": + scr.pop() + else: + break; + lof=[] + lof.append(product.get("positions","1")) + lof.append(product.get("lofl","9750")) + lof.append(product.get("lofh","10600")) + lof.append(product.get("threshold","11700")) + scr.append(tuple(lof)) + m.update({product.get("name"):tuple(scr)}) + unicablematrixproducts.update({manufacturer.get("name"):m}) + UnicableLnbManufacturers = unicablelnbproducts.keys() UnicableLnbManufacturers.sort() - - unicablematrixproducts = { - "Ankaro": { - "UCS 51440":("1400","1632","1284","1516"), - "UCS 51820":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 51840":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 52240":("1400","1632"), - "UCS 52420":("1400","1632","1284","1516"), - "UCS 52440":("1400","1632","1284","1516"), - "UCS 91440":("1400","1632","1284","1516"), - "UCS 91820":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 91840":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 92240":("1400","1632"), - "UCS 92420":("1400","1632","1284","1516"), - "UCS 92440":("1400","1632","1284","1516")}, - "DCT Delta": { - "SUM518":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SUM918":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SUM928":("1284","1400","1516","1632","1748","1864","1980","2096")}, - "Inverto": { - "IDLP-UST11O-CUO1O-8PP":("1076","1178","1280","1382","1484","1586","1688","1790")}, - "Kathrein": { - "EXR501":("1400","1516","1632","1748"), - "EXR551":("1400","1516","1632","1748"), - "EXR552":("1400","1516")}, - "ROTEK": { - "EKL2/1":("1400","1516"), - "EKL2/1E":("0","0","1632","1748")}, - "Smart": { - "DPA 51":("1284","1400","1516","1632","1748","1864","1980","2096")}, - "Technisat": { - "TechniRouter 5/1x8 G":("1284","1400","1516","1632","1748","1864","1980","2096"), - "TechniRouter 5/1x8 K":("1284","1400","1516","1632","1748","1864","1980","2096"), - "TechniRouter 5/2x4 G":("1284","1400","1516","1632"), - "TechniRouter 5/2x4 K":("1284","1400","1516","1632")}, - "Telstar": { - "SCR 5/1x8 G":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SCR 5/1x8 K":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SCR 5/2x4 G":("1284","1400","1516","1632"), - "SCR 5/2x4 K":("1284","1400","1516","1632")}} UnicableMatrixManufacturers = unicablematrixproducts.keys() UnicableMatrixManufacturers.sort() @@ -1117,7 +1152,7 @@ def InitNimManager(nimmgr): scrlist = [] vcolist = unicablematrixproducts[y][z] tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)): + for cnt in range(1,1+len(vcolist)-1): vcofreq = int(vcolist[cnt-1]) if vcofreq == 0: scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) @@ -1137,29 +1172,54 @@ def InitNimManager(nimmgr): tmp.product = ConfigSelection(choices = products, default = products[0]) tmp.scr = ConfigSubDict() tmp.vco = ConfigSubDict() + tmp.lofl = ConfigSubDict() + tmp.lofh = ConfigSubDict() + tmp.loft = ConfigSubDict() + tmp.positions = ConfigSubDict() for z in products: scrlist = [] vcolist = unicablelnbproducts[y][z] tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)): + for cnt in range(1,1+len(vcolist)-1): scrlist.append(("%d" %cnt,"SCR %d" %cnt)) vcofreq = int(vcolist[cnt-1]) tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + + positions = int(vcolist[len(vcolist)-1][0]) + tmp.positions[z] = ConfigSubList() + tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) + + lofl = vcolist[len(vcolist)-1][1] + tmp.lofl[z] = ConfigSubList() + tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) + + lofh = int(vcolist[len(vcolist)-1][2]) + tmp.lofh[z] = ConfigSubList() + tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) + + loft = int(vcolist[len(vcolist)-1][3]) + tmp.loft[z] = ConfigSubList() + tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) + section.unicableLnb[y] = tmp - + +#TODO satpositions for satcruser section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1") tmp = ConfigSubList() - tmp.append(ConfigInteger(default=1284, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1400, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1516, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1632, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1748, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1864, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1980, limits = (0, 9999))) - tmp.append(ConfigInteger(default=2096, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) + tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) section.satcrvcouser = tmp + nim.advanced.unicableconnected = ConfigYesNo(default=False) + nim.advanced.unicableconnectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) + def configDiSEqCModeChanged(configElement): section = configElement.section if configElement.value == "1_2" and isinstance(section.longitude, ConfigNothing): diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 471b59ec..d7506e31 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -29,6 +29,7 @@ from time import localtime, strftime class ConfigElement(object): def __init__(self): self.saved_value = None + self.save_forced = False self.last_value = None self.save_disabled = False self.__notifiers = None @@ -83,7 +84,7 @@ class ConfigElement(object): # you need to override this if str(self.value) doesn't work def save(self): - if self.save_disabled or self.value == self.default: + if self.save_disabled or (self.value == self.default and not self.save_forced): self.saved_value = None else: self.saved_value = self.tostring(self.value) diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 87d65e54..40e89420 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -95,6 +95,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType = None self.advancedManufacturer = None self.advancedSCR = None + self.advancedConnected = None if self.nim.isMultiType(): multiType = self.nimConfig.multiType @@ -205,7 +206,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): checkList = (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, \ self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, \ self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, \ - self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ + self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, self.advancedConnected, \ self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) if self["config"].getCurrent() == self.multiType: from Components.NimManager import InitNimManager @@ -285,6 +286,18 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.list.append(self.advancedType) self.list.append(self.advancedSCR) self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index])) + + choices = [] + connectable = nimmanager.canConnectTo(self.slotid) + for id in connectable: + choices.append((str(id), nimmanager.getNimDescription(id))) + if len(choices): + self.advancedConnected = getConfigListEntry(_("connected"), self.nimConfig.advanced.unicableconnected) + self.list.append(self.advancedConnected) + if self.nimConfig.advanced.unicableconnected.value == True: + self.nimConfig.advanced.unicableconnectedTo.setChoices(choices) + self.list.append(getConfigListEntry(_("Connected to"),self.nimConfig.advanced.unicableconnectedTo)) + else: #kein Unicable self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage)) self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage)) -- cgit v1.2.3 From 8c18cd1cb867cd915d8cd3830dcb32b32db4fce3 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 8 Jun 2010 19:49:22 +0200 Subject: NimManager.py: add missing conversion to int --- lib/python/Components/NimManager.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index de820160..baa3b659 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1040,10 +1040,10 @@ def InitNimManager(nimmgr): else: break; lof=[] - lof.append(product.get("positions","1")) - lof.append(product.get("lofl","9750")) - lof.append(product.get("lofh","10600")) - lof.append(product.get("threshold","11700")) + lof.append(int(product.get("positions",1))) + lof.append(int(product.get("lofl",9750))) + lof.append(int(product.get("lofh",10600))) + lof.append(int(product.get("threshold",11700))) scr.append(tuple(lof)) m.update({product.get("name"):tuple(scr)}) unicablelnbproducts.update({manufacturer.get("name"):m}) @@ -1062,10 +1062,10 @@ def InitNimManager(nimmgr): else: break; lof=[] - lof.append(product.get("positions","1")) - lof.append(product.get("lofl","9750")) - lof.append(product.get("lofh","10600")) - lof.append(product.get("threshold","11700")) + lof.append(int(product.get("positions",1))) + lof.append(int(product.get("lofl",9750))) + lof.append(int(product.get("lofh",10600))) + lof.append(int(product.get("threshold",11700))) scr.append(tuple(lof)) m.update({product.get("name"):tuple(scr)}) unicablematrixproducts.update({manufacturer.get("name"):m}) -- cgit v1.2.3 From a39ea95f5376d25874ebfbae8f10b9e6761f368b Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Jun 2010 14:18:29 +0200 Subject: fix crash when unicable matrix is selected, cleanup code --- lib/python/Components/NimManager.py | 124 +++++++++++++++--------------------- 1 file changed, 52 insertions(+), 72 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index baa3b659..553de9c9 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -293,17 +293,9 @@ class SecConfigure: sec.setLNBLOFH(10600000) sec.setLNBThreshold(11700000) elif currLnb.lof.value == "unicable": - if currLnb.unicable.value == "unicable_user": -#TODO satpositions for satcruser - sec.setLNBLOFL(currLnb.lofl.value * 1000) - sec.setLNBLOFH(currLnb.lofh.value * 1000) - sec.setLNBThreshold(currLnb.threshold.value * 1000) - sec.setLNBSatCR(currLnb.satcruser.index) - sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) - sec.setLNBSatCRpositions(1) #HACK - elif currLnb.unicable.value == "unicable_matrix": - manufacturer_name = currLnb.unicableMatrixManufacturer.value - manufacturer = currLnb.unicableMatrix[manufacturer_name] + def setupUnicable(configManufacturer, ProductDict): + manufacturer_name = configManufacturer.value + manufacturer = ProductDict[manufacturer_name] product_name = manufacturer.product.value sec.setLNBSatCR(manufacturer.scr[product_name].index) sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) @@ -311,22 +303,22 @@ class SecConfigure: sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) - currLnb.unicableMatrixManufacturer.save_forced = True + configManufacturer.save_forced = True manufacturer.product.save_forced = True manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True + + if currLnb.unicable.value == "unicable_user": +#TODO satpositions for satcruser + sec.setLNBLOFL(currLnb.lofl.value * 1000) + sec.setLNBLOFH(currLnb.lofh.value * 1000) + sec.setLNBThreshold(currLnb.threshold.value * 1000) + sec.setLNBSatCR(currLnb.satcruser.index) + sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) + sec.setLNBSatCRpositions(1) #HACK + elif currLnb.unicable.value == "unicable_matrix": + setupUnicable(currLnb.unicableMatrixManufacturer, currLnb.unicableMatrix) elif currLnb.unicable.value == "unicable_lnb": - manufacturer_name = currLnb.unicableLnbManufacturer.value - manufacturer = currLnb.unicableLnb[manufacturer_name] - product_name = manufacturer.product.value - sec.setLNBSatCR(manufacturer.scr[product_name].index) - sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) - sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) - sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) - sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) - sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) - currLnb.unicableLnbManufacturer.save_forced = True - manufacturer.product.save_forced = True - manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True + setupUnicable(currLnb.unicableLnbManufacturer, currLnb.unicableLnb) elif currLnb.lof.value == "c_band": sec.setLNBLOFL(5150000) sec.setLNBLOFH(5150000) @@ -1138,72 +1130,60 @@ def InitNimManager(nimmgr): else: section.unicable = ConfigSelection(choices = {"unicable_user": _("User defined")}, default = "unicable_user") - if lnb < 3: - section.unicableMatrix = ConfigSubDict() - section.unicableMatrixManufacturer = ConfigSelection(choices = UnicableMatrixManufacturers, default = UnicableMatrixManufacturers[0]) - for y in unicablematrixproducts: - products = unicablematrixproducts[y].keys() + def fillUnicableConf(sectionDict, unicableproducts, vco_null_check): + for y in unicableproducts: + products = unicableproducts[y].keys() products.sort() tmp = ConfigSubsection() tmp.product = ConfigSelection(choices = products, default = products[0]) tmp.scr = ConfigSubDict() tmp.vco = ConfigSubDict() + tmp.lofl = ConfigSubDict() + tmp.lofh = ConfigSubDict() + tmp.loft = ConfigSubDict() + tmp.positions = ConfigSubDict() for z in products: scrlist = [] - vcolist = unicablematrixproducts[y][z] + vcolist = unicableproducts[y][z] tmp.vco[z] = ConfigSubList() for cnt in range(1,1+len(vcolist)-1): vcofreq = int(vcolist[cnt-1]) - if vcofreq == 0: + if vcofreq == 0 and vco_null_check: scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) else: scrlist.append(("%d" %cnt,"SCR %d" %cnt)) tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - section.unicableMatrix[y] = tmp + tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + + positions = int(vcolist[len(vcolist)-1][0]) + tmp.positions[z] = ConfigSubList() + tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) + + lofl = vcolist[len(vcolist)-1][1] + tmp.lofl[z] = ConfigSubList() + tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) + + lofh = int(vcolist[len(vcolist)-1][2]) + tmp.lofh[z] = ConfigSubList() + tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) + + loft = int(vcolist[len(vcolist)-1][3]) + tmp.loft[z] = ConfigSubList() + tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) + sectionDict[y] = tmp + + if lnb < 3: + print "MATRIX" + section.unicableMatrix = ConfigSubDict() + section.unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0]) + fillUnicableConf(section.unicableMatrix, unicablematrixproducts, True) if lnb < 2: + print "LNB" section.unicableLnb = ConfigSubDict() section.unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) - for y in unicablelnbproducts: - products = unicablelnbproducts[y].keys() - products.sort() - tmp = ConfigSubsection() - tmp.product = ConfigSelection(choices = products, default = products[0]) - tmp.scr = ConfigSubDict() - tmp.vco = ConfigSubDict() - tmp.lofl = ConfigSubDict() - tmp.lofh = ConfigSubDict() - tmp.loft = ConfigSubDict() - tmp.positions = ConfigSubDict() - for z in products: - scrlist = [] - vcolist = unicablelnbproducts[y][z] - tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)-1): - scrlist.append(("%d" %cnt,"SCR %d" %cnt)) - vcofreq = int(vcolist[cnt-1]) - tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - - positions = int(vcolist[len(vcolist)-1][0]) - tmp.positions[z] = ConfigSubList() - tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) - - lofl = vcolist[len(vcolist)-1][1] - tmp.lofl[z] = ConfigSubList() - tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) - - lofh = int(vcolist[len(vcolist)-1][2]) - tmp.lofh[z] = ConfigSubList() - tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) - - loft = int(vcolist[len(vcolist)-1][3]) - tmp.loft[z] = ConfigSubList() - tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) - - section.unicableLnb[y] = tmp - + fillUnicableConf(section.unicableLnb, unicablelnbproducts, False) + #TODO satpositions for satcruser section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1") tmp = ConfigSubList() -- cgit v1.2.3 From 43f543871592eda0489f6dcbf3ad901309aaa9f9 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 10 Jun 2010 15:19:12 +0200 Subject: add missing dm800se color oled screens. refs #530 --- data/skin_default.xml | 227 +++++++++++++++------ lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 19 +- .../Plugins/Extensions/MediaPlayer/plugin.py | 11 +- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 14 +- .../Plugins/SystemPlugins/Videomode/VideoWizard.py | 14 +- 5 files changed, 211 insertions(+), 74 deletions(-) mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml index 832ee70e..5e28ca83 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -164,9 +164,7 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count > 7 and 2 or 3) - - - + @@ -511,10 +509,6 @@ newwidth = wsize[0] self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - - - - @@ -1042,11 +1036,55 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + Name @@ -1059,9 +1097,21 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Format:%S + + + + + Name + + + Progress + + + Format:%H:%M + - + Name @@ -1095,15 +1145,8 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Blink - - - - - - - - + Name @@ -1118,18 +1161,89 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Blink + + + + Name + + + Position + + + Format:%H:%M + + + config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean + Blink + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + Format:%H:%M @@ -1138,37 +1252,18 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Blink - - - - - - - - - - - - - - - - - - - - - - - - + + + + Format:%H:%M - - + + config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean + Blink - - + + @@ -1176,19 +1271,29 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - - - - - - + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index e092e82f..64b4ae50 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -88,8 +88,8 @@ class FileBrowser(Screen): self.close(None) class DVDSummary(Screen): - skin = """ - + skin = ( + """ Name @@ -101,7 +101,20 @@ class DVDSummary(Screen): Position - """ + """, + """ + + Name + + + + + Position + + + Position + + """) def __init__(self, session, parent): Screen.__init__(self, session, parent) diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 036bbbb9..28cf7238 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -925,12 +925,17 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.clear_playlist() class MediaPlayerLCDScreen(Screen): - skin = """ - + skin = ( + """ - """ + """, + """ + + + + """) def __init__(self, session, parent): Screen.__init__(self, session) diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py old mode 100644 new mode 100755 index 8986560b..7a0da851 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -39,13 +39,19 @@ class writeNAND(Task): self.output_line = data class NFISummary(Screen): - skin = """ - + skin = ( + """ - - """ + + """, + """ + + + + + """) def __init__(self, session, parent): Screen.__init__(self, session, parent) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py old mode 100644 new mode 100755 index 3c76685e..9b9044ee --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -12,14 +12,22 @@ from Tools.HardwareInfo import HardwareInfo config.misc.showtestcard = ConfigBoolean(default = False) class VideoWizardSummary(WizardSummary): - skin = """ - + skin = ( + """ - """ #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png")) + """, + """ + + + + + + """) + #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png")) def __init__(self, session, parent): WizardSummary.__init__(self, session, parent) -- cgit v1.2.3 From 2048bec4bfd7a99833b50557020a43d05d92ac8b Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 28 Jun 2010 18:27:26 +0200 Subject: add support for /proc/stb/frontend/X/lnb_sense --- lib/dvb/frontend.cpp | 8 +++++--- lib/python/Components/NimManager.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 233921dc..5d3d36d7 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -1435,9 +1435,11 @@ int eDVBFrontend::readInputpower() return 0; int power=m_slotid; // this is needed for read inputpower from the correct tuner ! char proc_name[64]; - sprintf(proc_name, "/proc/stb/fp/lnb_sense%d", m_slotid); - FILE *f=fopen(proc_name, "r"); - if (f) + char proc_name2[64]; + sprintf(proc_name, "/proc/stb/frontend/%d/lnb_sense", m_slotid); + sprintf(proc_name2, "/proc/stb/fp/lnb_sense%d", m_slotid); + FILE *f; + if ((f=fopen(proc_name, "r")) || (f=fopen(proc_name2, "r"))) { if (fscanf(f, "%d", &power) != 1) eDebug("read %s failed!! (%m)", proc_name); diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 3c96fbb9..a69df009 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1168,7 +1168,7 @@ def InitNimManager(nimmgr): section.latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)]) section.latitudeOrientation = ConfigSelection(latitude_orientation_choices, "north") section.powerMeasurement = ConfigYesNo(default=True) - section.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) + section.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm7025" and 50 or 15, limits=(0, 100)) section.turningSpeed = ConfigSelection(turning_speed_choices, "fast") section.fastTurningBegin = ConfigDateTime(default=advanced_lnb_fast_turning_btime, formatstring = _("%H:%M"), increment = 600) section.fastTurningEnd = ConfigDateTime(default=advanced_lnb_fast_turning_etime, formatstring = _("%H:%M"), increment = 600) -- cgit v1.2.3 From 9db4863afb7c32efbdd2d4fc5b5caa674914f823 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 6 Jul 2010 15:39:32 +0200 Subject: Screens/Ipkg.py: properly count processed packages. refs #550 --- lib/python/Screens/Ipkg.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/Ipkg.py b/lib/python/Screens/Ipkg.py index 96876336..7f98f3df 100755 --- a/lib/python/Screens/Ipkg.py +++ b/lib/python/Screens/Ipkg.py @@ -25,6 +25,7 @@ class Ipkg(Screen): self.packages = 0 self.error = 0 + self.processed_packages = [] self.activity = 0 self.activityTimer = eTimer() @@ -85,15 +86,21 @@ class Ipkg(Screen): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_("Upgrading")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_("Installing")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_REMOVE: self.package.setText(param) self.status.setText(_("Removing")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_CONFIGURING: self.package.setText(param) self.status.setText(_("Configuring")) @@ -103,10 +110,10 @@ class Ipkg(Screen): self.runNextCmd() 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) - ) + self.modificationCallback, + MessageBox, + _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) + ) def modificationCallback(self, res): self.ipkg.write(res and "N" or "Y") -- cgit v1.2.3 From eaad1f0e4ed9bd3d3cfca1c6e98c68c294d3df23 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 6 Jul 2010 15:41:11 +0200 Subject: Softwaremanager: * properly count processed packages. * make configfile owerwrite question while upgrading configurable over new setupscreen on Menu Button. * show files that will be backed up inside own infoscreen and not inside the menu description. * add possibility to navigate with the remote keys (a-z) inside packagemanager. thx emanuel fixes #550 --- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 124 +++++++-- .../SystemPlugins/SoftwareManager/plugin.py | 302 +++++++++++++++++++-- 2 files changed, 388 insertions(+), 38 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index d4653cca..a29a5e99 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -1,4 +1,5 @@ -from enigma import eConsoleAppContainer +# -*- coding: iso-8859-1 -*- +from enigma import eConsoleAppContainer,eTPM from Components.Console import Console from Components.About import about from Components.DreamInfoHandler import DreamInfoHandler @@ -8,9 +9,49 @@ from Components.Ipkg import IpkgComponent from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR from Tools.HardwareInfo import HardwareInfo +import sha from time import time +def bin2long(s): + return reduce( lambda x,y:(x<<8L)+y, map(ord, s)) + +def long2bin(l): + res = "" + for byte in range(128): + res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff) + return res + +def rsa_pub1024(src, mod): + return long2bin(pow(bin2long(src), 65537, bin2long(mod))) + +def decrypt_block(src, mod): + if len(src) != 128 and len(src) != 202: + return None + dest = rsa_pub1024(src[:128], mod) + hash = sha.new(dest[1:107]) + if len(src) == 202: + hash.update(src[131:192]) + result = hash.digest() + if result == dest[107:127]: + return dest + return None + +def validate_cert(cert, key): + buf = decrypt_block(cert[8:], key) + if buf is None: + return None + return buf[36:107] + cert[139:196] + +def read_random(): + try: + fd = open("/dev/urandom", "r") + buf = fd.read(8) + fd.close() + return buf + except: + return None + class SoftwareTools(DreamInfoHandler): lastDownloadDate = None NetworkConnectionAvailable = None @@ -58,24 +99,71 @@ class SoftwareTools(DreamInfoHandler): self.getUpdates() def getUpdates(self, callback = None): - if SoftwareTools.NetworkConnectionAvailable == True: - SoftwareTools.lastDownloadDate = time() - if SoftwareTools.list_updating is False and callback is None: - SoftwareTools.list_updating = True - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - elif SoftwareTools.list_updating is False and callback is not None: - SoftwareTools.list_updating = True - self.NotifierCallback = callback - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - elif SoftwareTools.list_updating is True and callback is not None: - #update info collecting already in progress - self.NotifierCallback = callback + if SoftwareTools.lastDownloadDate is None: + if self.hardware_info.device_name != "dm7025": + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + return + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + return + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "please run the genuine dreambox plugin" + return + l3key = validate_cert(l3cert, l2key) + if l3key is None: + return + rnd = read_random() + if rnd is None: + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if self.hardware_info.device_name == "dm7025" or result[80:88] == rnd: + if SoftwareTools.NetworkConnectionAvailable == True: + SoftwareTools.lastDownloadDate = time() + if SoftwareTools.list_updating is False and callback is None: + SoftwareTools.list_updating = True + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is False and callback is not None: + SoftwareTools.list_updating = True + self.NotifierCallback = callback + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is True and callback is not None: + self.NotifierCallback = callback + else: + SoftwareTools.list_updating = False + if callback is not None: + callback(False) + elif self.NotifierCallback is not None: + self.NotifierCallback(False) + else: + SoftwareTools.NetworkConnectionAvailable = False + SoftwareTools.list_updating = False + if callback is not None: + callback(False) + elif self.NotifierCallback is not None: + self.NotifierCallback(False) else: - SoftwareTools.list_updating = False - if callback is not None: - callback(False) - elif self.NotifierCallback is not None: - self.NotifierCallback(False) + if SoftwareTools.NetworkConnectionAvailable == True: + SoftwareTools.lastDownloadDate = time() + if SoftwareTools.list_updating is False and callback is None: + SoftwareTools.list_updating = True + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is False and callback is not None: + SoftwareTools.list_updating = True + self.NotifierCallback = callback + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is True and callback is not None: + self.NotifierCallback = callback + else: + SoftwareTools.list_updating = False + if callback is not None: + callback(False) + elif self.NotifierCallback is not None: + self.NotifierCallback(False) def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_ERROR: diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 1e0ed4d5..99837678 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -14,7 +14,8 @@ 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.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigYesNo, ConfigSelection +from Components.ConfigList import ConfigListScreen from Components.Console import Console from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest from Components.SelectionList import SelectionList @@ -26,7 +27,8 @@ from Components.AVSwitch import AVSwitch from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad +from Tools.NumericalTextInput import NumericalTextInput +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode 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 @@ -43,6 +45,14 @@ 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']) +config.plugins.SoftwareManager = ConfigSubsection() +config.plugins.SoftwareManager.overwriteConfigFiles = ConfigSelection( + [ + ("Y", _("Yes, always")), + ("N", _("No, never")), + ("ask", _("Always ask")) + ], "Y") + def write_cache(cache_file, cache_data): #Does a cPickle dump if not os_path.isdir( os_path.dirname(cache_file) ): @@ -109,13 +119,16 @@ class UpdatePluginMenu(Screen): self.menu = args self.list = [] self.oktext = _("\nPress OK on your remote control to continue.") + self.menutext = _("Press MENU on your remote control for additional options.") + self.infotext = _("Press INFO on your remote control for additional information.") self.text = "" self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) if self.menu == 0: + print "building menu entries" self.list.append(("install-extensions", _("Manage extensions"), _("\nManage extensions or plugins for your Dreambox" ) + self.oktext, None)) self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + 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-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext + "\n\n" + self.infotext, 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 extensions and install them." ) + self.oktext, None)) for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): @@ -136,7 +149,7 @@ class UpdatePluginMenu(Screen): 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)) + self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup.") + self.oktext + "\n\n" + self.infotext, 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)) @@ -156,25 +169,25 @@ class UpdatePluginMenu(Screen): self["menu"] = List(self.list) self["key_red"] = StaticText(_("Close")) - self["status"] = StaticText("") + self["status"] = StaticText(self.menutext) - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions"], + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "MenuActions"], { "ok": self.go, "back": self.close, "red": self.close, + "menu": self.handleMenu, + "showEventInfo": self.handleInfo, }, -1) self.onLayoutFinish.append(self.layoutFinished) self.backuppath = getBackupPath() self.backupfile = getBackupFilename() self.fullbackupfilename = self.backuppath + "/" + self.backupfile self.onShown.append(self.setWindowTitle) - #self.onClose.append(self.cleanup) def layoutFinished(self): idx = 0 self["menu"].index = idx - #self.getUpdateInfos() def setWindowTitle(self): self.setTitle(_("Software management")) @@ -201,9 +214,17 @@ class UpdatePluginMenu(Screen): self.text = _("No network connection available.") self["status"].setText(self.text) + def handleMenu(self): + self.session.open(SoftwareManagerSetup) + + def handleInfo(self): + current = self["menu"].getCurrent() + if current: + currentEntry = current[0] + if currentEntry in ("system-backup","backupfiles"): + self.session.open(SoftwareManagerInfo, mode = "backupinfo") def go(self): - #iNetwork.stopPingConsole() current = self["menu"].getCurrent() if current: currentEntry = current[0] @@ -290,6 +311,185 @@ class UpdatePluginMenu(Screen): self.exe = True self.session.open(RestoreScreen, runRestore = True) +class SoftwareManagerSetup(Screen, ConfigListScreen): + + skin = """ + + + + + + + + + + + + + """ + + def __init__(self, session, skin_path = None): + Screen.__init__(self, session) + self.session = session + self.skin_path = skin_path + if self.skin_path == None: + self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") + + self.onChangedEntry = [ ] + self.setup_title = _("Software manager setup") + self.overwriteConfigfilesEntry = None + + self.list = [ ] + ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry) + + self["actions"] = ActionMap(["SetupActions"], + { + "cancel": self.keyCancel, + "save": self.apply, + }, -2) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.createSetup() + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(self.setup_title) + + def createSetup(self): + self.list = [ ] + self.overwriteConfigfilesEntry = getConfigListEntry(_("Overwrite configuration files ?"), config.plugins.SoftwareManager.overwriteConfigFiles) + self.list.append(self.overwriteConfigfilesEntry) + self["config"].list = self.list + self["config"].l.setSeperation(400) + self["config"].l.setList(self.list) + if not self.selectionChanged in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.selectionChanged) + self.selectionChanged() + + def selectionChanged(self): + if self["config"].getCurrent() == self.overwriteConfigfilesEntry: + self["introduction"].setText(_("Overwrite configuration files during software upgrade?")) + else: + self["introduction"].setText("") + + def newConfig(self): + pass + + def keyLeft(self): + ConfigListScreen.keyLeft(self) + + def keyRight(self): + ConfigListScreen.keyRight(self) + + def confirm(self, confirmed): + if not confirmed: + print "not confirmed" + return + else: + self.keySave() + + def apply(self): + self.session.openWithCallback(self.confirm, MessageBox, _("Use this settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + + def cancelConfirm(self, result): + if not result: + return + for x in self["config"].list: + x[1].cancel() + self.close() + + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + else: + self.close() + + # for summary: + def changedEntry(self): + for x in self.onChangedEntry: + x() + self.selectionChanged() + + def getCurrentEntry(self): + return self["config"].getCurrent()[0] + + def getCurrentValue(self): + return str(self["config"].getCurrent()[1].value) + + def createSummary(self): + from Screens.Setup import SetupSummary + return SetupSummary + + +class SoftwareManagerInfo(Screen): + skin = """ + + + + + + + + + + + + {"template": [ + MultiContentEntryText(pos = (5, 0), size = (540, 26), font=0, flags = RT_HALIGN_LEFT | RT_HALIGN_CENTER, text = 0), # index 0 is the name + ], + "fonts": [gFont("Regular", 24),gFont("Regular", 22)], + "itemHeight": 26 + } + + + + + """ + + def __init__(self, session, skin_path = None, mode = None): + Screen.__init__(self, session) + self.session = session + self.mode = mode + self.skin_path = skin_path + if self.skin_path == None: + self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") + + self["actions"] = ActionMap(["ShortcutActions", "WizardActions"], + { + "back": self.close, + "red": self.close, + }, -2) + + self.list = [] + self["list"] = List(self.list) + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText() + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(_("Softwaremanager information")) + if self.mode is not None: + self.showInfos() + + def showInfos(self): + if self.mode == "backupinfo": + self.list = [] + backupfiles = config.plugins.configurationbackup.backupdirs.value + for entry in backupfiles: + print entry + self.list.append((entry,)) + self['list'].setList(self.list) + class PluginManager(Screen, DreamInfoHandler): @@ -1095,7 +1295,7 @@ class PluginDetails(Screen, DreamInfoHandler): class UpdatePlugin(Screen): skin = """ - + @@ -1115,9 +1315,11 @@ class UpdatePlugin(Screen): self["status"] = self.status self.package = StaticText() self["package"] = self.package + self.oktext = _("Press OK on your remote control to continue.") self.packages = 0 self.error = 0 + self.processed_packages = [] self.activity = 0 self.activityTimer = eTimer() @@ -1151,20 +1353,34 @@ class UpdatePlugin(Screen): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_("Upgrading")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_("Installing")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 + elif event == IpkgComponent.EVENT_REMOVE: + self.package.setText(param) + self.status.setText(_("Removing")) + if not param in self.processed_packages: + self.processed_packages.append(param) + 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) - ) + if config.plugins.SoftwareManager.overwriteConfigFiles.value in ("N", "Y"): + self.ipkg.write(True and config.plugins.SoftwareManager.overwriteConfigFiles.value) + else: + 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: @@ -1178,7 +1394,7 @@ class UpdatePlugin(Screen): self.activityslider.setValue(0) self.package.setText("") - self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages) + self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages + "\n\n" + self.oktext) else: self.activityTimer.stop() self.activityslider.setValue(0) @@ -1381,7 +1597,7 @@ class IPKGSource(Screen): self["text"].number(number) -class PacketManager(Screen): +class PacketManager(Screen, NumericalTextInput): skin = """ @@ -1405,15 +1621,29 @@ class PacketManager(Screen): def __init__(self, session, plugin_path, args = None): Screen.__init__(self, session) + NumericalTextInput.__init__(self) self.session = session self.skin_path = plugin_path - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz') + + self["shortcuts"] = NumberActionMap(["ShortcutActions", "WizardActions", "NumberActions", "InputActions", "InputAsciiActions", "KeyboardInputActions" ], { "ok": self.go, "back": self.exit, "red": self.exit, "green": self.reload, + "gotAsciiCode": self.keyGotAscii, + "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.list = [] @@ -1438,12 +1668,44 @@ class PacketManager(Screen): self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.rebuildList) + rcinput = eRCInput.getInstance() + rcinput.setKeyboardMode(rcinput.kmAscii) + + def keyNumberGlobal(self, val): + key = self.getKey(val) + if key is not None: + keyvalue = key.encode("utf-8") + if len(keyvalue) == 1: + self.setNextIdx(keyvalue[0]) + + def keyGotAscii(self): + keyvalue = unichr(getPrevAsciiCode()).encode("utf-8") + if len(keyvalue) == 1: + self.setNextIdx(keyvalue[0]) + + def setNextIdx(self,char): + if char in ("0", "1", "a"): + self["list"].setIndex(0) + else: + idx = self.getNextIdx(char) + if idx and idx <= self["list"].count: + self["list"].setIndex(idx) + + def getNextIdx(self,char): + idx = 0 + for i in self["list"].list: + if i[0][0] == char: + return idx + idx += 1 + 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) + rcinput = eRCInput.getInstance() + rcinput.setKeyboardMode(rcinput.kmNone) self.close() def reload(self): -- cgit v1.2.3 From fcb47d3f536f619b872184a7ab241be08307bf6e Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 May 2010 14:24:22 +0200 Subject: Network.py,NetworkSetup.py,skin_default.xml: * Introduce new unified naming for network interfaces. * Redesign NetworkadapterSelection Screen. * small cleanups. Refs #137 , Fixes #418 --- data/skin_default.xml | 14 +++- data/skin_default/icons/Makefile.am | 6 ++ data/skin_default/icons/network_wired-active.png | Bin 0 -> 2771 bytes data/skin_default/icons/network_wired-inactive.png | Bin 0 -> 2745 bytes data/skin_default/icons/network_wired.png | Bin 0 -> 2477 bytes .../skin_default/icons/network_wireless-active.png | Bin 0 -> 2821 bytes .../icons/network_wireless-inactive.png | Bin 0 -> 2745 bytes data/skin_default/icons/network_wireless.png | Bin 0 -> 2539 bytes lib/python/Components/Network.py | 51 ++++++++++-- lib/python/Screens/NetworkSetup.py | 90 ++++++++++++--------- 10 files changed, 114 insertions(+), 47 deletions(-) mode change 100644 => 100755 data/skin_default/icons/Makefile.am create mode 100755 data/skin_default/icons/network_wired-active.png create mode 100755 data/skin_default/icons/network_wired-inactive.png create mode 100755 data/skin_default/icons/network_wired.png create mode 100755 data/skin_default/icons/network_wireless-active.png create mode 100755 data/skin_default/icons/network_wireless-inactive.png create mode 100755 data/skin_default/icons/network_wireless.png (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml index 0114349b..497d33ac 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -577,7 +577,19 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + + + {"template": [ + MultiContentEntryText(pos = (85, 6), size = (440, 28), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1), # index 1 is the interfacename + MultiContentEntryText(pos = (85, 43), size = (440, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, text = 2), # index 2 is the description + MultiContentEntryPixmapAlphaTest(pos = (2, 8), size = (54, 54), png = 3), # index 3 is the interface pixmap + MultiContentEntryPixmapAlphaTest(pos = (63, 46), size = (15, 16), png = 4), # index 4 is the default pixmap + ], + "fonts": [gFont("Regular", 28),gFont("Regular", 20)], + "itemHeight": 70 + } + + diff --git a/data/skin_default/icons/Makefile.am b/data/skin_default/icons/Makefile.am old mode 100644 new mode 100755 index 8e2052b0..088556a6 --- a/data/skin_default/icons/Makefile.am +++ b/data/skin_default/icons/Makefile.am @@ -34,6 +34,12 @@ dist_install_DATA = \ lock.png \ marker.png \ mp_buttons.png \ + network_wired.png \ + network_wired-active.png \ + network_wired-inactive.png \ + network_wireless.png \ + network_wireless-active.png \ + network_wireless-inactive.png \ plugin.png \ rass_logo.png \ rass_page1.png \ diff --git a/data/skin_default/icons/network_wired-active.png b/data/skin_default/icons/network_wired-active.png new file mode 100755 index 00000000..d8efc9c8 Binary files /dev/null and b/data/skin_default/icons/network_wired-active.png differ diff --git a/data/skin_default/icons/network_wired-inactive.png b/data/skin_default/icons/network_wired-inactive.png new file mode 100755 index 00000000..18f2c70f Binary files /dev/null and b/data/skin_default/icons/network_wired-inactive.png differ diff --git a/data/skin_default/icons/network_wired.png b/data/skin_default/icons/network_wired.png new file mode 100755 index 00000000..db695ad5 Binary files /dev/null and b/data/skin_default/icons/network_wired.png differ diff --git a/data/skin_default/icons/network_wireless-active.png b/data/skin_default/icons/network_wireless-active.png new file mode 100755 index 00000000..07a21874 Binary files /dev/null and b/data/skin_default/icons/network_wireless-active.png differ diff --git a/data/skin_default/icons/network_wireless-inactive.png b/data/skin_default/icons/network_wireless-inactive.png new file mode 100755 index 00000000..5bd69f9d Binary files /dev/null and b/data/skin_default/icons/network_wireless-inactive.png differ diff --git a/data/skin_default/icons/network_wireless.png b/data/skin_default/icons/network_wireless.png new file mode 100755 index 00000000..629a05a6 Binary files /dev/null and b/data/skin_default/icons/network_wireless.png differ diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index b9da48d8..e8a3d459 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -26,6 +26,9 @@ class Network: self.DnsConsole = Console() self.PingConsole = Console() self.config_ready = None + self.friendlyNames = {} + self.lan_interfaces = [] + self.wlan_interfaces = [] self.getInterfaces() def onRemoteRootFS(self): @@ -309,13 +312,47 @@ class Network: return len(self.ifaces) def getFriendlyAdapterName(self, x): - # maybe this needs to be replaced by an external list. - friendlyNames = { - "eth0": _("Integrated Ethernet"), - "wlan0": _("Wireless"), - "ath0": _("Integrated Wireless") - } - return friendlyNames.get(x, x) # when we have no friendly name, use adapter name + if x in self.friendlyNames.keys(): + return self.friendlyNames.get(x, x) + else: + self.friendlyNames[x] = self.getFriendlyAdapterNaming(x) + return self.friendlyNames.get(x, x) # when we have no friendly name, use adapter name + + def getFriendlyAdapterNaming(self, iface): + if iface.startswith('eth'): + if iface not in self.lan_interfaces and len(self.lan_interfaces) == 0: + self.lan_interfaces.append(iface) + return _("LAN connection") + elif iface not in self.lan_interfaces and len(self.lan_interfaces) >= 1: + self.lan_interfaces.append(iface) + return _("LAN connection") + " " + str(len(self.lan_interfaces)) + else: + if iface not in self.wlan_interfaces and len(self.wlan_interfaces) == 0: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + elif iface not in self.wlan_interfaces and len(self.wlan_interfaces) >= 1: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + " " + str(len(self.wlan_interfaces)) + + def getFriendlyAdapterDescription(self, iface): + if iface == 'eth0': + return _("Internal LAN adapter.") + else: + classdir = "/sys/class/net/" + iface + "/device/" + driverdir = "/sys/class/net/" + iface + "/device/driver/" + if os_path.exists(classdir): + files = listdir(classdir) + if 'driver' in files: + if os_path.realpath(driverdir).endswith('ath_pci'): + return _("Atheros")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('zd1211b'): + return _("Zydas")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('rt73'): + return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + else: + return _("Unknown network adapter.") + else: + return _("Unknown network adapter.") def getAdapterName(self, iface): return iface diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index c0037f81..2e33ac3b 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -7,6 +7,7 @@ from Screens.HelpMenu import HelpableScreen from Components.Network import iNetwork from Components.Sources.StaticText import StaticText from Components.Sources.Boolean import Boolean +from Components.Sources.List import List from Components.Label import Label,MultiColorLabel from Components.Pixmap import Pixmap,MultiPixmap from Components.MenuList import MenuList @@ -23,32 +24,6 @@ from os import path as os_path, system as os_system, unlink from re import compile as re_compile, search as re_search -class InterfaceList(MenuList): - def __init__(self, list, enableWrapAround=False): - MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) - self.l.setFont(0, gFont("Regular", 20)) - self.l.setItemHeight(30) - -def InterfaceEntryComponent(index,name,default,active ): - res = [ - (index), - MultiContentEntryText(pos=(80, 5), size=(430, 25), font=0, text=name) - ] - num_configured_if = len(iNetwork.getConfiguredAdapters()) - if num_configured_if >= 2: - if default is True: - png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue.png")) - if default is False: - png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue_off.png")) - res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png)) - if active is True: - png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) - if active is False: - png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_error.png")) - res.append(MultiContentEntryPixmapAlphaTest(pos=(40, 1), size=(25, 25), png = png2)) - return res - - class NetworkAdapterSelection(Screen,HelpableScreen): def __init__(self, session): Screen.__init__(self, session) @@ -91,13 +66,49 @@ class NetworkAdapterSelection(Screen,HelpableScreen): }) self.list = [] - self["list"] = InterfaceList(self.list) + self["list"] = List(self.list) self.updateList() if len(self.adapters) == 1: self.onFirstExecBegin.append(self.okbuttonClick) self.onClose.append(self.cleanup) + def buildInterfaceList(self,iface,name,default,active ): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + defaultpng = None + activepng = None + description = None + interfacepng = None + + if iface in iNetwork.lan_interfaces: + if active is True: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired-active.png")) + elif active is False: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired-inactive.png")) + else: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired.png")) + elif iface in iNetwork.wlan_interfaces: + if active is True: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless-active.png")) + elif active is False: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless-inactive.png")) + else: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless.png")) + + num_configured_if = len(iNetwork.getConfiguredAdapters()) + if num_configured_if >= 2: + if default is True: + defaultpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue.png")) + elif default is False: + defaultpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue_off.png")) + if active is True: + activepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) + elif active is False: + activepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_error.png")) + + description = iNetwork.getFriendlyAdapterDescription(iface) + + return((iface, name, description, interfacepng, defaultpng, activepng, divpng)) def updateList(self): self.list = [] @@ -122,7 +133,7 @@ class NetworkAdapterSelection(Screen,HelpableScreen): default_gw = result if len(self.adapters) == 0: # no interface available => display only eth0 - self.list.append(InterfaceEntryComponent("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True )) + self.list.append(self.buildInterfaceList("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True )) else: for x in self.adapters: if x[1] == default_gw: @@ -133,11 +144,11 @@ class NetworkAdapterSelection(Screen,HelpableScreen): active_int = True else: active_int = False - self.list.append(InterfaceEntryComponent(index = x[1],name = _(x[0]),default=default_int,active=active_int )) + self.list.append(self.buildInterfaceList(x[1],_(x[0]),default_int,active_int )) if os_path.exists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")): self["key_blue"].setText(_("NetworkWizard")) - self["list"].l.setList(self.list) + self["list"].setList(self.list) def setDefaultInterface(self): selection = self["list"].getCurrent() @@ -253,7 +264,7 @@ class NameserverSetup(Screen, ConfigListScreen, HelpableScreen): self.list = [] ConfigListScreen.__init__(self, self.list) self.createSetup() - + def createConfig(self): self.nameservers = iNetwork.getNameserverList() self.nameserverEntries = [ NoSave(ConfigIP(default=nameserver)) for nameserver in self.nameservers] @@ -412,7 +423,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.wsconfig = None self.default = None - if self.iface == "wlan0" or self.iface == "ath0" : + if self.iface in iNetwork.wlan_interfaces: from Plugins.SystemPlugins.WirelessLan.Wlan import wpaSupplicant,Wlan self.w = Wlan(self.iface) self.ws = wpaSupplicant() @@ -535,7 +546,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.createSetup() if self["config"].getCurrent() == self.gatewayEntry: self.createSetup() - if self.iface == "wlan0" or self.iface == "ath0" : + if self.iface in iNetwork.wlan_interfaces: if self["config"].getCurrent() == self.wlanSSID: self.createSetup() if self["config"].getCurrent() == self.encryptionEnabled: @@ -731,7 +742,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def ok(self): self.cleanup() if self["menulist"].getCurrent()[1] == 'edit': - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless @@ -817,7 +828,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self["menulist"].getCurrent()[1] == 'dns': self["description"].setText(_("Edit the Nameserver configuration of your Dreambox.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'scanwlan': - self["description"].setText(_("Scan your network for wireless Access Points and connect to them using your selected wireless device.\n" ) + self.oktext ) + self["description"].setText(_("Scan your network for wireless access points and connect to them using your selected wireless device.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'wlanstatus': self["description"].setText(_("Shows the state of your wireless LAN connection.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'lanrestart': @@ -834,7 +845,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) self["Statustext"].setText(_("Link:")) - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except: @@ -884,7 +895,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def AdapterSetupClosed(self, *ret): if ret is not None and len(ret): - if ret[0] == 'ok' and (self.iface == 'wlan0' or self.iface == 'ath0') and iNetwork.getAdapterAttribute(self.iface, "up") is True: + if ret[0] == 'ok' and (self.iface in iNetwork.wlan_interfaces) and iNetwork.getAdapterAttribute(self.iface, "up") is True: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless @@ -1263,6 +1274,7 @@ class NetworkAdapterTest(Screen): self.nextStepTimer.stop() def layoutFinished(self): + self.setTitle(_("Network test: ") + iNetwork.getFriendlyAdapterName(self.iface) ) self["shortcutsyellow"].setEnabled(False) self["AdapterInfo_OK"].hide() self["NetworkInfo_Check"].hide() @@ -1282,7 +1294,7 @@ class NetworkAdapterTest(Screen): self["AdapterInfo_Text"] = MultiColorLabel(_("Show Info")) self["AdapterInfo_OK"] = Pixmap() - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: self["Networktext"] = MultiColorLabel(_("Wireless Network")) else: self["Networktext"] = MultiColorLabel(_("Local Network")) @@ -1321,7 +1333,7 @@ class NetworkAdapterTest(Screen): self["InfoText"] = Label() def getLinkState(self,iface): - if iface == 'wlan0' or iface == 'ath0': + if iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status except: -- cgit v1.2.3 From 4279d927998c42abec8cb234162e34f3e42a5021 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Sat, 24 Jul 2010 15:41:58 +0200 Subject: SystemPlugins/WirelessLan: remove outdated flags.py and iwlibs.py. refs #558 --- .../Plugins/SystemPlugins/WirelessLan/Makefile.am | 2 - .../Plugins/SystemPlugins/WirelessLan/flags.py | 104 -- .../Plugins/SystemPlugins/WirelessLan/iwlibs.py | 1114 -------------------- 3 files changed, 1220 deletions(-) delete mode 100755 lib/python/Plugins/SystemPlugins/WirelessLan/flags.py delete mode 100755 lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am b/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am index 2f362379..bdc1a884 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am @@ -4,8 +4,6 @@ SUBDIRS = meta install_PYTHON = \ __init__.py \ - flags.py \ - iwlibs.py \ plugin.py \ Wlan.py diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py b/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py deleted file mode 100755 index 4435f845..00000000 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: ISO-8859-1 -*- -# python-wifi -- a wireless library to access wireless cards via python -# Copyright (C) 2004, 2005, 2006 Róman Joost -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA - -modes = ['Auto', - 'Ad-Hoc', - 'Managed', - 'Master', - 'Repeat', - 'Second', - 'Monitor'] - -IFNAMSIZE = 16 -IW_ESSID_MAX_SIZE = 16 - -KILO = 10**3 -MEGA = 10**6 -GIGA = 10**9 - -# ioctl calls for the Linux/i386 kernel -SIOCIWFIRST = 0x8B00 # FIRST ioctl identifier -SIOCGIFCONF = 0x8912 # ifconf struct -SIOCGIWNAME = 0x8B01 # get name == wireless protocol -SIOCGIWFREQ = 0x8B05 # get channel/frequency -SIOCSIWMODE = 0x8B06 # set the operation mode -SIOCGIWMODE = 0x8B07 # get operation mode -SIOCGIWSENS = 0x8B09 # get sensitivity -SIOCGIWAP = 0x8B15 # get AP MAC address -SIOCSIWSCAN = 0x8B18 # set scanning off -SIOCGIWSCAN = 0x8B19 # get scanning results -SIOCGIWRATE = 0x8B21 # get default bit rate -SIOCGIWRTS = 0x8B23 # get rts/cts threshold -SIOCGIWFRAG = 0x8B25 # get fragmention thrh -SIOCGIWTXPOW = 0x8B27 # get transmit power (dBm) -SIOCGIWRETRY = 0x8B29 # get retry limit -SIOCGIWRANGE = 0x8B0B # range -SIOCGIWSTATS = 0x8B0F # get wireless statistics -SIOCSIWESSID = 0x8B1A # set essid -SIOCGIWESSID = 0x8B1B # get essid -SIOCGIWPOWER = 0x8B2D # get power managment settings -SIOCGIWENCODE = 0x8B2B # get encryption information -SIOCIWLAST = 0x8BFF # LAST ioctl identifier - -# Power management flags -IW_POWER_ON = 0x0000 # No details ... -IW_POWER_TYPE = 0xF000 # Type of parameter -IW_POWER_PERIOD = 0x1000 # Value is a period/duration of -IW_POWER_TIMEOUT = 0x2000 # Value is a timeout -IW_POWER_MODE = 0x0F00 # Power management mode -IW_POWER_MIN = 0x0001 # Value is a minimum -IW_POWER_MAX = 0x0002 # Value is a maximum -IW_POWER_RELATIVE = 0x0004 # Value is not in seconds/ms/us - -# Retry limits -IW_RETRY_TYPE = 0xF000 # Type of parameter - -# encoding stuff -IW_ENCODE_DISABLED = 0x8000 # encoding is disabled -IW_ENCODE_NOKEY = 0x0800 # key is write only, not present - -# constants responsible for scanning -IW_SCAN_MAX_DATA = 4096 - -IW_EV_LCP_LEN = 4 -IW_EV_CHAR_LEN = IW_EV_LCP_LEN + IFNAMSIZE -IW_EV_UINT_LEN = IW_EV_LCP_LEN + 4 -IW_EV_FREQ_LEN = IW_EV_LCP_LEN + 8 -IW_EV_ADDR_LEN = IW_EV_LCP_LEN + 16 -IW_EV_POINT_LEN = IW_EV_LCP_LEN + 4 -IW_EV_PARAM_LEN = IW_EV_LCP_LEN + 8 -IW_EV_QUAL_LEN = IW_EV_LCP_LEN + 4 - -EPERM = 1 -E2BIG = 7 -EAGAIN = 11 - -IWHT_NULL = 0 -IWHT_CHAR = 2 -IWHT_UINT = 4 -IWHT_FREQ = 5 -IWHT_ADDR = 6 -IWHT_POINT = 8 -IWHT_PARAM = 9 -IWHT_QUAL = 10 - -IWEVFIRST = 0x8C00 # FIRST event identifier -IWEVQUAL = 0x8C01 # Quality statistics from scan -IWEVCUSTOM = 0x8C02 # Custom Ascii string from Driver -IWEVLAST = 0x8C0A # LAST event identifier diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py b/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py deleted file mode 100755 index c5f9c6d2..00000000 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py +++ /dev/null @@ -1,1114 +0,0 @@ -# -*- coding: ISO-8859-1 -*- -# python-wifi -- a wireless library to access wireless cards via python -# Copyright (C) 2004, 2005, 2006 Róman Joost -# -# Contributions from: -# Mike Auty (Iwscanresult, Iwscan) -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA - -from struct import pack as struct_pack, \ - unpack as struct_unpack, \ - calcsize as struct_calcsize - -from array import array -from math import ceil, log10 -from fcntl import ioctl -from socket import AF_INET, SOCK_DGRAM, socket -from time import sleep -from re import compile - -from flags import * - -def getNICnames(): - """ extract wireless device names of /proc/net/wireless - - returns empty list if no devices are present - - >>> getNICnames() - ['eth1', 'wifi0'] - """ - device = compile('[a-z]+[0-9]+') - ifnames = [] - - f = open('/proc/net/wireless', 'r') - data = f.readlines() - for line in data: - try: - ifnames.append(device.search(line).group()) - except AttributeError: - pass - # if we couldn't lookup the devices, try to ask the kernel - if ifnames == []: - ifnames = getConfiguredNICnames() - - return ifnames - -def getConfiguredNICnames(): - """get the *configured* ifnames by a systemcall - - >>> getConfiguredNICnames() - [] - """ - iwstruct = Iwstruct() - ifnames = [] - buff = array('c', '\0'*1024) - caddr_t, length = buff.buffer_info() - s = iwstruct.pack('iP', length, caddr_t) - try: - result = iwstruct._fcntl(SIOCGIFCONF, s) - except IOError, (i, e): - return i, e - - # get the interface names out of the buffer - for i in range(0, 1024, 32): - ifname = buff.tostring()[i:i+32] - ifname = struct_unpack('32s', ifname)[0] - ifname = ifname.split('\0', 1)[0] - if ifname: - # verify if ifnames are really wifi devices - wifi = Wireless(ifname) - result = wifi.getAPaddr() - if result[0] == 0: - ifnames.append(ifname) - - return ifnames - -def makedict(**kwargs): - return kwargs - - -class Wireless(object): - """Access to wireless interfaces""" - - def __init__(self, ifname): - self.sockfd = socket(AF_INET, SOCK_DGRAM) - self.ifname = ifname - self.iwstruct = Iwstruct() - - def getAPaddr(self): - """ returns accesspoint mac address - - >>> from iwlibs import Wireless, getNICnames - >>> ifnames = getNICnames() - >>> ifnames - ['eth1', 'wifi0'] - >>> wifi = Wireless(ifnames[0]) - >>> wifi.getAPaddr() - '00:0D:88:8E:4E:93' - - Test with non-wifi card: - >>> wifi = Wireless('eth0') - >>> wifi.getAPaddr() - (95, 'Operation not supported') - - Test with non-existant card: - >>> wifi = Wireless('eth2') - >>> wifi.getAPaddr() - (19, 'No such device') - """ - buff, s = self.iwstruct.pack_wrq(32) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWAP, - data=s) - if i > 0: - return result - - return self.iwstruct.getMAC(result) - - def getBitrate(self): - """returns device currently set bit rate - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getBitrate() - '11 Mb/s' - """ - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWRATE) - if i > 0: - return result - iwfreq = Iwfreq(result) - return iwfreq.getBitrate() - - def getBitrates(self): - """returns the number of available bitrates for the device - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> num, rates = wifi.getBitrates() - >>> num == len(rates) - True - """ - range = Iwrange(self.ifname) - if range.errorflag: - return (range.errorflag, range.error) - return (range.num_bitrates, range.bitrates) - - def getChannelInfo(self): - """returns the number of channels and available frequency for - the device - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> num, rates = wifi.getChannelInfo() - >>> num == len(rates) - True - """ - range = Iwrange(self.ifname) - if range.errorflag: - return (range.errorflag, range.error) - return (range.num_channels, range.frequencies) - - def getEssid(self): - """get essid information - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getEssid() - 'romanofski' - """ - essid = "" - buff, s = self.iwstruct.pack_wrq(32) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWESSID, - data=s) - if i > 0: - return result - str = buff.tostring() - return str.strip('\x00') - - def setEssid(self, essid): - """set essid """ - raise NotImplementedError - if len(essid) > IW_ESSID_MAX_SIZE: - return "essid to big" - buff, s = self.iwstruct.pack_test(essid, 32) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCSIWESSID, - data=s) - if i > 0: - return result - - def getEncryption(self): - """get encryption information which is probably a string of '*', - 'open', 'private' - - as a normal user, you will get a 'Operation not permitted' - error: - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getEncryption() - (1, 'Operation not permitted') - """ - iwpoint = Iwpoint(self.ifname) - if iwpoint.errorflag: - return (iwpoint.errorflag, iwpoint.error) - return iwpoint.getEncryptionKey() - - def getFragmentation(self): - """returns fragmentation threshold - - It depends on what the driver says. If you have fragmentation - threshold turned on, you'll get an int. If it's turned of - you'll get a string: 'off'. - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getFragmentation() - 'off' - """ - iwparam = Iwparam(self.ifname, SIOCGIWFRAG) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getFrequency(self): - """returns currently set frequency of the card - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getFrequency() - '2.417GHz' - """ - i, r = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWFREQ) - if i > 0: - return (i, r) - iwfreq = Iwfreq(r) - return iwfreq.getFrequency() - - - def getMode(self): - """returns currently set operation mode - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getMode() - 'Managed' - """ - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWMODE) - if i > 0: - return result - mode = self.iwstruct.unpack('i', result[:4])[0] - return modes[mode] - - def setMode(self, mode): - """sets the operation mode """ - try: - this_modes = [x.lower() for x in modes] - mode = mode.lower() - wifimode = this_modes.index(mode) - except ValueError: - return "Invalid operation mode!" - - s = self.iwstruct.pack('I', wifimode) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCSIWMODE, - data=s) - if i > 0: - return result - - def getWirelessName(self): - """ returns wireless name - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getWirelessName() - 'IEEE 802.11-DS' - """ - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWNAME) - if i > 0: - return result - return result.split('\0')[0] - - def getPowermanagement(self): - """returns power management settings - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getPowermanagement() - 'off' - """ - iwparam = Iwparam(self.ifname, SIOCGIWPOWER) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - - def getRetrylimit(self): - """returns limit retry/lifetime - - man iwconfig: - Most cards have MAC retransmissions, and some allow to set - the behaviour of the retry mechanism. - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getRetrylimit() - 16 - """ - iwparam = Iwparam(self.ifname, SIOCGIWRETRY) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getRTS(self): - """returns rts threshold - - returns int, 'auto', 'fixed', 'off' - - man iwconfig: - RTS/CTS adds a handshake before each packet transmission to - make sure that the channel is clear. This adds overhead, but - increases performance in case of hidden nodes or a large - number of active nodes. This parameter sets the size of the - smallest packet for which the node sends RTS; a value equal - to the maximum packet size disable the mechanism. - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getRTS() - 'off' - """ - iwparam = Iwparam(self.ifname, SIOCGIWRTS) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getSensitivity(self): - """returns sensitivity information - - man iwconfig: - This is the lowest signal level for which the hardware - attempt packet reception, signals weaker than this are - ignored. This is used to avoid receiving background noise, - so you should set it according to the average noise - level. Positive values are assumed to be the raw value used - by the hardware or a percentage, negative values are - assumed to be dBm. - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getSensitivity() - 'off' - - """ - iwparam = Iwparam(self.ifname, SIOCGIWSENS) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getTXPower(self): - """returns transmit power in dBm - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getTXPower() - '17 dBm' - """ - i, r = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWTXPOW) - if i > 0: - return (i, r) - iwfreq = Iwfreq(r) - return iwfreq.getTransmitPower() - - def getStatistics(self): - """returns statistics information which can also be found in - /proc/net/wireless - """ - iwstats = Iwstats(self.ifname) - if iwstats.errorflag > 0: - return (iwstats.errorflag, iwstats.error) - return [iwstats.status, iwstats.qual, iwstats.discard, - iwstats.missed_beacon] - - def scan(self): - """returns Iwscanresult objects, after a successful scan""" - iwscan = Iwscan(self.ifname) - return iwscan.scan() - - -class Iwstruct(object): - """basic class to handle iwstruct data """ - - def __init__(self): - self.idx = 0 - self.sockfd = socket(AF_INET, SOCK_DGRAM) - - def parse_data(self, fmt, data): - """ unpacks raw C data """ - size = struct_calcsize(fmt) - idx = self.idx - - str = data[idx:idx + size] - self.idx = idx+size - value = struct_unpack(fmt, str) - - # take care of a tuple like (int, ) - if len(value) == 1: - return value[0] - else: - return value - - def pack(self, fmt, *args): - """ calls struct_pack and returns the result """ - return struct_pack(fmt, *args) - - def pack_wrq(self, buffsize): - """ packs wireless request data for sending it to the kernel """ - # Prepare a buffer - # We need the address of our buffer and the size for it. The - # ioctl itself looks for the pointer to the address in our - # memory and the size of it. - # Dont change the order how the structure is packed!!! - buff = array('c', '\0'*buffsize) - caddr_t, length = buff.buffer_info() - s = struct_pack('Pi', caddr_t, length) - return buff, s - - def pack_test(self, string, buffsize): - """ packs wireless request data for sending it to the kernel """ - buffsize = buffsize - len(string) - buff = array('c', string+'\0'*buffsize) - caddr_t, length = buff.buffer_info() - s = struct_pack('Pii', caddr_t, length, 1) - return buff, s - - def unpack(self, fmt, packed_data): - """ unpacks data with given format """ - return struct_unpack(fmt, packed_data) - - def _fcntl(self, request, args): - return ioctl(self.sockfd.fileno(), request, args) - - def iw_get_ext(self, ifname, request, data=None): - """ read information from ifname """ - # put some additional data behind the interface name - if data is not None: - buff = IFNAMSIZE-len(ifname) - ifreq = ifname + '\0'*buff - ifreq = ifreq + data - else: - ifreq = (ifname + '\0'*32) - - try: - result = self._fcntl(request, ifreq) - except IOError, (i, e): - return i, e - - return (0, result[16:]) - - def getMAC(self, packed_data): - """ extracts mac addr from packed data and returns it as str """ - mac_addr = struct_unpack('xxBBBBBB', packed_data[:8]) - return "%02X:%02X:%02X:%02X:%02X:%02X" % mac_addr - -class Iwparam(object): - """class to hold iwparam data """ - - def __init__(self, ifname, ioctl): - # (i) value, (b) fixed, (b) disabled, (b) flags - self.fmt = "ibbH" - self.value = 0 - self.fixed = 0 - self.disabled = 0 - self.flags = 0 - self.errorflag = 0 - self.error = "" - self.ioctl = ioctl - self.ifname = ifname - self.update() - - def getValue(self): - """returns the value if not disabled """ - - if self.disabled: - return 'off' - if self.flags & IW_RETRY_TYPE == 0: - return self.getRLAttributes() - else: - return self.getPMAttributes() - - def getRLAttributes(self): - """returns a string with attributes determined by self.flags - """ - return self.value - - def getPMAttributes(self): - """returns a string with attributes determined by self.flags - and IW_POWER* - """ - result = "" - - # Modifiers - if self.flags & IW_POWER_MIN == 0: - result = " min" - if self.flags & IW_POWER_MAX == 0: - result = " max" - - # Type - if self.flags & IW_POWER_TIMEOUT == 0: - result = " period:" - else: - result = " timeout:" - # Value with or without units - # IW_POWER_RELATIVE - value is *not* in s/ms/us - if self.flags & IW_POWER_RELATIVE: - result += "%f" %(float(self.value)/MEGA) - else: - if self.value >= MEGA: - result += "%fs" %(float(self.value)/MEGA) - elif self.value >= KILO: - result += "%fms" %(float(self.value)/KILO) - else: - result += "%dus" % self.value - - return result - - def update(self): - iwstruct = Iwstruct() - i, r = iwstruct.iw_get_ext(self.ifname, - self.ioctl) - if i > 0: - self.errorflag = i - self.error = r - self._parse(r) - - def _parse(self, data): - """ unpacks iwparam data """ - iwstruct = Iwstruct() - self.value, self.fixed, self.disabled, self.flags =\ - iwstruct.parse_data(self.fmt, data) - -class Iwfreq(object): - """ class to hold iwfreq data - delegates to Iwstruct class - """ - - def __init__(self, data=None): - self.fmt = "ihbb" - if data is not None: - self.frequency = self.parse(data) - else: - self.frequency = 0 - self.iwstruct = Iwstruct() - - def __getattr__(self, attr): - return getattr(self.iwstruct, attr) - - def parse(self, data): - """ unpacks iwparam""" - - size = struct_calcsize(self.fmt) - m, e, i, pad = struct_unpack(self.fmt, data[:size]) - # XXX well, its not *the* frequency - we need a better name - if e == 0: - return m - else: - return float(m)*10**e - - def getFrequency(self): - """returns Frequency (str) - - data - binary data returned by systemcall (iw_get_ext()) - """ - freq = self.frequency - - if freq >= GIGA: - return "%0.3fGHz" %(freq/GIGA) - - if freq >= MEGA: - return "%0.3fMHZ" %(freq/MEGA) - - if freq >= KILO: - return "%0.3fKHz" %(freq/KILO) - - def getBitrate(self): - """ returns Bitrate in Mbit - - data - binary data returned by systemcall (iw_get_ext()) - """ - bitrate = self.frequency - - if bitrate >= GIGA: - return "%i Gb/s" %(bitrate/GIGA) - - if bitrate >= MEGA: - return "%i Mb/s" %(bitrate/MEGA) - - if bitrate >= KILO: - return "%i Kb/s" %(bitrate/KILO) - - def getTransmitPower(self): - """ returns transmit power in dbm """ - # XXX something flaky is going on with m and e - # eg. m = 50 and e should than be 0, because the number is stored in - # m and don't needs to be recalculated - return "%i dBm" %self.mw2dbm(self.frequency/10) - - def getChannel(self, freq): - """returns channel information given by frequency - - returns None if frequency can't be converted - freq = frequency to convert (int) - iwrange = Iwrange object - """ - - try: - freq = float(freq) - except: - return None - - lut = {} - #13 Channels beginning at 2.412GHz and inreasing by 0,005 GHz steps - for i in range(0,12): - cur = float( 2.412 + ( i * 0.005 ) ) - lut[str(cur)] = i+1 - # Channel 14 need special actions ;) - lut['2.484'] = 14 - - - if str(freq) in lut.keys(): - return lut[str(freq)] - - return None - - - def mw2dbm(self, mwatt): - """ converts mw to dbm(float) """ - return ceil(10.0 * log10(mwatt)) - - def _setFrequency(self, list): - """sets self.frequency by given list - - currently only used by Iwrange - """ - assert len(list) == 4 - m, e, i, pad = list - if e == 0: - self.frequency = m - else: - self.frequency = m #float(m)*10**e - -class Iwstats(object): - """ class to hold iwstat data """ - - def __init__(self, ifname): - # (2B) status, 4B iw_quality, 6i iw_discarded - self.fmt = "2B4B6i" - self.status = 0 - self.qual = Iwquality() - self.discard = {} - self.missed_beacon = 0 - self.ifname = ifname - self.errorflag = 0 - self.error = "" - self.update() - - def update(self): - iwstruct = Iwstruct() - buff, s = iwstruct.pack_wrq(32) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWSTATS, - data=s) - if i > 0: - self.error = result - self.errorflag = i - self._parse(buff.tostring()) - - def _parse(self, data): - """ unpacks iwstruct data """ - struct = Iwstruct() - iwqual = Iwquality() - iwstats_data = struct.parse_data(self.fmt, data) - - self.status = iwstats_data[0:2] - self.qual.quality, self.qual.sl, self.qual.nl,\ - self.qual.flags = iwstats_data[2:6] - nwid, code, frag, retries, flags = iwstats_data[6:11] - self.missed_beacon = iwstats_data[11:12][0] - self.discard = makedict(nwid=nwid, code=code, - fragment=frag, retries=retries, misc=flags) - -class Iwquality(object): - """ class to hold iwquality data """ - - def __init__(self): - self.quality = 0 - self.sl = 0 - self.nl = 0 - self.updated = 0 - self.fmt = "4B" - - def parse(self, data): - """ unpacks iwquality data """ - struct = Iwstruct() - qual, sl, nl, flags = struct.parse_data(self.fmt, data) - - # compute signal and noise level - self.signal_level = sl - self.noise_level = nl - - # asign the other values - self.quality = qual - self.updated = flags - - def setValues(self, list): - """ assigns values given by a list to our attributes """ - attributes = ["quality", "signallevel", "noise_level", - "updated"] - assert len(list) == 4 - - for i in range(len(list)): - setattr(self, attributes[i], list[i]) - - def getSignallevel(self): - """ returns signal level """ - return self.sl-0x100 - - def setSignallevel(self, sl): - """ sets signal level """ - self.sl = sl - signallevel = property(getSignallevel, setSignallevel) - - def getNoiselevel(self): - """ returns noise level """ - return self.nl - 0x100 - - def setNoiselevel(self): - raise NotImplementedError - self.nl = nl - noiselevel = property(getNoiselevel, setNoiselevel) - -class Iwpoint(object): - """ class to hold iwpoint data """ - - def __init__(self, ifname): - self.key = [0,0,0,0] - self.fields = 0 - self.flags = 0 - # (4B) pointer to data, H length, H flags - self.fmt = "4BHH" - self.errorflag = 0 - self.error = "" - self.ifname = ifname - self.update() - - def __getattr__(self, attr): - return getattr(self.iwstruct, attr) - - def update(self): - iwstruct = Iwstruct() - buff, s = iwstruct.pack_wrq(32) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWENCODE, - data=s) - if i > 0: - self.errorflag = i - self.error = result - self._parse(result) - - def getEncryptionKey(self): - """ returns encryption key as '**' or 'off' as str """ - if self.flags & IW_ENCODE_DISABLED != 0: - return 'off' - elif self.flags & IW_ENCODE_NOKEY != 0: - # a key is set, so print it - return '**' * self.fields - - def _parse(self, data): - """ unpacks iwpoint data - """ - iwstruct = Iwstruct() - ptr, ptr, ptr, ptr, self.fields, self.flags =\ - iwstruct.parse_data(self.fmt, data) - self.key = [ptr, ptr, ptr, ptr] - -class Iwrange(object): - """holds iwrange struct """ - IW_MAX_FREQUENCIES = 32 - - def __init__(self, ifname): - self.fmt = "iiihb6ii4B4Bi32i2i2i2i2i3h8h2b2bhi8i2b3h2i2ihB17x"\ - + self.IW_MAX_FREQUENCIES*"ihbb" - - self.ifname = ifname - self.errorflag = 0 - self.error = "" - - # informative stuff - self.throughput = 0 - - # nwid (or domain id) - self.min_nwid = self.max_nwid = 0 - - # frequency for backward compatibility - self.old_num_channels = self.old_num_frequency = self.old_freq = 0 - - # signal level threshold - self.sensitivity = 0 - - # link quality - self.max_qual = Iwquality() - self.avg_qual = Iwquality() - - # rates - self.num_bitrates = 0 - self.bitrates = [] - - # rts threshold - self.min_rts = self.max_rts = 0 - - # fragmention threshold - self.min_frag = self.max_frag = 0 - - # power managment - self.min_pmp = self.max_pmp = 0 - self.min_pmt = self.max_pmt = 0 - self.pmp_flags = self.pmt_flags = self.pm_capa = 0 - - # encoder stuff - self.encoding_size = 0 - self.num_encoding_sizes = self.max_encoding_tokens = 0 - self.encoding_login_index = 0 - - # transmit power - self.txpower_capa = self.num_txpower = self.txpower = 0 - - # wireless extension version info - self.we_vers_compiled = self.we_vers_src = 0 - - # retry limits and lifetime - self.retry_capa = self.retry_flags = self.r_time_flags = 0 - self.min_retry = self.max_retry = 0 - self.min_r_time = self.max_r_time = 0 - - # frequency - self.num_channels = self.num_frequency = 0 - self.frequencies = [] - self.update() - - def update(self): - """updates Iwrange object by a system call to the kernel - and updates internal attributes - """ - iwstruct = Iwstruct() - buff, s = iwstruct.pack_wrq(640) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWRANGE, - data=s) - if i > 0: - self.errorflag = i - self.error = result - data = buff.tostring() - self._parse(data) - - def _parse(self, data): - struct = Iwstruct() - result = struct.parse_data(self.fmt, data) - - # XXX there is maybe a much more elegant way to do this - self.throughput, self.min_nwid, self.max_nwid = result[0:3] - self.old_num_channels, self.old_num_frequency = result[3:5] - self.old_freq = result[5:11] - self.sensitivity = result[11] - self.max_qual.setValues(result[12:16]) - self.avg_qual.setValues(result[16:20]) - self.num_bitrates = result[20] # <- XXX - raw_bitrates = result[21:53] - for rate in raw_bitrates: - iwfreq = Iwfreq() - iwfreq.frequency = rate - br = iwfreq.getBitrate() - if br is not None: - self.bitrates.append(br) - - self.min_rts, self.max_rts = result[53:55] - self.min_frag, self.max_frag = result[55:57] - self.min_pmp, self.max_pmp = result[57:59] - self.min_pmt, self.max_pmt = result[59:61] - self.pmp_flags, self.pmt_flags, self.pm_capa = result[61:64] - self.encoding_size = result[64:72] - self.num_encoding_sizes, self.max_encoding_tokens = result[72:74] - self.encoding_login_index = result[74:76] - self.txpower_capa, self.num_txpower = result[76:78] - self.txpower = result[78:86] - self.we_vers_compiled, self.we_vers_src = result[86:88] - self.retry_capa, self.retry_flags, self.r_time_flags = result[88:91] - self.min_retry, self.max_retry = result[91:93] - self.min_r_time, self.max_r_time = result[93:95] - self.num_channels = result[95] - self.num_frequency = result[96] - freq = result[97:] - - i = self.num_frequency - for x in range(0, len(freq), 4): - iwfreq = Iwfreq() - iwfreq._setFrequency(freq[x:x+4]) - fq = iwfreq.getFrequency() - if fq is not None: - self.frequencies.append(fq) - i -= 1 - if i <= 0: - break - -class Iwscan(object): - """class to handle AP scanning""" - - def __init__(self, ifname): - self.ifname = ifname - self.range = Iwrange(ifname) - self.errorflag = 0 - self.error = "" - self.stream = None - self.aplist = None - - def scan(self, fullscan=True): - """Completes a scan for available access points, - and returns them in Iwscanresult format - - fullscan: If False, data is read from a cache of the last scan - If True, a scan is conducted, and then the data is read - """ - # By default everything is fine, do not wait - result = 1 - if fullscan: - self.setScan() - if self.errorflag > EPERM: - raise RuntimeError, 'setScan failure ' + str(self.errorflag) + " " + str(self.error) - return None - elif self.errorflag < EPERM: - # Permission was NOT denied, therefore we must WAIT to get results - result = 250 - - while (result > 0): - sleep(result/1000) - result = self.getScan() - - if result < 0 or self.errorflag != 0: - raise RuntimeError, 'getScan failure ' + str(self.errorflag) + " " + str(self.error) - - return self.aplist - - - def setScan(self): - """Triggers the scan, if we have permission - """ - iwstruct = Iwstruct() - s = iwstruct.pack('Pii', 0, 0, 0) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCSIWSCAN,s) - if i > 0: - self.errorflag = i - self.error = result - return result - - def getScan(self): - """Retreives results, stored from the most recent scan - Returns 0 if successful, a delay if the data isn't ready yet - or -1 if something really nasty happened - """ - iwstruct = Iwstruct() - i = E2BIG - bufflen = IW_SCAN_MAX_DATA - - # Keep resizing the buffer until it's large enough to hold the scan - while (i == E2BIG): - buff, s = iwstruct.pack_wrq(bufflen) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWSCAN, - data=s) - if i == E2BIG: - pbuff, newlen = iwstruct.unpack('Pi', s) - if bufflen < newlen: - bufflen = newlen - else: - bufflen = bufflen * 2 - - if i == EAGAIN: - return 100 - if i > 0: - self.errorflag = i - self.error = result - return -1 - - pbuff, reslen = iwstruct.unpack('Pi', s) - if reslen > 0: - # Initialize the stream, and turn it into an enumerator - self.aplist = self._parse(buff.tostring()) - return 0 - - def _parse(self, data): - """Parse the event stream, and return a list of Iwscanresult objects - """ - iwstruct = Iwstruct() - scanresult = None - aplist = [] - - # Run through the stream, until broken - while 1: - # If we're the stream doesn't have enough space left for a header, break - if len(data) < IW_EV_LCP_LEN: - break; - - # Unpack the header - length, cmd = iwstruct.unpack('HH', data[:4]) - # If the header says the following data is shorter than the header, then break - if length < IW_EV_LCP_LEN: - break; - - # Put the events into their respective result data - if cmd == SIOCGIWAP: - if scanresult is not None: - aplist.append(scanresult) - scanresult = Iwscanresult(data[IW_EV_LCP_LEN:length], self.range) - elif scanresult is None: - raise RuntimeError, 'Attempting to add an event without AP data' - else: - scanresult.addEvent(cmd, data[IW_EV_LCP_LEN:length]) - - # We're finished with the preveious event - data = data[length:] - - # Don't forgset the final result - if scanresult.bssid != "00:00:00:00:00:00": - aplist.append(scanresult) - else: - raise RuntimeError, 'Attempting to add an AP without a bssid' - return aplist - -class Iwscanresult(object): - """An object to contain all the events associated with a single scanned AP - """ - - def __init__(self, data, range): - """Initialize the scan result with the access point data""" - self.iwstruct = Iwstruct() - self.range = range - self.bssid = "%02X:%02X:%02X:%02X:%02X:%02X" % struct_unpack('BBBBBB', data[2:8]) - self.essid = None - self.mode = None - self.rate = [] - self.quality = Iwquality() - self.frequency = None - self.encode = None - self.custom = [] - self.protocol = None - - def addEvent(self, cmd, data): - """Attempts to add the data from an event to a scanresult - Only certain data is accept, in which case the result is True - If the event data is invalid, None is returned - If the data is valid but unused, False is returned - """ - if cmd <= SIOCIWLAST: - if cmd < SIOCIWFIRST: - return None - elif cmd >= IWEVFIRST: - if cmd > IWEVLAST: - return None - else: - return None - - if cmd == SIOCGIWESSID: - self.essid = data[4:] - elif cmd == SIOCGIWMODE: - self.mode = modes[self.iwstruct.unpack('i', data[:4])[0]] - elif cmd == SIOCGIWRATE: - # TODO, deal with multiple rates, or at least the highest rate - freqsize = struct_calcsize("ihbb") - while len(data) >= freqsize: - iwfreq = Iwfreq(data) - self.rate.append(iwfreq.getBitrate()) - data = data[freqsize:] - elif cmd == IWEVQUAL: - self.quality.parse(data) - elif cmd == SIOCGIWFREQ: - self.frequency = Iwfreq(data) - elif cmd == SIOCGIWENCODE: - self.encode = data - elif cmd == IWEVCUSTOM: - self.custom.append(data[1:]) - elif cmd == SIOCGIWNAME: - self.protocol = data[:len(data)-2] - else: - #print "Cmd:", cmd - return False - return True \ No newline at end of file -- cgit v1.2.3 From 996081f3ac0b17e0609fb74b11db49112eeec43e Mon Sep 17 00:00:00 2001 From: acid-burn Date: Sat, 24 Jul 2010 23:14:58 +0200 Subject: Enigma2-Network: update Wlan plugin to support new python-wifi. some fixes and cleanups. refs #558 --- lib/python/Components/About.py | 11 ++ lib/python/Components/Network.py | 54 ++++--- .../SystemPlugins/NetworkWizard/NetworkWizard.py | 3 +- .../Plugins/SystemPlugins/WirelessLan/Wlan.py | 179 ++++++++++----------- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 74 ++++++++- lib/python/Screens/NetworkSetup.py | 68 +++++--- 6 files changed, 252 insertions(+), 137 deletions(-) mode change 100644 => 100755 lib/python/Components/About.py (limited to 'lib/python') diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py old mode 100644 new mode 100755 index 8e332e33..6b322c9d --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -1,5 +1,6 @@ from Tools.Directories import resolveFilename, SCOPE_SYSETC from enigma import getEnigmaVersionString +from os import popen class About: def __init__(self): @@ -43,4 +44,14 @@ class About: def getEnigmaVersionString(self): return getEnigmaVersionString() + def getKernelVersionString(self): + try: + result = popen("uname -r","r").read().strip("\n").split('-') + kernel_version = result[0] + return kernel_version + except: + pass + + return "unknown" + about = About() diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index e8a3d459..e980cb8c 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -4,6 +4,7 @@ from socket import * from enigma import eConsoleAppContainer from Components.Console import Console from Components.PluginComponent import plugins +from Components.About import about from Plugins.Plugin import PluginDescriptor class Network: @@ -349,8 +350,10 @@ class Network: return _("Zydas")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") elif os_path.realpath(driverdir).endswith('rt73'): return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('rt73usb'): + return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") else: - return _("Unknown network adapter.") + return str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") else: return _("Unknown network adapter.") @@ -606,24 +609,39 @@ class Network: if callback is not None: callback(True) - def detectWlanModule(self): + def detectWlanModule(self, iface = None): self.wlanmodule = None - rt73_dir = "/sys/bus/usb/drivers/rt73/" - zd1211b_dir = "/sys/bus/usb/drivers/zd1211b/" - madwifi_dir = "/sys/bus/pci/drivers/ath_pci/" - if os_path.exists(madwifi_dir): - files = listdir(madwifi_dir) - if len(files) >= 1: - self.wlanmodule = 'madwifi' - if os_path.exists(rt73_dir): - rtfiles = listdir(rt73_dir) - 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 or len(zdfiles) == 5: - self.wlanmodule = 'zydas' - return self.wlanmodule + classdir = "/sys/class/net/" + iface + "/device/" + driverdir = "/sys/class/net/" + iface + "/device/driver/" + if os_path.exists(classdir): + classfiles = listdir(classdir) + driver_found = False + nl80211_found = False + for x in classfiles: + if x == 'driver': + driver_found = True + if x.startswith('ieee80211:'): + nl80211_found = True + + if driver_found and nl80211_found: + #print about.getKernelVersionString() + self.wlanmodule = "nl80211" + else: + if driver_found and not nl80211_found: + driverfiles = listdir(driverdir) + if os_path.realpath(driverdir).endswith('ath_pci'): + if len(driverfiles) >= 1: + self.wlanmodule = 'madwifi' + if os_path.realpath(driverdir).endswith('rt73'): + if len(driverfiles) == 2 or len(driverfiles) == 5: + self.wlanmodule = 'ralink' + if os_path.realpath(driverdir).endswith('zd1211b'): + if len(driverfiles) == 1 or len(driverfiles) == 5: + self.wlanmodule = 'zydas' + if self.wlanmodule is None: + self.wlanmodule = "wext" + print 'Using "%s" as wpa-supplicant driver' % (self.wlanmodule) + return self.wlanmodule def calc_netmask(self,nmask): from struct import pack, unpack diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py index 6096ca8b..d7e83072 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py @@ -257,7 +257,7 @@ class NetworkWizard(WizardLanguage, Rc): text1 = _("Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\n") text2 = _('Accesspoint:') + "\t" + str(status[self.selectedInterface]["acesspoint"]) + "\n" text3 = _('SSID:') + "\t" + str(status[self.selectedInterface]["essid"]) + "\n" - text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+"%" + "\n" + text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+ "\n" text5 = _('Signal Strength:') + "\t" + str(status[self.selectedInterface]["signal"]) + "\n" text6 = _('Bitrate:') + "\t" + str(status[self.selectedInterface]["bitrate"]) + "\n" text7 = _('Encryption:') + " " + str(status[self.selectedInterface]["encryption"]) + "\n" @@ -421,3 +421,4 @@ class NetworkWizard(WizardLanguage, Rc): def ChoicesSelectionMoved(self): pass + diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py index 1c1471ce..baefd435 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py @@ -1,7 +1,3 @@ -#from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER -#from Components.MultiContent import MultiContentEntryText -#from Components.GUIComponent import GUIComponent -#from Components.HTMLComponent import HTMLComponent from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword from Components.Console import Console @@ -10,7 +6,8 @@ from string import maketrans, strip import sys import types from re import compile as re_compile, search as re_search -from iwlibs import getNICnames, Wireless, Iwfreq +from pythonwifi.iwlibs import getNICnames, Wireless, Iwfreq, getWNICnames +from pythonwifi import flags as wififlags list = [] list.append("WEP") @@ -65,38 +62,42 @@ class Wlan: print "self.iface im iwconfigFinished",self.iface callback = extra_args data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False } - #print "result im iwconfigFinished",result for line in result.splitlines(): - #print "line",line line = line.strip() if "ESSID" in line: if "off/any" in line: ssid = _("No Connection") else: - tmpssid=(line[line.index('ESSID')+7:len(line)-1]) - if tmpssid == '': - ssid = _("Hidden networkname") - elif tmpssid ==' ': - ssid = _("Hidden networkname") + if "Nickname" in line: + tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid else: - ssid = tmpssid - #print "SSID->",ssid + tmpssid=(line[line.index('ESSID')+7:len(line)-1]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid + if ssid is not None: data['essid'] = ssid if 'Frequency' in line: frequency = line[line.index('Frequency')+10 :line.index(' GHz')] - #print "Frequency",frequency if frequency is not None: data['frequency'] = frequency if "Access Point" in line: ap=line[line.index('Access Point')+14:len(line)-1] - #print "AP",ap if ap is not None: data['acesspoint'] = ap if "Bit Rate" in line: br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] - #print "Bitrate",br if br is not None: data['bitrate'] = br if 'Encryption key' in line: @@ -104,7 +105,6 @@ class Wlan: enc = _("Disabled") else: enc = line[line.index('Encryption key')+15 :line.index(' Security')] - #print "Encryption key",enc if enc is not None: data['encryption'] = _("Enabled") if 'Quality' in line: @@ -112,12 +112,10 @@ class Wlan: qual = line[line.index('Quality')+8:line.index('/100')] else: qual = line[line.index('Quality')+8:line.index('Sig')] - #print "Quality",qual if qual is not None: data['quality'] = qual if 'Signal level' in line: - signal = line[line.index('Signal level')+14 :line.index(' dBm')] - #print "Signal level",signal + signal = line[line.index('Signal level')+13 :line.index(' dBm')] if signal is not None: data['signal'] = signal @@ -130,7 +128,6 @@ class Wlan: callback(True,self.wlaniface) def getAdapterAttribute(self, attribute): - print "im getAdapterAttribute" if self.wlaniface.has_key(self.iface): print "self.wlaniface.has_key",self.iface if self.wlaniface[self.iface].has_key(attribute): @@ -142,13 +139,17 @@ class Wlan: def getWirelessInterfaces(self): - iwifaces = None - try: - iwifaces = getNICnames() - except: - print "[Wlan.py] No Wireless Networkcards could be found" - - return iwifaces + device = re_compile('[a-z]{2,}[0-9]*:') + ifnames = [] + + fp = open('/proc/net/wireless', 'r') + for line in fp: + try: + # append matching pattern, without the trailing colon + ifnames.append(device.search(line).group()[:-1]) + except AttributeError: + pass + return ifnames def getNetworkList(self): @@ -156,8 +157,8 @@ class Wlan: ifobj = Wireless(self.iface) # a Wireless NIC Object #Association mappings - stats, quality, discard, missed_beacon = ifobj.getStatistics() - snr = quality.signallevel - quality.noiselevel + #stats, quality, discard, missed_beacon = ifobj.getStatistics() + #snr = quality.signallevel - quality.noiselevel try: scanresults = ifobj.scan() @@ -167,55 +168,47 @@ class Wlan: if scanresults is not None: aps = {} + (num_channels, frequencies) = ifobj.getChannelInfo() + index = 1 for result in scanresults: - bssid = result.bssid - - encryption = map(lambda x: hex(ord(x)), result.encode) - - if encryption[-1] == "0x8": + + if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0: + encryption = False + elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0: encryption = True else: - encryption = False - + encryption = None + + signal = str(result.quality.siglevel-0x100) + " dBm" + quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality) + extra = [] for element in result.custom: element = element.encode() extra.append( strip(self.asciify(element)) ) - - if result.quality.sl is 0 and len(extra) > 0: - begin = extra[0].find('SignalStrength=')+15 - - done = False - end = begin+1 - - while not done: - if extra[0][begin:end].isdigit(): - end += 1 - else: - done = True - end -= 1 - - signal = extra[0][begin:end] - #print "[Wlan.py] signal is:" + str(signal) + for element in extra: + print element + if 'SignalStrength' in element: + signal = element[element.index('SignalStrength')+15:element.index(',L')] + if 'LinkQuality' in element: + quality = element[element.index('LinkQuality')+12:len(element)] - else: - signal = str(result.quality.sl) - aps[bssid] = { 'active' : True, 'bssid': result.bssid, - 'channel': result.frequency.getChannel(result.frequency.getFrequency()), + 'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1, 'encrypted': encryption, 'essid': strip(self.asciify(result.essid)), 'iface': self.iface, - 'maxrate' : result.rate[-1], - 'noise' : result.quality.getNoiselevel(), - 'quality' : str(result.quality.quality), - 'signal' : signal, + 'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]), + 'noise' : '',#result.quality.nlevel-0x100, + 'quality' : str(quality), + 'signal' : str(signal), 'custom' : extra, } - print aps[bssid] + #print "GOT APS ENTRY:",aps[bssid] + index = index + 1 return aps @@ -226,12 +219,11 @@ class Wlan: self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))) except: self.channel = 0 - #print ifobj.getStatistics() status = { - 'BSSID': str(ifobj.getAPaddr()), + 'BSSID': str(ifobj.getAPaddr()), #ifobj.getStatistics() 'ESSID': str(ifobj.getEssid()), - 'quality': str(ifobj.getStatistics()[1].quality), - 'signal': str(ifobj.getStatistics()[1].sl), + 'quality': "%s/%s" % (ifobj.getStatistics()[1].quality,ifobj.getQualityMax().quality), + 'signal': str(ifobj.getStatistics()[1].siglevel-0x100) + " dBm", 'bitrate': str(ifobj.getBitrate()), 'channel': str(self.channel), #'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))), @@ -326,7 +318,6 @@ class wpaSupplicant: essid = split[1][1:-1] elif split[0] == 'proto': - print "split[1]",split[1] config.plugins.wlan.encryption.enabled.value = True if split[1] == "WPA" : mode = 'WPA' @@ -354,12 +345,9 @@ class wpaSupplicant: else: config.plugins.wlan.encryption.wepkeytype.value = 'HEX' config.plugins.wlan.encryption.psk.value = split[1] - print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value - print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value elif split[0] == 'psk': config.plugins.wlan.encryption.psk.value = split[1][1:-1] - print "[Wlan.py] Got PSK: "+split[1][1:-1] else: pass @@ -436,24 +424,30 @@ class Status: if "off/any" in line: ssid = _("No Connection") else: - tmpssid=(line[line.index('ESSID')+7:len(line)-1]) - if tmpssid == '': - ssid = _("Hidden networkname") - elif tmpssid ==' ': - ssid = _("Hidden networkname") + if "Nickname" in line: + tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid else: - ssid = tmpssid - #print "SSID->",ssid + tmpssid=(line[line.index('ESSID')+7:len(line)-1]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid if ssid is not None: data['essid'] = ssid if 'Frequency' in line: frequency = line[line.index('Frequency')+10 :line.index(' GHz')] - #print "Frequency",frequency if frequency is not None: data['frequency'] = frequency if "Access Point" in line: ap=line[line.index('Access Point')+14:len(line)] - #print "AP",ap if ap is not None: data['acesspoint'] = ap if ap == "Not-Associated": @@ -467,7 +461,6 @@ class Status: br += " Mb/s" else: br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s" - #print "Bitrate",br if br is not None: data['bitrate'] = br if 'Encryption key' in line: @@ -480,28 +473,30 @@ class Status: enc = line[line.index('Encryption key')+15 :line.index(' Security')] if enc is not None: enc = _("Enabled") - #print "Encryption key",enc if enc is not None: data['encryption'] = enc if 'Quality' in line: if "/100" in line: - qual = line[line.index('Quality')+8:line.index('/100')] + #qual = line[line.index('Quality')+8:line.index('/100')] + qual = line[line.index('Quality')+8:line.index(' Signal')] else: qual = line[line.index('Quality')+8:line.index('Sig')] - #print "Quality",qual if qual is not None: data['quality'] = qual if 'Signal level' in line: if "dBm" in line: - signal = line[line.index('Signal level')+14 :line.index(' dBm')] + signal = line[line.index('Signal level')+13 :line.index(' dBm')] signal += " dBm" elif "/100" in line: - signal = line[line.index('Signal level')+13:line.index('/100 Noise')] - signal += "%" + if "Noise" in line: + signal = line[line.index('Signal level')+13:line.index(' Noise')] + else: + signal = line[line.index('Signal level')+13:len(line)] else: - signal = line[line.index('Signal level')+13:line.index(' Noise')] - signal += "%" - #print "Signal level",signal + if "Noise" in line: + signal = line[line.index('Signal level')+13:line.index(' Noise')] + else: + signal = line[line.index('Signal level')+13:len(line)] if signal is not None: data['signal'] = signal @@ -515,12 +510,10 @@ class Status: callback(True,self.wlaniface) def getAdapterAttribute(self, iface, attribute): - print "im getAdapterAttribute" self.iface = iface if self.wlaniface.has_key(self.iface): - print "self.wlaniface.has_key",self.iface if self.wlaniface[self.iface].has_key(attribute): return self.wlaniface[self.iface][attribute] return None -iStatus = Status() \ No newline at end of file +iStatus = Status() diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index a687714d..28ee363e 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,4 +1,4 @@ -from enigma import eTimer +from enigma import eTimer, eTPM from Screens.Screen import Screen from Components.ActionMap import ActionMap, NumberActionMap from Components.Pixmap import Pixmap,MultiPixmap @@ -14,7 +14,9 @@ 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 Tools.HardwareInfo import HardwareInfo from Wlan import Wlan, wpaSupplicant, iStatus +import sha plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan" @@ -122,7 +124,7 @@ class WlanStatus(Screen): 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["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"]) @@ -373,6 +375,45 @@ class WlanScan(Screen): return self.WlanList +def bin2long(s): + return reduce( lambda x,y:(x<<8L)+y, map(ord, s)) + +def long2bin(l): + res = "" + for byte in range(128): + res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff) + return res + +def rsa_pub1024(src, mod): + return long2bin(pow(bin2long(src), 65537, bin2long(mod))) + +def decrypt_block(src, mod): + if len(src) != 128 and len(src) != 202: + return None + dest = rsa_pub1024(src[:128], mod) + hash = sha.new(dest[1:107]) + if len(src) == 202: + hash.update(src[131:192]) + result = hash.digest() + if result == dest[107:127]: + return dest + return None + +def validate_cert(cert, key): + buf = decrypt_block(cert[8:], key) + if buf is None: + return None + return buf[36:107] + cert[139:196] + +def read_random(): + try: + fd = open("/dev/urandom", "r") + buf = fd.read(8) + fd.close() + return buf + except: + return None + def WlanStatusScreenMain(session, iface): session.open(WlanStatus, iface) @@ -387,8 +428,32 @@ def callFunction(iface): def configStrings(iface): - driver = iNetwork.detectWlanModule() - print "Found WLAN-Driver:",driver + hardware_info = HardwareInfo() + if hardware_info.device_name != "dm7025": + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + return + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + return + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "better run the genuine dreambox plugin" + return + l3key = validate_cert(l3cert, l2key) + if l3key is None: + return + rnd = read_random() + if rnd is None: + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if hardware_info.device_name == "dm7025" or result[80:88] == rnd: + driver = iNetwork.detectWlanModule(iface) + else: + driver = 'dreambox' 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: @@ -399,4 +464,3 @@ def configStrings(iface): 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 diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index 2e33ac3b..de2fa993 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -745,14 +745,21 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: # Wlan Interface found. - self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup,self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup,self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() @@ -765,28 +772,42 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self["menulist"].getCurrent()[1] == 'scanwlan': try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.WlanScanClosed, WlanScan, self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.WlanScanClosed, WlanScan, self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() if self["menulist"].getCurrent()[1] == 'wlanstatus': try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() @@ -898,14 +919,21 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if ret[0] == 'ok' and (self.iface in iNetwork.wlan_interfaces) and iNetwork.getAdapterAttribute(self.iface, "up") is True: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() @@ -916,7 +944,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def WlanStatusClosed(self, *ret): if ret is not None and len(ret): - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus iStatus.stopWlanConsole() self.updateStatusbar() @@ -924,7 +952,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if ret[0] is not None: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1]) else: - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus iStatus.stopWlanConsole() self.updateStatusbar() @@ -1335,7 +1363,7 @@ class NetworkAdapterTest(Screen): def getLinkState(self,iface): if iface in iNetwork.wlan_interfaces: try: - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except: self["Network"].setForegroundColorNum(1) self["Network"].setText(_("disconnected")) @@ -1417,7 +1445,7 @@ class NetworkAdapterTest(Screen): iNetwork.stopLinkStateConsole() iNetwork.stopDNSConsole() try: - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except ImportError: pass else: -- cgit v1.2.3 From 33d0b53a0b4949534d09698b29bcdd6fe2446269 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Sun, 25 Jul 2010 22:35:19 +0200 Subject: Softwaremanager: fix potential crash when trying to delete from empty list. Graphmultiepg: fix typo inside metafile. fixes #563 --- .../Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml | 2 +- .../Plugins/SystemPlugins/SoftwareManager/BackupRestore.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml index a10840da..3e2a3f6e 100755 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml @@ -6,7 +6,7 @@ Dream Multimedia GraphMultiEPG - eenigma2-plugin-extensions-graphmultiepg + enigma2-plugin-extensions-graphmultiepg GraphMultiEPG shows a graphical timeline EPG. GraphMultiEPG shows a graphical timeline EPG.\nShows a nice overview of all running und upcoming tv shows. diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index dcff3ca2..7bd7d7a2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -251,8 +251,9 @@ class RestoreMenu(Screen): def KeyOk(self): 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!")) + if self.sel: + 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!")) def keyCancel(self): self.close() @@ -265,8 +266,9 @@ class RestoreMenu(Screen): def deleteFile(self): if (self.exe == False) and (self.entry == True): self.sel = self["filelist"].getCurrent() - self.val = self.path + "/" + self.sel - self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel )) + if self.sel: + self.val = self.path + "/" + self.sel + self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel )) def startDelete(self, ret = False): if (ret == True): -- cgit v1.2.3 From ecd15d83806de513514e2ef84892b6d30c64cc8c Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Aug 2010 11:06:49 +0200 Subject: lib/python/Components/VolumeControl.py: make the VolumeControl instance global accessible and add a singleton check --- lib/python/Components/VolumeControl.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index 19fb90d7..eef74d0e 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -5,6 +5,8 @@ from Screens.Mute import Mute from GlobalActions import globalActionMap from config import config, ConfigSubsection, ConfigInteger +instance = None + profile("VolumeControl") #TODO .. move this to a own .py file class VolumeControl: @@ -12,10 +14,14 @@ class VolumeControl: a corresponding dialog""" def __init__(self, session): global globalActionMap + global instance globalActionMap.actions["volumeUp"]=self.volUp globalActionMap.actions["volumeDown"]=self.volDown globalActionMap.actions["volumeMute"]=self.volMute + assert not instance, "only one VolumeControl instance is allowed!" + instance = self + config.audio = ConfigSubsection() config.audio.volume = ConfigInteger(default = 100, limits = (0, 100)) -- cgit v1.2.3 From 65ce4a9bd27e342545b88faf9420426113d32702 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Aug 2010 11:15:00 +0200 Subject: lib/python/Components/VolumeControl.py: move instance to class --- lib/python/Components/VolumeControl.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index eef74d0e..38102926 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -5,22 +5,20 @@ from Screens.Mute import Mute from GlobalActions import globalActionMap from config import config, ConfigSubsection, ConfigInteger -instance = None - profile("VolumeControl") #TODO .. move this to a own .py file class VolumeControl: + instance = None """Volume control, handles volUp, volDown, volMute actions and display a corresponding dialog""" def __init__(self, session): global globalActionMap - global instance globalActionMap.actions["volumeUp"]=self.volUp globalActionMap.actions["volumeDown"]=self.volDown globalActionMap.actions["volumeMute"]=self.volMute - assert not instance, "only one VolumeControl instance is allowed!" - instance = self + assert not VolumeControl.instance, "only one VolumeControl instance is allowed!" + VolumeControl.instance = self config.audio = ConfigSubsection() config.audio.volume = ConfigInteger(default = 100, limits = (0, 100)) -- cgit v1.2.3 From 97f8d756b444ef1d308f2c6e80b62e5e5a057cc1 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 26 Aug 2010 08:34:43 +0200 Subject: Enigma2: add possibility to configure input device delay and repeat settings. fixes #69 --- data/menu.xml | 3 +- data/skin_default/icons/Makefile.am | 9 + .../icons/input_keyboard-configured.png | Bin 0 -> 2700 bytes data/skin_default/icons/input_keyboard.png | Bin 0 -> 2520 bytes data/skin_default/icons/input_mouse-configured.png | Bin 0 -> 2785 bytes data/skin_default/icons/input_mouse.png | Bin 0 -> 2512 bytes data/skin_default/icons/input_rcnew-configured.png | Bin 0 -> 2809 bytes data/skin_default/icons/input_rcnew.png | Bin 0 -> 2570 bytes data/skin_default/icons/input_rcold-configured.png | Bin 0 -> 2796 bytes data/skin_default/icons/input_rcold.png | Bin 0 -> 2598 bytes lib/python/Components/InputDevice.py | 225 +++++++++++++++-- lib/python/Screens/InputDeviceSetup.py | 280 +++++++++++++++++++++ lib/python/Screens/Makefile.am | 3 +- 13 files changed, 495 insertions(+), 25 deletions(-) create mode 100644 data/skin_default/icons/input_keyboard-configured.png create mode 100644 data/skin_default/icons/input_keyboard.png create mode 100644 data/skin_default/icons/input_mouse-configured.png create mode 100644 data/skin_default/icons/input_mouse.png create mode 100644 data/skin_default/icons/input_rcnew-configured.png create mode 100644 data/skin_default/icons/input_rcnew.png create mode 100644 data/skin_default/icons/input_rcold-configured.png create mode 100644 data/skin_default/icons/input_rcold.png mode change 100644 => 100755 lib/python/Components/InputDevice.py create mode 100755 lib/python/Screens/InputDeviceSetup.py (limited to 'lib/python') diff --git a/data/menu.xml b/data/menu.xml index b437fbc7..6507bfe3 100755 --- a/data/menu.xml +++ b/data/menu.xml @@ -62,8 +62,9 @@ - + + + {"template": [ + MultiContentEntryPixmapAlphaTest(pos = (2, 8), size = (54, 54), png = 2), # index 3 is the interface pixmap + MultiContentEntryText(pos = (65, 6), size = (450, 54), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER|RT_WRAP, text = 1), # index 1 is the interfacename + ], + "fonts": [gFont("Regular", 28),gFont("Regular", 20)], + "itemHeight": 70 + } + + + + + + """ + + + def __init__(self, session): + Screen.__init__(self, session) + HelpableScreen.__init__(self) + + self.edittext = _("Press OK to edit the settings.") + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Select")) + self["key_yellow"] = StaticText("") + self["key_blue"] = StaticText("") + self["introduction"] = StaticText(self.edittext) + + self.devices = [(iInputDevices.getDeviceName(x),x) for x in iInputDevices.getDeviceList()] + print "[InputDeviceSelection] found devices :->", len(self.devices),self.devices + + self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", + { + "cancel": (self.close, _("Exit input device selection.")), + "ok": (self.okbuttonClick, _("Select input device.")), + }, -2) + + self["ColorActions"] = HelpableActionMap(self, "ColorActions", + { + "red": (self.close, _("Exit input device selection.")), + "green": (self.okbuttonClick, _("Select input device.")), + }, -2) + + self.currentIndex = 0 + self.list = [] + self["list"] = List(self.list) + self.updateList() + self.onLayoutFinish.append(self.layoutFinished) + self.onClose.append(self.cleanup) + + def layoutFinished(self): + self.setTitle(_("Select input device")) + + def cleanup(self): + self.currentIndex = 0 + + def buildInterfaceList(self,device,description,type ): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + activepng = None + devicepng = None + enabled = iInputDevices.getDeviceAttribute(device, 'enabled') + + if type == 'remote': + if config.misc.rcused.value == 0: + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew.png")) + else: + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcold-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcold.png")) + elif type == 'keyboard': + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_keyboard-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_keyboard.png")) + elif type == 'mouse': + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_mouse-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_mouse.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew.png")) + return((device, description, devicepng, divpng)) + + def updateList(self): + self.list = [] + for x in self.devices: + dev_type = iInputDevices.getDeviceAttribute(x[1], 'type') + self.list.append(self.buildInterfaceList(x[1],_(x[0]), dev_type )) + self["list"].setList(self.list) + self["list"].setIndex(self.currentIndex) + + def okbuttonClick(self): + selection = self["list"].getCurrent() + self.currentIndex = self["list"].getIndex() + if selection is not None: + self.session.openWithCallback(self.DeviceSetupClosed, InputDeviceSetup, selection[0]) + + def DeviceSetupClosed(self, *ret): + self.updateList() + + +class InputDeviceSetup(Screen, ConfigListScreen): + + skin = """ + + + + + + + + + + + + + """ + + def __init__(self, session, device): + Screen.__init__(self, session) + self.inputDevice = device + iInputDevices.currentDevice = self.inputDevice + self.onChangedEntry = [ ] + self.setup_title = _("Input device setup") + self.isStepSlider = None + self.enableEntry = None + self.repeatEntry = None + self.delayEntry = None + self.nameEntry = None + self.enableConfigEntry = None + + self.list = [ ] + ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry) + + self["actions"] = ActionMap(["SetupActions"], + { + "cancel": self.keyCancel, + "save": self.apply, + }, -2) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.createSetup() + self.onLayoutFinish.append(self.layoutFinished) + self.onClose.append(self.cleanup) + + def layoutFinished(self): + self.setTitle(self.setup_title) + + def cleanup(self): + iInputDevices.currentDevice = "" + + def createSetup(self): + self.list = [ ] + cmd = "self.enableEntry = getConfigListEntry(_('"'Change repeat and delay settings?'"'), config.inputDevices." + self.inputDevice + ".enabled)" + exec (cmd) + cmd = "self.repeatEntry = getConfigListEntry(_('"'Interval between keys when repeating:'"'), config.inputDevices." + self.inputDevice + ".repeat)" + exec (cmd) + cmd = "self.delayEntry = getConfigListEntry(_('"'Delay before key repeat starts:'"'), config.inputDevices." + self.inputDevice + ".delay)" + exec (cmd) + cmd = "self.nameEntry = getConfigListEntry(_('"'Devicename:'"'), config.inputDevices." + self.inputDevice + ".name)" + exec (cmd) + if self.enableEntry: + if isinstance(self.enableEntry[1], ConfigYesNo): + self.enableConfigEntry = self.enableEntry[1] + + self.list.append(self.enableEntry) + if self.enableConfigEntry: + if self.enableConfigEntry.value is True: + self.list.append(self.repeatEntry) + self.list.append(self.delayEntry) + else: + self.repeatEntry[1].setValue(self.repeatEntry[1].default) + self["config"].invalidate(self.repeatEntry) + self.delayEntry[1].setValue(self.delayEntry[1].default) + self["config"].invalidate(self.delayEntry) + self.nameEntry[1].setValue(self.nameEntry[1].default) + self["config"].invalidate(self.nameEntry) + + self["config"].list = self.list + self["config"].l.setSeperation(400) + self["config"].l.setList(self.list) + if not self.selectionChanged in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.selectionChanged) + self.selectionChanged() + + def selectionChanged(self): + if self["config"].getCurrent() == self.enableEntry: + self["introduction"].setText(_("Current device: ") + str(iInputDevices.getDeviceAttribute(self.inputDevice, 'name')) ) + else: + self["introduction"].setText(_("Current value: ") + self.getCurrentValue() + _(" ms")) + + def newConfig(self): + current = self["config"].getCurrent() + if current: + if current == self.enableEntry: + self.createSetup() + + def keyLeft(self): + ConfigListScreen.keyLeft(self) + self.newConfig() + + def keyRight(self): + ConfigListScreen.keyRight(self) + self.newConfig() + + def confirm(self, confirmed): + if not confirmed: + print "not confirmed" + return + else: + self.nameEntry[1].setValue(iInputDevices.getDeviceAttribute(self.inputDevice, 'name')) + cmd = "config.inputDevices." + self.inputDevice + ".name.save()" + exec (cmd) + self.keySave() + + def apply(self): + self.session.openWithCallback(self.confirm, MessageBox, _("Use this input device settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + + def cancelConfirm(self, result): + if not result: + return + for x in self["config"].list: + x[1].cancel() + self.close() + + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + else: + self.close() + # for summary: + def changedEntry(self): + for x in self.onChangedEntry: + x() + self.selectionChanged() + + def getCurrentEntry(self): + return self["config"].getCurrent()[0] + + def getCurrentValue(self): + return str(self["config"].getCurrent()[1].value) + + def createSummary(self): + from Screens.Setup import SetupSummary + return SetupSummary diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index d96b491e..a4b158de 100755 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -14,5 +14,6 @@ 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 ServiceStopScreen.py + TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py ServiceStopScreen.py \ + InputDeviceSetup.py -- cgit v1.2.3 From 721452bdbfe05409846dab5d183228ca2ca11ee5 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 21 Sep 2010 21:29:48 +0200 Subject: Enigma2-meta: rework plugin meta files and prepare for inclusion into enigma2 translation. Meta.xml files are now only in english and translation is now easy possible for all languages over enigma2 translation project. This also reduces consumed space inside flash memory. Add missing TempFanControl plugin meta and LICENSE. DreamInfohandler.py,SoftwareManager: follow meta xml changes. fixes #578 --- Makefile.am | 8 +- configure.ac | 1 + lib/python/Components/DreamInfoHandler.py | 86 ++++++---------------- .../CutListEditor/meta/plugin_cutlisteditor.xml | 13 +--- .../Extensions/DVDBurn/meta/plugin_dvdburn.xml | 17 ++--- .../Extensions/DVDPlayer/meta/plugin_dvdplayer.xml | 13 +--- .../GraphMultiEPG/meta/plugin_graphmultiepg.xml | 15 +--- .../MediaPlayer/meta/plugin_mediaplayer.xml | 13 +--- .../MediaScanner/meta/plugin_mediascanner.xml | 14 +--- .../PicturePlayer/meta/plugin_pictureplayer.xml | 13 +--- .../Extensions/SocketMMI/meta/plugin_socketmmi.xml | 11 +-- .../TuxboxPlugins/meta/plugin_tuxboxplugins.xml | 11 +-- .../CleanupWizard/meta/plugin_cleanupwizard.xml | 18 +---- .../meta/plugin_commoninterfaceassignment.xml | 23 ++---- .../meta/plugin_crashlogautosubmit.xml | 17 +---- .../meta/plugin_defaultservicesscanner.xml | 16 +--- .../DiseqcTester/meta/plugin_diseqctester.xml | 16 +--- .../meta/plugin_frontprocessorupgrade.xml | 14 +--- .../SystemPlugins/Hotplug/meta/plugin_hotplug.xml | 15 +--- .../NFIFlash/meta/plugin_nfiflash.xml | 18 +---- .../NetworkWizard/meta/plugin_networkwizard.xml | 16 +--- .../meta/plugin_positionersetup.xml | 17 +---- .../meta/plugin_satelliteequipmentcontrol.xml | 16 +--- .../Satfinder/meta/plugin_satfinder.xml | 18 +---- .../SkinSelector/meta/plugin_skinselector.xml | 15 +--- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 2 +- .../meta/plugin_softwaremanager.xml | 18 +---- .../SystemPlugins/SoftwareManager/plugin.py | 39 ++++------ .../Plugins/SystemPlugins/TempFanControl/LICENSE | 12 +++ .../SystemPlugins/TempFanControl/Makefile.am | 4 + .../SystemPlugins/TempFanControl/meta/Makefile.am | 3 + .../TempFanControl/meta/plugin_tempfancontrol.xml | 18 +++++ .../meta/plugin_videoenhancement.xml | 14 +--- .../VideoTune/meta/plugin_videotune.xml | 13 +--- .../Videomode/meta/plugin_videomode.xml | 14 +--- .../WirelessLan/meta/plugin_wirelesslan.xml | 12 +-- tools/genmetaindex.py | 12 ++- 37 files changed, 174 insertions(+), 421 deletions(-) mode change 100644 => 100755 lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml mode change 100644 => 100755 lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml create mode 100755 lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am create mode 100755 lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am create mode 100755 lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml (limited to 'lib/python') diff --git a/Makefile.am b/Makefile.am index c517d9c5..bc1770b7 100755 --- a/Makefile.am +++ b/Makefile.am @@ -7,12 +7,8 @@ install_PYTHON = \ keyids.py keymapparser.py mytest.py skin.py timer.py tools.py GlobalActions.py \ e2reactor.py -LANGS := $(shell cat $(srcdir)/po/LINGUAS) - install-exec-hook: - for lang in $(LANGS); do \ - $(PYTHON) $(srcdir)/tools/genmetaindex.py $$lang $(DESTDIR)$(datadir)/meta/plugin_*.xml > $(DESTDIR)$(datadir)/meta/index-enigma2_$$lang.xml; \ - done + $(PYTHON) $(srcdir)/tools/genmetaindex.py $(DESTDIR)$(datadir)/meta/plugin_*.xml > $(DESTDIR)$(datadir)/meta/index-enigma2.xml uninstall-hook: - $(RM) $(DESTDIR)$(datadir)/meta/index-enigma2_*.xml + $(RM) $(DESTDIR)$(datadir)/meta/index-enigma2.xml diff --git a/configure.ac b/configure.ac index d1b1d279..9a616220 100755 --- a/configure.ac +++ b/configure.ac @@ -158,6 +158,7 @@ lib/python/Plugins/SystemPlugins/Hotplug/Makefile lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile lib/python/Plugins/SystemPlugins/Makefile lib/python/Plugins/SystemPlugins/TempFanControl/Makefile +lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile lib/python/Plugins/SystemPlugins/NetworkWizard/Makefile lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile lib/python/Plugins/SystemPlugins/NFIFlash/Makefile diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index 85e2b533..dd140cbb 100755 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -16,7 +16,7 @@ class InfoHandlerParseError(Exception): return repr(self.value) class InfoHandler(xml.sax.ContentHandler): - def __init__(self, prerequisiteMet, directory, language = None): + def __init__(self, prerequisiteMet, directory): self.attributes = {} self.directory = directory self.list = [] @@ -26,9 +26,6 @@ class InfoHandler(xml.sax.ContentHandler): self.validFileTypes = ["skin", "config", "services", "favourites", "package"] self.prerequisitesMet = prerequisiteMet self.data = "" - self.language = language - self.translatedPackageInfos = {} - self.foundTranslation = None def printError(self, error): print "Error in defaults xml files:", error @@ -52,15 +49,6 @@ class InfoHandler(xml.sax.ContentHandler): if name == "info": self.foundTranslation = None self.data = "" - if not attrs.has_key("language"): - print "info tag with no language attribute" - else: - if attrs["language"] == 'en': # read default translations - self.foundTranslation = False - self.data = "" - elif attrs["language"] == self.language: - self.foundTranslation = True - self.data = "" if name == "files": if attrs.has_key("type"): @@ -91,20 +79,17 @@ class InfoHandler(xml.sax.ContentHandler): if attrs.has_key("details"): self.attributes["details"] = str(attrs["details"]) if attrs.has_key("name"): - self.attributes["name"] = str(attrs["name"].encode("utf-8")) + self.attributes["name"] = str(attrs["name"]) if attrs.has_key("packagename"): - self.attributes["packagename"] = str(attrs["packagename"].encode("utf-8")) + self.attributes["packagename"] = str(attrs["packagename"]) if attrs.has_key("packagetype"): - self.attributes["packagetype"] = str(attrs["packagetype"].encode("utf-8")) + self.attributes["packagetype"] = str(attrs["packagetype"]) if attrs.has_key("shortdescription"): - self.attributes["shortdescription"] = str(attrs["shortdescription"].encode("utf-8")) + self.attributes["shortdescription"] = str(attrs["shortdescription"]) if name == "screenshot": if attrs.has_key("src"): - if self.foundTranslation is False: - self.attributes["screenshot"] = str(attrs["src"]) - elif self.foundTranslation is True: - self.translatedPackageInfos["screenshot"] = str(attrs["src"]) + self.attributes["screenshot"] = str(attrs["src"]) def endElement(self, name): #print "endElement", name @@ -124,7 +109,7 @@ class InfoHandler(xml.sax.ContentHandler): self.attributes[self.filetype].append({ "name": str(self.fileattrs["name"]), "directory": directory }) if name in ( "default", "package" ): - self.list.append({"attributes": self.attributes, 'prerequisites': self.globalprerequisites ,"translation": self.translatedPackageInfos}) + self.list.append({"attributes": self.attributes, 'prerequisites': self.globalprerequisites}) self.attributes = {} self.globalprerequisites = {} @@ -133,30 +118,13 @@ class InfoHandler(xml.sax.ContentHandler): self.attributes["author"] = str(data) if self.elements[-1] == "name": self.attributes["name"] = str(data) - if self.foundTranslation is False: - if self.elements[-1] == "author": - self.attributes["author"] = str(data) - if self.elements[-1] == "name": - self.attributes["name"] = str(data) - if self.elements[-1] == "packagename": - self.attributes["packagename"] = str(data.encode("utf-8")) - if self.elements[-1] == "shortdescription": - self.attributes["shortdescription"] = str(data.encode("utf-8")) - if self.elements[-1] == "description": - self.data += data.strip() - self.attributes["description"] = str(self.data.encode("utf-8")) - elif self.foundTranslation is True: - if self.elements[-1] == "author": - self.translatedPackageInfos["author"] = str(data) - if self.elements[-1] == "name": - self.translatedPackageInfos["name"] = str(data) - if self.elements[-1] == "description": - self.data += data.strip() - self.translatedPackageInfos["description"] = str(self.data.encode("utf-8")) - if self.elements[-1] == "name": - self.translatedPackageInfos["name"] = str(data.encode("utf-8")) - if self.elements[-1] == "shortdescription": - self.translatedPackageInfos["shortdescription"] = str(data.encode("utf-8")) + if self.elements[-1] == "packagename": + self.attributes["packagename"] = str(data) + if self.elements[-1] == "shortdescription": + self.attributes["shortdescription"] = str(data) + if self.elements[-1] == "description": + self.data += data + self.attributes["description"] = str(self.data) #print "characters", data @@ -166,13 +134,12 @@ class DreamInfoHandler: STATUS_ERROR = 2 STATUS_INIT = 4 - def __init__(self, statusCallback, blocking = False, neededTag = None, neededFlag = None, language = None): + def __init__(self, statusCallback, blocking = False, neededTag = None, neededFlag = None): self.hardware_info = HardwareInfo() self.directory = "/" self.neededTag = neededTag self.neededFlag = neededFlag - self.language = language # caution: blocking should only be used, if further execution in enigma2 depends on the outcome of # the installer! @@ -203,8 +170,8 @@ class DreamInfoHandler: #print handler.list def readIndex(self, directory, file): - print "Reading .xml meta index file", file - handler = InfoHandler(self.prerequisiteMet, directory, self.language) + print "Reading .xml meta index file", directory, file + handler = InfoHandler(self.prerequisiteMet, directory) try: xml.sax.parse(file, handler) for entry in handler.list: @@ -216,7 +183,7 @@ class DreamInfoHandler: def readDetails(self, directory, file): self.packageDetails = [] print "Reading .xml meta details file", file - handler = InfoHandler(self.prerequisiteMet, directory, self.language) + handler = InfoHandler(self.prerequisiteMet, directory) try: xml.sax.parse(file, handler) for entry in handler.list: @@ -225,7 +192,6 @@ class DreamInfoHandler: print "file", file, "ignored due to errors in the file" #print handler.list - # prerequisites = True: give only packages matching the prerequisites def fillPackagesList(self, prerequisites = True): self.packageslist = [] @@ -254,20 +220,14 @@ class DreamInfoHandler: self.directory = [self.directory] for indexfile in os.listdir(self.directory[0]): - if indexfile.startswith("index"): - if indexfile.endswith("_en.xml"): #we first catch all english indexfiles - indexfileList.append(os.path.splitext(indexfile)[0][:-3]) - + if indexfile.startswith("index-"): + if indexfile.endswith(".xml"): + indexfileList.append(indexfile) if len(indexfileList): for file in indexfileList: neededFile = self.directory[0] + "/" + file - if self.language is not None: - if os.path.exists(neededFile + '_' + self.language + '.xml' ): - #print "translated index file found",neededFile + '_' + self.language + '.xml' - self.readIndex(self.directory[0] + "/", neededFile + '_' + self.language + '.xml') - else: - #print "reading original index file" - self.readIndex(self.directory[0] + "/", neededFile + '_en.xml') + if os.path.isfile(neededFile): + self.readIndex(self.directory[0] + "/" , neededFile) if prerequisites: for package in self.packagesIndexlist[:]: diff --git a/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml b/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml index 1431caf4..7132ba02 100755 --- a/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml +++ b/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml @@ -2,23 +2,14 @@ - + Dream Multimedia CutListEditor enigma2-plugin-extensions-cutlisteditor - CutListEditor allows you to edit your movies. + CutListEditor allows you to edit your movies CutListEditor allows you to edit your movies.\nSeek to the start of the stuff you want to cut away. Press OK, select 'start cut'.\nThen seek to the end, press OK, select 'end cut'. That's it. - - Dream Multimedia - Schnitteditor - enigma2-plugin-extensions-cutlisteditor - Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden. - Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden.\nSpulen Sie zum Anfang des zu schneidenden Teils der Aufnahme. Drücken Sie dann OK und wählen Sie: 'start cut'.\nDann spulen Sie zum Ende, drücken OK und wählen 'end cut'. Das ist alles. - - - diff --git a/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml b/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml index 647d1cfd..c1e202a9 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml +++ b/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml @@ -3,22 +3,17 @@ - + Dream Multimedia DVDBurn enigma2-plugin-extensions-dvdburn - With DVDBurn you can burn your recordings to a dvd. - With DVDBurn you can burn your recordings to a dvd.\nArchive all your favorite movies to recordable dvds with menus if wanted. + Burn your recordings to DVD + With DVDBurn you can make compilations of records from your Dreambox hard drive.\n + Optionally you can add customizable menus. You can record the compilation to a standard-compliant DVD that can be played on conventinal DVD players.\n + HDTV recordings can only be burned in proprietary dreambox format. - - Dream Multimedia - DVDBurn - enigma2-plugin-extensions-dvdburn - Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD. - Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD.\nArchivieren Sie Ihre Liblingsfilme auf DVD mit Menus wenn Sie es wünschen. - - + diff --git a/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml b/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml index 1353f7d2..6fc5a6f1 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml +++ b/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml @@ -2,23 +2,14 @@ - + Dream Multimedia DVDPlayer enigma2-plugin-extensions-dvdplayer - DVDPlayer plays your DVDs on your Dreambox. + DVDPlayer plays your DVDs on your Dreambox DVDPlayer plays your DVDs on your Dreambox.\nWith the DVDPlayer you can play your DVDs on your Dreambox from a DVD or even from an iso file or video_ts folder on your harddisc or network. - - Dream Multimedia - DVDPlayer - enigma2-plugin-extensions-dvdplayer - Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab. - Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab.\nMit dem DVDPlayer können Sie Ihre DVDs auf Ihrer Dreambox abspielen. Dabei ist es egal ob Sie von DVD, iso-Datei oder sogar direkt von einer video_ts Ordnerstruktur von Ihrer Festplatte oder dem Netzwerk abspielen. - - - diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml index a10840da..37d09889 100755 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml @@ -3,23 +3,14 @@ - + Dream Multimedia GraphMultiEPG - eenigma2-plugin-extensions-graphmultiepg - GraphMultiEPG shows a graphical timeline EPG. + enigma2-plugin-extensions-graphmultiepg + GraphMultiEPG shows a graphical timeline EPG GraphMultiEPG shows a graphical timeline EPG.\nShows a nice overview of all running und upcoming tv shows. - - Dream Multimedia - GraphMultiEPG - enigma2-plugin-extensions-graphmultiepg - Zeigt ein grafisches Zeitlinien-EPG. - Zeigt ein grafisches Zeitlinien-EPG.\nZeigt eine grafische Übersicht aller laufenden und kommenden Sendungen. - - - diff --git a/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml b/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml index 2f9f22bf..ffbb8e89 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml +++ b/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml @@ -2,23 +2,14 @@ - + Dream Multimedia MediaPlayer enigma2-plugin-extensions-mediaplayer - Mediaplayer plays your favorite music and videos. + Plays your favorite music and videos Mediaplayer plays your favorite music and videos.\nPlay all your favorite music and video files, organize them in playlists, view cover and album information. - - Dream Multimedia - MediaPlayer - enigma2-plugin-extensions-mediaplayer - Mediaplayer spielt Ihre Musik und Videos. - Mediaplayer spielt Ihre Musik und Videos.\nSie können all Ihre Musik- und Videodateien abspielen, in Playlisten organisieren, Cover und Albuminformationen abrufen. - - - diff --git a/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml b/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml index eced924f..eb9de1b6 100755 --- a/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml +++ b/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml @@ -1,25 +1,15 @@ - - + Dream Multimedia MediaScanner enigma2-plugin-extensions-mediascanner - MediaScanner scans devices for playable media files. + Scan devices for playable media files MediaScanner scans devices for playable media files and displays a menu with possible actions like viewing pictures or playing movies. - - Dream Multimedia - MediaScanner - enigma2-plugin-extensions-mediascanner - MediaScanner durchsucht Geräte nach Mediendateien. - MediaScanner durchsucht Geräte nach Mediendateien und bietet Ihnen die dazu passenden Aktionen an wie z.B. Bilder betrachten oder Videos abspielen. - - - diff --git a/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml b/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml index faff9785..16e2ec90 100755 --- a/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml +++ b/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml @@ -2,23 +2,14 @@ - + Dream Multimedia PicturePlayer enigma2-plugin-extensions-pictureplayer - PicturePlayer displays your photos on the TV. + Display your photos on the TV The PicturePlayer displays your photos on the TV.\nYou can view them as thumbnails or slideshow. - - Dream Multimedia - Bildbetrachter - enigma2-plugin-extensions-pictureplayer - Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an. - Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an.\nSie können sich Ihre Bilder als Thumbnails, einzeln oder als Slideshow anzeigen lassen. - - - diff --git a/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml b/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml old mode 100644 new mode 100755 index acf8374d..3eaf8fc5 --- a/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml +++ b/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml @@ -2,20 +2,13 @@ - + Dream Multimedia SocketMMI enigma2-plugin-extensions-socketmmi - Python frontend for /tmp/mmi.socket. + Frontend for /tmp/mmi.socket Python frontend for /tmp/mmi.socket. - - Dream Multimedia - SocketMMI - enigma2-plugin-extensions-socketmmi - Python frontend für /tmp/mmi.socket. - Python frontend für /tmp/mmi.socket. - diff --git a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml old mode 100644 new mode 100755 index 734c48f1..7ca10826 --- a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml +++ b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml @@ -2,20 +2,13 @@ - + Dream Multimedia TuxboxPlugins TuxboxPlugins - Allows the execution of TuxboxPlugins. + Execute TuxboxPlugins Allows the execution of TuxboxPlugins. - - Dream Multimedia - TuxboxPlugins - enigma2-plugin-extensions-tuxboxplugins - Erlaubt das Ausführen von TuxboxPlugins. - Erlaubt das Ausführen von TuxboxPlugins. - diff --git a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml index 99add3d3..d0781af4 100755 --- a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml +++ b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml @@ -2,26 +2,16 @@ - + Dream Multimedia CleanupWizard enigma2-plugin-systemplugins-cleanupwizard Automatically informs you on low internal memory - The CleanupWizard informs you when your internal free memory of your dreambox has droppen under 2MB. - You can use this wizard to remove some extensions. - + The CleanupWizard informs you when the internal free memory of your dreambox has dropped below a definable threshold. + You can use this wizard to remove some plugins. - - Dream Multimedia - CleanupWizard - enigma2-plugin-systemplugins-cleanupwizard - Informiert Sie automatisch wenn der interne Speicher Ihrer Dreambox voll wird. - Der CleanupWizard informiert Sie, wenn der interne freie Speicher Ihrer Dreambox unter 2MB fällt. - Sie können dann einige Erweiterungen deinstallieren um wieder Platz zu schaffen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml index 9abc5986..f34f0a3c 100755 --- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml @@ -4,28 +4,17 @@ - + Dream Multimedia CommonInterfaceAssignment enigma2-plugin-systemplugins-commoninterfaceassignment - Assigning providers/services/caids to a dedicated CI module - With the CommonInterfaceAssignment extension it is possible to use different CI modules - in your Dreambox and assign to each of them dedicated providers/services or caids.\n - So it is then possible to watch a scrambled service while recording another one. - - - - - Dream Multimedia - CommonInterfaceAssignment - enigma2-plugin-systemplugins-commoninterfaceassignment - Zuweisen von Providern/Services/CAIDs an ein CI Modul - Mit der CommonInterfaceAssignment Erweiterung ist es möglich jedem CI Modul bestimmte Provider/Services/CAIDs zuzuweisen.\n - So ist es möglich mit einem CI einen Sender aufzunehmen\n - und mit einem anderen einen Sender zu schauen. - + Assigning providers/services/caids to a CI module + With the CommonInterfaceAssignment plugin it is possible to use different + CI modules in your Dreambox and assign dedicated providers/services or caids to each of them.\n + This allows watching a scrambled service while recording another one. + diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml index a118ed7f..3140b15f 100755 --- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml +++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml @@ -2,26 +2,17 @@ - + Dream Multimedia CrashlogAutoSubmit enigma2-plugin-systemplugins-crashlogautosubmit Automatically send crashlogs to Dream Multimedia - With the CrashlogAutoSubmit extension it is possible to automatically send crashlogs - found on your Harddrive to Dream Multimedia + With the CrashlogAutoSubmit plugin it is possible to automatically + mail crashlogs found on your hard drive to Dream Multimedia. - - Dream Multimedia - CrashlogAutoSubmit - enigma2-plugin-systemplugins-crashlogautosubmit - Automatisches versenden von Crashlogs an Dream Multimedia - Mit dem CrashlogAutoSubmit Plugin ist es möglich auf Ihrer Festplatte - gefundene Crashlogs automatisch an Dream Multimedia zu versenden. - - - + diff --git a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml index 41d41ed6..74b7886f 100755 --- a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml +++ b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml @@ -1,26 +1,18 @@ - + Dream Multimedia DefaultServicesScanner enigma2-plugin-systemplugins-defaultservicesscanner - Scans default lamedbs sorted by satellite with a connected dish positioner. - With the DefaultServicesScanner extension you can scan default lamedbs sorted by satellite with a connected dish positioner. - - - - - Dream Multimedia - DefaultServicesScanner - enigma2-plugin-systemplugins-defaultservicesscanner - Standard Sendersuche nach Satellit mit einem Rotor. - Mit der DefaultServicesScanner Erweiterung können Sie eine standard Sendersuche nach Satellit mit einem angeschlossenen Rotor durchführen. + Scans default lamedbs sorted by satellite + With the DefaultServicesScanner plugin you can scan default lamedbs sorted by satellite with a connected dish positioner. + diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml index 33808b3e..567618b2 100755 --- a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml +++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml @@ -3,24 +3,16 @@ - + Dream Multimedia DiseqcTester enigma2-plugin-systemplugins-diseqctester - Test your Diseqc equipment. - With the DiseqcTester extension you can test your satellite equipment for Diseqc compatibility and errors. + Test your DiSEqC equipment + With the DiseqcTester plugin you can test your satellite equipment for DiSEqC compatibility and errors. - - Dream Multimedia - DiseqcTester - enigma2-plugin-systemplugins-diseqctester - Testet Ihr Diseqc Equipment. - Mit der DiseqcTester Erweiterung können Sie Ihr Satelliten-Equipment nach Diseqc-Kompatibilität und Fehlern überprüfen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml old mode 100644 new mode 100755 index 1763f67f..7b6fdca7 --- a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml +++ b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml @@ -3,24 +3,16 @@ - + Dream Multimedia FrontprocessorUpgrade enigma2-plugin-systemplugins-frontprocessorupgrade internal - Internal firmware updater. + Internal firmware updater This system tool is internally used to program the hardware with firmware updates. - - Dream Multimedia - FrontprocessorUpgrade - enigma2-plugin-systemplugins-frontprocessorupgrade - internal - Interner Firmware-Upgrader. - Dieses Systemtool wird intern benutzt um Firmware-Upgrades für die Hardware aufzuspielen. - - + diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml b/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml old mode 100644 new mode 100755 index 6c2824ca..610dfee6 --- a/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml +++ b/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml @@ -2,22 +2,15 @@ - + Dream Multimedia Hotplug enigma2-plugin-systemplugins-hotplug - Hotplugging for removeable devices. - The Hotplug extension notifies your system of newly added or removed devices. - - - - Dream Multimedia - Hotplug - enigma2-plugin-systemplugins-hotplug - Hotplugging für entfernbare Geräte. - Mit der Hotplug-Erweiterung wird Ihr System über neu angeschlossene oder entfernte Geräte informiert. + Hotplugging for removeable devices + The Hotplug plugin notifies your system of newly added or removed devices. + diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml index c81f4ca5..f93f5c5a 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml @@ -2,28 +2,18 @@ - - + Dream Multimedia NFIFlash enigma2-plugin-systemplugins-nfiflash - Restore your Dreambox with a USB stick. - With the NFIFlash extension it is possible to prepare a USB stick with an Dreambox image.\n + Restore your Dreambox with a USB stick + With the NFIFlash plugin it is possible to prepare a USB stick with an Dreambox image.\n It is then possible to flash your Dreambox with the image on that stick. - - Dream Multimedia - NFIFlash - enigma2-plugin-systemplugins-nfiflash - Wiederherstellen Ihrer Dreambox mittels USB-Stick. - Mit der NFIFlash Erweiterung können Sie ein Dreambox Image auf einen USB-Stick laden.\ - Mit diesem USB-Stick ist es dann möglich Ihre Dreambox zu flashen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml index 4d3adcbd..423365f1 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml @@ -1,26 +1,18 @@ + - + Dream Multimedia NetworkWizard enigma2-plugin-systemplugins-networkwizard Step by step network configuration - With the NetworkWizard you can easy configure your network step by step. + With the NetworkWizard you can easily configure your network step by step. - - Dream Multimedia - NetzwerkWizard - enigma2-plugin-systemplugins-networkwizard - Schritt für Schritt Netzwerk konfiguration - Mit dem NetzwerkWizard können Sie Ihr Netzwerk konfigurieren. Sie werden Schritt - für Schritt durch die Konfiguration geleitet. - - - + diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml index 2cb47c07..5e1db7ba 100755 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml @@ -3,25 +3,16 @@ - + Dream Multimedia PositionerSetup enigma2-plugin-systemplugins-positionersetup - PositionerSetup helps you installing a motorized dish. - With the PositionerSetup extension it is easy to install and configure a motorized dish. - - - - - Dream Multimedia - PositionerSetup - enigma2-plugin-systemplugins-positionersetup - Unterstützt Sie beim installieren eines Rotors. - Die PositionerSetup Erweiterung unterstützt Sie beim einrichten - und konfigurieren einer motorgesteuerten Satellitenantenne. + PositionerSetup helps you installing a motorized dish + With the PositionerSetup plugin it is easy to install and configure a motorized dish. + diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml index 4c0c7af7..904f9a2e 100755 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml @@ -3,25 +3,17 @@ - + Dream Multimedia SatelliteEquipmentControl SatelliteEquipmentControl enigma2-plugin-systemplugins-satelliteequipmentcontrol - SatelliteEquipmentControl allows you to fine-tune DiSEqC-settings. - With the SatelliteEquipmentControl extension it is possible to fine-tune DiSEqC-settings. - - - - - Dream Multimedia - SatelliteEquipmentControl - enigma2-plugin-systemplugins-satelliteequipmentcontrol - Fein-Einstellungen für DiSEqC - Die SatelliteEquipmentControl-Erweiterung unterstützt Sie beim Feintuning der DiSEqC Einstellungen. + SatelliteEquipmentControl allows you to fine-tune DiSEqC-settings + With the SatelliteEquipmentControl plugin it is possible to fine-tune DiSEqC-settings. + diff --git a/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml b/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml index e9453deb..fe0c901e 100755 --- a/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml +++ b/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml @@ -1,28 +1,18 @@ - + - + Dream Multimedia Satfinder enigma2-plugin-systemplugins-satfinder - Satfinder helps you to align your dish. - The Satfinder extension helps you to align your dish.\n + Satfinder helps you to align your dish + The Satfinder plugin helps you to align your dish.\n It shows you informations about signal rate and errors. - - Dream Multimedia - Satfinder - enigma2-plugin-systemplugins-satfinder - Satfinder unterstützt Sie beim ausrichten ihrer Satellitenanlage. - Die Satfinder-Erweiterung unterstützt Sie beim Ausrichten ihrer Satellitenanlage.\n - Es zeigt Ihnen Daten wie Signalstärke und Fehlerrate an. - - - diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml index 717f732b..73544a56 100755 --- a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml +++ b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml @@ -1,28 +1,19 @@ - + Dream Multimedia SkinSelector enigma2-plugin-systemplugins-skinselector - SkinSelector shows a menu with selectable skins. + SkinSelector shows a menu with selectable skins The SkinSelector shows a menu with selectable skins.\n It's now easy to change the look and feel of your Dreambox. - - Dream Multimedia - SkinSelector - enigma2-plugin-systemplugins-skinselector - Der SkinSelector zeigt Ihnen ein Menu mit auswählbaren Skins. - Die SkinSelector Erweiterung zeigt Ihnen ein Menu mit auswählbaren Skins.\n - Sie können nun einfach das Aussehen der grafischen Oberfläche Ihrer Dreambox verändern. - - - + diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index d4653cca..e3a9acb7 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -28,7 +28,7 @@ class SoftwareTools(DreamInfoHandler): 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) + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion) self.directory = resolveFilename(SCOPE_METADIR) self.hardware_info = HardwareInfo() self.list = List([]) diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml index cd425c33..4135a212 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml @@ -3,27 +3,17 @@ - + Dream Multimedia SoftwareManager enigma2-plugin-systemplugins-softwaremanager - SoftwareManager manages your Dreambox software. + SoftwareManager manages your Dreambox software The SoftwareManager manages your Dreambox software.\n - It's easy to update your receiver's software, install or remove extensions or even backup and restore your system settings. + It's easy to update your receiver's software, install or remove plugins or even backup and restore your system settings. - - Dream Multimedia - SoftwareManager - enigma2-plugin-systemplugins-softwaremanager - Der SoftwareManager verwaltet Ihre Dreambox Software. - Der SoftwareManager verwaltet Ihre Dreambox Software.\n - Sie können nun einfach Ihre Dreambox-Software aktualisieren, neue Erweiterungen installieren oder entfernen, - oder ihre Einstellungen sichern und wiederherstellen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 1e0ed4d5..286636cc 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -589,13 +589,13 @@ class PluginManager(Screen, DreamInfoHandler): status = "remove" else: status = "installed" - self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState)) + self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) else: if selectState == True: status = "install" else: status = "installable" - self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState)) + self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) if len(self.list): self.list.sort(key=lambda x: x[0]) self["list"].style = "default" @@ -904,8 +904,7 @@ class PluginDetails(Screen, DreamInfoHandler): 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) + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False) self.directory = resolveFilename(SCOPE_METADIR) if packagedata: self.pluginname = packagedata[0] @@ -943,8 +942,6 @@ class PluginDetails(Screen, DreamInfoHandler): 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!") @@ -954,7 +951,7 @@ class PluginDetails(Screen, DreamInfoHandler): self.onLayoutFinish.append(self.setInfos) def setWindowTitle(self): - self.setTitle(_("Details for extension: " + self.pluginname)) + self.setTitle(_("Details for plugin: ") + self.pluginname ) def exit(self): self.close(False) @@ -969,34 +966,26 @@ class PluginDetails(Screen, DreamInfoHandler): pass def setInfos(self): - if self.translatedAttributes.has_key("name"): - self.pluginname = self.translatedAttributes["name"] - elif self.attributes.has_key("name"): + if self.attributes.has_key("screenshot"): + self.loadThumbnail(self.attributes) + + if 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"): + if 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"] + if self.attributes.has_key("description"): + self.description = _(self.attributes["description"].replace("\\n", "\n")) 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()) + self["detailtext"].setText(_(self.description)) if self.pluginstate in ('installable', 'install'): self["key_green"].setText(_("Install")) else: @@ -1006,6 +995,10 @@ class PluginDetails(Screen, DreamInfoHandler): thumbnailUrl = None if entry.has_key("screenshot"): thumbnailUrl = entry["screenshot"] + if self.language == "de": + if thumbnailUrl[-7:] == "_en.jpg": + thumbnailUrl = thumbnailUrl[:-7] + "_de.jpg" + if thumbnailUrl is not None: self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1] print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE b/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE new file mode 100755 index 00000000..99700593 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE @@ -0,0 +1,12 @@ +This plugin is licensed under the Creative Commons +Attribution-NonCommercial-ShareAlike 3.0 Unported +License. To view a copy of this license, visit +http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative +Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + +Alternatively, this plugin may be distributed and executed on hardware which +is licensed by Dream Multimedia GmbH. + +This plugin is NOT free software. It is open source, you are allowed to +modify it (if you keep the license), but it may not be commercially +distributed other than under the conditions noted above. diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am old mode 100644 new mode 100755 index 78ff11c3..cfdeb654 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am @@ -1,5 +1,9 @@ installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/TempFanControl +SUBDIRS = meta + install_PYTHON = \ __init__.py \ plugin.py + +dist_install_DATA = LICENSE \ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am new file mode 100755 index 00000000..da7be245 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am @@ -0,0 +1,3 @@ +installdir = $(datadir)/meta + +dist_install_DATA = plugin_tempfancontrol.xml diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml new file mode 100755 index 00000000..a0bb5fa5 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml @@ -0,0 +1,18 @@ + + + + + + + + Dream Multimedia + TempFanControl + enigma2-plugin-systemplugins-tempfancontrol + Control your system fan + Control your internal system fan. + + + + + + diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml index 208c7e0c..11b0c59f 100755 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml @@ -6,22 +6,14 @@ - + Dream Multimedia VideoEnhancement enigma2-plugin-systemplugins-videoenhancement - VideoEnhancement provides advanced video enhancement settings. - The VideoEnhancement extension provides advanced video enhancement settings. + VideoEnhancement provides advanced video enhancement settings + The VideoEnhancement plugin provides advanced video enhancement settings. - - Dream Multimedia - Erweiterte A/V Einstellungen - enigma2-plugin-systemplugins-videoenhancement - Erweiterte A/V Einstellungen für Ihre Dreambox. - Erweiterte A/V Einstellungen für Ihre Dreambox. - - diff --git a/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml b/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml index c4609433..78b170ac 100755 --- a/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml +++ b/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml @@ -3,23 +3,14 @@ - + Dream Multimedia VideoTune enigma2-plugin-systemplugins-videotune - VideoTune helps fine-tuning your tv display. + VideoTune helps fine-tuning your tv display The VideoTune helps fine-tuning your tv display.\nYou can control brightness and contrast of your tv. - - Dream Multimedia - DE - VideoTune - DE - enigma2-plugin-systemplugins-videotune - VideoTune hilft beim fein-einstellen des Fernsehers. - VideoTune hilf beim fein-einstellen des Fernsehers.\nSie können Kontrast und Helligkeit fein-einstellen. - - - diff --git a/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml b/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml index fbb6e3f4..e16a7dc8 100755 --- a/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml +++ b/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml @@ -3,22 +3,14 @@ - + Dream Multimedia Videomode enigma2-plugin-systemplugins-videomode - Videomode provides advanced video modes. - The Videomode extension provides advanced video modes. + Videomode provides advanced video mode settings + The Videomode plugin provides advanced video mode settings. - - Dream Multimedia - Videomode - enigma2-plugin-systemplugins-videomode - Videomode bietet erweiterte Video Einstellungen. - Die Videomode-Erweiterung bietet erweiterte Video-Einstellungen. - - diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml index 1f882b32..eca6c0f9 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml @@ -3,22 +3,14 @@ - + Dream Multimedia WirelessLan enigma2-plugin-systemplugins-wirelesslan Configure your WLAN network interface - The WirelessLan extensions helps you configuring your WLAN network interface. + The WirelessLan plugin helps you configuring your WLAN network interface. - - Dream Multimedia - WirelessLan - enigma2-plugin-systemplugins-wirelesslan - Konfigurieren Sie Ihr WLAN Netzwerk. - Die WirelessLan Erweiterung hilft Ihnen beim konfigurieren Ihres WLAN Netzwerkes.. - - diff --git a/tools/genmetaindex.py b/tools/genmetaindex.py index f7dc5b98..f42cefc2 100755 --- a/tools/genmetaindex.py +++ b/tools/genmetaindex.py @@ -1,25 +1,23 @@ -# usage: genmetaindex.py > index.xml +# usage: genmetaindex.py > index.xml import sys, os from xml.etree.ElementTree import ElementTree, Element -language = sys.argv[1] - root = Element("index") -for file in sys.argv[2:]: +for file in sys.argv[1:]: p = ElementTree() p.parse(file) package = Element("package") package.set("details", os.path.basename(file)) - # we need all prerequisuited + # we need all prerequisites package.append(p.find("prerequisites")) info = None - # we need some of the info, but only our locale + # we need some of the info, but not all for i in p.findall("info"): - if not info or i.get("language") == language: + if not info: info = i assert info -- cgit v1.2.3 From f5ff68d184672add16da02cd34993c2d39b87c82 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 22 Sep 2010 15:39:36 +0200 Subject: Components/DreamInfoHandler.py: ignore old meta-xml index files. refs #578 --- lib/python/Components/DreamInfoHandler.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index dd140cbb..40305671 100755 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -222,6 +222,8 @@ class DreamInfoHandler: for indexfile in os.listdir(self.directory[0]): if indexfile.startswith("index-"): if indexfile.endswith(".xml"): + if indexfile[-7:-6] == "_": + continue indexfileList.append(indexfile) if len(indexfileList): for file in indexfileList: -- cgit v1.2.3 From 3b990b579c3f4211994b91ea60f3d9f868ac065a Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 29 Sep 2010 09:28:40 +0200 Subject: DreamInfoHandler.py: strip data. refs #578 --- lib/python/Components/DreamInfoHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index 40305671..03d52157 100755 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -123,7 +123,7 @@ class InfoHandler(xml.sax.ContentHandler): if self.elements[-1] == "shortdescription": self.attributes["shortdescription"] = str(data) if self.elements[-1] == "description": - self.data += data + self.data += data.strip() self.attributes["description"] = str(self.data) #print "characters", data -- cgit v1.2.3 From 77dc369c56e6995d1aeda3c7b686ed675534ec90 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 15:21:13 +0200 Subject: fixes bug #467 add tpm interface to enigma 2 introduce a demo plugin for tpm usage in plugins to validate running on dream multimedia hardware to be used in plugins (see doc/TPM for further information) --- configure.ac | 1 + doc/TPM | 24 +++ lib/base/Makefile.am | 2 +- lib/base/etpm.cpp | 161 +++++++++++++++++++++ lib/base/etpm.h | 46 ++++++ lib/python/Plugins/DemoPlugins/Makefile.am | 6 +- lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am | 5 + lib/python/Plugins/DemoPlugins/TPMDemo/README | 1 + lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py | 82 +++++++++++ lib/python/Plugins/Makefile.am | 1 + lib/python/enigma_python.i | 2 + 11 files changed, 328 insertions(+), 3 deletions(-) create mode 100644 doc/TPM create mode 100644 lib/base/etpm.cpp create mode 100644 lib/base/etpm.h create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/README create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py (limited to 'lib/python') diff --git a/configure.ac b/configure.ac index 9a616220..35fad779 100755 --- a/configure.ac +++ b/configure.ac @@ -118,6 +118,7 @@ lib/python/Components/Sources/Makefile lib/python/Screens/Makefile lib/python/Plugins/Makefile lib/python/Plugins/DemoPlugins/Makefile +lib/python/Plugins/DemoPlugins/TPMDemo/Makefile lib/python/Plugins/DemoPlugins/TestPlugin/Makefile lib/python/Plugins/Extensions/CutListEditor/Makefile lib/python/Plugins/Extensions/CutListEditor/meta/Makefile diff --git a/doc/TPM b/doc/TPM new file mode 100644 index 00000000..2b2b2062 --- /dev/null +++ b/doc/TPM @@ -0,0 +1,24 @@ +If you'd like to write your own plugins and honor the efforts, Dream Multimedia +puts into developing Enigma 2, you can protect your plugin against execution +on Non-Dream Multimedia Hardware by implementing a TPM (Trusted Platform Module) +check into your plugin. +For ease of use we provide a demo plugin in lib/python/Plugins/DemoPlugins/TPMDemo. + +The main TPM check is implemented into the "main" function. You need to provide +this code yourself in your plugin. So copy&paste the code into your own as well +as the needed functions +- bin2long +- long2bin +- rsa_pub1024 +- decrypt_block +- validate_cert +- read_random +Importing the functions from somewhere else would spoil the security model. So +you need to provide the code with your plugin. + +You can either use the given method using the main function (which will run the +TPM check each time the plugin is called) or directly use it in the +Plugins(**kwargs) function and not return the Plugins-list if the TPM check failes +(which will prevent the plugin from showing up at all). You can also implement +a warning message for all possible TPM failure scenarios. + \ No newline at end of file diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am index 6ea9d03f..05085632 100644 --- a/lib/base/Makefile.am +++ b/lib/base/Makefile.am @@ -8,5 +8,5 @@ libenigma_base_a_SOURCES = \ init.cpp message.cpp thread.cpp \ smartptr.cpp estring.cpp connection.cpp \ filepush.cpp encoding.cpp console.cpp rawfile.cpp \ - nconfig.cpp ioprio.cpp + nconfig.cpp ioprio.cpp etpm.cpp diff --git a/lib/base/etpm.cpp b/lib/base/etpm.cpp new file mode 100644 index 00000000..f1ac07ba --- /dev/null +++ b/lib/base/etpm.cpp @@ -0,0 +1,161 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DEFINE_REF(eTPM); + +eTPM::eTPM() +{ + struct sockaddr_un addr; + unsigned char buf[8]; + unsigned int tag, len; + unsigned char *val; + + level2_cert_read = level3_cert_read = false; + + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, TPMD_SOCKET); + + fd = socket(PF_UNIX, SOCK_STREAM, 0); + if (fd < 0) { + eDebug("[eTPM] socket error"); + return; + } + + if (connect(fd, (const struct sockaddr *)&addr, SUN_LEN(&addr)) < 0) { + eDebug("[eTPM] connect error"); + return; + } + + buf[0] = TPMD_DT_LEVEL2_CERT; + buf[1] = TPMD_DT_LEVEL3_CERT; + if (!send_cmd(TPMD_CMD_GET_DATA, buf, 2)) + { + return; + } + + val = (unsigned char*)recv_cmd(&tag, &len); + if (val == NULL) + { + return; + } + + parse_data(val, len); + free(val); +} + +eTPM::~eTPM() +{ + +} + +bool eTPM::send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len) +{ + unsigned char buf[len + 4]; + + buf[0] = (cmd >> 8) & 0xff; + buf[1] = (cmd >> 0) & 0xff; + buf[2] = (len >> 8) & 0xff; + buf[3] = (len >> 0) & 0xff; + memcpy(&buf[4], data, len); + + if (write(fd, buf, sizeof(buf)) != (ssize_t)sizeof(buf)) { + fprintf(stderr, "%s: incomplete write\n", __func__); + return false; + } + + return true; +} + +void* eTPM::recv_cmd(unsigned int *tag, unsigned int *len) +{ + unsigned char buf[4]; + void *val; + + if (read(fd, buf, 4) != 4) { + fprintf(stderr, "%s: incomplete read\n", __func__); + return NULL; + } + + *tag = (buf[0] << 8) | buf[1]; + *len = (buf[2] << 8) | buf[3]; + + val = malloc(*len); + if (val == NULL) + return NULL; + + if (read(fd, val, *len) != (ssize_t)*len) { + fprintf(stderr, "%s: incomplete read\n", __func__); + free(val); + return NULL; + } + + return val; +} + +void eTPM::parse_data(const unsigned char *data, unsigned int datalen) +{ + unsigned int i, j; + unsigned int tag; + unsigned int len; + const unsigned char *val; + + for (i = 0; i < datalen; i += len) { + tag = data[i++]; + len = data[i++]; + val = &data[i]; + + switch (tag) { + case TPMD_DT_LEVEL2_CERT: + if (len != 210) + break; + memcpy(level2_cert, val, 210); + level2_cert_read = true; + break; + case TPMD_DT_LEVEL3_CERT: + if (len != 210) + break; + memcpy(level3_cert, val, 210); + level3_cert_read = true; + break; + } + } +} + +PyObject *eTPM::getCert(cert_type type) +{ + if (type == TPMD_DT_LEVEL2_CERT && level2_cert_read) + return PyBuffer_FromMemory(level2_cert, 210); + else if (type == TPMD_DT_LEVEL3_CERT && level3_cert_read) + return PyBuffer_FromMemory(level3_cert, 210); + return Py_None; + +} + +PyObject *eTPM::challenge(PyObject* rnd) +{ + if (PyString_Check(rnd) && PyString_Size(rnd) == 8) + { + char* buf = PyString_AsString(rnd); + if (!send_cmd(TPMD_CMD_COMPUTE_SIGNATURE, buf, 8)) + return Py_None; + + unsigned int tag, len; + unsigned char *val = (unsigned char*)recv_cmd(&tag, &len); + + if (tag != TPMD_CMD_COMPUTE_SIGNATURE) + return Py_None; + + return PyBuffer_FromMemory(val, len); + } + else + return Py_None; +} diff --git a/lib/base/etpm.h b/lib/base/etpm.h new file mode 100644 index 00000000..3728249b --- /dev/null +++ b/lib/base/etpm.h @@ -0,0 +1,46 @@ +#ifndef __lib_base_etpm_h +#define __lib_base_etpm_h + +#include +#include + +#ifndef SWIG +#define TPMD_SOCKET "/var/run/tpmd_socket" +#endif + +class eTPM: public Object, public iObject +{ + DECLARE_REF(eTPM); +#ifndef SWIG + int fd; + unsigned char level2_cert[210]; + unsigned char level3_cert[210]; + bool level2_cert_read; + bool level3_cert_read; + + enum tpmd_cmd { + TPMD_CMD_RESERVED = 0x0000, + TPMD_CMD_GET_DATA = 0x0001, + TPMD_CMD_APDU = 0x0002, + TPMD_CMD_COMPUTE_SIGNATURE = 0x0003, + TPMD_CMD_APP_CERT = 0x0004, + }; + + bool send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len); + void *recv_cmd(unsigned int *tag, unsigned int *len); + void parse_data(const unsigned char *data, unsigned int datalen); + +#endif +public: + eTPM(); + ~eTPM(); + + enum cert_type { + TPMD_DT_LEVEL2_CERT = 0x04, + TPMD_DT_LEVEL3_CERT = 0x05 + }; + PyObject *getCert(cert_type type); + PyObject *challenge(PyObject *rnd); +}; + +#endif // __lib_base_etpm_h diff --git a/lib/python/Plugins/DemoPlugins/Makefile.am b/lib/python/Plugins/DemoPlugins/Makefile.am index aace17cc..9e16bfc1 100755 --- a/lib/python/Plugins/DemoPlugins/Makefile.am +++ b/lib/python/Plugins/DemoPlugins/Makefile.am @@ -1,6 +1,8 @@ installdir = $(pkglibdir)/python/Plugins/DemoPlugins -SUBDIRS = TestPlugin +SUBDIRS = TestPlugin TPMDemo install_PYTHON = \ - __init__.py \ No newline at end of file + __init__.py + + \ No newline at end of file diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am new file mode 100644 index 00000000..3ccca98e --- /dev/null +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am @@ -0,0 +1,5 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/DemoPlugins/TPMDemo + +install_PYTHON = \ + __init__.py \ + plugin.py diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/README b/lib/python/Plugins/DemoPlugins/TPMDemo/README new file mode 100644 index 00000000..89a972aa --- /dev/null +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/README @@ -0,0 +1 @@ +Please read enigma2/doc/TPM for further instructions on how to integrate this into your own plugins. \ No newline at end of file diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py new file mode 100644 index 00000000..dafb2837 --- /dev/null +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py @@ -0,0 +1,82 @@ +from Screens.Screen import Screen +from Plugins.Plugin import PluginDescriptor +from enigma import eTPM +import sha + +def bin2long(s): + return reduce( lambda x,y:(x<<8L)+y, map(ord, s)) + +def long2bin(l): + res = "" + for byte in range(128): + res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff) + return res + +def rsa_pub1024(src, mod): + return long2bin(pow(bin2long(src), 65537, bin2long(mod))) + +def decrypt_block(src, mod): + if len(src) != 128 and len(src) != 202: + return None + dest = rsa_pub1024(src[:128], mod) + hash = sha.new(dest[1:107]) + if len(src) == 202: + hash.update(src[131:192]) + result = hash.digest() + if result == dest[107:127]: + return dest + return None + +def validate_cert(cert, key): + buf = decrypt_block(cert[8:], key) + if buf is None: + return None + return buf[36:107] + cert[139:196] + +def read_random(): + try: + fd = open("/dev/urandom", "r") + buf = fd.read(8) + fd.close() + return buf + except: + return None + +def main(session, **kwargs): + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + print "l2cert not found" + return + + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + print "l2cert invalid" + return + + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)" + return + + l3key = validate_cert(l3cert, l2key) + if l3key is None: + print "l3cert invalid" + return + + rnd = read_random() + if rnd is None: + print "random error" + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if result[80:88] == rnd: + print "successfully finished the tpm test" + # would start your plugin here + +def Plugins(**kwargs): + return [PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main), + PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), icon = "plugin.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main)] + \ No newline at end of file diff --git a/lib/python/Plugins/Makefile.am b/lib/python/Plugins/Makefile.am index f0435036..79d2b0b6 100644 --- a/lib/python/Plugins/Makefile.am +++ b/lib/python/Plugins/Makefile.am @@ -4,3 +4,4 @@ SUBDIRS = Extensions SystemPlugins DemoPlugins install_PYTHON = \ __init__.py Plugin.py + diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 2fec2ff1..19fb9254 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -39,6 +39,7 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include #include #include #include @@ -157,6 +158,7 @@ typedef long time_t; %immutable ePythonMessagePump::recv_msg; %immutable eDVBLocalTimeHandler::m_timeUpdated; %include +%include %include %include %include -- cgit v1.2.3 From 4a4b39509d9e8675a519be91a184d2069c14397f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 19:10:52 +0200 Subject: refs bug #467 add __init__.py in TPMDemo plugin --- lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py (limited to 'lib/python') diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py b/lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From 6e6b1b30fd31f653b18772dffebac81c62e383b5 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 20:40:28 +0200 Subject: refs bug #467 whitelist dm7025 from tpm test and add beta warning to the documentation --- doc/TPM | 5 +- lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py | 63 +++++++++++++----------- 2 files changed, 37 insertions(+), 31 deletions(-) (limited to 'lib/python') diff --git a/doc/TPM b/doc/TPM index 2b2b2062..20c02300 100644 --- a/doc/TPM +++ b/doc/TPM @@ -1,3 +1,6 @@ +The TPM check is currently to be considered a beta version. So please expect +code changes in the future. + If you'd like to write your own plugins and honor the efforts, Dream Multimedia puts into developing Enigma 2, you can protect your plugin against execution on Non-Dream Multimedia Hardware by implementing a TPM (Trusted Platform Module) @@ -21,4 +24,4 @@ TPM check each time the plugin is called) or directly use it in the Plugins(**kwargs) function and not return the Plugins-list if the TPM check failes (which will prevent the plugin from showing up at all). You can also implement a warning message for all possible TPM failure scenarios. - \ No newline at end of file + diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py index dafb2837..0be09ccf 100644 --- a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py @@ -1,5 +1,6 @@ from Screens.Screen import Screen from Plugins.Plugin import PluginDescriptor +from Tools.HardwareInfo import HardwareInfo from enigma import eTPM import sha @@ -43,38 +44,40 @@ def read_random(): return None def main(session, **kwargs): - rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + device = HardwareInfo().get_device_name() + if device != "dm7025": + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + print "l2cert not found" + return - etpm = eTPM() - l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) - if l2cert is None: - print "l2cert not found" - return - - l2key = validate_cert(l2cert, rootkey) - if l2key is None: - print "l2cert invalid" - return - - l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) - if l3cert is None: - print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)" - return - - l3key = validate_cert(l3cert, l2key) - if l3key is None: - print "l3cert invalid" - return - - rnd = read_random() - if rnd is None: - print "random error" - return - val = etpm.challenge(rnd) - result = decrypt_block(val, l3key) - if result[80:88] == rnd: + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + print "l2cert invalid" + return + + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)" + return + + l3key = validate_cert(l3cert, l2key) + if l3key is None: + print "l3cert invalid" + return + + rnd = read_random() + if rnd is None: + print "random error" + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if device == "dm7025" or result[80:88] == rnd: print "successfully finished the tpm test" - # would start your plugin here + # would start your plugin here def Plugins(**kwargs): return [PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main), -- cgit v1.2.3 From b451e9ca5fac13989e123d45b173cb053ee6180a Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 20:49:15 +0200 Subject: refs bug #467 read proc device instead of using internal methods --- lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py index 0be09ccf..2c078d35 100644 --- a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py @@ -1,6 +1,5 @@ from Screens.Screen import Screen from Plugins.Plugin import PluginDescriptor -from Tools.HardwareInfo import HardwareInfo from enigma import eTPM import sha @@ -44,7 +43,10 @@ def read_random(): return None def main(session, **kwargs): - device = HardwareInfo().get_device_name() + try: + device = open("/proc/stb/info/model", "r").readline().strip() + except: + device = "" if device != "dm7025": rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] -- cgit v1.2.3 From 57275452069078c5aeaaf1785ff178419c864eb4 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 16 Jul 2010 01:36:14 +0200 Subject: fixes bug #552 add the equal sign to numerical text input onto the 0 rcu button --- lib/python/Tools/NumericalTextInput.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Tools/NumericalTextInput.py b/lib/python/Tools/NumericalTextInput.py index df6a5ea8..da090b13 100644 --- a/lib/python/Tools/NumericalTextInput.py +++ b/lib/python/Tools/NumericalTextInput.py @@ -31,7 +31,7 @@ class NumericalTextInput: return if self.lang == 'de_DE': - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"aäbc2AÄBC") # 2 self.mapping.append (u"def3DEF") # 3 @@ -42,7 +42,7 @@ class NumericalTextInput: self.mapping.append (u"tuüv8TUÜV") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 elif self.lang == 'es_ES': - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"abcáà2ABCÃÀ") # 2 self.mapping.append (u"deéèf3DEFÉÈ") # 3 @@ -53,7 +53,7 @@ class NumericalTextInput: self.mapping.append (u"tuvúù8TUVÚÙ") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 if self.lang in ('sv_SE', 'fi_FI'): - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"abcåä2ABCÅÄ") # 2 self.mapping.append (u"defé3DEFÉ") # 3 @@ -64,7 +64,7 @@ class NumericalTextInput: self.mapping.append (u"tuv8TUV") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 else: - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"abc2ABC") # 2 self.mapping.append (u"def3DEF") # 3 -- cgit v1.2.3 From ddef990f9a2b56ef9c63dda46d1b84c9438410c5 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 22 Jul 2010 19:37:35 +0200 Subject: fixes bug #556 - fixes adding timers from inside the movie player: the .ts service was added as channel - fixes a small bug in ConfigSelection to allow empty strings inside the ChoicesList --- RecordTimer.py | 5 ++++- ServiceReference.py | 6 ++++++ lib/python/Components/config.py | 2 +- lib/python/Screens/TimerEntry.py | 22 +++++++++++++++++++--- 4 files changed, 30 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/RecordTimer.py b/RecordTimer.py index 1608caaf..def75684 100755 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -102,7 +102,10 @@ class RecordTimerEntry(timer.TimerEntry, object): assert isinstance(serviceref, ServiceReference) - self.service_ref = serviceref + if serviceref.getType() == eServiceReference.idDVB and serviceref.getPath() == "": + self.service_ref = serviceref + else: + self.service_ref = ServiceReference(None) self.eit = eit self.dontSave = False self.name = name diff --git a/ServiceReference.py b/ServiceReference.py index 11e28786..5d11ae77 100644 --- a/ServiceReference.py +++ b/ServiceReference.py @@ -20,3 +20,9 @@ class ServiceReference(eServiceReference): def list(self): return self.serviceHandler.list(self.ref) + + def getType(self): + return self.ref.type + + def getPath(self): + return self.ref.getPath() diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 471b59ec..1afd398e 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -178,7 +178,7 @@ class choicesList(object): # XXX: we might want a better name for this def __list__(self): if self.type == choicesList.LIST_TYPE_LIST: - ret = [not isinstance(x, tuple) and x or x[0] for x in self.choices] + ret = [not isinstance(x, tuple) and x or len(x) > 0 and x[0] or len(x) == 0 and x for x in self.choices] else: ret = self.choices.keys() return ret or [""] diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index 64fa9f19..62faf9bf 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -13,8 +13,9 @@ from Components.UsageConfig import defaultMoviePath from Screens.MovieSelection import getPreferredTagEditor from Screens.LocationBox import MovieLocationBox from Screens.ChoiceBox import ChoiceBox +from Screens.MessageBox import MessageBox from RecordTimer import AFTEREVENT -from enigma import eEPGCache +from enigma import eEPGCache, eServiceReference from time import localtime, mktime, time, strftime from datetime import datetime @@ -245,7 +246,7 @@ class TimerEntry(Screen, ConfigListScreen): self.timerentry_service_ref = ServiceReference(args[0]) self.timerentry_service.setCurrentText(self.timerentry_service_ref.getServiceName()) self["config"].invalidate(self.channelEntry) - + def getTimestamp(self, date, mytime): d = localtime(date) dt = datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1]) @@ -264,7 +265,22 @@ class TimerEntry(Screen, ConfigListScreen): end += 86400 return begin, end - def keyGo(self): + def selectChannelSelector(self, *args): + self.session.openWithCallback( + self.finishedChannelSelectionCorrection, + ChannelSelection.SimpleChannelSelection, + _("Select channel to record from") + ) + + def finishedChannelSelectionCorrection(self, *args): + if args: + self.finishedChannelSelection(*args) + self.keyGo() + + def keyGo(self, result = None): + if self.timerentry_service_ref.getType() != eServiceReference.idDVB or self.timerentry_service_ref.getPath() != "": + self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR) + return self.timer.name = self.timerentry_name.value self.timer.description = self.timerentry_description.value self.timer.justplay = self.timerentry_justplay.value == "zap" -- cgit v1.2.3 From 073cea58c7f58a9cd2fe2adf9c93c0557b54d854 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 13 Sep 2010 23:42:23 +0200 Subject: fixes bug #582 handle keyboard entries in wizard correctly for dynamic config elements --- lib/python/Screens/Wizard.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 1bff0284..a752d31c 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -387,10 +387,14 @@ class Wizard(Screen): def keyNumberGlobal(self, number): if (self.wizard[self.currStep]["config"]["screen"] != None): self.configInstance.keyNumberGlobal(number) + elif (self.wizard[self.currStep]["config"]["type"] == "dynamic"): + self["config"].handleKey(KEY_0 + number) def keyGotAscii(self): if (self.wizard[self.currStep]["config"]["screen"] != None): self["config"].handleKey(KEY_ASCII) + elif (self.wizard[self.currStep]["config"]["type"] == "dynamic"): + self["config"].handleKey(KEY_ASCII) def left(self): self.resetCounter() -- cgit v1.2.3 From 8646cfe67f006cbec63cfe8fbbff50b6aa5ba811 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 27 Sep 2010 15:08:16 +0200 Subject: fixes bug #584 - Fixes BSOD in radio mode when trying to add a service to the favourites - Don't close ChannelSelection when adding a service to the facourites. --- lib/python/Screens/ChannelSelection.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 0895c9c2..9ced5840 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -223,7 +223,7 @@ class ChannelContextMenu(Screen): if cnt > 1: # show bouquet list self.bsel = self.session.openWithCallback(self.bouquetSelClosed, BouquetSelector, bouquets, self.addCurrentServiceToBouquet) elif cnt == 1: # add to only one existing bouquet - self.addCurrentServiceToBouquet(bouquets[0][1]) + self.addCurrentServiceToBouquet(bouquets[0][1], closeBouquetSelection = False) def bouquetSelClosed(self, recursive): self.bsel = None @@ -257,12 +257,12 @@ class ChannelContextMenu(Screen): self.csel.addMarker(marker) self.close() - def addCurrentServiceToBouquet(self, dest): + def addCurrentServiceToBouquet(self, dest, closeBouquetSelection = True): self.csel.addServiceToBouquet(dest) if self.bsel is not None: self.bsel.close(True) else: - self.close(True) # close bouquet selection + self.close(closeBouquetSelection) # close bouquet selection def removeCurrentService(self): self.csel.removeCurrentService() @@ -1400,9 +1400,9 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"], { - "keyTV": self.closeRadio, - "keyRadio": self.closeRadio, - "cancel": self.closeRadio, + "keyTV": self.cancel, + "keyRadio": self.cancel, + "cancel": self.cancel, "ok": self.channelSelected, }) @@ -1440,7 +1440,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS self["RdsActions"].setEnabled(state) ########## RDS Radiotext / Rass Support END - def closeRadio(self): + def cancel(self): self.infobar.rds_display.onRassInteractivePossibilityChanged.remove(self.RassInteractivePossibilityChanged) self.info.hide() #set previous tv service -- cgit v1.2.3 From ba4499aef953ae803c76171d4f966c06732dab2a Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 27 Sep 2010 15:18:55 +0200 Subject: refs bug #584 don't show "add service to bouquet" when inside bouquet view in multi bouquet mode and just one bouquet is set don't show "add service to favourites" when inside favourite view (multi bouquet mode is disabled) --- lib/python/Screens/ChannelSelection.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 9ced5840..1c05bbf3 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -111,9 +111,16 @@ class ChannelContextMenu(Screen): else: append_when_current_valid(current, menu, (_("remove from parental protection"), boundFunction(self.removeParentalProtection, csel.getCurrentSelection())), level = 0) if haveBouquets: - append_when_current_valid(current, menu, (_("add service to bouquet"), self.addServiceToBouquetSelected), level = 0) + bouquets = self.csel.getBouquetList() + if bouquets is None: + bouquetCnt = 0 + else: + bouquetCnt = len(bouquets) + if not inBouquet or bouquetCnt > 1: + append_when_current_valid(current, menu, (_("add service to bouquet"), self.addServiceToBouquetSelected), level = 0) else: - append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0) + if not inBouquet: + append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0) else: if current_root.getPath().find('FROM SATELLITES') != -1: append_when_current_valid(current, menu, (_("remove selected satellite"), self.removeSatelliteServices), level = 0) -- cgit v1.2.3 From 3b57a6578fd6d09abb77c2eba4bd1e30660be59a Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 6 Oct 2010 11:11:05 +0200 Subject: TempFanControl/plugin.py: increase config skin display seperation a bit. fixes #590 --- lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py old mode 100644 new mode 100755 index c8af9cdd..42fe82da --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -131,6 +131,7 @@ class TempFanControl(Screen, ConfigListScreen): ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) + self["config"].l.setSeperation(300) self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { -- cgit v1.2.3 From 6f59909bea021e8eca6a60b6b76556b54d52fc49 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 4 Oct 2010 10:23:07 +0200 Subject: permit also to record from service groups (services with associated alternative services) --- RecordTimer.py | 2 +- ServiceReference.py | 13 ++++++++++--- lib/python/Screens/TimerEntry.py | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/RecordTimer.py b/RecordTimer.py index def75684..4ece9c58 100755 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -102,7 +102,7 @@ class RecordTimerEntry(timer.TimerEntry, object): assert isinstance(serviceref, ServiceReference) - if serviceref.getType() == eServiceReference.idDVB and serviceref.getPath() == "": + if serviceref.isRecordable(): self.service_ref = serviceref else: self.service_ref = ServiceReference(None) diff --git a/ServiceReference.py b/ServiceReference.py index 5d11ae77..4907fa28 100644 --- a/ServiceReference.py +++ b/ServiceReference.py @@ -10,7 +10,7 @@ class ServiceReference(eServiceReference): def __str__(self): return self.ref.toString() - + def getServiceName(self): info = self.info() return info and info.getName(self.ref) or "" @@ -20,9 +20,16 @@ class ServiceReference(eServiceReference): def list(self): return self.serviceHandler.list(self.ref) - + def getType(self): return self.ref.type - + def getPath(self): return self.ref.getPath() + + def getFlags(self): + return self.ref.flags + + def isRecordable(self): + ref = self.ref + return ref.flags & eServiceReference.isGroup or (ref.type == eServiceReference.idDVB and ref.getPath() == "") \ No newline at end of file diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index 62faf9bf..9885e700 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -278,7 +278,7 @@ class TimerEntry(Screen, ConfigListScreen): self.keyGo() def keyGo(self, result = None): - if self.timerentry_service_ref.getType() != eServiceReference.idDVB or self.timerentry_service_ref.getPath() != "": + if not self.timerentry_service_ref.isRecordable(): self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR) return self.timer.name = self.timerentry_name.value -- cgit v1.2.3 From 81ffdf5509cc46accb9d607ac5e51ae07d38c041 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 20 Jul 2010 10:06:11 +0200 Subject: implement configurable http user-agent (fixes #224) --- .../Plugins/Extensions/MediaPlayer/settings.py | 2 ++ lib/service/servicemp3.cpp | 22 ++++++++++++++++++++++ lib/service/servicemp3.h | 2 ++ 3 files changed, 26 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/settings.py b/lib/python/Plugins/Extensions/MediaPlayer/settings.py index 0b95812f..7f42677d 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/settings.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/settings.py @@ -12,6 +12,8 @@ config.mediaplayer.repeat = ConfigYesNo(default=False) config.mediaplayer.savePlaylistOnExit = ConfigYesNo(default=True) config.mediaplayer.saveDirOnExit = ConfigYesNo(default=False) config.mediaplayer.defaultDir = ConfigDirectory() +config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False) +config.mediaplayer.alternateUserAgent = ConfigText(default="") class DirectoryBrowser(Screen, HelpableScreen): diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 154f4868..3ab4924a 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -287,6 +287,15 @@ eServiceMP3::eServiceMP3(eServiceReference ref) if ( sourceinfo.is_streaming ) { uri = g_strdup_printf ("%s", filename); + + std::string config_str; + if( ePythonConfigQuery::getConfigValue("config.mediaplayer.useAlternateUserAgent", config_str) == 0 ) + { + if ( config_str == "True" ) + ePythonConfigQuery::getConfigValue("config.mediaplayer.alternateUserAgent", m_useragent); + } + if ( m_useragent.length() == 0 ) + m_useragent = "Dream Multimedia Dreambox Enigma2 Mediaplayer"; } else if ( sourceinfo.containertype == ctCDA ) { @@ -347,6 +356,10 @@ eServiceMP3::eServiceMP3(eServiceReference ref) subs.language_code = std::string("und"); m_subtitleStreams.push_back(subs); } + if ( sourceinfo.is_streaming ) + { + g_signal_connect (G_OBJECT (m_gst_playbin), "notify::source", G_CALLBACK (gstHTTPSourceSetAgent), this); + } } else { m_event((iPlayableService*)this, evUser+12); @@ -1364,6 +1377,15 @@ GstBusSyncReply eServiceMP3::gstBusSyncHandler(GstBus *bus, GstMessage *message, return GST_BUS_PASS; } +void eServiceMP3::gstHTTPSourceSetAgent(GObject *object, GParamSpec *unused, gpointer user_data) +{ + eServiceMP3 *_this = (eServiceMP3*)user_data; + GstElement *source; + g_object_get(_this->m_gst_playbin, "source", &source, NULL); + g_object_set (G_OBJECT (source), "user-agent", _this->m_useragent.c_str(), NULL); + gst_object_unref(source); +} + audiotype_t eServiceMP3::gstCheckAudioPad(GstStructure* structure) { if (!structure) diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 56a068b9..a8139573 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -208,6 +208,7 @@ private: static void gstCBsubtitleAvail(GstElement *element, gpointer user_data); GstPad* gstCreateSubtitleSink(eServiceMP3* _this, subtype_t type); void gstPoll(const int&); + static void gstHTTPSourceSetAgent(GObject *source, GParamSpec *unused, gpointer user_data); std::list m_subtitle_pages; ePtr m_subtitle_sync_timer; @@ -220,6 +221,7 @@ private: RESULT seekToImpl(pts_t to); gint m_aspect, m_width, m_height, m_framerate, m_progressive; + std::string m_useragent; RESULT trickSeek(gdouble ratio); }; #endif -- cgit v1.2.3 From 9f939b60988f8b05650fdca37d2ba3b35d5a4d9e Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 6 Oct 2010 12:56:11 +0200 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 0fee0a14..805be4df 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1007,7 +1007,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 9a95546733e013704fbdc19de5dc6c4bf3a169b1 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 6 Oct 2010 20:06:19 +0200 Subject: lib/python/Components/NimManager.py: add toneAmplitude option for 340 and 360mV --- 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 805be4df..b75b65eb 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1337,7 +1337,7 @@ def InitNimManager(nimmgr): 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 = ConfigSelection([("11", "340mV"), ("10", "360mV"), ("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) -- cgit v1.2.3 From 9bcad45ba1ad98b73f0a2e369b240c9ebedd129d 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 1dbc1505..7fb3e740 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -113,6 +113,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 @@ -160,6 +161,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): @@ -243,6 +257,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 403b761102b88bcd63f07fd2e0459c6e31833148 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 24 Jul 2010 12:33:58 +0200 Subject: refs bug #460 swap bflag and eflag (begin and end flag for timer sanity check) old version: bflag = 1, eflag = -1 that lead to the sort function sorting timers with begin=end wrong: self.nrep_eventlist.extend([(self.newtimer.begin,self.bflag,-1),(self.newtimer.end,self.eflag,-1)]) resulted in (end, eflag) before (begin, bflag) and in a conflict with zapping timers with end=begin (no end time) --- lib/python/Components/TimerSanityCheck.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/TimerSanityCheck.py b/lib/python/Components/TimerSanityCheck.py index 8f48d1ec..b472a19e 100644 --- a/lib/python/Components/TimerSanityCheck.py +++ b/lib/python/Components/TimerSanityCheck.py @@ -12,8 +12,8 @@ class TimerSanityCheck: self.simultimer = [] self.rep_eventlist = [] self.nrep_eventlist = [] - self.bflag = 1 - self.eflag = -1 + self.bflag = -1 + self.eflag = 1 def check(self, ext_timer=1): print "check" -- cgit v1.2.3 From c18bde2f75df7aa93eefbaf866d28fe1a5d290b8 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 1 Sep 2010 15:41:15 +0200 Subject: [DVDBurn] remove absolut paths for DVD media toolbox console utilities (add #429) --- lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py index 53287a36..0b81cfdf 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py @@ -68,7 +68,7 @@ class DVDToolbox(Screen): self["info"].text = "" self["details"].setText("") self.Console = Console() - cmd = "/bin/dvd+rw-mediainfo /dev/" + harddiskmanager.getCD() + cmd = "dvd+rw-mediainfo /dev/" + harddiskmanager.getCD() self.Console.ePopen(cmd, self.mediainfoCB) def format(self): @@ -186,7 +186,7 @@ class DVDformatTask(Task): Task.__init__(self, job, ("RW medium format")) self.toolbox = job.toolbox self.postconditions.append(DVDformatTaskPostcondition()) - self.setTool("/bin/dvd+rw-format") + self.setTool("dvd+rw-format") self.args += [ "/dev/" + harddiskmanager.getCD() ] self.end = 1100 self.retryargs = [ ] -- cgit v1.2.3 From ca4b0f86ca83b25fdbd56942d4576603721dcd29 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 | 9 ++++++++- mytest.py | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/data/setup.xml b/data/setup.xml index b920edd6..f5dea734 100755 --- 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_event_progress_in_servicelist diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 572f47e0..b86c1a13 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -51,7 +51,14 @@ 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.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 0b9be523..253ee168 100755 --- a/mytest.py +++ b/mytest.py @@ -365,9 +365,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 c4a55fbb1dbb22ccd43bfd92f1ec9df4f811310f 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 7fb3e740..5dc3cb41 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, \ @@ -193,7 +194,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 a97f3cb3fc63e25d6378a75cb7649563d18f2a5e 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 5dc3cb41..f4828088 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -191,7 +191,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: if HardwareInfo().get_device_name() == "dm500hd": -- cgit v1.2.3 From 8c0d8d821ec868cfa246923fc3e438b8f71877a0 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 10 Aug 2010 13:45:17 +0200 Subject: re-commit new NFIFlash plugin (bug #480) --- .../SystemPlugins/NFIFlash/dm8000_writenand | Bin 71669 -> 0 bytes .../Plugins/SystemPlugins/NFIFlash/downloader.py | 1216 ++++++++++---------- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 324 ++---- .../Plugins/SystemPlugins/NFIFlash/mywritenand | Bin 71626 -> 0 bytes .../Plugins/SystemPlugins/NFIFlash/plugin.py | 23 +- 5 files changed, 747 insertions(+), 816 deletions(-) delete mode 100755 lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand delete mode 100755 lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand b/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand deleted file mode 100755 index bd02d8fe..00000000 Binary files a/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand and /dev/null differ diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 6463f179..c0094cc1 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -1,72 +1,209 @@ # -*- coding: utf-8 -*- -from Components.MenuList import MenuList +from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox +from Screens.HelpMenu import HelpableScreen +from Screens.TaskView import JobView +from Components.About import about from Components.ActionMap import ActionMap from Components.Sources.StaticText import StaticText -from Components.Sources.Progress import Progress +from Components.Sources.List import List from Components.Label import Label from Components.FileList import FileList +from Components.MenuList import MenuList from Components.MultiContent import MultiContentEntryText from Components.ScrollLabel import ScrollLabel +from Components.Harddisk import harddiskmanager +from Components.Task import Task, Job, job_manager, Condition from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo -from enigma import eConsoleAppContainer, eListbox, gFont, eListboxPythonMultiContent, \ - RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eRect, eTimer -from os import system, remove -import re -import urllib from Tools.Downloader import downloadWithProgress +from enigma import eConsoleAppContainer, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eTimer +from os import system, path, access, stat, remove, W_OK, R_OK from twisted.web import client from twisted.internet import reactor, defer from twisted.python import failure -from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier - -class UserRequestedCancel(Exception): - pass - -class Feedlist(MenuList): - def __init__(self, list=[], enableWrapAround = False): - MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) - self.l.setFont(0, gFont("Regular", 16)) - self.l.setItemHeight(22) - - def clear(self): - del self.list[:] - self.l.setList(self.list) - - def getNFIname(self): - l = self.l.getCurrentSelection() - return l and l[0][0] - - def getNFIurl(self): - l = self.l.getCurrentSelection() - return l and l[0][1] - - def getNFOname(self): - l = self.l.getCurrentSelection() - return l and l[0][0][:-3]+"nfo" - - def getNFOurl(self): - l = self.l.getCurrentSelection() - return l and l[0][1][:-3]+"nfo" +import re - def isValid(self): - l = self.l.getCurrentSelection() - if not l or l[0] == 0: - return False +class ImageDownloadJob(Job): + def __init__(self, url, filename, device=None, mountpoint="/"): + Job.__init__(self, _("Download .NFI-Files for USB-Flasher")) + if device: + MountTask(self, device, mountpoint) + ImageDownloadTask(self, url, mountpoint+filename) + ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo") + if device: + UmountTask(self, mountpoint) + + def retry(self): + self.tasks[0].args += self.tasks[0].retryargs + Job.retry(self) + +class MountTask(Task): + def __init__(self, job, device, mountpoint): + Task.__init__(self, job, ("mount")) + self.setTool("mount") + self.args += [device, mountpoint, "-orw,sync"] + self.weighting = 1 + + def processOutput(self, data): + print "[MountTask] output:", data + +class UmountTask(Task): + def __init__(self, job, mountpoint): + Task.__init__(self, job, ("mount")) + self.setTool("umount") + self.args += [mountpoint] + self.weighting = 1 + +class DownloaderPostcondition(Condition): + def check(self, task): + return task.returncode == 0 + + def getErrorMessage(self, task): + return self.error_message + +class ImageDownloadTask(Task): + def __init__(self, job, url, path): + Task.__init__(self, job, _("Downloading")) + self.postconditions.append(DownloaderPostcondition()) + self.job = job + self.url = url + self.path = path + self.error_message = "" + self.last_recvbytes = 0 + self.error_message = None + + def run(self, callback): + self.callback = callback + self.download = downloadWithProgress(self.url,self.path) + self.download.addProgress(self.download_progress) + self.download.start().addCallback(self.download_finished).addErrback(self.download_failed) + print "[ImageDownloadTask] downloading", self.url, "to", self.path + + def download_progress(self, recvbytes, totalbytes): + #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes) + if ( recvbytes - self.last_recvbytes ) > 10000: # anti-flicker + self.progress = int(100*(float(recvbytes)/float(totalbytes))) + self.name = _("Downloading") + ' ' + "%d of %d kBytes" % (recvbytes/1024, totalbytes/1024) + self.last_recvbytes = recvbytes + + def download_failed(self, failure_instance=None, error_message=""): + self.error_message = error_message + if error_message == "" and failure_instance is not None: + self.error_message = failure_instance.getErrorMessage() + print "[download_failed]", self.error_message + Task.processFinished(self, 1) + + def download_finished(self, string=""): + print "[download_finished]", string + Task.processFinished(self, 0) + +class StickWizardJob(Job): + def __init__(self, path): + Job.__init__(self, _("USB stick wizard")) + self.path = path + self.device = path + while self.device[-1:] == "/" or self.device[-1:].isdigit(): + self.device = self.device[:-1] + + box = HardwareInfo().get_device_name() + url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % box + self.downloadfilename = "/tmp/dreambox-nfiflasher-%s.tar.bz2" % box + self.imagefilename = "/tmp/nfiflash_%s.img" % box + #UmountTask(self, device) + PartitionTask(self) + ImageDownloadTask(self, url, self.downloadfilename) + UnpackTask(self) + CopyTask(self) + +class PartitionTaskPostcondition(Condition): + def check(self, task): + return task.returncode == 0 + + def getErrorMessage(self, task): + return { + task.ERROR_BLKRRPART: ("Device or resource busy"), + task.ERROR_UNKNOWN: (task.errormsg) + }[task.error] + +class PartitionTask(Task): + ERROR_UNKNOWN, ERROR_BLKRRPART = range(2) + def __init__(self, job): + Task.__init__(self, job, ("partitioning")) + self.postconditions.append(PartitionTaskPostcondition()) + self.job = job + self.setTool("sfdisk") + self.args += [self.job.device] + self.weighting = 10 + self.initial_input = "0 - 0x6 *\n;\n;\n;\ny" + self.errormsg = "" + + def run(self, callback): + Task.run(self, callback) + + def processOutput(self, data): + print "[PartitionTask] output:", data + if data.startswith("BLKRRPART:"): + self.error = self.ERROR_BLKRRPART else: - return True + self.error = self.ERROR_UNKNOWN + self.errormsg = data + +class UnpackTask(Task): + def __init__(self, job): + Task.__init__(self, job, ("Unpacking USB flasher image...")) + self.job = job + self.setTool("tar") + self.args += ["-xjvf", self.job.downloadfilename] + self.weighting = 80 + self.end = 80 + self.delayTimer = eTimer() + self.delayTimer.callback.append(self.progress_increment) + + def run(self, callback): + Task.run(self, callback) + self.delayTimer.start(1000, False) + + def progress_increment(self): + self.progress += 1 + + def processOutput(self, data): + print "[UnpackTask] output: \'%s\'" % data + self.job.imagefilename = data + + def afterRun(self): + self.delayTimer.callback.remove(self.progress_increment) + +class CopyTask(Task): + def __init__(self, job): + Task.__init__(self, job, ("Copying USB flasher boot image to stick...")) + self.job = job + self.setTool("dd") + self.args += ["if=%s" % self.job.imagefilename, "of=%s1" % self.job.device] + self.weighting = 20 + self.end = 20 + self.delayTimer = eTimer() + self.delayTimer.callback.append(self.progress_increment) + + def run(self, callback): + Task.run(self, callback) + self.delayTimer.start(100, False) + + def progress_increment(self): + self.progress += 1 + + def processOutput(self, data): + print "[CopyTask] output:", data - def moveSelection(self,idx=0): - if self.instance is not None: - self.instance.moveSelectionTo(idx) + def afterRun(self): + self.delayTimer.callback.remove(self.progress_increment) class NFOViewer(Screen): skin = """ - - + + """ def __init__(self, session, nfo): @@ -80,206 +217,37 @@ class NFOViewer(Screen): "ok": self.exit, "cancel": self.exit, "down": self.pageDown, - "up": self.pageUp + "up": self.pageUp }) def pageUp(self): self["changelog"].pageUp() def pageDown(self): self["changelog"].pageDown() - + def exit(self): self.close(False) -class NFIDownload(Screen): - LIST_SOURCE = 1 - LIST_DEST = 2 - skin = """ - - - - - - - - - - - - - - - - - - - - - - """ - - def __init__(self, session, destdir="/tmp/"): - self.skin = NFIDownload.skin - Screen.__init__(self, session) - - self["job_progressbar"] = Progress() - self["job_progresslabel"] = StaticText() - - self["infolabel"] = StaticText() - self["statusbar"] = StaticText() - self["label_top"] = StaticText() - self["label_bottom"] = StaticText() - self["path_bottom"] = StaticText() - - self["key_green"] = StaticText() - self["key_yellow"] = StaticText() - self["key_blue"] = StaticText() - - self["key_red"] = StaticText() - - self["feedlist"] = Feedlist([0,(eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, "feed not available")]) - self["destlist"] = FileList(destdir, showDirectories = True, showFiles = False) - self["destlist"].hide() - - self.download_container = eConsoleAppContainer() - self.nfo = "" - self.nfofile = "" - self.feedhtml = "" - self.focus = None - self.download = None - self.box = HardwareInfo().get_device_name() - self.feed_base = "http://www.dreamboxupdate.com/opendreambox/1.5/%s/images/" % self.box - self.nfi_filter = "" # "release" # only show NFIs containing this string, or all if "" - self.wizard_mode = False - - self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "EPGSelectActions"], - { - "cancel": self.closeCB, - "red": self.closeCB, - "green": self.nfi_download, - "yellow": self.switchList, - "blue": self.askCreateUSBstick, - "prevBouquet": self.switchList, - "nextBouquet": self.switchList, - "ok": self.ok, - "left": self.left, - "right": self.right, - "up": self.up, - "upRepeated": self.up, - "downRepeated": self.down, - "down": self.down - }, -1) - - self.feed_download() - - def downloading(self, state=True): - if state is True: - self["key_red"].text = _("Cancel") - self["key_green"].text = "" - self["key_yellow"].text = "" - self["key_blue"].text = "" - else: - self.download = None - self["key_red"].text = _("Exit") - if self["feedlist"].isValid(): - self["key_green"].text = (_("Download")) - if self.focus is self.LIST_SOURCE: - self["key_yellow"].text = (_("Change dir.")) - else: - self["key_yellow"].text = (_("Select image")) - self["key_blue"].text = (_("USB stick wizard")) - - def switchList(self,to_where=None): - if self.download or not self["feedlist"].isValid(): - return - - self["job_progressbar"].value = 0 - self["job_progresslabel"].text = "" - - if to_where is None: - if self.focus is self.LIST_SOURCE: - to_where = self.LIST_DEST - if self.focus is self.LIST_DEST: - to_where = self.LIST_SOURCE - - if to_where is self.LIST_DEST: - self.focus = self.LIST_DEST - self["statusbar"].text = _("Please select target directory or medium") - self["label_top"].text = _("choose destination directory")+":" - self["feedlist"].hide() - self["destlist"].show() - self["label_bottom"].text = _("Selected source image")+":" - self["path_bottom"].text = str(self["feedlist"].getNFIname()) - self["key_yellow"].text = (_("Select image")) - - elif to_where is self.LIST_SOURCE: - self.focus = self.LIST_SOURCE - self["statusbar"].text = _("Please choose .NFI image file from feed server to download") - self["label_top"].text = _("select image from server")+":" - self["feedlist"].show() - self["destlist"].hide() - self["label_bottom"].text = _("Destination directory")+":" - self["path_bottom"].text = str(self["destlist"].getCurrentDirectory()) - self["key_yellow"].text = (_("Change dir.")) - - def up(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].up() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].up() - - def down(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].down() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].down() - - def left(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].pageUp() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].pageUp() - - def right(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].pageDown() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].pageDown() - - def ok(self): - if self.focus is self.LIST_SOURCE and self.nfo: - self.session.open(NFOViewer, self.nfo) - if self.download: - return - if self.focus is self.LIST_DEST: - if self["destlist"].canDescent(): - self["destlist"].descent() - - def feed_download(self): - self.downloading(True) - self.download = self.feed_download - client.getPage(self.feed_base).addCallback(self.feed_finished).addErrback(self.feed_failed) +class feedDownloader: + def __init__(self, feed_base, box, OE_vers): + print "[feedDownloader::init] feed_base=%s, box=%s" % (feed_base, box) + self.feed_base = feed_base + self.OE_vers = OE_vers + self.box = box + + def getList(self, callback, errback): + self.urlbase = "%s/%s/%s/images/" % (self.feed_base, self.OE_vers, self.box) + print "[getList]", self.urlbase + self.callback = callback + self.errback = errback + client.getPage(self.urlbase).addCallback(self.feed_finished).addErrback(self.feed_failed) def feed_failed(self, failure_instance): - print "[feed_failed] " + str(failure_instance) - self["infolabel"].text = _("Could not connect to Dreambox .NFI Image Feed Server:") + "\n" + failure_instance.getErrorMessage() + "\n\n" + _("Please check your network settings!") - self.downloading(False) + print "[feed_failed]", str(failure_instance) + self.errback(failure_instance.getErrorMessage()) def feed_finished(self, feedhtml): - print "[feed_finished] " + str(feedhtml) - self.downloading(False) + print "[feed_finished]" fileresultmask = re.compile(".*?)[\'\"]>(?P.*?.nfi)", re.DOTALL) searchresults = fileresultmask.finditer(feedhtml) fileresultlist = [] @@ -287,378 +255,472 @@ class NFIDownload(Screen): for x in searchresults: url = x.group("url") if url[0:7] != "http://": - url = self.feed_base + x.group("url") + url = self.urlbase + x.group("url") name = x.group("name") - if name.find(self.nfi_filter) > -1: - entry = [[name, url],(eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, name)] - print "adding to feedlist: " + str(entry) - fileresultlist.append(entry) - else: - print "NOT adding to feedlist: " + name - self["feedlist"].l.setList(fileresultlist) - self["feedlist"].moveSelection(0) + entry = (name, url) + fileresultlist.append(entry) + self.callback(fileresultlist, self.OE_vers) - if len(fileresultlist) > 0: - self.switchList(self.LIST_SOURCE) - self.nfo_download() - else: - self["infolabel"].text = _("Cannot parse feed directory") - - def nfo_download(self): - print "[check_for_NFO]" - if self["feedlist"].isValid(): - print "nfiname: " + self["feedlist"].getNFIname() - self["job_progressbar"].value = 0 - self["job_progresslabel"].text = "" - if self["feedlist"].getNFIurl() is None: - self["key_green"].text = "" - return - self["key_green"].text = _("Download") - nfourl = self["feedlist"].getNFOurl() - print "downloading " + nfourl - self.download = self.nfo_download - self.downloading(True) - client.getPage(nfourl).addCallback(self.nfo_finished).addErrback(self.nfo_failed) - self["statusbar"].text = ("Downloading image description...") +class DeviceBrowser(Screen, HelpableScreen): + skin = """ + + + + + + + + """ - def nfo_failed(self, failure_instance): - print "[nfo_failed] " + str(failure_instance) - self["infolabel"].text = _("No details for this image file") + "\n" + self["feedlist"].getNFIname() - self["statusbar"].text = "" - self.nfofilename = "" - self.nfo = "" - self.downloading(False) + def __init__(self, session, startdir, message="", showDirectories = True, showFiles = True, showMountpoints = True, matchingPattern = "", useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None): + Screen.__init__(self, session) - def nfo_finished(self,nfodata=""): - print "[nfo_finished] " + str(nfodata) - self.downloading(False) - self.nfo = nfodata - if self.nfo != "": - self.nfofilename = self["destlist"].getCurrentDirectory() + '/' + self["feedlist"].getNFOname() - self["infolabel"].text = self.nfo - else: - self.nfofilename = "" - self["infolabel"].text = _("No details for this image file") - self["statusbar"].text = _("Press OK to view full changelog") - - def nfi_download(self): - if self["destlist"].getCurrentDirectory() is None: - self.switchList(self.LIST_TARGET) - if self["feedlist"].isValid(): - url = self["feedlist"].getNFIurl() - self.nfilocal = self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname() - print "[nfi_download] downloading %s to %s" % (url, self.nfilocal) - self.download = downloadWithProgress(url,self.nfilocal) - self.download.addProgress(self.nfi_progress) - self["job_progressbar"].range = 1000 - self.download.start().addCallback(self.nfi_finished).addErrback(self.nfi_failed) - self.downloading(True) - - def nfi_progress(self, recvbytes, totalbytes): - #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes) - self["job_progressbar"].value = int(1000*recvbytes/float(totalbytes)) - self["job_progresslabel"].text = "%d of %d kBytes (%.2f%%)" % (recvbytes/1024, totalbytes/1024, 100*recvbytes/float(totalbytes)) + HelpableScreen.__init__(self) - def nfi_failed(self, failure_instance=None, error_message=""): - if error_message == "" and failure_instance is not None: - error_message = failure_instance.getErrorMessage() - print "[nfi_failed] " + error_message - if fileExists(self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname()): - message = "%s %s\n%s" % (_(".NFI Download failed:"), error_message, _("Remove the incomplete .NFI file?")) - self.session.openWithCallback(self.nfi_remove, MessageBox, message, MessageBox.TYPE_YESNO) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText() + self["message"] = StaticText(message) + + self.filelist = FileList(startdir, showDirectories = showDirectories, showFiles = showFiles, showMountpoints = showMountpoints, matchingPattern = matchingPattern, useServiceRef = useServiceRef, inhibitDirs = inhibitDirs, inhibitMounts = inhibitMounts, isTop = isTop, enableWrapAround = enableWrapAround, additionalExtensions = additionalExtensions) + self["filelist"] = self.filelist + + self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"], + { + "green": self.use, + "red": self.exit, + "ok": self.ok, + "cancel": self.exit + }) + + hotplugNotifier.append(self.hotplugCB) + self.onShown.append(self.updateButton) + self.onClose.append(self.removeHotplug) + + def hotplugCB(self, dev, action): + print "[hotplugCB]", dev, action + self.updateButton() + + def updateButton(self): + + if self["filelist"].getFilename() or self["filelist"].getCurrentDirectory(): + self["key_green"].text = _("Use") else: - message = "%s %s" % (_(".NFI Download failed:"),error_message) - self.session.open(MessageBox, message, MessageBox.TYPE_ERROR) - self.downloading(False) + self["key_green"].text = "" + + def removeHotplug(self): + print "[removeHotplug]" + hotplugNotifier.remove(self.hotplugCB) - def nfi_finished(self, string=""): - print "[nfi_finished] " + str(string) - if self.nfo != "": - self.nfofilename = self["destlist"].getCurrentDirectory() + '/' + self["feedlist"].getNFOname() - nfofd = open(self.nfofilename, "w") - if nfofd: - nfofd.write(self.nfo) - nfofd.close() - else: - print "couldn't save nfo file " + self.nfofilename - - pos = self.nfo.find("MD5:") - if pos > 0 and len(self.nfo) >= pos+5+32: - self["statusbar"].text = ("Please wait for md5 signature verification...") - cmd = "md5sum -c -" - md5 = self.nfo[pos+5:pos+5+32] + " " + self.nfilocal - print cmd, md5 - self.download_container.setCWD(self["destlist"].getCurrentDirectory()) - self.download_container.appClosed.append(self.md5finished) - self.download_container.execute(cmd) - self.download_container.write(md5) - self.download_container.dataSent.append(self.md5ready) + def ok(self): + if self.filelist.canDescent(): + if self["filelist"].showMountpoints == True and self["filelist"].showDirectories == False: + self.use() else: - self["statusbar"].text = "Download completed." - self.downloading(False) - else: - self["statusbar"].text = "Download completed." - self.downloading(False) - if self.wizard_mode: - self.configBackup() + self.filelist.descent() - def md5ready(self, retval): - self.download_container.sendEOF() + def use(self): + print "[use]", self["filelist"].getCurrentDirectory(), self["filelist"].getFilename() + if self["filelist"].getCurrentDirectory() is not None: + if self.filelist.canDescent() and self["filelist"].getFilename() and len(self["filelist"].getFilename()) > len(self["filelist"].getCurrentDirectory()): + self.filelist.descent() + self.close(self["filelist"].getCurrentDirectory()) + elif self["filelist"].getFilename(): + self.close(self["filelist"].getFilename()) - def md5finished(self, retval): - print "[md5finished]: " + str(retval) - self.download_container.appClosed.remove(self.md5finished) - if retval==0: - self.downloading(False) - if self.wizard_mode: - self.configBackup() - else: - self["statusbar"].text = _(".NFI file passed md5sum signature check. You can safely flash this image!") - self.switchList(self.LIST_SOURCE) - else: - self.session.openWithCallback(self.nfi_remove, MessageBox, (_("The md5sum validation failed, the file may be downloaded incompletely or be corrupted!") + "\n" + _("Remove the broken .NFI file?")), MessageBox.TYPE_YESNO) - - def nfi_remove(self, answer): - self.downloading(False) - if answer == True: - nfifilename = self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname() - if fileExists(self.nfofilename): - remove(self.nfofilename) - if fileExists(nfifilename): - remove(nfifilename) - self.switchList(self.LIST_SOURCE) - - def askCreateUSBstick(self): - self.downloading() - self.imagefilename = "/tmp/nfiflash_" + self.box + ".img" - message = _("You have chosen to create a new .NFI flasher bootable USB stick. This will repartition the USB stick and therefore all data on it will be erased.") - self.session.openWithCallback(self.flasherdownload_query, MessageBox, (message + '\n' + _("First we need to download the latest boot environment for the USB flasher.")), MessageBox.TYPE_YESNO) - - def flasherdownload_query(self, answer): - if answer is False: - self.downloading(False) - self.switchList(self.LIST_SOURCE) - return - #url = self.feed_base + "/nfiflasher_" + self.box + ".tar.bz2" - url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % self.box - localfile = "/tmp/nfiflasher_image.tar.bz2" - print "[flasherdownload_query] downloading %s to %s" % (url, localfile) - self["statusbar"].text = ("Downloading %s..." % url) - self.download = downloadWithProgress(url,localfile) - self.download.addProgress(self.nfi_progress) - self["job_progressbar"].range = 1000 - self.download.start().addCallback(self.flasherdownload_finished).addErrback(self.flasherdownload_failed) - - def flasherdownload_failed(self, failure_instance=None, error_message=""): - if error_message == "" and failure_instance is not None: - error_message = failure_instance.getErrorMessage() - print "[flasherdownload_failed] " + error_message - message = "%s %s" % (_("Download of USB flasher boot image failed: "),error_message) - self.session.open(MessageBox, message, MessageBox.TYPE_ERROR) - self.remove_img(True) - - def flasherdownload_finished(self, string=""): - print "[flasherdownload_finished] " + str(string) + def exit(self): + self.close(False) + +(ALLIMAGES, RELEASE, EXPERIMENTAL, STICK_WIZARD, START) = range(5) + +class NFIDownload(Screen): + skin = """ + + + + + + + + + + + + + {"templates": + {"default": (25, [ + MultiContentEntryText(pos = (2, 2), size = (330, 24), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText, + ], True, "showOnDemand") + }, + "fonts": [gFont("Regular", 22)], + "itemHeight": 25 + } + + + + + {"templates": + {"default": (300, [ + MultiContentEntryText(pos = (2, 2), size = (240, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, + ], False, "showNever") + }, + "fonts": [gFont("Regular", 22)], + "itemHeight": 300 + } + + + + """ + + def __init__(self, session, destdir=None): + Screen.__init__(self, session) + #self.skin_path = plugin_path + #self.menu = args + + self.box = HardwareInfo().get_device_name() + self.feed_base = "http://www.dreamboxupdate.com/opendreambox" #/1.5/%s/images/" % self.box + self.usbmountpoint = "/mnt/usb/" + + self.menulist = [] + + self["menu"] = List(self.menulist) + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText() + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + + self["status"] = StaticText(_("Please wait... Loading list...")) + + self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"], + { + "ok": self.keyOk, + "green": self.keyOk, + "red": self.keyRed, + "blue": self.keyBlue, + "up": self.keyUp, + "upRepeated": self.keyUp, + "downRepeated": self.keyDown, + "down": self.keyDown, + "cancel": self.close, + }, -1) + self.onShown.append(self.go) + self.feedlists = [[],[],[]] + self.branch = START self.container = eConsoleAppContainer() - self.container.appClosed.append(self.umount_finished) self.container.dataAvail.append(self.tool_avail) self.taskstring = "" - umountdevs = "" - from os import listdir - for device in listdir("/dev"): - if device[:2] == "sd" and device[-1:].isdigit(): - umountdevs += "/dev/"+device - self.cmd = "umount " + umountdevs - print "executing " + self.cmd - self.container.execute(self.cmd) + self.image_idx = 0 + self.nfofilename = "" + self.nfo = "" + self.target_dir = None def tool_avail(self, string): print "[tool_avail]" + string self.taskstring += string - def umount_finished(self, retval): - self.container.appClosed.remove(self.umount_finished) - self.container.appClosed.append(self.dmesg_cleared) - self.taskstring = "" - self.cmd = "dmesg -c" - print "executing " + self.cmd - self.container.execute(self.cmd) + def go(self): + self.onShown.remove(self.go) + self["menu"].index = 0 + url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s-md5sums" % self.box + client.getPage(url).addCallback(self.md5sums_finished).addErrback(self.feed_failed) - def dmesg_cleared(self, answer): - self.container.appClosed.remove(self.dmesg_cleared) - self.msgbox = self.session.open(MessageBox, _("Please disconnect all USB devices from your Dreambox and (re-)attach the target USB stick (minimum size is 64 MB) now!"), MessageBox.TYPE_INFO) - hotplugNotifier.append(self.hotplugCB) + def md5sums_finished(self, data): + print "[md5sums_finished]", data + self.stickimage_md5 = data + self.checkUSBStick() - def hotplugCB(self, dev, action): - print "[hotplugCB]", dev, action - if dev.startswith("sd") and action == "add": - self.msgbox.close() - hotplugNotifier.remove(self.hotplugCB) - self.container.appClosed.append(self.dmesg_scanned) - self.taskstring = "" - self.cmd = "dmesg" - print "executing " + self.cmd - self.container.execute(self.cmd) - - def dmesg_scanned(self, retval): - self.container.appClosed.remove(self.dmesg_scanned) - dmesg_lines = self.taskstring.splitlines() - self.devicetext = None - self.stickdevice = None - for i, line in enumerate(dmesg_lines): - if line.find("usb-storage: waiting for device") != -1 and len(dmesg_lines) > i+3: - self.devicetext = dmesg_lines[i+1].lstrip()+"\n"+dmesg_lines[i+3] - elif line.find("/dev/scsi/host") != -1: - self.stickdevice = line.split(":",1)[0].lstrip() - - if retval != 0 or self.devicetext is None or self.stickdevice is None: - self.session.openWithCallback(self.remove_img, MessageBox, _("No useable USB stick found"), MessageBox.TYPE_ERROR) - else: - self.session.openWithCallback(self.fdisk_query, MessageBox, (_("The following device was found:\n\n%s\n\nDo you want to write the USB flasher to this stick?") % self.devicetext), MessageBox.TYPE_YESNO) - - def fdisk_query(self, answer): - if answer == True and self.stickdevice: - self["statusbar"].text = ("Partitioning USB stick...") - self["job_progressbar"].range = 1000 - self["job_progressbar"].value = 100 - self["job_progresslabel"].text = "5.00%" - self.taskstring = "" - self.container.appClosed.append(self.fdisk_finished) - self.container.execute("fdisk " + self.stickdevice + "/disc") - self.container.write("d\n4\nd\n3\nd\n2\nd\nn\np\n1\n\n\nt\n6\nw\n") - self.delayTimer = eTimer() - self.delayTimer.callback.append(self.progress_increment) - self.delayTimer.start(105, False) - else: - self.remove_img(True) - - def fdisk_finished(self, retval): - self.container.appClosed.remove(self.fdisk_finished) - self.delayTimer.stop() - if retval == 0: - if fileExists(self.imagefilename): - self.tar_finished(0) - self["job_progressbar"].value = 700 - else: - self["statusbar"].text = ("Decompressing USB stick flasher boot image...") - self.taskstring = "" - self.container.appClosed.append(self.tar_finished) - self.container.setCWD("/tmp") - self.cmd = "tar -xjvf nfiflasher_image.tar.bz2" - self.container.execute(self.cmd) - print "executing " + self.cmd - self.delayTimer = eTimer() - self.delayTimer.callback.append(self.progress_increment) - self.delayTimer.start(105, False) + def keyRed(self): + if self.branch == START: + self.close() else: - print "fdisk failed: " + str(retval) - self.session.openWithCallback(self.remove_img, MessageBox, ("fdisk " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) + self.branch = START + self["menu"].setList(self.menulist) + #elif self.branch == ALLIMAGES or self.branch == STICK_WIZARD: - def progress_increment(self): - newval = int(self["job_progressbar"].value) + 1 - if newval < 950: - self["job_progressbar"].value = newval - self["job_progresslabel"].text = "%.2f%%" % (newval/10.0) - - def tar_finished(self, retval): - self.delayTimer.stop() - if len(self.container.appClosed) > 0: - self.container.appClosed.remove(self.tar_finished) - if retval == 0: - self.imagefilename = "/tmp/nfiflash_" + self.box + ".img" - self["statusbar"].text = ("Copying USB flasher boot image to stick...") - self.taskstring = "" - self.container.appClosed.append(self.dd_finished) - self.cmd = "dd if=%s of=%s" % (self.imagefilename,self.stickdevice+"/part1") - self.container.execute(self.cmd) - print "executing " + self.cmd - self.delayTimer = eTimer() - self.delayTimer.callback.append(self.progress_increment) - self.delayTimer.start(105, False) + def keyBlue(self): + if self.nfo != "": + self.session.open(NFOViewer, self.nfo) + + def keyOk(self): + print "[keyOk]", self["menu"].getCurrent() + current = self["menu"].getCurrent() + if current: + if self.branch == START: + currentEntry = current[0] + if currentEntry == RELEASE: + self.image_idx = 0 + self.branch = RELEASE + self.askDestination() + elif currentEntry == EXPERIMENTAL: + self.image_idx = 0 + self.branch = EXPERIMENTAL + self.askDestination() + elif currentEntry == ALLIMAGES: + self.branch = ALLIMAGES + self.listImages() + elif currentEntry == STICK_WIZARD: + self.askStartWizard() + elif self.branch == ALLIMAGES: + self.image_idx = self["menu"].getIndex() + self.askDestination() + self.updateButtons() + + def keyUp(self): + self["menu"].selectPrevious() + self.updateButtons() + + def keyDown(self): + self["menu"].selectNext() + self.updateButtons() + + def updateButtons(self): + current = self["menu"].getCurrent() + if current: + if self.branch == START: + self["key_red"].text = _("Close") + currentEntry = current[0] + if currentEntry in (RELEASE, EXPERIMENTAL): + self.nfo_download(currentEntry, 0) + self["key_green"].text = _("Download") + else: + self.nfofilename = "" + self.nfo = "" + self["key_blue"].text = "" + self["key_green"].text = _("continue") + + elif self.branch == ALLIMAGES: + self["key_red"].text = _("Back") + self["key_green"].text = _("Download") + self.nfo_download(ALLIMAGES, self["menu"].getIndex()) + + def listImages(self): + print "[listImages]" + imagelist = [] + for name, url in self.feedlists[ALLIMAGES]: + imagelist.append((url, name, _("Download %s from Server" ) % url, None)) + self["menu"].setList(imagelist) + + def getUSBPartitions(self): + allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)] + print "[getUSBPartitions]", allpartitions + usbpartition = [] + for x in allpartitions: + print x, x[1] == '/', x[0].find("USB"), access(x[1], R_OK) + if x[1] != '/' and x[0].find("USB") > -1: # and access(x[1], R_OK) is True: + usbpartition.append(x) + return usbpartition + + def askDestination(self): + usbpartition = self.getUSBPartitions() + if len(usbpartition) == 1: + self.target_dir = usbpartition[0][1] + self.ackDestinationDevice(device_description=usbpartition[0][0]) + else: + self.openDeviceBrowser() + + def openDeviceBrowser(self): + if self.branch != STICK_WIZARD: + self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) + if self.branch == STICK_WIZARD: + self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=False, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) + + def DeviceBrowserClosed(self, path): + print "[DeviceBrowserClosed]", str(path) + self.target_dir = path + if path: + self.ackDestinationDevice() else: - self.session.openWithCallback(self.remove_img, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) - - def dd_finished(self, retval): - self.delayTimer.stop() - self.container.appClosed.remove(self.dd_finished) - self.downloading(False) - if retval == 0: - self["job_progressbar"].value = 950 - self["job_progresslabel"].text = "95.00%" - self["statusbar"].text = ("Remounting stick partition...") - self.taskstring = "" - self.container.appClosed.append(self.mount_finished) - self.cmd = "mount %s /mnt/usb -o rw,sync" % (self.stickdevice+"/part1") - self.container.execute(self.cmd) - print "executing " + self.cmd + self.keyRed() + + def ackDestinationDevice(self, device_description=None): + if device_description == None: + dev = self.target_dir else: - self.session.openWithCallback(self.remove_img, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) - - def mount_finished(self, retval): - self.container.dataAvail.remove(self.tool_avail) - self.container.appClosed.remove(self.mount_finished) - if retval == 0: - self["job_progressbar"].value = 1000 - self["job_progresslabel"].text = "100.00%" - self["statusbar"].text = (".NFI Flasher bootable USB stick successfully created.") - self.session.openWithCallback(self.flasherFinishedCB, MessageBox, _("The USB stick is now bootable. Do you want to download the latest image from the feed server and save it on the stick?"), type = MessageBox.TYPE_YESNO) - self["destlist"].changeDir("/mnt/usb") + dev = device_description + message = _("Do you want to download the image to %s ?") % (dev) + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.openDeviceBrowser), (_("Cancel"),self.keyRed)] + self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) + + def ackDestination_query(self, choice): + print "[ackDestination_query]", choice + if isinstance(choice, tuple): + choice[1]() else: - self.session.openWithCallback(self.flasherFinishedCB, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) - self.remove_img(True) - - def remove_img(self, answer): - if fileExists("/tmp/nfiflasher_image.tar.bz2"): - remove("/tmp/nfiflasher_image.tar.bz2") - if fileExists(self.imagefilename): - remove(self.imagefilename) - self.downloading(False) - self.switchList(self.LIST_SOURCE) - - def flasherFinishedCB(self, answer): - if answer == True: - self.wizard_mode = True - self["feedlist"].moveSelection(0) - self["path_bottom"].text = str(self["destlist"].getCurrentDirectory()) - self.nfo_download() - self.nfi_download() - - def configBackup(self): - self.session.openWithCallback(self.runBackup, MessageBox, _("The wizard can backup your current settings. Do you want to do a backup now?")) - - def runBackup(self, result=None): - from Tools.Directories import createDir, isMount, pathExists - from time import localtime - from datetime import date - from Screens.Console import Console - if result: - if isMount("/mnt/usb/"): - if (pathExists("/mnt/usb/backup") == False): - createDir("/mnt/usb/backup", True) - d = localtime() - dt = date(d.tm_year, d.tm_mon, d.tm_mday) - self.backup_file = "backup/" + str(dt) + "_settings_backup.tar.gz" - self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + "/mnt/usb/" + self.backup_file + " /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"], finishedCallback = self.backup_finished, closeOnSuccess = True) + self.keyRed() + + def ackedDestination(self): + print "[ackedDestination]", self.branch, self.target_dir, self.target_dir[8:] + self.container.setCWD("/mnt") + if self.target_dir[:8] == "/autofs/": + self.target_dir = "/dev/" + self.target_dir[8:-1] + + if self.branch == STICK_WIZARD: + job = StickWizardJob(self.target_dir) + job_manager.AddJob(job) + self.session.openWithCallback(self.StickWizardCB, JobView, job) + + elif self.branch != STICK_WIZARD: + url = self.feedlists[self.branch][self.image_idx][1] + filename = self.feedlists[self.branch][self.image_idx][0] + print "[getImage] start downloading %s to %s" % (url, path) + job = ImageDownloadJob(url, filename, self.target_dir, self.usbmountpoint) + job_manager.AddJob(job) + self.session.openWithCallback(self.ImageDownloadCB, JobView, job) + + def StickWizardCB(self, ret=None): + self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) + print "[StickWizardCB]", ret + if len(self.feedlists[ALLIMAGES]) == 0: + self.getFeed() else: - self.backup_file = None - self.backup_finished(skipped=True) - - def backup_finished(self, skipped=False): - if not skipped: - wizardfd = open("/mnt/usb/wizard.nfo", "w") - if wizardfd: - wizardfd.write("image: "+self["feedlist"].getNFIname()+'\n') - wizardfd.write("configuration: "+self.backup_file+'\n') - wizardfd.close() + self.setMenu() + + def ImageDownloadCB(self, ret): + print "[ImageDownloadCB]", ret self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) - def closeCB(self): - try: - self.download.stop() - #self.nfi_failed(None, "Cancelled by user request") - self.downloading(False) - except AttributeError: + def getFeed(self): + self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") + self.feedDownloader16 = feedDownloader(self.feed_base, self.box, OE_vers="1.6") + self.feedlists = [[],[],[]] + self.feedDownloader15.getList(self.gotFeed, self.feed_failed) + self.feedDownloader16.getList(self.gotFeed, self.feed_failed) + + def feed_failed(self, message=""): + self["status"].text = _("Could not connect to Dreambox .NFI Image Feed Server:") + "\n" + str(message) + "\n" + _("Please check your network settings!") + + def gotFeed(self, feedlist, OE_vers): + print "[gotFeed]", OE_vers + releaselist = [] + experimentallist = [] + + for name, url in feedlist: + if name.find("release") > -1: + releaselist.append((name, url)) + if name.find("experimental") > -1: + experimentallist.append((name, url)) + self.feedlists[ALLIMAGES].append((name, url)) + + if OE_vers == "1.6": + self.feedlists[RELEASE] = releaselist + self.feedlists[RELEASE] + self.feedlists[EXPERIMENTAL] = experimentallist + self.feedlists[RELEASE] + elif OE_vers == "1.5": + self.feedlists[RELEASE] = self.feedlists[RELEASE] + releaselist + self.feedlists[EXPERIMENTAL] = self.feedlists[EXPERIMENTAL] + experimentallist + + self.setMenu() + + def checkUSBStick(self): + self.target_dir = None + allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)] + print "[checkUSBStick] found partitions:", allpartitions + usbpartition = [] + for x in allpartitions: + print x, x[1] == '/', x[0].find("USB"), access(x[1], R_OK) + if x[1] != '/' and x[0].find("USB") > -1: # and access(x[1], R_OK) is True: + usbpartition.append(x) + + print usbpartition + if len(usbpartition) == 1: + self.target_dir = usbpartition[0][1] + self.md5_passback = self.getFeed + self.md5_failback = self.askStartWizard + self.md5verify(self.stickimage_md5, self.target_dir) + elif usbpartition == []: + print "[NFIFlash] needs to create usb flasher stick first!" + self.askStartWizard() + else: + self.askStartWizard() + + def askStartWizard(self): + self.branch = STICK_WIZARD + message = _("""This plugin creates a USB stick which can be used to update the firmware of your Dreambox in case it has no network connection or only WLAN access. +First, you need to prepare a USB stick so that it is bootable. +In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. +If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") + self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) + + def wizardDeviceBrowserClosed(self, path): + print "[wizardDeviceBrowserClosed]", path + self.target_dir = path + if path: + self.md5_passback = self.getFeed + self.md5_failback = self.wizardQuery + self.md5verify(self.stickimage_md5, self.target_dir) + else: self.close() + + def wizardQuery(self): + print "[wizardQuery]" + description = self.target_dir + for name, dev in self.getUSBPartitions(): + if dev == self.target_dir: + description = name + message = _("You have chosen to create a new .NFI flasher bootable USB stick. This will repartition the USB stick and therefore all data on it will be erased.") + "\n" + message += _("The following device was found:\n\n%s\n\nDo you want to write the USB flasher to this stick?") % description + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.askStartWizard), (_("Cancel"),self.close)] + self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) + + def setMenu(self): + self.menulist = [] + try: + latest_release = "Release %s (Opendreambox 1.5)" % self.feedlists[RELEASE][0][0][-9:-4] + self.menulist.append((RELEASE, _("Get latest release image"), _("Download %s from Server" ) % latest_release, None)) + except IndexError: + pass + + try: + dat = self.feedlists[EXPERIMENTAL][0][0][-12:-4] + latest_experimental = "Experimental %s-%s-%s (Opendreambox 1.6)" % (dat[:4], dat[4:6], dat[6:]) + self.menulist.append((EXPERIMENTAL, _("Get latest experimental image"), _("Download %s from Server") % latest_experimental, None)) + except IndexError: + pass + + self.menulist.append((ALLIMAGES, _("Choose image to download"), _("Select desired image from feed list" ), None)) + self.menulist.append((STICK_WIZARD, _("USB stick wizard"), _("Prepare another USB stick for image flashing" ), None)) + self["menu"].setList(self.menulist) + self["status"].text = _("Currently installed image") + ": %s" % (about.getImageVersionString())) + self.branch = START + self.updateButtons() + + def nfo_download(self, branch, idx): + nfourl = (self.feedlists[branch][idx][1])[:-4]+".nfo" + self.nfofilename = (self.feedlists[branch][idx][0])[:-4]+".nfo" + print "[check_for_NFO]", nfourl + client.getPage(nfourl).addCallback(self.nfo_finished).addErrback(self.nfo_failed) + + def nfo_failed(self, failure_instance): + print "[nfo_failed] " + str(failure_instance) + self["key_blue"].text = "" + self.nfofilename = "" + self.nfo = "" + + def nfo_finished(self,nfodata=""): + print "[nfo_finished] " + str(nfodata) + self["key_blue"].text = _("Changelog viewer") + self.nfo = nfodata + + def md5verify(self, md5, path): + cmd = "md5sum -c -s" + print "[verify_md5]", md5, path, cmd + self.container.setCWD(path) + self.container.appClosed.append(self.md5finished) + self.container.execute(cmd) + self.container.write(md5) + self.container.dataSent.append(self.md5ready) + + def md5ready(self, retval): + self.container.sendEOF() + + def md5finished(self, retval): + print "[md5finished]", str(retval) + self.container.appClosed.remove(self.md5finished) + self.container.dataSent.remove(self.md5ready) + if retval==0: + print "check passed! calling", repr(self.md5_passback) + self.md5_passback() + else: + print "check failed! calling", repr(self.md5_failback) + self.md5_failback() def main(session, **kwargs): session.open(NFIDownload,"/home/root") diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index 7a0da851..95c7eee9 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -8,25 +8,55 @@ from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean from Components.Label import Label from Components.FileList import FileList -from Components.Task import Task, Job, JobManager +from Components.Task import Task, Job, job_manager, Condition +from Screens.TaskView import JobView from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo from os import system from enigma import eConsoleAppContainer -import re +from Components.About import about + +class md5Postcondition(Condition): + def check(self, task): + print "md5Postcondition::check", task.returncode + return task.returncode == 0 + + def getErrorMessage(self, task): + if task.returncode == 1: + return _("The md5sum validation failed, the file may be corrupted!") + return "md5 error" + +class md5verify(Task): + def __init__(self, job, path, md5): + Task.__init__(self, job, "md5sum") + self.postconditions.append(md5Postcondition()) + self.weighting = 5 + self.cwd = path + self.setTool("md5sum") + self.args += ["-c", "-s"] + self.initial_input = md5 + + def writeInput(self, input): + self.container.dataSent.append(self.md5ready) + print "[writeInput]", input + Task.writeInput(self, input) + + def md5ready(self, retval): + self.container.sendEOF() + + def processOutput(self, data): + print "[md5sum]", class writeNAND(Task): - def __init__(self,job,param,box): + def __init__(self, job, param, box): Task.__init__(self,job, ("Writing image file to NAND Flash")) - self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/mywritenand") + self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/writenfi-mipsel-2.6.18-r1") if box == "dm7025": self.end = 256 elif box[:5] == "dm800": self.end = 512 - if box == "dm8000": - self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand") self.args += param - self.weighting = 1 + self.weighting = 95 def processOutput(self, data): print "[writeNand] " + data @@ -38,149 +68,84 @@ class writeNAND(Task): else: self.output_line = data -class NFISummary(Screen): - skin = ( - """ - - - - - """, - """ - - - - - """) - - def __init__(self, session, parent): - Screen.__init__(self, session, parent) - self["title"] = StaticText(_("Image flash utility")) - self["content"] = StaticText(_("Please select .NFI flash image file from medium")) - self["job_progressbar"] = Progress() - self["job_progresslabel"] = StaticText("") - - def setText(self, text): - self["content"].setText(text) - class NFIFlash(Screen): skin = """ - - - - - - - - - - - - - - """ - - def __init__(self, session, cancelable = True, close_on_finish = False): - self.skin = NFIFlash.skin + + + + + + + + + + + + + + """ + + def __init__(self, session, destdir=None): Screen.__init__(self, session) - self["job_progressbar"] = Progress() - self["job_progresslabel"] = StaticText("") - - self["finished"] = Boolean() + self.box = HardwareInfo().get_device_name() + self.usbmountpoint = "/mnt/usb/" - self["infolabel"] = StaticText("") - self["statusbar"] = StaticText(_("Please select .NFI flash image file from medium")) - self["listlabel"] = StaticText(_("select .NFI flash file")+":") - + self["key_red"] = StaticText() self["key_green"] = StaticText() self["key_yellow"] = StaticText() self["key_blue"] = StaticText() + self.filelist = FileList(self.usbmountpoint, matchingPattern = "^.*\.(nfi|NFI)") + self["filelist"] = self.filelist + self["infolabel"] = StaticText("") - self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"], + self["status"] = StaticText("currently installed image: %s" % (about.getImageVersionString())) + self.job = None + + self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"], { - "green": self.ok, + "ok": self.keyOk, + "green": self.keyOk, + "up": self.keyUp, + "upRepeated": self.keyUp, + "downRepeated": self.keyDown, + "down": self.keyDown, + "left": self.keyLeft, "yellow": self.reboot, - "blue": self.runWizard, - "ok": self.ok, - "left": self.left, - "right": self.right, - "up": self.up, - "down": self.down + "right": self.keyRight }, -1) - - currDir = "/media/usb/" - self.filelist = FileList(currDir, matchingPattern = "^.*\.(nfi|NFI)") - self["filelist"] = self.filelist - self.nfifile = "" 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: - self.close() - #else: - #if self.cancelable: - #self.cancel() - - def up(self): + def keyUp(self): self["filelist"].up() self.check_for_NFO() - def down(self): + def keyDown(self): self["filelist"].down() self.check_for_NFO() - def right(self): + def keyRight(self): self["filelist"].pageDown() self.check_for_NFO() - def left(self): + def keyLeft(self): self["filelist"].pageUp() self.check_for_NFO() + def keyOk(self): + if self.job is None or self.job.status is not self.job.IN_PROGRESS: + if self["filelist"].canDescent(): # isDir + self["filelist"].descent() + self.check_for_NFO() + elif self["filelist"].getFilename(): + 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) + def check_for_NFO(self, nfifile=None): - self.session.summary.setText(self["filelist"].getFilename()) + print "check_for_NFO", self["filelist"].getFilename(), self["filelist"].getCurrentDirectory() + self["infolabel"].text = "" + self["key_green"].text = "" + 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: @@ -191,8 +156,10 @@ class NFIFlash(Screen): if self.nfifile.upper().endswith(".NFI"): self["key_green"].text = _("Flash") nfofilename = self.nfifile[0:-3]+"nfo" + print nfofilename, fileExists(nfofilename) if fileExists(nfofilename): nfocontent = open(nfofilename, "r").read() + print "nfocontent:", nfocontent self["infolabel"].text = nfocontent pos = nfocontent.find("MD5:") if pos > 0: @@ -202,122 +169,27 @@ class NFIFlash(Screen): else: self["infolabel"].text = _("No details for this image file") + (self["filelist"].getFilename() or "") self.md5sum = "" - else: - self["infolabel"].text = "" - self["key_green"].text = "" - - def ok(self): - if self.job is None or self.job.status is not self.job.IN_PROGRESS: - if self["filelist"].canDescent(): # isDir - self["filelist"].descent() - self.session.summary.setText(self["filelist"].getFilename()) - self.check_for_NFO() - self.check_for_wizard() - else: - self.queryFlash() - - def queryFlash(self): - fd = open(self.nfifile, 'r') - print fd - sign = fd.read(11) - print sign - if sign.find("NFI1" + self.box + "\0") == 0: - if self.md5sum != "": - self["statusbar"].text = ("Please wait for md5 signature verification...") - self.session.summary.setText(("Please wait for md5 signature verification...")) - self.container = eConsoleAppContainer() - self.container.setCWD(self["filelist"].getCurrentDirectory()) - self.container.appClosed.append(self.md5finished) - self.container.dataSent.append(self.md5ready) - self.container.execute("md5sum -cw -") - self.container.write(self.md5sum) - else: - self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file does not have a md5sum signature and is not guaranteed to work. Do you really want to burn this image to flash memory?"), MessageBox.TYPE_YESNO) - else: - self.session.open(MessageBox, (_("This .NFI file does not contain a valid %s image!") % (self.box.upper())), MessageBox.TYPE_ERROR) - - def md5ready(self, retval): - self.container.sendEOF() - - def md5finished(self, retval): - if retval==0: - 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) def queryCB(self, answer): if answer == True: 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") - param = [self.nfifile] - writeNAND(self.job,param,self.box) - #writeNAND2(self.job,param) - #writeNAND3(self.job,param) - self.job.state_changed.append(self.update_job) - self.job.end = 540 - self.cwd = self["filelist"].getCurrentDirectory() - self["job_progressbar"].range = self.job.end - self.startJob() - - def startJob(self): + cwd = self["filelist"].getCurrentDirectory() + md5verify(self.job, cwd, self.md5sum) + writeNAND(self.job, [self.nfifile], self.box) self["key_blue"].text = "" self["key_yellow"].text = "" self["key_green"].text = "" - #self["progress0"].show() - #self["progress1"].show() + job_manager.AddJob(self.job) + self.session.openWithCallback(self.flashed, JobView, self.job, cancelable = False, backgroundable = False) - self.job.start(self.jobcb) - - def update_job(self): - j = self.job - #print "[job state_changed]" - if j.status == j.IN_PROGRESS: - self.session.summary["job_progressbar"].value = j.progress - self.session.summary["job_progressbar"].range = j.end - self.session.summary["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end)) - self["job_progressbar"].range = j.end - self["job_progressbar"].value = j.progress - #print "[update_job] j.progress=%f, j.getProgress()=%f, j.end=%d, text=%f" % (j.progress, j.getProgress(), j.end, (100*j.progress/float(j.end))) - self["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end)) - self.session.summary.setText(j.tasks[j.current_task].name) - self["statusbar"].text = (j.tasks[j.current_task].name) - - 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: - self["statusbar"].text = j.tasks[j.current_task].name + " " + _("failed") - self.session.open(MessageBox, (_("Flashing failed") + ":\n" + j.tasks[j.current_task].name + ":\n" + j.tasks[j.current_task].output_line), MessageBox.TYPE_ERROR) - - def jobcb(self, jobref, fasel, blubber): - print "[jobcb] %s %s %s" % (jobref, fasel, blubber) - self["key_green"].text = _("Flash") + def flashed(self, bg): + print "[flashed]" + self["key_yellow"].text = _("Reboot") def reboot(self, ret=None): if self.job.status == self.job.FINISHED: - self["statusbar"].text = ("rebooting...") + self["status"].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 diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand b/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand deleted file mode 100755 index 073a204f..00000000 Binary files a/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand and /dev/null differ diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py index 28b33305..1eba1dd4 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py @@ -2,6 +2,7 @@ from Plugins.Plugin import PluginDescriptor from Tools.HardwareInfo import HardwareInfo from Tools.Directories import fileExists from downloader import NFIDownload, filescan +from flasher import NFIFlash def NFIFlasherMain(session, tmp = None, **kwargs): session.open(NFIDownload, "/home/root" ) @@ -13,16 +14,12 @@ def Plugins(**kwargs): # currently only available for DM8000 if HardwareInfo().get_device_name() != "dm8000": return [PluginDescriptor()] - if fileExists("/usr/share/bootlogo-flasher.mvi"): - import flasher - # started from usb stick # don't try to be intelligent and trick this - it's not possible to rewrite the flash memory with a system currently booted from it - return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,flasher.NFIFlash))] - else: - # started on real enigma2 - return [PluginDescriptor(name=_("NFI Image Flashing"), - description=_("Download .NFI-Files for USB-Flasher"), - icon = "flash.png", - where = PluginDescriptor.WHERE_SOFTWAREMANAGER, - fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"), - "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}), - PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)] + #return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,NFIFlash))] + # it's not possible to rewrite the flash memory with a system currently booted from it + return [PluginDescriptor(name=_("NFI Image Flashing"), + description=_("Download .NFI-Files for USB-Flasher"), + icon = "flash.png", + where = PluginDescriptor.WHERE_SOFTWAREMANAGER, + fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"), + "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}), + PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)] -- cgit v1.2.3 From c437ed274b0155ecdeb7382d6ee46d67a53755b9 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Thu, 12 Aug 2010 12:05:33 +0200 Subject: NFIFlash: hide hdd and other mounts (#480) --- lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index c0094cc1..79fa069a 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -515,13 +515,7 @@ class NFIDownload(Screen): self.target_dir = usbpartition[0][1] self.ackDestinationDevice(device_description=usbpartition[0][0]) else: - self.openDeviceBrowser() - - def openDeviceBrowser(self): - if self.branch != STICK_WIZARD: self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) - if self.branch == STICK_WIZARD: - self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=False, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) def DeviceBrowserClosed(self, path): print "[DeviceBrowserClosed]", str(path) @@ -537,7 +531,7 @@ class NFIDownload(Screen): else: dev = device_description message = _("Do you want to download the image to %s ?") % (dev) - choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.openDeviceBrowser), (_("Cancel"),self.keyRed)] + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.askDestination), (_("Cancel"),self.keyRed)] self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) def ackDestination_query(self, choice): @@ -637,7 +631,7 @@ class NFIDownload(Screen): First, you need to prepare a USB stick so that it is bootable. In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") - self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) + self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/","/media/usb/","/media/dvd/"]) def wizardDeviceBrowserClosed(self, path): print "[wizardDeviceBrowserClosed]", path @@ -678,7 +672,7 @@ If you already have a prepared bootable USB stick, please insert it now. Otherwi self.menulist.append((ALLIMAGES, _("Choose image to download"), _("Select desired image from feed list" ), None)) self.menulist.append((STICK_WIZARD, _("USB stick wizard"), _("Prepare another USB stick for image flashing" ), None)) self["menu"].setList(self.menulist) - self["status"].text = _("Currently installed image") + ": %s" % (about.getImageVersionString())) + self["status"].text = _("Currently installed image") + ": %s" % (about.getImageVersionString()) self.branch = START self.updateButtons() -- cgit v1.2.3 From a738c033e8a2e952f0840ff03e7fd285808acbbe Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 13 Aug 2010 22:04:43 +0200 Subject: NFIFlash fixes (#480) --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 38 +++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 79fa069a..a94de2b6 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -16,7 +16,7 @@ from Components.MultiContent import MultiContentEntryText from Components.ScrollLabel import ScrollLabel from Components.Harddisk import harddiskmanager from Components.Task import Task, Job, job_manager, Condition -from Tools.Directories import fileExists +from Tools.Directories import fileExists, isMount from Tools.HardwareInfo import HardwareInfo from Tools.Downloader import downloadWithProgress from enigma import eConsoleAppContainer, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eTimer @@ -30,6 +30,8 @@ class ImageDownloadJob(Job): def __init__(self, url, filename, device=None, mountpoint="/"): Job.__init__(self, _("Download .NFI-Files for USB-Flasher")) if device: + if isMount(mountpoint): + UmountTask(self, mountpoint) MountTask(self, device, mountpoint) ImageDownloadTask(self, url, mountpoint+filename) ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo") @@ -44,7 +46,9 @@ class MountTask(Task): def __init__(self, job, device, mountpoint): Task.__init__(self, job, ("mount")) self.setTool("mount") - self.args += [device, mountpoint, "-orw,sync"] + options = "rw,sync" + self.mountpoint = mountpoint + self.args += [ device, mountpoint, "-o"+options ] self.weighting = 1 def processOutput(self, data): @@ -164,7 +168,7 @@ class UnpackTask(Task): def run(self, callback): Task.run(self, callback) - self.delayTimer.start(1000, False) + self.delayTimer.start(950, False) def progress_increment(self): self.progress += 1 @@ -549,28 +553,40 @@ class NFIDownload(Screen): if self.branch == STICK_WIZARD: job = StickWizardJob(self.target_dir) + job.afterEvent = "close" job_manager.AddJob(job) - self.session.openWithCallback(self.StickWizardCB, JobView, job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.StickWizardCB, JobView, job, afterEventChangeable = False) elif self.branch != STICK_WIZARD: url = self.feedlists[self.branch][self.image_idx][1] filename = self.feedlists[self.branch][self.image_idx][0] - print "[getImage] start downloading %s to %s" % (url, path) + print "[getImage] start downloading %s to %s" % (url, filename) job = ImageDownloadJob(url, filename, self.target_dir, self.usbmountpoint) + job.afterEvent = "close" job_manager.AddJob(job) - self.session.openWithCallback(self.ImageDownloadCB, JobView, job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.ImageDownloadCB, JobView, job, afterEventChangeable = False) def StickWizardCB(self, ret=None): - self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) print "[StickWizardCB]", ret - if len(self.feedlists[ALLIMAGES]) == 0: - self.getFeed() + print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job + if len(job_manager.failed_jobs) == 0: + self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) + if len(self.feedlists[ALLIMAGES]) == 0: + self.getFeed() + else: + self.setMenu() else: - self.setMenu() + self.checkUSBStick() def ImageDownloadCB(self, ret): print "[ImageDownloadCB]", ret - self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job + if len(job_manager.failed_jobs) == 0: + self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + else: + self.branch = START def getFeed(self): self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") -- cgit v1.2.3 From 15a99c0b5ac80d52889874af65f9887aabca11b4 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 16 Aug 2010 11:11:35 +0200 Subject: NFIFlash: change display of feed list details --- lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index a94de2b6..e0bad848 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -499,8 +499,16 @@ class NFIDownload(Screen): def listImages(self): print "[listImages]" imagelist = [] + mask = re.compile("%s/(?P1\.\d)/%s/images/(?P.*?)-%s_(?P.*?).nfi" % (self.feed_base, self.box, self.box), re.DOTALL) for name, url in self.feedlists[ALLIMAGES]: - imagelist.append((url, name, _("Download %s from Server" ) % url, None)) + result = mask.match(url) + if result: + if result.group("version").startswith("20"): + version = ( result.group("version")[:4]+'-'+result.group("version")[4:6]+'-'+result.group("version")[6:8] ) + else: + version = result.group("version") + description = "\nOpendreambox %s\n%s image\n%s\n" % (result.group("OE_vers"), result.group("branch"), version) + imagelist.append((url, name, _("Download %s from Server" ) % description, None)) self["menu"].setList(imagelist) def getUSBPartitions(self): -- cgit v1.2.3 From 60e2dcb19baa37753d189fccabeae9b3a5e037fb Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 17 Aug 2010 20:52:48 +0200 Subject: JobView/HTTPProgressDownloader/NFIFlash correctly handle cancelling downloads --- lib/python/Components/Task.py | 5 +-- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 50 ++++++++++++++++------ lib/python/Screens/TaskView.py | 2 +- 3 files changed, 41 insertions(+), 16 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 2e4e757d..3a755405 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -64,11 +64,10 @@ class Job(object): def runNext(self): if self.current_task == len(self.tasks): if len(self.resident_tasks) == 0: - cb = self.callback - self.callback = None self.status = self.FINISHED self.state_changed() - cb(self, None, []) + self.callback(self, None, []) + self.callback = None else: print "still waiting for %d resident task(s) %s to finish" % (len(self.resident_tasks), str(self.resident_tasks)) else: diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index e0bad848..8768021c 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -78,7 +78,9 @@ class ImageDownloadTask(Task): self.error_message = "" self.last_recvbytes = 0 self.error_message = None - + self.download = None + self.aborted = False + def run(self, callback): self.callback = callback self.download = downloadWithProgress(self.url,self.path) @@ -86,23 +88,30 @@ class ImageDownloadTask(Task): self.download.start().addCallback(self.download_finished).addErrback(self.download_failed) print "[ImageDownloadTask] downloading", self.url, "to", self.path + def abort(self): + print "[ImageDownloadTask] aborting", self.url + if self.download: + self.download.stop() + self.aborted = True + def download_progress(self, recvbytes, totalbytes): #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes) if ( recvbytes - self.last_recvbytes ) > 10000: # anti-flicker self.progress = int(100*(float(recvbytes)/float(totalbytes))) self.name = _("Downloading") + ' ' + "%d of %d kBytes" % (recvbytes/1024, totalbytes/1024) self.last_recvbytes = recvbytes - + def download_failed(self, failure_instance=None, error_message=""): self.error_message = error_message if error_message == "" and failure_instance is not None: self.error_message = failure_instance.getErrorMessage() - print "[download_failed]", self.error_message Task.processFinished(self, 1) - + def download_finished(self, string=""): - print "[download_finished]", string - Task.processFinished(self, 0) + if self.aborted: + self.finish(aborted = True) + else: + Task.processFinished(self, 0) class StickWizardJob(Job): def __init__(self, path): @@ -423,7 +432,10 @@ class NFIDownload(Screen): def go(self): self.onShown.remove(self.go) - self["menu"].index = 0 + self.umountCallback = self.getMD5 + self.umount() + + def getMD5(self): url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s-md5sums" % self.box client.getPage(url).addCallback(self.md5sums_finished).addErrback(self.feed_failed) @@ -578,7 +590,7 @@ class NFIDownload(Screen): def StickWizardCB(self, ret=None): print "[StickWizardCB]", ret - print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job +# print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job if len(job_manager.failed_jobs) == 0: self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) if len(self.feedlists[ALLIMAGES]) == 0: @@ -586,15 +598,17 @@ class NFIDownload(Screen): else: self.setMenu() else: - self.checkUSBStick() + self.umountCallback = self.checkUSBStick + self.umount() def ImageDownloadCB(self, ret): print "[ImageDownloadCB]", ret - print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job +# print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job if len(job_manager.failed_jobs) == 0: self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) else: - self.branch = START + self.umountCallback = self.keyRed + self.umount() def getFeed(self): self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") @@ -655,7 +669,7 @@ class NFIDownload(Screen): First, you need to prepare a USB stick so that it is bootable. In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") - self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/","/media/usb/","/media/dvd/"]) + self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/",self.usbmountpoint,"/media/dvd/"]) def wizardDeviceBrowserClosed(self, path): print "[wizardDeviceBrowserClosed]", path @@ -740,6 +754,18 @@ If you already have a prepared bootable USB stick, please insert it now. Otherwi print "check failed! calling", repr(self.md5_failback) self.md5_failback() + def umount(self): + cmd = "umount " + self.usbmountpoint + print "[umount]", cmd + self.container.setCWD('/') + self.container.appClosed.append(self.umountFinished) + self.container.execute(cmd) + + def umountFinished(self, retval): + print "[umountFinished]", str(retval) + self.container.appClosed.remove(self.umountFinished) + self.umountCallback() + def main(session, **kwargs): session.open(NFIDownload,"/home/root") diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 9907e2fb..0b5abcc0 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -114,7 +114,7 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): if self.settings.afterEvent.getValue() == "nothing": return elif self.settings.afterEvent.getValue() == "close": - self.abort() + self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.getValue() == "deepstandby": if not Screens.Standby.inTryQuitMainloop: -- cgit v1.2.3 From 8c8d6b8c810534b63d114c8d51cfefac95eaee49 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 24 Aug 2010 15:03:16 +0200 Subject: fix downloading image to flash or harddrive (#480) --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 8768021c..2c8b45db 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -539,7 +539,10 @@ class NFIDownload(Screen): self.target_dir = usbpartition[0][1] self.ackDestinationDevice(device_description=usbpartition[0][0]) else: - self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) + self.openDeviceBrowser() + + def openDeviceBrowser(self): + self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) def DeviceBrowserClosed(self, path): print "[DeviceBrowserClosed]", str(path) @@ -555,7 +558,7 @@ class NFIDownload(Screen): else: dev = device_description message = _("Do you want to download the image to %s ?") % (dev) - choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.askDestination), (_("Cancel"),self.keyRed)] + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.openDeviceBrowser), (_("Cancel"),self.keyRed)] self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) def ackDestination_query(self, choice): @@ -566,27 +569,30 @@ class NFIDownload(Screen): self.keyRed() def ackedDestination(self): - print "[ackedDestination]", self.branch, self.target_dir, self.target_dir[8:] + print "[ackedDestination]", self.branch, self.target_dir self.container.setCWD("/mnt") if self.target_dir[:8] == "/autofs/": self.target_dir = "/dev/" + self.target_dir[8:-1] - if self.branch == STICK_WIZARD: - job = StickWizardJob(self.target_dir) - job.afterEvent = "close" - job_manager.AddJob(job) - job_manager.failed_jobs = [] - self.session.openWithCallback(self.StickWizardCB, JobView, job, afterEventChangeable = False) - - elif self.branch != STICK_WIZARD: - url = self.feedlists[self.branch][self.image_idx][1] - filename = self.feedlists[self.branch][self.image_idx][0] - print "[getImage] start downloading %s to %s" % (url, filename) + if self.branch == STICK_WIZARD: + job = StickWizardJob(self.target_dir) + job.afterEvent = "close" + job_manager.AddJob(job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.StickWizardCB, JobView, job, afterEventChangeable = False) + + elif self.branch != STICK_WIZARD: + url = self.feedlists[self.branch][self.image_idx][1] + filename = self.feedlists[self.branch][self.image_idx][0] + print "[getImage] start downloading %s to %s" % (url, filename) + if self.target_dir.startswith("/dev/"): job = ImageDownloadJob(url, filename, self.target_dir, self.usbmountpoint) - job.afterEvent = "close" - job_manager.AddJob(job) - job_manager.failed_jobs = [] - self.session.openWithCallback(self.ImageDownloadCB, JobView, job, afterEventChangeable = False) + else: + job = ImageDownloadJob(url, filename, None, self.target_dir) + job.afterEvent = "close" + job_manager.AddJob(job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.ImageDownloadCB, JobView, job, afterEventChangeable = False) def StickWizardCB(self, ret=None): print "[StickWizardCB]", ret -- cgit v1.2.3 From 142b6e6e5f4aeaee51ce46ce08b5472c1e2966c6 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 1 Sep 2010 15:53:27 +0200 Subject: [NFIFlash] ask whether to run configuration backup after image download (add #480) --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 2c8b45db..27038e67 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -35,8 +35,8 @@ class ImageDownloadJob(Job): MountTask(self, device, mountpoint) ImageDownloadTask(self, url, mountpoint+filename) ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo") - if device: - UmountTask(self, mountpoint) + #if device: + #UmountTask(self, mountpoint) def retry(self): self.tasks[0].args += self.tasks[0].retryargs @@ -611,11 +611,30 @@ class NFIDownload(Screen): print "[ImageDownloadCB]", ret # print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job if len(job_manager.failed_jobs) == 0: - self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + self.session.openWithCallback(self.askBackupCB, MessageBox, _("The wizard can backup your current settings. Do you want to do a backup now?"), MessageBox.TYPE_YESNO) else: self.umountCallback = self.keyRed self.umount() + def askBackupCB(self, ret): + if ret: + from Plugins.SystemPlugins.SoftwareManager.BackupRestore import BackupScreen + + class USBBackupScreen(BackupScreen): + def __init__(self, session, usbmountpoint): + BackupScreen.__init__(self, session, runBackup = True) + self.backuppath = usbmountpoint + self.fullbackupfilename = self.backuppath + "/" + self.backupfile + + self.session.openWithCallback(self.showHint, USBBackupScreen, self.usbmountpoint) + else: + self.showHint() + + def showHint(self, ret=None): + self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + self.umountCallback = self.keyRed + self.umount() + def getFeed(self): self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") self.feedDownloader16 = feedDownloader(self.feed_base, self.box, OE_vers="1.6") -- cgit v1.2.3 From 441ac3dbbc2c5dfd21b09b00f6d376a115ac32a5 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 7 Sep 2010 14:06:41 +0200 Subject: NFIFlash: integrate configuration backup/restore, string corrections --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 10 ++--- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 48 ++++++++++++++++++---- 2 files changed, 46 insertions(+), 12 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 27038e67..296d3bca 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -215,7 +215,7 @@ class CopyTask(Task): class NFOViewer(Screen): skin = """ - + """ @@ -631,7 +631,7 @@ class NFIDownload(Screen): self.showHint() def showHint(self, ret=None): - self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and make sure the bootable USB stick is plugged in.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) self.umountCallback = self.keyRed self.umount() @@ -690,8 +690,8 @@ class NFIDownload(Screen): def askStartWizard(self): self.branch = STICK_WIZARD - message = _("""This plugin creates a USB stick which can be used to update the firmware of your Dreambox in case it has no network connection or only WLAN access. -First, you need to prepare a USB stick so that it is bootable. + message = _("""This plugin creates a USB stick which can be used to update the firmware of your Dreambox without the need for a network or WLAN connection. +First, a USB stick needs to be prepared so that it becomes bootable. In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/",self.usbmountpoint,"/media/dvd/"]) @@ -753,7 +753,7 @@ If you already have a prepared bootable USB stick, please insert it now. Otherwi def nfo_finished(self,nfodata=""): print "[nfo_finished] " + str(nfodata) - self["key_blue"].text = _("Changelog viewer") + self["key_blue"].text = _("Changelog") self.nfo = nfodata def md5verify(self, md5, path): diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index 95c7eee9..ba96c071 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -2,6 +2,7 @@ from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox from Screens.Standby import TryQuitMainloop +from Screens.Console import Console from Components.ActionMap import ActionMap from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress @@ -13,7 +14,7 @@ from Screens.TaskView import JobView from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo from os import system -from enigma import eConsoleAppContainer +from enigma import eConsoleAppContainer, quitMainloop from Components.About import about class md5Postcondition(Condition): @@ -95,11 +96,11 @@ class NFIFlash(Screen): self["key_green"] = StaticText() self["key_yellow"] = StaticText() self["key_blue"] = StaticText() - self.filelist = FileList(self.usbmountpoint, matchingPattern = "^.*\.(nfi|NFI)") + self.filelist = FileList(self.usbmountpoint, matchingPattern = "^.*\.(nfi|NFI)", showDirectories = False, showMountpoints = False) self["filelist"] = self.filelist - self["infolabel"] = StaticText("") + self["infolabel"] = StaticText() - self["status"] = StaticText("currently installed image: %s" % (about.getImageVersionString())) + self["status"] = StaticText(_("Please select an NFI file and press green key to flash!") + '\n' + _("currently installed image: %s") % (about.getImageVersionString())) self.job = None self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"], @@ -115,6 +116,15 @@ class NFIFlash(Screen): "right": self.keyRight }, -1) self.md5sum = "" + self.onShown.append(self.autostart) + + def autostart(self): + self.onShown.remove(self.autostart) + self.check_for_NFO() + print "[[layoutFinished]]", len(self["filelist"].getFileList()) + if len(self["filelist"].getFileList()) == 1: + print "==1" + self.keyOk() def keyUp(self): self["filelist"].up() @@ -176,6 +186,7 @@ class NFIFlash(Screen): def createJob(self): self.job = Job("Image flashing job") + self.job.afterEvent = "close" cwd = self["filelist"].getCurrentDirectory() md5verify(self.job, cwd, self.md5sum) writeNAND(self.job, [self.nfifile], self.box) @@ -183,13 +194,36 @@ class NFIFlash(Screen): self["key_yellow"].text = "" self["key_green"].text = "" job_manager.AddJob(self.job) - self.session.openWithCallback(self.flashed, JobView, self.job, cancelable = False, backgroundable = False) + self.session.openWithCallback(self.flashed, JobView, self.job, cancelable = False, backgroundable = False, afterEventChangeable = False) def flashed(self, bg): print "[flashed]" - self["key_yellow"].text = _("Reboot") + if self.job.status == self.job.FINISHED: + self["status"].text = _("NFI image flashing completed. Press Yellow to Reboot!") + filename = self.usbmountpoint+'enigma2settingsbackup.tar.gz' + if fileExists(filename): + import os.path, time + date = time.ctime(os.path.getmtime(filename)) + self.session.openWithCallback(self.askRestoreCB, MessageBox, _("The wizard found a configuration backup. Do you want to restore your old settings from %s?") % date, MessageBox.TYPE_YESNO) + else: + self.unlockRebootButton() + else: + self["status"].text = _("Flashing failed") + + def askRestoreCB(self, ret): + if ret: + from Plugins.SystemPlugins.SoftwareManager.BackupRestore import getBackupFilename + restorecmd = ["tar -xzvf " + self.usbmountpoint + getBackupFilename() + " -C /"] + self.session.openWithCallback(self.unlockRebootButton, Console, title = _("Restore is running..."), cmdlist = restorecmd, closeOnSuccess = True) + else: + self.unlockRebootButton() + + def unlockRebootButton(self, retval = None): + if self.job.status == self.job.FINISHED: + self["key_yellow"].text = _("Reboot") def reboot(self, ret=None): if self.job.status == self.job.FINISHED: self["status"].text = ("rebooting...") - TryQuitMainloop(self.session,2) + from os import system + system("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/kill_e2_reboot.sh") -- cgit v1.2.3 From 46fd0ceb0b4850ffa9f2f3e1efd42b914eeef748 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 25 May 2010 10:43:10 +0200 Subject: experimentally merge audio + subtitle streams selection dialogs into one --- data/menu.xml | 1 - data/skin_default.xml | 47 +++++- lib/python/Screens/AudioSelection.py | 308 ++++++++++++++++++++++++++++++++++ lib/python/Screens/InfoBarGenerics.py | 125 +------------- lib/python/Screens/Makefile.am | 6 +- lib/python/Screens/Subtitles.py | 103 ------------ 6 files changed, 359 insertions(+), 231 deletions(-) create mode 100644 lib/python/Screens/AudioSelection.py delete mode 100644 lib/python/Screens/Subtitles.py (limited to 'lib/python') diff --git a/data/menu.xml b/data/menu.xml index 6507bfe3..6e103542 100755 --- a/data/menu.xml +++ b/data/menu.xml @@ -17,7 +17,6 @@ self.openSetup("network")--> - self.session.scart.VCRSbChanged(3) diff --git a/data/skin_default.xml b/data/skin_default.xml index 8e0c1562..5c40c7d0 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -62,8 +62,47 @@ - - + + + + + + + + + + + + + + + + + + + + + {"templates": + {"default": (25, [ + MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, + MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + ], True, "showNever"), + "notselected": (25, [ + MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, + MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + ], False, "showNever") + }, + "fonts": [gFont("Regular", 20), gFont("Regular", 16)], + "itemHeight": 25 + } + + @@ -941,9 +980,9 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py new file mode 100644 index 00000000..b97c25b2 --- /dev/null +++ b/lib/python/Screens/AudioSelection.py @@ -0,0 +1,308 @@ +from Screen import Screen +from Components.ServiceEventTracker import ServiceEventTracker +from Components.ActionMap import ActionMap +from Components.ConfigList import ConfigListScreen +from Components.ChoiceList import ChoiceList, ChoiceEntryComponent +from Components.config import config, ConfigSubsection, getConfigListEntry, ConfigNothing, ConfigSelection, ConfigOnOff +from Components.MultiContent import MultiContentEntryText +from Components.Sources.List import List +from Components.Sources.Boolean import Boolean +from Components.SystemInfo import SystemInfo + +from enigma import iPlayableService + +from Tools.ISO639 import LanguageCodes +from Tools.BoundFunction import boundFunction +FOCUS_CONFIG, FOCUS_STREAMS = range(2) + +class AudioSelection(Screen, ConfigListScreen): + def __init__(self, session, infobar=None): + Screen.__init__(self, session) + + self["streams"] = List([]) + self["key_red"] = Boolean(False) + self["key_green"] = Boolean(False) + self["key_yellow"] = Boolean(True) + self["key_blue"] = Boolean(False) + + ConfigListScreen.__init__(self, []) + self.infobar = infobar or self.session.infobar + + self.__event_tracker = ServiceEventTracker(screen=self, eventmap= + { + iPlayableService.evUpdatedInfo: self.__updatedInfo + }) + self.cached_subtitle_checked = False + self.__selected_subtitle = None + + self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"], + { + "red": self.keyRed, + "green": self.keyGreen, + "yellow": self.keyYellow, + "blue": self.keyBlue, + "ok": self.keyOk, + "cancel": self.cancel, + "up": self.keyUp, + "down": self.keyDown, + }, -3) + + self.settings = ConfigSubsection() + choicelist = [("audio",_("audio tracks")), ("subtitles",_("Subtitles"))] + self.settings.menupage = ConfigSelection(choices = choicelist) + self.settings.menupage.addNotifier(self.fillList) + self.onLayoutFinish.append(self.__layoutFinished) + + def __layoutFinished(self): + self["config"].instance.setSelectionEnable(False) + self.focus = FOCUS_STREAMS + + def fillList(self, arg=None): + streams = [] + conflist = [] + selectedidx = 0 + + service = self.session.nav.getCurrentService() + self.audioTracks = audio = service and service.audioTracks() + n = audio and audio.getNumberOfTracks() or 0 + + if self.settings.menupage.getValue() == "audio": + self.setTitle(_("Select audio track")) + if SystemInfo["CanDownmixAC3"]: + print "config.av.downmix_ac3.value=", config.av.downmix_ac3.value + self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value) + self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False) + conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix)) + self["key_red"] = Boolean(True) + + if n > 0: + self.audioChannel = service.audioChannel() + print "self.audioChannel.getCurrentChannel()", self.audioChannel.getCurrentChannel() + choicelist = [("0",_("left")), ("1",_("stereo")), ("2", _("right"))] + self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel())) + self.settings.channelmode.addNotifier(self.changeMode, initial_call = False) + conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode)) + self["key_green"] = Boolean(True) + + selectedAudio = self.audioTracks.getCurrentTrack() + print "selectedAudio:", selectedAudio + + for x in range(n): + number = str(x) + i = audio.getTrackInfo(x) + languages = i.getLanguage().split('/') + description = i.getDescription() or _("") + selected = "" + language = "" + + if selectedAudio == x: + selected = _("Running") + selectedidx = x + + cnt = 0 + for lang in languages: + if cnt: + language += ' / ' + if LanguageCodes.has_key(lang): + language += LanguageCodes[lang][0] + elif lang == "und": + _("") + else: + language += lang + cnt += 1 + + streams.append((x, "", number, description, language, selected)) + + #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("") + else: + streams = [(None, "", "", _("none"), "")] + + elif self.settings.menupage.getValue() == "subtitles": + self.setTitle(_("Subtitle selection")) + + self.settings.dummy = ConfigNothing() + conflist.append(getConfigListEntry("", self.settings.dummy)) + conflist.append(getConfigListEntry("", self.settings.dummy)) + + if self.subtitlesEnabled(): + sel = self.infobar.selected_subtitle + else: + sel = None + + idx = 0 + + subtitlelist = self.getSubtitleList() + + if len(subtitlelist): + for x in subtitlelist: + number = str(x[1]) + description = "?" + language = _("") + selected = "" + + if sel and x[:4] == sel[:4]: + selected = _("Running") + selectedidx = idx + + if x[4] != "und": + if LanguageCodes.has_key(x[4]): + language = LanguageCodes[x[4]][0] + else: + language = x[4] + + if x[0] == 0: + description = "DVB" + number = "%x" % (x[1]) + + elif x[0] == 1: + description = "TTX" + number = "%x%02x" % (x[3],x[2]) + + elif x[0] == 2: + types = (" UTF-8 text "," SSA / AAS "," .SRT file ") + description = types[x[2]] + + streams.append((x, "", number, description, language, selected)) + idx += 1 + + else: + streams = [(None, "", "", _("none"), "")] + + conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) + self["config"].list = conflist + self["config"].l.setList(conflist) + + self["streams"].list = streams + self["streams"].setIndex(selectedidx) + + def __updatedInfo(self): + self.fillList() + + def getSubtitleList(self): + s = self.infobar and self.infobar.getCurrentServiceSubtitle() + l = s and s.getSubtitleList() or [ ] + return l + + def subtitlesEnabled(self): + return self.infobar.subtitles_enabled + + def enableSubtitle(self, subtitles): + print "[enableSubtitle]", subtitles + if self.infobar.selected_subtitle != subtitles: + self.infobar.subtitles_enabled = False + self.infobar.selected_subtitle = subtitles + if subtitles: + self.infobar.subtitles_enabled = True + + def changeAC3Downmix(self, downmix): + print "changeAC3Downmix config.av.downmix_ac3.value=", config.av.downmix_ac3.value, downmix.getValue() + if downmix.getValue() == True: + config.av.downmix_ac3.value = True + else: + config.av.downmix_ac3.value = False + config.av.downmix_ac3.save() + + def changeMode(self, mode): + print "changeMode", mode, mode.getValue() + if mode is not None: + self.audioChannel.selectChannel(int(mode.getValue())) + + def changeAudio(self, audio): + print "changeAudio", audio, "self.session.nav.getCurrentService().audioTracks().getNumberOfTracks():", self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() + track = int(audio) + if isinstance(track, int): + if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > track: + self.audioTracks.selectTrack(track) + + def keyLeft(self): + if self.focus == FOCUS_CONFIG: + ConfigListScreen.keyLeft(self) + elif self.focus == FOCUS_STREAMS: + self["streams"].setIndex(0) + + def keyRight(self): + if self.focus == FOCUS_CONFIG: + ConfigListScreen.keyRight(self) + elif self.focus == FOCUS_STREAMS and self["streams"].count(): + self["streams"].setIndex(self["streams"].count()-1) + + def keyRed(self): + self.colorkey(0) + + def keyGreen(self): + self.colorkey(1) + + def keyYellow(self): + self.colorkey(2) + + def keyBlue(self): + pass + + def colorkey(self, idx): + self["config"].setCurrentIndex(idx) + ConfigListScreen.keyRight(self) + + def keyUp(self): + print "[keyUp]", self["streams"].getIndex() + if self.focus == FOCUS_CONFIG: + self["config"].instance.moveSelection(self["config"].instance.moveUp) + elif self.focus == FOCUS_STREAMS: + if self["streams"].getIndex() == 0: + self["config"].instance.setSelectionEnable(True) + self["streams"].style = "notselected" + self["config"].setCurrentIndex(len(self["config"].getList())-1) + self.focus = FOCUS_CONFIG + else: + self["streams"].selectPrevious() + + def keyDown(self): + print "[keyDown]", self["config"].getCurrentIndex(), len(self["config"].getList())-1 + if self.focus == FOCUS_CONFIG: + if self["config"].getCurrentIndex() < len(self["config"].getList())-1: + self["config"].instance.moveSelection(self["config"].instance.moveDown) + else: + self["config"].instance.setSelectionEnable(False) + self["streams"].style = "default" + self.focus = FOCUS_STREAMS + elif self.focus == FOCUS_STREAMS: + self["streams"].selectNext() + + def keyOk(self): + print "[keyok]", self["streams"].list, self["streams"].getCurrent() + if self.focus == FOCUS_STREAMS and self["streams"].list: + cur = self["streams"].getCurrent() + if self.settings.menupage.getValue() == "audio" and cur[0]: + self.changeAudio(cur[2]) + self.__updatedInfo() + if self.settings.menupage.getValue() == "subtitles" and cur[0]: + if self.infobar.selected_subtitle == cur[0]: + self.enableSubtitle(None) + selectedidx = self["streams"].getIndex() + self.__updatedInfo() + self["streams"].setIndex(selectedidx) + else: + self.enableSubtitle(cur[0]) + self.__updatedInfo() + #self.close() + elif self.focus == FOCUS_CONFIG: + self.keyRight() + + def cancel(self): + self.close() diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index f98d4c33..a6b22e5c 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1672,126 +1672,11 @@ class InfoBarAudioSelection: }) def audioSelection(self): - service = self.session.nav.getCurrentService() - self.audioTracks = audio = service and service.audioTracks() - n = audio and audio.getNumberOfTracks() or 0 - tlist = [] - if n > 0: - self.audioChannel = service.audioChannel() - - idx = 0 - while idx < n: - cnt = 0 - i = audio.getTrackInfo(idx) - languages = i.getLanguage().split('/') - description = i.getDescription() - language = "" - - for lang in languages: - if cnt: - language += ' / ' - if LanguageCodes.has_key(lang): - language += LanguageCodes[lang][0] - else: - language += lang - cnt += 1 - - if len(description): - description += " (" + language + ")" - else: - description = language - - tlist.append((description, idx)) - idx += 1 - - tlist.sort(key=lambda x: x[0]) - - selectedAudio = self.audioTracks.getCurrentTrack() - - selection = 0 - - for x in tlist: - if x[1] != selectedAudio: - selection += 1 - else: - break - - availableKeys = [] - usedKeys = [] - - if SystemInfo["CanDownmixAC3"]: - 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 - 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 - - def changeAC3Downmix(self, arg): - choicelist = self.session.current_dialog["list"] - list = choicelist.list - t = list[0][1] - list[0][1]=(t[0], t[1], t[2], t[3], t[4], t[5], t[6], - _("AC3 downmix") + " - " + (_("On"), _("Off"))[config.av.downmix_ac3.value and 1 or 0]) - choicelist.setList(list) - if config.av.downmix_ac3.value: - config.av.downmix_ac3.value = False - else: - config.av.downmix_ac3.value = True - config.av.downmix_ac3.save() - - def audioSelected(self, audio): - if audio is not None: - if isinstance(audio[1], str): - if audio[1] == "mode": - keys = ["red", "green", "yellow"] - selection = self.audioChannel.getCurrentChannel() - tlist = ((_("left"), 0), (_("stereo"), 1), (_("right"), 2)) - self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys, skin_name ="AudioModeSelection") - else: - del self.audioChannel - if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > audio[1]: - self.audioTracks.selectTrack(audio[1]) - else: - del self.audioChannel - del self.audioTracks - - def modeSelected(self, mode): - if mode is not None: - self.audioChannel.selectChannel(mode[1]) - del self.audioChannel + from Screens.AudioSelection import AudioSelection + self.session.openWithCallback(self.audioSelected, AudioSelection, infobar=self) + + def audioSelected(self, ret=None): + print "[infobar::audioSelected]", ret class InfoBarSubserviceSelection: def __init__(self): diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index a4b158de..69600f01 100755 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -1,13 +1,13 @@ installdir = $(pkglibdir)/python/Screens install_PYTHON = \ - ChannelSelection.py ClockDisplay.py ConfigMenu.py InfoBar.py Menu.py \ - MessageBox.py Screen.py ServiceScan.py TimerEdit.py \ + AudioSelection.py ChannelSelection.py ClockDisplay.py ConfigMenu.py InfoBar.py \ + Menu.py MessageBox.py Screen.py ServiceScan.py TimerEdit.py \ MovieSelection.py Setup.py About.py HarddiskSetup.py FixedMenu.py \ Satconfig.py ScanSetup.py NetworkSetup.py Ci.py TimerEntry.py Volume.py \ EpgSelection.py EventView.py Mute.py Standby.py ServiceInfo.py \ InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \ - Dish.py LanguageSelection.py StartWizard.py PiPSetup.py Subtitles.py \ + Dish.py LanguageSelection.py StartWizard.py PiPSetup.py \ TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \ Console.py InputBox.py ChoiceBox.py SimpleSummary.py \ TimerSelection.py PictureInPicture.py TimeDateInput.py \ diff --git a/lib/python/Screens/Subtitles.py b/lib/python/Screens/Subtitles.py deleted file mode 100644 index 9ba7e0a5..00000000 --- a/lib/python/Screens/Subtitles.py +++ /dev/null @@ -1,103 +0,0 @@ -from Screen import Screen -from Components.ServiceEventTracker import ServiceEventTracker -from Components.ActionMap import ActionMap -from Components.ConfigList import ConfigListScreen -from Components.config import config, getConfigListEntry, ConfigNothing -from enigma import iPlayableService - -from Tools.ISO639 import LanguageCodes - -class Subtitles(Screen, ConfigListScreen): - def __init__(self, session, infobar=None): - Screen.__init__(self, session) - - self["actions"] = ActionMap(["SetupActions"], - { - "ok": self.ok, - "cancel": self.cancel, - }, -2) - - self.list = [] - ConfigListScreen.__init__(self, self.list) - self.infobar = infobar or self.session.infobar - self.fillList() - - self.__event_tracker = ServiceEventTracker(screen=self, eventmap= - { - iPlayableService.evUpdatedInfo: self.__updatedInfo - }) - self.cached_subtitle_checked = False - self.__selected_subtitle = None - - def fillList(self): - list = self.list - del list[:] - print "self.list", list - if self.subtitlesEnabled(): - list.append(getConfigListEntry(_("Disable Subtitles"), ConfigNothing(), None)) - sel = self.infobar.selected_subtitle - else: - sel = None - for x in self.getSubtitleList(): - if sel and sel[:4] == x[:4]: #ignore Language code in compare - text = _("Running") - else: - text = _("Enable") - if x[0] == 0: - if LanguageCodes.has_key(x[4]): - list.append(getConfigListEntry(text+" DVB "+LanguageCodes[x[4]][0], ConfigNothing(), x)) - else: - list.append(getConfigListEntry(text+" DVB "+x[4], ConfigNothing(), x)) - elif x[0] == 1: - if x[4] == 'und': #undefined - list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2]), ConfigNothing(), x)) - else: - if LanguageCodes.has_key(x[4]): - list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+LanguageCodes[x[4]][0], ConfigNothing(), x)) - else: - list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+x[4], ConfigNothing(), x)) - elif x[0] == 2: - types = (" UTF-8 text "," SSA / AAS "," .SRT file ") - if x[4] == 'und': #undefined - list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d" % x[1], ConfigNothing(), x)) - else: - if LanguageCodes.has_key(x[4]): - list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles") + ' ' + LanguageCodes[x[4]][0], ConfigNothing(), x)) - else: - list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d " % x[1] +x[4], ConfigNothing(), x)) -# return _("Disable subtitles") - self["config"].list = list - self["config"].l.setList(list) - - def __updatedInfo(self): - self.fillList() - - def getSubtitleList(self): - s = self.infobar and self.infobar.getCurrentServiceSubtitle() - l = s and s.getSubtitleList() or [ ] - return l - - def subtitlesEnabled(self): - return self.infobar.subtitles_enabled - - def enableSubtitle(self, subtitles): - if self.infobar.selected_subtitle != subtitles: - self.infobar.subtitles_enabled = False - self.infobar.selected_subtitle = subtitles - if subtitles: - self.infobar.subtitles_enabled = True - - def keyLeft(self): - ConfigListScreen.keyLeft(self) - - def keyRight(self): - ConfigListScreen.keyRight(self) - - def ok(self): - if self.list: - cur = self["config"].getCurrent() - self.enableSubtitle(cur[2]) - self.close(1) - - def cancel(self): - self.close() -- cgit v1.2.3 From 2afff9a1e6fd80a1dce00ba861b50d72a1541f88 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 25 May 2010 13:39:16 +0200 Subject: allow switching to stream 0 --- lib/python/Screens/AudioSelection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index b97c25b2..a11127cb 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -288,10 +288,10 @@ class AudioSelection(Screen, ConfigListScreen): print "[keyok]", self["streams"].list, self["streams"].getCurrent() if self.focus == FOCUS_STREAMS and self["streams"].list: cur = self["streams"].getCurrent() - if self.settings.menupage.getValue() == "audio" and cur[0]: + if self.settings.menupage.getValue() == "audio" and cur[0] is not None: self.changeAudio(cur[2]) self.__updatedInfo() - if self.settings.menupage.getValue() == "subtitles" and cur[0]: + if self.settings.menupage.getValue() == "subtitles" and cur[0] is not None: if self.infobar.selected_subtitle == cur[0]: self.enableSubtitle(None) selectedidx = self["streams"].getIndex() -- cgit v1.2.3 From 71dcc2c21cb3488861444e6f4e82a25b77df70ed Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 26 May 2010 11:33:11 +0200 Subject: fix empty streams list crash, correctly show/hide color key buttons, re-implement plugin-hook for blue key, fix possible exit crash --- lib/python/Screens/AudioSelection.py | 87 +++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 35 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index a11127cb..2cae1de9 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -73,7 +73,7 @@ class AudioSelection(Screen, ConfigListScreen): self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value) self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False) conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix)) - self["key_red"] = Boolean(True) + self["key_red"].setBoolean(True) if n > 0: self.audioChannel = service.audioChannel() @@ -82,7 +82,7 @@ class AudioSelection(Screen, ConfigListScreen): self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel())) self.settings.channelmode.addNotifier(self.changeMode, initial_call = False) conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode)) - self["key_green"] = Boolean(True) + self["key_green"].setBoolean(True) selectedAudio = self.audioTracks.getCurrentTrack() print "selectedAudio:", selectedAudio @@ -113,33 +113,17 @@ class AudioSelection(Screen, ConfigListScreen): streams.append((x, "", number, description, language, selected)) - #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("") else: - streams = [(None, "", "", _("none"), "")] + streams = [] elif self.settings.menupage.getValue() == "subtitles": self.setTitle(_("Subtitle selection")) self.settings.dummy = ConfigNothing() conflist.append(getConfigListEntry("", self.settings.dummy)) + self["key_red"].setBoolean(False) conflist.append(getConfigListEntry("", self.settings.dummy)) + self["key_green"].setBoolean(False) if self.subtitlesEnabled(): sel = self.infobar.selected_subtitle @@ -149,7 +133,7 @@ class AudioSelection(Screen, ConfigListScreen): idx = 0 subtitlelist = self.getSubtitleList() - + if len(subtitlelist): for x in subtitlelist: number = str(x[1]) @@ -183,14 +167,39 @@ class AudioSelection(Screen, ConfigListScreen): idx += 1 else: - streams = [(None, "", "", _("none"), "")] + streams = [] conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) + + from Components.PluginComponent import plugins + from Plugins.Plugin import PluginDescriptor + + if hasattr(self.infobar, "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.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] + + print "Plugins", Plugins + + self.settings.dummy = ConfigNothing() + if len(Plugins): + self["key_blue"].setBoolean(True) + conflist.append(getConfigListEntry(Plugins[0][0], self.settings.dummy)) + self.plugincallfunc = Plugins[0][1] + self["config"].list = conflist self["config"].l.setList(conflist) + print "setting self[streams].list:", streams self["streams"].list = streams + print "setting self[streams].setIndex:", selectedidx self["streams"].setIndex(selectedidx) + print "debug1" def __updatedInfo(self): self.fillList() @@ -237,27 +246,35 @@ class AudioSelection(Screen, ConfigListScreen): elif self.focus == FOCUS_STREAMS: self["streams"].setIndex(0) - def keyRight(self): - if self.focus == FOCUS_CONFIG: - ConfigListScreen.keyRight(self) - elif self.focus == FOCUS_STREAMS and self["streams"].count(): + def keyRight(self, config = False): + if config or self.focus == FOCUS_CONFIG: + if self["config"].getCurrentIndex() < 3: + ConfigListScreen.keyRight(self) + elif hasattr(self, "plugincallfunc"): + self.plugincallfunc() + if self.focus == FOCUS_STREAMS and self["streams"].count(): self["streams"].setIndex(self["streams"].count()-1) def keyRed(self): - self.colorkey(0) + if self["key_red"].getBoolean(): + self.colorkey(0) def keyGreen(self): - self.colorkey(1) + if self["key_green"].getBoolean(): + self.colorkey(1) def keyYellow(self): - self.colorkey(2) - + if self["key_yellow"].getBoolean(): + self.colorkey(2) + def keyBlue(self): - pass - + if self["key_blue"].getBoolean(): + print "colorkey(3)" + self.colorkey(3) + def colorkey(self, idx): self["config"].setCurrentIndex(idx) - ConfigListScreen.keyRight(self) + self.keyRight(True) def keyUp(self): print "[keyUp]", self["streams"].getIndex() @@ -305,4 +322,4 @@ class AudioSelection(Screen, ConfigListScreen): self.keyRight() def cancel(self): - self.close() + self.close(0) -- cgit v1.2.3 From 932f1ec948f517d2cf739cba5ac564fcac618aa9 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 2 Jun 2010 15:03:52 +0200 Subject: Extend AudioSelection width, fix mediaplayer subtitle selection key --- data/skin_default.xml | 24 +++++++++--------- .../Plugins/Extensions/MediaPlayer/plugin.py | 8 +++--- lib/python/Screens/AudioSelection.py | 29 ++++++++++++++-------- 3 files changed, 35 insertions(+), 26 deletions(-) (limited to 'lib/python') diff --git a/data/skin_default.xml b/data/skin_default.xml index 5c40c7d0..779e2be1 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -62,8 +62,8 @@ - - + + @@ -78,24 +78,24 @@ - + - + {"templates": {"default": (25, [ MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, - MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, - MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, - MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, - MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + MultiContentEntryText(pos = (40, 0), size = (60, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (110, 0), size = (120, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (240, 0), size = (210, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (460, 4), size = (80, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, ], True, "showNever"), "notselected": (25, [ MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, - MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, - MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, - MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, - MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + MultiContentEntryText(pos = (40, 0), size = (60, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (110, 0), size = (120, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (240, 0), size = (210, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (460, 4), size = (80, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, ], False, "showNever") }, "fonts": [gFont("Regular", 20), gFont("Regular", 16)], diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 28cf7238..9ae886fc 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -901,11 +901,11 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def unPauseService(self): self.setSeekState(self.SEEK_STATE_PLAY) - + def subtitleSelection(self): - from Screens.Subtitles import Subtitles - self.session.open(Subtitles, self) - + from Screens.AudioSelection import SubtitleSelection + self.session.open(SubtitleSelection, self) + def hotplugCB(self, dev, media_state): if dev == harddiskmanager.getCD(): if media_state == "1": diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index 2cae1de9..2dd6ad90 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -14,9 +14,10 @@ from enigma import iPlayableService from Tools.ISO639 import LanguageCodes from Tools.BoundFunction import boundFunction FOCUS_CONFIG, FOCUS_STREAMS = range(2) +[PAGE_AUDIO, PAGE_SUBTITLES] = ["audio", "subtitles"] class AudioSelection(Screen, ConfigListScreen): - def __init__(self, session, infobar=None): + def __init__(self, session, infobar=None, page=PAGE_AUDIO): Screen.__init__(self, session) self["streams"] = List([]) @@ -48,8 +49,8 @@ class AudioSelection(Screen, ConfigListScreen): }, -3) self.settings = ConfigSubsection() - choicelist = [("audio",_("audio tracks")), ("subtitles",_("Subtitles"))] - self.settings.menupage = ConfigSelection(choices = choicelist) + choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))] + self.settings.menupage = ConfigSelection(choices = choicelist, default=page) self.settings.menupage.addNotifier(self.fillList) self.onLayoutFinish.append(self.__layoutFinished) @@ -66,7 +67,7 @@ class AudioSelection(Screen, ConfigListScreen): self.audioTracks = audio = service and service.audioTracks() n = audio and audio.getNumberOfTracks() or 0 - if self.settings.menupage.getValue() == "audio": + if self.settings.menupage.getValue() == PAGE_AUDIO: self.setTitle(_("Select audio track")) if SystemInfo["CanDownmixAC3"]: print "config.av.downmix_ac3.value=", config.av.downmix_ac3.value @@ -115,8 +116,11 @@ class AudioSelection(Screen, ConfigListScreen): else: streams = [] + self.settings.dummy = ConfigNothing() + conflist.append(getConfigListEntry("", self.settings.dummy)) + self["key_green"].setBoolean(False) - elif self.settings.menupage.getValue() == "subtitles": + elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) self.settings.dummy = ConfigNothing() @@ -158,9 +162,9 @@ class AudioSelection(Screen, ConfigListScreen): elif x[0] == 1: description = "TTX" number = "%x%02x" % (x[3],x[2]) - + elif x[0] == 2: - types = (" UTF-8 text "," SSA / AAS "," .SRT file ") + types = ("UTF-8 text","SSA / AAS",".SRT file") description = types[x[2]] streams.append((x, "", number, description, language, selected)) @@ -252,7 +256,7 @@ class AudioSelection(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) elif hasattr(self, "plugincallfunc"): self.plugincallfunc() - if self.focus == FOCUS_STREAMS and self["streams"].count(): + if self.focus == FOCUS_STREAMS and self["streams"].count() and config == False: self["streams"].setIndex(self["streams"].count()-1) def keyRed(self): @@ -305,10 +309,10 @@ class AudioSelection(Screen, ConfigListScreen): print "[keyok]", self["streams"].list, self["streams"].getCurrent() if self.focus == FOCUS_STREAMS and self["streams"].list: cur = self["streams"].getCurrent() - if self.settings.menupage.getValue() == "audio" and cur[0] is not None: + if self.settings.menupage.getValue() == PAGE_AUDIO and cur[0] is not None: self.changeAudio(cur[2]) self.__updatedInfo() - if self.settings.menupage.getValue() == "subtitles" and cur[0] is not None: + if self.settings.menupage.getValue() == PAGE_SUBTITLES and cur[0] is not None: if self.infobar.selected_subtitle == cur[0]: self.enableSubtitle(None) selectedidx = self["streams"].getIndex() @@ -323,3 +327,8 @@ class AudioSelection(Screen, ConfigListScreen): def cancel(self): self.close(0) + +class SubtitleSelection(AudioSelection): + def __init__(self, session, infobar=None): + AudioSelection.__init__(self, session, infobar, page=PAGE_SUBTITLES) + self.skinName = ["AudioSelection"] -- cgit v1.2.3 From e9be0f345b0237bd60e12b7ffc36c5dbd1a09cec Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 4 Jun 2010 15:17:40 +0200 Subject: make empty conflist entries unselectable and change some debug output --- lib/python/Screens/AudioSelection.py | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index 2dd6ad90..bacc00c1 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -70,7 +70,6 @@ class AudioSelection(Screen, ConfigListScreen): if self.settings.menupage.getValue() == PAGE_AUDIO: self.setTitle(_("Select audio track")) if SystemInfo["CanDownmixAC3"]: - print "config.av.downmix_ac3.value=", config.av.downmix_ac3.value self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value) self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False) conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix)) @@ -78,16 +77,12 @@ class AudioSelection(Screen, ConfigListScreen): if n > 0: self.audioChannel = service.audioChannel() - print "self.audioChannel.getCurrentChannel()", self.audioChannel.getCurrentChannel() choicelist = [("0",_("left")), ("1",_("stereo")), ("2", _("right"))] self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel())) self.settings.channelmode.addNotifier(self.changeMode, initial_call = False) conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode)) self["key_green"].setBoolean(True) - selectedAudio = self.audioTracks.getCurrentTrack() - print "selectedAudio:", selectedAudio - for x in range(n): number = str(x) i = audio.getTrackInfo(x) @@ -116,17 +111,14 @@ class AudioSelection(Screen, ConfigListScreen): else: streams = [] - self.settings.dummy = ConfigNothing() - conflist.append(getConfigListEntry("", self.settings.dummy)) + conflist.append(('',)) self["key_green"].setBoolean(False) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) - - self.settings.dummy = ConfigNothing() - conflist.append(getConfigListEntry("", self.settings.dummy)) + conflist.append(('',)) + conflist.append(('',)) self["key_red"].setBoolean(False) - conflist.append(getConfigListEntry("", self.settings.dummy)) self["key_green"].setBoolean(False) if self.subtitlesEnabled(): @@ -187,23 +179,19 @@ class AudioSelection(Screen, ConfigListScreen): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] - - print "Plugins", Plugins - self.settings.dummy = ConfigNothing() if len(Plugins): self["key_blue"].setBoolean(True) - conflist.append(getConfigListEntry(Plugins[0][0], self.settings.dummy)) + conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallfunc = Plugins[0][1] + if len(Plugins) > 1: + print "these plugins are installed but not displayed in the dialog box:", Plugins[1:] self["config"].list = conflist self["config"].l.setList(conflist) - print "setting self[streams].list:", streams self["streams"].list = streams - print "setting self[streams].setIndex:", selectedidx self["streams"].setIndex(selectedidx) - print "debug1" def __updatedInfo(self): self.fillList() @@ -217,7 +205,6 @@ class AudioSelection(Screen, ConfigListScreen): return self.infobar.subtitles_enabled def enableSubtitle(self, subtitles): - print "[enableSubtitle]", subtitles if self.infobar.selected_subtitle != subtitles: self.infobar.subtitles_enabled = False self.infobar.selected_subtitle = subtitles @@ -225,7 +212,6 @@ class AudioSelection(Screen, ConfigListScreen): self.infobar.subtitles_enabled = True def changeAC3Downmix(self, downmix): - print "changeAC3Downmix config.av.downmix_ac3.value=", config.av.downmix_ac3.value, downmix.getValue() if downmix.getValue() == True: config.av.downmix_ac3.value = True else: @@ -233,12 +219,10 @@ class AudioSelection(Screen, ConfigListScreen): config.av.downmix_ac3.save() def changeMode(self, mode): - print "changeMode", mode, mode.getValue() if mode is not None: self.audioChannel.selectChannel(int(mode.getValue())) def changeAudio(self, audio): - print "changeAudio", audio, "self.session.nav.getCurrentService().audioTracks().getNumberOfTracks():", self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() track = int(audio) if isinstance(track, int): if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > track: @@ -273,7 +257,6 @@ class AudioSelection(Screen, ConfigListScreen): def keyBlue(self): if self["key_blue"].getBoolean(): - print "colorkey(3)" self.colorkey(3) def colorkey(self, idx): @@ -281,7 +264,6 @@ class AudioSelection(Screen, ConfigListScreen): self.keyRight(True) def keyUp(self): - print "[keyUp]", self["streams"].getIndex() if self.focus == FOCUS_CONFIG: self["config"].instance.moveSelection(self["config"].instance.moveUp) elif self.focus == FOCUS_STREAMS: @@ -294,7 +276,6 @@ class AudioSelection(Screen, ConfigListScreen): self["streams"].selectPrevious() def keyDown(self): - print "[keyDown]", self["config"].getCurrentIndex(), len(self["config"].getList())-1 if self.focus == FOCUS_CONFIG: if self["config"].getCurrentIndex() < len(self["config"].getList())-1: self["config"].instance.moveSelection(self["config"].instance.moveDown) @@ -306,7 +287,6 @@ class AudioSelection(Screen, ConfigListScreen): self["streams"].selectNext() def keyOk(self): - print "[keyok]", self["streams"].list, self["streams"].getCurrent() if self.focus == FOCUS_STREAMS and self["streams"].list: cur = self["streams"].getCurrent() if self.settings.menupage.getValue() == PAGE_AUDIO and cur[0] is not None: -- cgit v1.2.3 From e5f4abe60a2d8e36f4406e3df9d7d68937700d14 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 21 Jun 2010 10:20:09 +0200 Subject: set currently running audio + subtitle streams as default selection. on OK keypress, select and close dialog. (add #188) --- lib/python/Screens/AudioSelection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index bacc00c1..a0bfcab9 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -51,12 +51,12 @@ class AudioSelection(Screen, ConfigListScreen): self.settings = ConfigSubsection() choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))] self.settings.menupage = ConfigSelection(choices = choicelist, default=page) - self.settings.menupage.addNotifier(self.fillList) self.onLayoutFinish.append(self.__layoutFinished) def __layoutFinished(self): self["config"].instance.setSelectionEnable(False) self.focus = FOCUS_STREAMS + self.settings.menupage.addNotifier(self.fillList) def fillList(self, arg=None): streams = [] @@ -301,7 +301,7 @@ class AudioSelection(Screen, ConfigListScreen): else: self.enableSubtitle(cur[0]) self.__updatedInfo() - #self.close() + self.close(0) elif self.focus == FOCUS_CONFIG: self.keyRight() -- cgit v1.2.3 From 896c84d2406e5c2a16a98539f10b9695027eace9 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 9 Jun 2010 02:32:29 +0200 Subject: fix subtitle configlist crash --- lib/python/Components/ConfigList.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 418a1b67..ffbc69af 100755 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -61,12 +61,13 @@ class ConfigList(HTMLComponent, GUIComponent, object): GUI_WIDGET = eListbox def selectionChanged(self): - if self.current: + if isinstance(self.current,tuple) and len(self.current) == 2: self.current[1].onDeselect(self.session) self.current = self.getCurrent() - if self.current: + if isinstance(self.current,tuple) and len(self.current) == 2: self.current[1].onSelect(self.session) - + else: + return for x in self.onSelectionChanged: x() @@ -75,11 +76,11 @@ class ConfigList(HTMLComponent, GUIComponent, object): instance.setContent(self.l) def preWidgetRemove(self, instance): - if self.current: + if isinstance(self.current,tuple) and len(self.current) == 2: self.current[1].onDeselect(self.session) instance.selectionChanged.get().remove(self.selectionChanged) instance.setContent(None) - + def setList(self, l): self.timer.stop() self.__list = l -- cgit v1.2.3 From 37d2d80ce2ebf47bd1a6d46a71dd90dd53065068 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 11 Jun 2010 23:05:36 +0200 Subject: don't crash on empty configlist lines --- lib/python/Components/ConfigList.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index ffbc69af..5a02c38d 100755 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -88,7 +88,7 @@ class ConfigList(HTMLComponent, GUIComponent, object): if l is not None: for x in l: - assert isinstance(x[1], ConfigElement), "entry in ConfigList " + str(x[1]) + " must be a ConfigElement" + assert isinstance(x, ConfigElement), "entry in ConfigList " + str(x) + " must be a ConfigElement" def getList(self): return self.__list -- cgit v1.2.3 From 8916a028519e706f6b7764839e1adc1d25eddac1 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 14 Jun 2010 12:59:12 +0200 Subject: fix-fix configlist assertion (add #188) --- lib/python/Components/ConfigList.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 5a02c38d..24f917f7 100755 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -88,7 +88,7 @@ class ConfigList(HTMLComponent, GUIComponent, object): if l is not None: for x in l: - assert isinstance(x, ConfigElement), "entry in ConfigList " + str(x) + " must be a ConfigElement" + assert len(x) < 2 or isinstance(x[1], ConfigElement), "entry in ConfigList " + str(x[1]) + " must be a ConfigElement" def getList(self): return self.__list -- cgit v1.2.3 From 626e2215066e3ed3efddb7edf12b41eda9d6ce50 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 6032ae6e6305ddb3c2d60581d0acb73793af0fc3 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 13 Aug 2010 22:03:26 +0200 Subject: introduce afterEventChangeable parameter --- lib/python/Screens/TaskView.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 0b5abcc0..78648602 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): + def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True, afterEventChangeable = True): from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean @@ -50,11 +50,15 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): shutdownString = _("shut down") 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.afterEventChangeable = afterEventChangeable self.setupList() self.state_changed() def setupList(self): - self["config"].setList( [ getConfigListEntry(_("After event"), self.settings.afterEvent) ]) + if self.afterEventChangeable: + self["config"].setList( [ getConfigListEntry(_("After event"), self.settings.afterEvent) ]) + else: + self["config"].hide() self.job.afterEvent = self.settings.afterEvent.getValue() def keyLeft(self): -- cgit v1.2.3 From 714ad2ad3ad21cebe0fe57400d462e4dcce8bb92 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 18 Aug 2010 17:06:05 +0200 Subject: TaskView: correctly pop-up aborted/failed notifications in foreground --- lib/python/Screens/TaskView.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/python') diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 78648602..660fb276 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -117,7 +117,7 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): self["config"].hide() if self.settings.afterEvent.getValue() == "nothing": return - elif self.settings.afterEvent.getValue() == "close": + elif self.settings.afterEvent.getValue() == "close" and self.job.status == self.job.FINISHED: self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.getValue() == "deepstandby": @@ -127,6 +127,12 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _("A sleep timer wants to set your\nDreambox to standby. Do that now?"), timeout = 20) + def checkNotifications(self): + InfoBarNotifications.checkNotifications(self) + if Notifications.notifications == []: + if self.settings.afterEvent.getValue() == "close" and self.job.status == self.job.FAILED: + self.close(False) + def sendStandbyNotification(self, answer): if answer: Notifications.AddNotification(Screens.Standby.Standby) -- cgit v1.2.3 From e4377b927b5fbbc01ff6f9e62b9ca5f7343d033f 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 a6b22e5c..6fa89112 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 910c0d916209bb6607b0def237b6c38e27906426 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 13 Aug 2010 22:00:08 +0200 Subject: show "nothing connected" instead of empty filelist with only mountpoints shown --- lib/python/Components/FileList.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/python') diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 841a2fe5..1d71514b 100755 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -196,6 +196,9 @@ class FileList(MenuList): if (self.matchingPattern is None) or re_compile(self.matchingPattern).search(path): self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False)) + if self.showMountpoints and len(self.list) == 0: + self.list.append(FileEntryComponent(name = _("nothing connected"), absolute = None, isDir = False)) + self.l.setList(self.list) if select is not None: -- cgit v1.2.3 From 8a1d65ce95fd4b583eec9cf65c9a0f5044008d79 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 8 Oct 2010 11:30:44 +0200 Subject: fix order and correct association of languages and audio stream files and set a limit of 8 (fixes bug #596) --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 14 ++++++++++++-- lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index b64541b6..e00dedd9 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -95,6 +95,8 @@ class DemuxTask(Task): self.relevantAudioPIDs = [ ] self.getRelevantAudioPIDs(title) self.generated_files = [ ] + self.mplex_audiofiles = { } + self.mplex_videofile = "" self.mplex_streamfiles = [ ] if len(self.cutlist) > 1: self.args += [ "-cut", self.cutfile ] @@ -132,8 +134,10 @@ class DemuxTask(Task): def haveNewFile(self, file): print "[DemuxTask] produced file:", file, self.currentPID self.generated_files.append(file) - if self.currentPID in self.relevantAudioPIDs or file.endswith("m2v"): - self.mplex_streamfiles.append(file) + if self.currentPID in self.relevantAudioPIDs: + self.mplex_audiofiles[self.currentPID] = file + elif file.endswith("m2v"): + self.mplex_videofile = file def haveProgress(self, progress): #print "PROGRESS [%s]" % progress @@ -167,6 +171,12 @@ class DemuxTask(Task): f.close() def cleanup(self, failed): + print "[DemuxTask::cleanup]" + self.mplex_streamfiles = [ self.mplex_videofile ] + for pid in self.relevantAudioPIDs: + self.mplex_streamfiles.append(self.mplex_audiofiles[pid]) + print self.mplex_streamfiles + if failed: import os for file in self.generated_files: diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py index a52fad9f..71a7f239 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py @@ -32,9 +32,9 @@ class TitleCutter(CutListEditor): pid = str(i.getPID()) if description == "MPEG": description = "MP2" - print "[audiotrack] pid:", pid, "description:", description, "language:", DVB_lang + print "[audiotrack] pid:", pid, "description:", description, "language:", DVB_lang, "count:", x, "active:", (x < 8) self.t.properties.audiotracks.append(ConfigSubsection()) - self.t.properties.audiotracks[-1].active = ConfigYesNo(default = True) + self.t.properties.audiotracks[-1].active = ConfigYesNo(default = (x < 8)) self.t.properties.audiotracks[-1].format = ConfigFixedText(description) self.t.properties.audiotracks[-1].language = ConfigSelection(choices = languageChoices.choices, default=languageChoices.getLanguage(DVB_lang)) self.t.properties.audiotracks[-1].pid = ConfigFixedText(pid) -- cgit v1.2.3