diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2009-03-31 15:51:31 +0200 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2009-03-31 15:51:31 +0200 |
| commit | bce53d4a67d1655a496eebe5912c8573e880114e (patch) | |
| tree | 9b410fbcaf0f4a22f1cf3489b635e3e94e47a6d8 /lib/python/Plugins | |
| parent | 166db5a9c9222c82939eede51d964c706039ebe8 (diff) | |
| parent | 54475ce18e43482b2ec1a150f7fa07c3464ec6d2 (diff) | |
| download | enigma2-bce53d4a67d1655a496eebe5912c8573e880114e.tar.gz enigma2-bce53d4a67d1655a496eebe5912c8573e880114e.zip | |
Merge commit 'origin/master' into tmbinc/FixTimingBugs
Diffstat (limited to 'lib/python/Plugins')
28 files changed, 1008 insertions, 184 deletions
diff --git a/lib/python/Plugins/Extensions/CutListEditor/keymap.xml b/lib/python/Plugins/Extensions/CutListEditor/keymap.xml index 741d9eb6..ae4fbb4b 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/keymap.xml +++ b/lib/python/Plugins/Extensions/CutListEditor/keymap.xml @@ -33,7 +33,7 @@ <map context="CutListEditorActions"> <!-- <key id="KEY_NEXT" mapto="setIn" flags="m" /> <key id="KEY_PREVIOUS" mapto="setOut" flags="m" /> --> - <key id="KEY_0" mapto="setMark" flags="m" /> +<!-- <key id="KEY_0" mapto="setMark" flags="m" /> --> <!-- <key id="KEY_CHANNELUP" mapto="addMark" flags="m" /> <key id="KEY_CHANNELDOWN" mapto="removeMark" flags="m" /> --> <key id="KEY_EXIT" mapto="leave" flags="m" /> diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index 1ef15a53..ed7cfb70 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -317,7 +317,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_ENDCUT: # remove in/out marks between the new cut for (where, what) in self.cut_list[:]: - if self.cut_start <= where <= self.context_position and what in [0,1]: + if self.cut_start <= where <= self.context_position and what in (0,1): self.cut_list.remove((where, what)) bisect.insort(self.cut_list, (self.cut_start, 1)) @@ -350,7 +350,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_REMOVEBEFORE: # remove in/out marks before current position for (where, what) in self.cut_list[:]: - if where <= self.context_position and what in [0,1]: + if where <= self.context_position and what in (0,1): self.cut_list.remove((where, what)) # add 'in' point bisect.insort(self.cut_list, (self.context_position, 0)) @@ -358,7 +358,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_REMOVEAFTER: # remove in/out marks after current position for (where, what) in self.cut_list[:]: - if where >= self.context_position and what in [0,1]: + if where >= self.context_position and what in (0,1): self.cut_list.remove((where, what)) # add 'out' point bisect.insort(self.cut_list, (self.context_position, 1)) diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index d0c9d3c6..6d9a4491 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -372,11 +372,11 @@ class CheckDiskspaceTask(Task): self.finish(aborted = True) def run(self, callback): + self.callback = callback failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if len(failed_preconditions): callback(self, failed_preconditions) return - self.callback = callback Task.processFinished(self, 0) class PreviewTask(Task): diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index 7407263d..a8888da3 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py +++ b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py @@ -18,11 +18,12 @@ class FileBrowser(Screen, HelpableScreen): <screen name="FileBrowser" position="100,100" size="520,376" title="DVD File Browser" > <widget name="filelist" position="0,0" size="520,376" scrollbarMode="showOnDemand" /> </screen>""" - def __init__(self, session, scope, settings): + def __init__(self, session, scope, configRef): Screen.__init__(self, session) HelpableScreen.__init__(self) self.scope = scope pattern = "" + self.configRef = configRef currDir = "/" if self.scope == "project": currDir = self.getDir() @@ -31,19 +32,19 @@ class FileBrowser(Screen, HelpableScreen): currDir = self.getDir() pattern = "(?i)^.*\.(ddvdm\.xml)" if self.scope == "menubg": - currDir = self.getDir(settings.menubg) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)" elif self.scope == "menuaudio": - currDir = self.getDir(settings.menuaudio) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(mp2|m2a|ac3)" elif self.scope == "vmgm": - currDir = self.getDir(settings.vmgm) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(mpg|mpeg)" elif self.scope == "font_face": - currDir = self.getDir(settings.font_face, resolveFilename(SCOPE_FONTS)) + currDir = self.getDir(configRef.getValue(), resolveFilename(SCOPE_FONTS)) pattern = "(?i)^.*\.(ttf)" elif self.scope == "isopath": - currDir = settings.isopath.getValue() + currDir = configRef.getValue() elif self.scope == "image": currDir = resolveFilename(SCOPE_HDD) pattern = "(?i)^.*\.(iso)" @@ -57,11 +58,9 @@ class FileBrowser(Screen, HelpableScreen): "cancel": self.exit }) - def getDir(self, key=None, defaultDir=None): - if key: - settingDir = key.getValue() - if len(settingDir) > 1: - return (settingDir.rstrip("/").rsplit("/",1))[0] + def getDir(self, currentVal=None, defaultDir=None): + if currentVal: + return (currentVal.rstrip("/").rsplit("/",1))[0] return defaultDir or (resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") def ok(self): @@ -70,15 +69,15 @@ class FileBrowser(Screen, HelpableScreen): if self.scope == "image": path = self["filelist"].getCurrentDirectory() or "" if fileExists(path+"VIDEO_TS"): - self.close(path,self.scope) + self.close(path,self.scope,self.configRef) else: ret = self["filelist"].getCurrentDirectory() + '/' + self["filelist"].getFilename() - self.close(ret,self.scope) + self.close(ret,self.scope,self.configRef) def exit(self): if self.scope == "isopath": - self.close(self["filelist"].getCurrentDirectory(),self.scope) - self.close(None,False) + self.close(self["filelist"].getCurrentDirectory(),self.scope,self.configRef) + self.close(None,False,None) class ProjectSettings(Screen,ConfigListScreen): skin = """ @@ -102,18 +101,21 @@ class ProjectSettings(Screen,ConfigListScreen): self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_yellow"] = StaticText(_("Load")) - self["key_blue"] = StaticText(_("Save")) + if config.usage.setup_level.index >= 2: # expert+ + self["key_blue"] = StaticText(_("Save")) + else: + self["key_blue"] = StaticText() - infotext = _("Available format variables") + ":\n$i=" + _("Track") + ", $t=" + _("Title") + ", $d=" + _("Description") + ", $l=" + _("length") + ", $c=" + _("chapters") + ",\n" + _("Record") + " $T=" + _("Begin time") + ", $Y=" + _("Year") + ", $M=" + _("month") + ", $D=" + _("day") + ",\n$A=" + _("audio tracks") + ", $C=" + _("Channel") + ", $f=" + _("filename") + if config.usage.setup_level.index >= 2: # expert+ + infotext = _("Available format variables") + ":\n$i=" + _("Track") + ", $t=" + _("Title") + ", $d=" + _("Description") + ", $l=" + _("length") + ", $c=" + _("chapters") + ",\n" + _("Record") + " $T=" + _("Begin time") + ", $Y=" + _("Year") + ", $M=" + _("month") + ", $D=" + _("day") + ",\n$A=" + _("audio tracks") + ", $C=" + _("Channel") + ", $f=" + _("filename") + else: + infotext = "" self["info"] = StaticText(infotext) + self.keydict = {} self.settings = project.settings ConfigListScreen.__init__(self, []) self.initConfigList() - - self.keydict = {} - for key, val in self.settings.dict().iteritems(): - self.keydict[val] = key self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], { @@ -141,9 +143,10 @@ class ProjectSettings(Screen,ConfigListScreen): self.list.append(getConfigListEntry(_("ISO path"), self.settings.isopath)) if authormode.startswith("menu"): self.list.append(getConfigListEntry(_("Menu")+' '+_("template file"), self.settings.menutemplate)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("Title"), self.project.menutemplate.settings.titleformat)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("Subtitles"), self.project.menutemplate.settings.subtitleformat)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("background image"), self.project.menutemplate.settings.menubg)) + if config.usage.setup_level.index >= 2: # expert+ + self.list.append(getConfigListEntry(_("Menu")+' '+_("Title"), self.project.menutemplate.settings.titleformat)) + self.list.append(getConfigListEntry(_("Menu")+' '+_("Subtitles"), self.project.menutemplate.settings.subtitleformat)) + self.list.append(getConfigListEntry(_("Menu")+' '+_("background image"), self.project.menutemplate.settings.menubg)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("headline")+' '+_("color"), self.settings.color_headline)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("text")+' '+_("color"), self.settings.color_button)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("highlighted button")+' '+_("color"), self.settings.color_highlight)) @@ -151,14 +154,20 @@ class ProjectSettings(Screen,ConfigListScreen): #self.list.append(getConfigListEntry(_("Font size")+' ('+_("headline")+', '+_("Title")+', '+_("Subtitles")+')', self.settings.font_size)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("spaces (top, between rows, left)"), self.settings.space)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("Audio"), self.settings.menuaudio)) - if authormode != "data_ts": - self.list.append(getConfigListEntry(_("Titleset mode"), self.settings.titlesetmode)) - if self.settings.titlesetmode.getValue() == "single" or authormode == "just_linked": - self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm)) - else: - self.list.append(getConfigListEntry(("DVD data format"), self.settings.dataformat)) + if config.usage.setup_level.index >= 2: # expert+ + if authormode != "data_ts": + self.list.append(getConfigListEntry(_("Titleset mode"), self.settings.titlesetmode)) + if self.settings.titlesetmode.getValue() == "single" or authormode == "just_linked": + self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm)) + else: + self.list.append(getConfigListEntry(("DVD data format"), self.settings.dataformat)) self["config"].setList(self.list) + self.keydict = {} + for key, val in self.settings.dict().iteritems(): + self.keydict[val] = key + for key, val in self.project.menutemplate.settings.dict().iteritems(): + self.keydict[val] = key def keyLeft(self): ConfigListScreen.keyLeft(self) @@ -182,8 +191,9 @@ class ProjectSettings(Screen,ConfigListScreen): def ok(self): key = self.keydict[self["config"].getCurrent()[1]] - if key in self.project.filekeys: - self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, key, self.settings) + from DVDProject import ConfigFilename + if type(self["config"].getCurrent()[1]) == ConfigFilename: + self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, key, self["config"].getCurrent()[1]) def cancel(self): self.close(False) @@ -192,26 +202,30 @@ class ProjectSettings(Screen,ConfigListScreen): self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, "project", self.settings) def saveProject(self): - self.applySettings() - ret = self.project.saveProject(resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") - if ret.startswith: - text = _("Save")+' '+_('OK')+':\n'+ret - self.session.open(MessageBox,text,type = MessageBox.TYPE_INFO) - else: - text = _("Save")+' '+_('Error') - self.session.open(MessageBox,text,type = MessageBox.TYPE_ERROR) + if config.usage.setup_level.index >= 2: # expert+ + self.applySettings() + ret = self.project.saveProject(resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") + if ret.startswith: + text = _("Save")+' '+_('OK')+':\n'+ret + self.session.open(MessageBox,text,type = MessageBox.TYPE_INFO) + else: + text = _("Save")+' '+_('Error') + self.session.open(MessageBox,text,type = MessageBox.TYPE_ERROR) - def FileBrowserClosed(self, path, scope): + def FileBrowserClosed(self, path, scope, configRef): if scope == "menutemplate": - if not self.project.menutemplate.loadTemplate(path): - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) - else: + if self.project.menutemplate.loadTemplate(path): print "[ProjectSettings] menu template loaded" - - if scope in self.project.filekeys: - self.settings.dict()[scope].setValue(path) - elif scope == "project": - if not self.project.loadProject(path): - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + configRef.setValue(path) + self.initConfigList() else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + elif scope == "project": + if self.project.loadProject(path): + configRef.setValue(path) self.initConfigList() + else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + elif scope: + configRef.setValue(path) + self.initConfigList() diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 749f80eb..fd4c7134 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -44,7 +44,7 @@ class TitleList(Screen, HelpableScreen): "titleProperties": (self.titleProperties, _("Properties of current title"), _("Title properties")), "removeCurrentTitle": (self.removeCurrentTitle, _("Remove currently selected title"), _("Remove title")), "settings": (self.settings, _("Collection settings"), _("Settings")), - "burnProject": (self.burnProject, _("Burn DVD"), _("Burn DVD")), + "burnProject": (self.askBurnProject, _("Burn DVD"), _("Burn DVD")), }) self["MovieSelectionActions"] = HelpableActionMap(self, "MovieSelectionActions", @@ -57,9 +57,9 @@ class TitleList(Screen, HelpableScreen): "cancel": self.leave }) - self["key_red"] = StaticText(_("Remove title")) + self["key_red"] = StaticText() self["key_green"] = StaticText(_("Add title")) - self["key_yellow"] = StaticText(_("Title properties")) + self["key_yellow"] = StaticText() self["key_blue"] = StaticText(_("Settings")) self["title_label"] = StaticText() @@ -74,6 +74,7 @@ class TitleList(Screen, HelpableScreen): self["titles"] = List(list = [ ], enableWrapAround = True, item_height=30, fonts = [gFont("Regular", 20)]) self.updateTitleList() + self.previous_size = 0 def checkBackgroundJobs(self): for job in job_manager.getPendingJobs(): @@ -90,19 +91,16 @@ class TitleList(Screen, HelpableScreen): if self.backgroundJob: 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": - menu.append((_("Burn DVD"), self.burnProject)) + 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((_("DVD media toolbox"), self.toolbox)) - menu.append((_("Preview menu"), self.previewMenu)) - menu.append((_("Collection settings"), self.settings)) - menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Edit chapters of current title"), self.editTitle)) - menu.append((_("Properties of current title"), self.titleProperties)) - menu.append((_("Add a new title"), self.addTitle)) - menu.append((_("Remove title"), self.removeCurrentTitle)) + menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Exit"), self.leave)) self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu) @@ -199,7 +197,13 @@ class TitleList(Screen, HelpableScreen): self["error_label"].show() return False - def burnProject(self): + def askBurnProject(self): + if len(self["titles"].list): + self.session.openWithCallback(self.burnProject,MessageBox,text = _("Do you want to burn this collection to DVD medium?"), type = MessageBox.TYPE_YESNO) + + def burnProject(self, answer=True): + if not answer: + return if self.project.settings.authormode.getValue() == "data_ts": job = Process.DVDdataJob(self.project) job_manager.AddJob(job) @@ -211,7 +215,7 @@ class TitleList(Screen, HelpableScreen): job_manager.in_background = False self.session.openWithCallback(self.JobViewCB, JobView, job) - def burnISO(self, path, scope): + def burnISO(self, path, scope, configRef): if path: job = Process.DVDisoJob(self.project, path) job_manager.AddJob(job) @@ -235,6 +239,12 @@ class TitleList(Screen, HelpableScreen): totalsize += title.estimatedDiskspace self["titles"].list = res self.updateSize(totalsize) + if len(res): + self["key_red"].text = _("Remove title") + self["key_yellow"].text = _("Title properties") + else: + self["key_red"].text = "" + self["key_yellow"].text = "" def updateSize(self, totalsize): size = int((totalsize/1024)/1024) @@ -244,14 +254,19 @@ class TitleList(Screen, HelpableScreen): 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) + 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) + 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) 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.previous_size = size def getCurrentTitle(self): t = self["titles"].getCurrent() diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index 63ae6c1f..1c2099fb 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -72,19 +72,19 @@ class TitleProperties(Screen,ConfigListScreen): self.list.append(getConfigListEntry("DVD " + _("Track"), self.properties.position)) self.list.append(getConfigListEntry("DVD " + _("Title"), self.properties.menutitle)) self.list.append(getConfigListEntry("DVD " + _("Description"), self.properties.menusubtitle)) - for audiotrack in self.properties.audiotracks: - DVB_aud = audiotrack.DVB_lang.getValue() or audiotrack.pid.getValue() - self.list.append(getConfigListEntry(_("burn audio track (%s)") % DVB_aud, audiotrack.active)) - if audiotrack.active.getValue(): - self.list.append(getConfigListEntry(_("audio track (%s) format") % DVB_aud, audiotrack.format)) - self.list.append(getConfigListEntry(_("audio track (%s) language") % DVB_aud, audiotrack.language)) - - self.list.append(getConfigListEntry("DVD " + _("Aspect Ratio"), self.properties.aspect)) - if self.properties.aspect.getValue() == "16:9": - self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.widescreen)) - else: - self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.crop)) - + if config.usage.setup_level.index >= 2: # expert+ + for audiotrack in self.properties.audiotracks: + DVB_aud = audiotrack.DVB_lang.getValue() or audiotrack.pid.getValue() + self.list.append(getConfigListEntry(_("burn audio track (%s)") % DVB_aud, audiotrack.active)) + if audiotrack.active.getValue(): + self.list.append(getConfigListEntry(_("audio track (%s) format") % DVB_aud, audiotrack.format)) + self.list.append(getConfigListEntry(_("audio track (%s) language") % DVB_aud, audiotrack.language)) + + self.list.append(getConfigListEntry("DVD " + _("Aspect Ratio"), self.properties.aspect)) + if self.properties.aspect.getValue() == "16:9": + self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.widescreen)) + else: + self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.crop)) if len(title.chaptermarks) == 0: self.list.append(getConfigListEntry(_("Auto chapter split every ? minutes (0=never)"), self.properties.autochapter)) infotext = "DVB " + _("Title") + ': ' + title.DVBname + "\n" + _("Description") + ': ' + title.DVBdescr + "\n" + _("Channel") + ': ' + title.DVBchannel + '\n' + _("Begin time") + title.formatDVDmenuText(": $D.$M.$Y, $T\n", self.title_idx+1) @@ -154,7 +154,7 @@ class LanguageChoices(): if len(key) == 2: self.langdict[key] = val[0] for key, val in self.langdict.iteritems(): - if key not in [syslang, 'en']: + if key not in (syslang, 'en'): self.langdict[key] = val self.choices.append((key, val)) self.choices.sort() @@ -164,8 +164,7 @@ class LanguageChoices(): def getLanguage(self, DVB_lang): DVB_lang = DVB_lang.lower() - stripwords = ["stereo", "audio", "description", "2ch", "dolby digital"] - for word in stripwords: + for word in ("stereo", "audio", "description", "2ch", "dolby digital"): DVB_lang = DVB_lang.replace(word,"").strip() for key, val in LanguageCodes.iteritems(): if DVB_lang.find(key.lower()) == 0: @@ -183,4 +182,4 @@ class LanguageChoices(): return key return "nolang" -languageChoices = LanguageChoices()
\ No newline at end of file +languageChoices = LanguageChoices() diff --git a/lib/python/Plugins/Extensions/DVDBurn/plugin.py b/lib/python/Plugins/Extensions/DVDBurn/plugin.py index 29076cea..45f438da 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/plugin.py +++ b/lib/python/Plugins/Extensions/DVDBurn/plugin.py @@ -12,5 +12,6 @@ def main_add(session, service, **kwargs): dvdburn.selectedSource(service) def Plugins(**kwargs): - return [PluginDescriptor(name="DVD Burn", description=_("Burn to DVD..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc=main_add, icon="dvdburn.png"), - PluginDescriptor(name="DVD Burn", description=_("Burn to DVD..."), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="dvdburn.png") ] + 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/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 8e2a9f3a..ebcf4f81 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -14,6 +14,7 @@ from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.config import config from Tools.Directories import pathExists, fileExists from Components.Harddisk import harddiskmanager +from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier import servicedvd # load c++ part of dvd player plugin @@ -345,28 +346,15 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP }) self.onClose.append(self.__onClose) - self.physicalDVD = False - self.dvd_device = None + hotplugNotifier.append(self.hotplugCB) + if dvd_device: - self.dvd_device = dvd_device - self.physicalDVD = True + self.physicalDVD = True else: - devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) - if pathExists(devicepath): - from Components.Scanner import scanDevice - res = scanDevice(devicepath) - list = [ (r.description, r, res[r], self.session) for r in res ] - if list: - (desc, scanner, files, session) = list[0] - for file in files: - print file - if file.mimetype == "video/x-dvd": - self.dvd_device = devicepath - print "physical dvd found:", self.dvd_device - self.physicalDVD = True + self.scanHotplug() self.dvd_filelist = dvd_filelist - self.onFirstExecBegin.append(self.showFileBrowser) + self.onFirstExecBegin.append(self.opened) self.service = None self.in_menu = False @@ -511,8 +499,10 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def askLeavePlayer(self): choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] - if not self.physicalDVD: + if True or not self.physicalDVD: choices.insert(1,(_("Return to file browser"), "browser")) + if self.physicalDVD and not self.session.nav.getCurrentlyPlayingServiceReference().toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): + choices.insert(0,(_("Play DVD"), "playPhysical" )) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) def sendKey(self, key): @@ -581,23 +571,22 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def keyCancel(self): self.askLeavePlayer() - def showFileBrowser(self): - if self.physicalDVD and len(self.dvd_filelist) == 0: - if self.dvd_device == harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()): - self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 ) - else: - self.DVDdriveCB(True) - elif len(self.dvd_filelist) == 1: + def opened(self): + if len(self.dvd_filelist) == 1: + # opened via autoplay self.FileBrowserClosed(self.dvd_filelist[0]) + elif self.physicalDVD: + # opened from menu with dvd in drive + self.session.openWithCallback(self.playPhysicalCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 ) else: + # opened from menu without dvd in drive self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, self.dvd_filelist) - - def DVDdriveCB(self, answer): + + def playPhysicalCB(self, answer): if answer == True: - self.FileBrowserClosed(self.dvd_device) + self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())) else: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser) - self.physicalDVD = False def FileBrowserClosed(self, val): curref = self.session.nav.getCurrentlyPlayingServiceReference() @@ -627,13 +616,18 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP #else if self.service: self.service = None - self.showFileBrowser() + self.session.openWithCallback(self.FileBrowserClosed, FileBrowser) + if answer[1] == "playPhysical": + if self.service: + self.service = None + self.playPhysicalCB(True) else: pass def __onClose(self): self.restore_infobar_seek_config() self.session.nav.playService(self.oldService) + hotplugNotifier.remove(self.hotplugCB) def playLastCB(self, answer): # overwrite infobar cuesheet function print "playLastCB", answer, self.resume_point @@ -660,6 +654,30 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def calcRemainingTime(self): return 0 + def hotplugCB(self, dev, media_state): + print "[hotplugCB]", dev, media_state + if dev == harddiskmanager.getCD(): + if media_state == "1": + self.scanHotplug() + else: + self.physicalDVD = False + + def scanHotplug(self): + devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) + if pathExists(devicepath): + from Components.Scanner import scanDevice + res = scanDevice(devicepath) + list = [ (r.description, r, res[r], self.session) for r in res ] + if list: + (desc, scanner, files, session) = list[0] + for file in files: + print file + if file.mimetype == "video/x-dvd": + print "physical dvd found:", devicepath + self.physicalDVD = True + return + self.physicalDVD = False + def main(session, **kwargs): session.open(DVDPlayer) @@ -705,7 +723,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "DVD", - description = "Play DVD", + description = _("Play DVD"), openfnc = filescan_open, )] diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index c2590af5..e35f2807 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -103,7 +103,10 @@ eServiceDVD::eServiceDVD(const char *filename): // create handle ddvd_set_dvd_path(m_ddvdconfig, filename); ddvd_set_ac3thru(m_ddvdconfig, 0); - ddvd_set_language(m_ddvdconfig, "de"); + + std::string ddvd_language; + if (!ePythonConfigQuery::getConfigValue("config.osd.language", ddvd_language)) + ddvd_set_language(m_ddvdconfig, (ddvd_language.substr(0,2)).c_str()); int fd = open("/proc/stb/video/aspect", O_RDONLY); if (fd > -1) diff --git a/lib/python/Plugins/Extensions/FileManager/plugin.py b/lib/python/Plugins/Extensions/FileManager/plugin.py index 12389813..62c9e7b2 100644 --- a/lib/python/Plugins/Extensions/FileManager/plugin.py +++ b/lib/python/Plugins/Extensions/FileManager/plugin.py @@ -59,5 +59,6 @@ def main(session, **kwargs): session.open(FileManager) def Plugins(**kwargs): - return [PluginDescriptor(name="File-Manager", description="Lets you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), - PluginDescriptor(name="File-Manager", description="Lets you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)] + descr = _("Lets you view/edit files in your Dreambox") + return [PluginDescriptor(name="File-Manager", description=descr, where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), + PluginDescriptor(name="File-Manager", description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)] diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 3e023841..e8504ff0 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -148,7 +148,6 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.player.show() return NumberActionMap.action(self, contexts, action) - self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", { "ok": (self.ok, _("add file to playlist")), @@ -224,7 +223,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { iPlayableService.evUpdatedInfo: self.__evUpdatedInfo, - iPlayableService.evUser+11: self.__evDecodeError, + iPlayableService.evUser+10: self.__evAudioDecodeError, + iPlayableService.evUser+11: self.__evVideoDecodeError, iPlayableService.evUser+12: self.__evPluginError, iPlayableService.evUser+13: self["coverArt"].embeddedCoverArt }) @@ -268,11 +268,17 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB print "[__evUpdatedInfo] title %d of %d (%s)" % (currenttitle, totaltitles, sTitle) self.readTitleInformation() - def __evDecodeError(self): + def __evAudioDecodeError(self): + currPlay = self.session.nav.getCurrentService() + sAudioType = currPlay.info().getInfoString(iServiceInformation.sUser+10) + print "[__evAudioDecodeError] audio-codec %s can't be decoded by hardware" % (sAudioType) + self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sAudioType, type = MessageBox.TYPE_INFO,timeout = 20 ) + + def __evVideoDecodeError(self): currPlay = self.session.nav.getCurrentService() sVideoType = currPlay.info().getInfoString(iServiceInformation.sVideoType) - print "[__evDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType) - self.session.open(MessageBox, _("This Dreambox can't decode %s video streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 ) + print "[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType) + self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 ) def __evPluginError(self): currPlay = self.session.nav.getCurrentService() @@ -379,7 +385,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.updateCurrentInfo() def showAfterSeek(self): - self.show() + pass def showAfterCuesheetOperation(self): self.show() @@ -984,7 +990,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Movie", - description = "View Movies...", + description = _("View Movies..."), openfnc = filescan_open, ), Scanner(mimetypes = ["video/x-vcd"], @@ -994,7 +1000,7 @@ def filescan(**kwargs): ScanPath(path = "MPEGAV", with_subdirs = False), ], name = "Video CD", - description = "View Video CD...", + description = _("View Video CD..."), openfnc = filescan_open, ), Scanner(mimetypes = ["audio/mpeg", "audio/x-wav", "application/ogg", "audio/x-flac"], @@ -1003,7 +1009,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Music", - description = "Play Music...", + description = _("Play Music..."), openfnc = filescan_open, )] try: @@ -1015,7 +1021,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Audio-CD", - description = "Play Audio-CD...", + description = _("Play Audio-CD..."), openfnc = audioCD_open, )) return mediatypes diff --git a/lib/python/Plugins/Extensions/MediaScanner/plugin.py b/lib/python/Plugins/Extensions/MediaScanner/plugin.py index 2c31197d..0cefa353 100755 --- a/lib/python/Plugins/Extensions/MediaScanner/plugin.py +++ b/lib/python/Plugins/Extensions/MediaScanner/plugin.py @@ -23,16 +23,16 @@ def mountpoint_choosen(option): list = [ (r.description, r, res[r], session) for r in res ] - if list == [ ]: + if not list: from Screens.MessageBox import MessageBox if access(mountpoint, F_OK|R_OK): - session.open(MessageBox, "No displayable files on this medium found!", MessageBox.TYPE_ERROR) + session.open(MessageBox, _("No displayable files on this medium found!"), MessageBox.TYPE_ERROR) else: print "ignore", mountpoint, "because its not accessible" return session.openWithCallback(execute, ChoiceBox, - title = "The following files were found...", + title = _("The following files were found..."), list = list) def scan(session): @@ -41,7 +41,7 @@ def scan(session): from Components.Harddisk import harddiskmanager parts = [ (r.description, r.mountpoint, session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)] - if len(parts): + if parts: for x in parts: if not access(x[1], F_OK|R_OK): parts.remove(x) @@ -91,7 +91,7 @@ def autostart(reason, **kwargs): def Plugins(**kwargs): return [ - PluginDescriptor(name="MediaScanner", description="Scan Files...", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), + PluginDescriptor(name="MediaScanner", description=_("Scan Files..."), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), # PluginDescriptor(where = PluginDescriptor.WHERE_MENU, fnc=menuHook), PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart), PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index 05adb633..10e4e514 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -586,7 +586,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Pictures", - description = "View Photos...", + description = _("View Photos..."), openfnc = filescan_open, ) diff --git a/lib/python/Plugins/Extensions/SocketMMI/plugin.py b/lib/python/Plugins/Extensions/SocketMMI/plugin.py index 4eadf2ea..387c8306 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/plugin.py +++ b/lib/python/Plugins/Extensions/SocketMMI/plugin.py @@ -22,6 +22,6 @@ def autostart(reason, **kwargs): socketHandler = SocketMMIMessageHandler() def Plugins(**kwargs): - return [ PluginDescriptor(name = "SocketMMI", description = "Python frontend for /tmp/mmi.socket", where = PluginDescriptor.WHERE_MENU, fnc = menu), + return [ PluginDescriptor(name = "SocketMMI", description = _("Python frontend for /tmp/mmi.socket"), where = PluginDescriptor.WHERE_MENU, fnc = menu), PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart), PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) ] diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index 53e7b0b8..d7fc6898 100644..100755 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -49,6 +49,9 @@ class PluginDescriptor: # or return a function which is called with session and the interface name for extended setup of this interface WHERE_EVENTINFO = 11 + # reason (True: Networkconfig read finished, False: Networkconfig reload initiated ) + WHERE_NETWORKCONFIG_READ = 12 + def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False): self.name = name self.internal = internal diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE new file mode 100644 index 00000000..99700593 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/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/CommonInterfaceAssignment/Makefile.am b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am new file mode 100644 index 00000000..562b1491 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am @@ -0,0 +1,6 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/CommonInterfaceAssignment + +install_PYTHON = \ + __init__.py \ + plugin.py + diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py new file mode 100644 index 00000000..4c8167d4 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py @@ -0,0 +1,630 @@ +from Screens.Screen import Screen +from Screens.ChannelSelection import * +from Components.ActionMap import HelpableActionMap, ActionMap, NumberActionMap +from Components.Sources.List import List +from Components.Sources.StaticText import StaticText +from Components.config import ConfigNothing +from Components.ConfigList import ConfigList +from Components.Label import Label +from Components.SelectionList import SelectionList +from Components.MenuList import MenuList +from ServiceReference import ServiceReference +from Plugins.Plugin import PluginDescriptor +from xml.etree.cElementTree import parse as ci_parse +from Tools.XMLTools import elementsWithTag, mergeText, stringToXML +from enigma import eDVBCI_UI, eDVBCIInterfaces + +from os import system, path as os_path + +class CIselectMainMenu(Screen): + skin = """ + <screen position="205,150" size="310,270" title="CI Assignment" > + <widget name="CiList" position="10,10" size="290,200" scrollbarMode="showOnDemand" /> + <ePixmap position="10,210" size="290,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,220" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,220" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,220" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,220" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, args = 0): + self.skin = CIselectMainMenu.skin + Screen.__init__(self, session) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Config")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "ok": self.greenPressed, + "cancel": self.cancel + }, -1) + + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + + print "[CI_Wizzard] FOUND %d CI Slots " % NUM_CI + + self.dlg = None + self.state = { } + self.list = [ ] + if NUM_CI > 0: + for slot in range(NUM_CI): + state = eDVBCI_UI.getInstance().getState(slot) + if state == 0: + appname = _("Slot %d") %(slot+1) + " - " + _("no module") + elif state == 1: + appname = _("Slot %d") %(slot+1) + " - " + _("init modules") + elif state == 2: + appname = _("Slot %d") %(slot+1) + " - " + eDVBCI_UI.getInstance().getAppName(slot) + self.list.append( (appname, ConfigNothing(), 0, slot) ) + else: + self.list.append( (_("no CI slots found") , ConfigNothing(), 1, -1) ) + + menuList = ConfigList(self.list) + menuList.list = self.list + menuList.l.setList(self.list) + self["CiList"] = menuList + + def greenPressed(self): + cur = self["CiList"].getCurrent() + if cur and len(cur) > 2: + action = cur[2] + slot = cur[3] + if action == 1: + print "[CI_Wizzard] there is no CI Slot in your receiver" + else: + print "[CI_Wizzard] selected CI Slot : %d" % slot + if config.usage.setup_level.index > 1: # advanced + self.session.open(CIconfigMenu, slot) + else: + self.session.open(easyCIconfigMenu, slot) + + def yellowPressed(self): + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + print "[CI_Check] FOUND %d CI Slots " % NUM_CI + if NUM_CI > 0: + for ci in range(NUM_CI): + print eDVBCIInterfaces.getInstance().getDescrambleRules(ci) +# else: +# print "no ci found" + + def redPressed(self): + print "[CI_Config] RED BUTTON not implemented yet - only use self.cancel()" + self.cancel() + + def cancel(self): + self.close() + +class CIconfigMenu(Screen): + skin = """ + <screen position="60,80" size="595,436" title="CI Assignment" > + <widget name="CAidList.desc" position="10,10" size="575,22" font="Regular;20" /> + <widget name="CAidList" position="10,40" size="575,45" font="Regular;20" /> + <widget name="ServiceList.desc" position="10,90" size="575,22" font="Regular;20" /> + <widget name="ServiceList" position="10,120" size="575,250" scrollbarMode="showOnDemand" /> + <ePixmap position="10,380" size="575,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="155,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="300,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="445,390" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="155,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_yellow" render="Label" position="300,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_blue" render="Label" position="445,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, ci_slot="9"): + self.skin = CIconfigMenu.skin + Screen.__init__(self, session) + self.ci_slot=ci_slot + self.filename="/etc/enigma2/ci"+str(self.ci_slot)+".xml" + + self["key_red"] = StaticText(_("delete")) + self["key_green"] = StaticText(_("add Service")) + self["key_yellow"] = StaticText(_("add Provider")) + self["key_blue"] = StaticText(_("select CAId")) + self["CAidList.desc"] = Label(_("assigned CAIds")) + self["ServiceList.desc"] = Label(_("assigned Services/Provider")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "blue": self.bluePressed, + "ok": self.okPressed, + "cancel": self.cancel + }, -1) + + print "[CI_Wizzard_Config] Configuring CI Slots : %d " % self.ci_slot + + i=0 + self.caidlist=[] + print eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot) + for caid in eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot): + i+=1 + self.caidlist.append((str(hex(int(caid))),str(caid),i)) + + print "[CI_Wizzard_Config_CI%d] read following CAIds from CI: %s" %(self.ci_slot, self.caidlist) + self.selectedcaid =[] + self.servicelist = [] + self.caids=_("no CAId selected") + self["CAidList"] = Label(self.caids) + + serviceList = ConfigList(self.servicelist) + serviceList.list = self.servicelist + serviceList.l.setList(self.servicelist) + self["ServiceList"] = serviceList + + self.loadXML() + # if config mode !=advanced autoselect any caid + if config.usage.setup_level.index <= 1: # advanced + self.selectedcaid=self.caidlist + + def redPressed(self): + self.delete() + + def greenPressed(self): + self.session.openWithCallback( self.finishedChannelSelection, myChannelSelection, None) + + def yellowPressed(self): + self.session.openWithCallback( self.finishedProviderSelection, myProviderSelection, None) + + def bluePressed(self): + self.session.openWithCallback(self.finishedCAidSelection, CAidSelect, self.caidlist, self.selectedcaid) + + def okPressed(self): + print "[CI_Config_CI%d] OK BUTTON not implemented yet" %self.ci_slot + + def cancel(self): + self.saveXML() + activate_all(self) + self.close() + + def delete(self): + cur = self["ServiceList"].getCurrent() + if cur and len(cur) > 2: + self.servicelist.remove(cur) + self["ServiceList"].l.setList(self.servicelist) + + def finishedChannelSelection(self, *args): + if len(args): + ref=args[0] + service_ref = ServiceReference(ref) + service_name = service_ref.getServiceName() + if find_in_list(self.servicelist, service_name, 0)==False: + split_ref=service_ref.ref.toString().split(":") + if split_ref[0] == "1": #== dvb service und nicht muell von None + self.servicelist.append( (service_name , ConfigNothing(), 0, service_ref.ref.toString()) ) + self["ServiceList"].l.setList(self.servicelist) + + def finishedProviderSelection(self, *args): + if len(args)>1: # bei nix selected kommt nur 1 arg zurueck (==None) + name=args[0] + dvbnamespace=args[1] + if find_in_list(self.servicelist, name, 0)==False: + self.servicelist.append( (name , ConfigNothing(), 1, dvbnamespace) ) + self["ServiceList"].l.setList(self.servicelist) + + def finishedCAidSelection(self, *args): + if len(args): + self.selectedcaid=args[0] + self.caids="" + for item in self.selectedcaid: + if len(self.caids): + self.caids+= ", " + item[0] + else: + self.caids=item[0] + else: + self.selectedcaid=[] + self.caids=_("no CAId selected") + self["CAidList"].setText(self.caids) + + def saveXML(self): + try: + fp = file(self.filename, 'w') + fp.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n") + fp.write("<ci>\n") + fp.write("\t<slot>\n") + fp.write("\t\t<id>%s</id>\n" % self.ci_slot) + for item in self.selectedcaid: + if len(self.selectedcaid): + fp.write("\t\t<caid id=\"%s\" />\n" % item[0]) + for item in self.servicelist: + if len(self.servicelist): + if item[2]==1: + fp.write("\t\t<provider name=\"%s\" dvbnamespace=\"%s\" />\n" % (item[0], item[3])) + else: + fp.write("\t\t<service name=\"%s\" ref=\"%s\" />\n" % (item[0], item[3])) + fp.write("\t</slot>\n") + fp.write("</ci>\n") + fp.close() + except: + print "[CI_Config_CI%d] xml not written" %self.ci_slot + os.unlink(self.filename) + + def loadXML(self): + if not os_path.exists(self.filename): + return + + def getValue(definitions, default): + ret = "" + Len = len(definitions) + return Len > 0 and definitions[Len-1].text or default + + try: + tree = ci_parse(self.filename).getroot() + self.read_services=[] + self.read_providers=[] + self.usingcaid=[] + self.ci_config=[] +# for ci in tree.findall("ci"): + for slot in tree.findall("slot"): + read_slot = getValue(slot.findall("id"), False).encode("UTF-8") + print "ci " + read_slot + + i=0 + for caid in slot.findall("caid"): + read_caid = caid.get("id").encode("UTF-8") + self.selectedcaid.append((str(read_caid),str(read_caid),i)) + self.usingcaid.append(long(read_caid,16)) + i+=1 + + for service in slot.findall("service"): + read_service_name = service.get("name").encode("UTF-8") + read_service_ref = service.get("ref").encode("UTF-8") + self.read_services.append (read_service_ref) + + for provider in slot.findall("provider"): + read_provider_name = provider.get("name").encode("UTF-8") + read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8") + self.read_providers.append((read_provider_name,read_provider_dvbname)) + + self.ci_config.append((int(read_slot), (self.read_services, self.read_providers, self.usingcaid))) + except: + print "[CI_Config_CI%d] error parsing xml..." %self.ci_slot + + for item in self.read_services: + if len(item): + self.finishedChannelSelection(item) + + for item in self.read_providers: + if len(item): + self.finishedProviderSelection(item[0],item[1]) + + print self.ci_config + self.finishedCAidSelection(self.selectedcaid) + self["ServiceList"].l.setList(self.servicelist) + +class easyCIconfigMenu(CIconfigMenu): + skin = """ + <screen position="80,80" size="470,420" title="CI Assignment" > + <widget name="ServiceList.desc" position="10,10" size="420,22" font="Regular;20" /> + <widget name="ServiceList" position="10,40" size="450,340" scrollbarMode="showOnDemand" /> + <ePixmap position="10,360" size="450,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,370" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,370" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="310,370" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_yellow" render="Label" position="310,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, ci_slot="9"): + ci=ci_slot + CIconfigMenu.__init__(self, session, ci_slot) + self.skin = easyCIconfigMenu.skin + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "blue": self.bluePressed, + "ok": self.okPressed, + "cancel": self.cancel + }, -1) + + def bluePressed(self): + print "do nothing" + +class CAidSelect(Screen): + skin = """ + <screen position="210,140" size="310,290" title="select CAId's" > + <widget name="list" position="10,10" size="290,210" scrollbarMode="showOnDemand" /> + <ePixmap position="10,230" size="290,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,240" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,240" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,240" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,240" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, list, selected_caids): + self.skin = CAidSelect.skin + Screen.__init__(self, session) + + self.list = SelectionList() + self["list"] = self.list + + for listindex in range(len(list)): + if find_in_list(selected_caids,list[listindex][0],0): + self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True) + else: + self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "ok": self.list.toggleSelection, + "cancel": self.cancel, + "green": self.greenPressed, + "red": self.cancel + }, -1) + + def greenPressed(self): + list = self.list.getSelectionsList() + print list + self.close(list) + + def cancel(self): + self.close() + +class myProviderSelection(ChannelSelectionBase): + skin = """ + <screen position="80,80" size="560,430" title="Select provider to add..."> + <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" /> + <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> + <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" /> + <widget name="list" position="00,45" size="560,364" scrollbarMode="showOnDemand" /> + </screen>""" + + def __init__(self, session, title): + ChannelSelectionBase.__init__(self, session) + self.onShown.append(self.__onExecCallback) + + self["actions"] = ActionMap(["OkCancelActions", "ChannelSelectBaseActions"], + { + "showFavourites": self.doNothing, + "showAllServices": self.doNothing, + "showProviders": self.doNothing, + "showSatellites": self.doNothing, + "cancel": self.cancel, + "ok": self.channelSelected, + }) + self["key_red"] = StaticText(_("")) + self["key_green"] = StaticText(_("")) + self["key_yellow"] = StaticText(_("")) + self["key_blue"] = StaticText(_("")) + + def doNothing(self): + print "nothing to do..." + + def __onExecCallback(self): + self.showSatellites() + + def channelSelected(self): # just return selected service + ref = self.getCurrentSelection() + splited_ref=ref.toString().split(":") + if ref.flags == 7 and splited_ref[6] != "0": + self.dvbnamespace=splited_ref[6] + self.enterPath(ref) + else: + self.close(ref.getName(), self.dvbnamespace) + + def showSatellites(self): + if not self.pathChangeDisabled: + refstr = '%s FROM SATELLITES ORDER BY satellitePosition'%(self.service_types) + if not self.preEnterPath(refstr): + ref = eServiceReference(refstr) + justSet=False + prev = None + + if self.isBasePathEqual(ref): + if self.isPrevPathEqual(ref): + justSet=True + prev = self.pathUp(justSet) + else: + currentRoot = self.getRoot() + if currentRoot is None or currentRoot != ref: + justSet=True + self.clearPath() + self.enterPath(ref, True) + if justSet: + serviceHandler = eServiceCenter.getInstance() + servicelist = serviceHandler.list(ref) + if not servicelist is None: + while True: + service = servicelist.getNext() + if not service.valid(): #check if end of list + break + unsigned_orbpos = service.getUnsignedData(4) >> 16 + orbpos = service.getData(4) >> 16 + if orbpos < 0: + orbpos += 3600 + if service.getPath().find("FROM PROVIDER") != -1: + service_type = _("Providers") + try: + # why we need this cast? + service_name = str(nimmanager.getSatDescription(orbpos)) + except: + if unsigned_orbpos == 0xFFFF: #Cable + service_name = _("Cable") + elif unsigned_orbpos == 0xEEEE: #Terrestrial + service_name = _("Terrestrial") + else: + if orbpos > 1800: # west + orbpos = 3600 - orbpos + h = _("W") + else: + h = _("E") + service_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10) + service.setName("%s - %s" % (service_name, service_type)) + self.servicelist.addService(service) + self.servicelist.finishFill() + if prev is not None: + self.setCurrentSelection(prev) + + def cancel(self): + self.close(None) + +class myChannelSelection(ChannelSelectionBase): + skin = """ + <screen position="80,80" size="560,430" title="Select service to add..."> + <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" /> + <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> + <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" /> + <widget name="list" position="00,45" size="560,364" scrollbarMode="showOnDemand" /> + </screen>""" + + def __init__(self, session, title): + ChannelSelectionBase.__init__(self, session) + self.onShown.append(self.__onExecCallback) + service = self.session.nav.getCurrentService() + if service: + info = service.info() + if info: + refstr = info.getInfoString(iServiceInformation.sServiceref) + self.servicelist.setPlayableIgnoreService(eServiceReference(refstr)) + + self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions", "ChannelSelectBaseActions"], + { + "showProviders": self.doNothing, + "showSatellites": self.doNothing, + "cancel": self.cancel, + "ok": self.channelSelected, + "keyRadio": self.setModeRadio, + "keyTV": self.setModeTv + }) + + self["key_green"] = StaticText(_("")) + self["key_yellow"] = StaticText(_("")) + + def __onExecCallback(self): + self.setModeTv() + + def doNothing(self): + print "nothing to do..." + + def channelSelected(self): # just return selected service + ref = self.getCurrentSelection() + if (ref.flags & 7) == 7: + self.enterPath(ref) + elif not (ref.flags & eServiceReference.isMarker): + ref = self.getCurrentSelection() + self.close(ref) + + def setModeTv(self): + self.setTvMode() + self.showFavourites() + + def setModeRadio(self): + self.setRadioMode() + self.showFavourites() + + def cancel(self): + self.close(None) + +def activate_all(session): + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + print "[CI_Activate] FOUND %d CI Slots " % NUM_CI + if NUM_CI > 0: + ci_config=[] + def getValue(definitions, default): + # Initialize Output + ret = "" + # How many definitions are present + Len = len(definitions) + return Len > 0 and definitions[Len-1].text or default + + for ci in range(NUM_CI): + filename="/etc/enigma2/ci"+str(ci)+".xml" + + if not os_path.exists(filename): + print "[CI_Activate_Config_CI%d] no config file found" %ci + + try: + tree = ci_parse(filename).getroot() + read_services=[] + read_providers=[] + usingcaid=[] + for slot in tree.findall("slot"): + read_slot = getValue(slot.findall("id"), False).encode("UTF-8") + + for caid in slot.findall("caid"): + read_caid = caid.get("id").encode("UTF-8") + usingcaid.append(long(read_caid,16)) + + for service in slot.findall("service"): + read_service_ref = service.get("ref").encode("UTF-8") + read_services.append (read_service_ref) + + for provider in slot.findall("provider"): + read_provider_name = provider.get("name").encode("UTF-8") + read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8") + read_providers.append((read_provider_name,long(read_provider_dvbname,16))) + + ci_config.append((int(read_slot), (read_services, read_providers, usingcaid))) + except: + print "[CI_Activate_Config_CI%d] error parsing xml..." %ci + + for item in ci_config: + print "[CI_Activate] activate CI%d with following settings:" %item[0] + print item[0] + print item[1] + try: + eDVBCIInterfaces.getInstance().setDescrambleRules(item[0],item[1]) + except: + print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." %item[0] + +def find_in_list(list, search, listpos=0): + for item in list: + if item[listpos]==search: + return True + return False + +global_session = None + +def sessionstart(reason, session): + global global_session + global_session = session + +def autostart(reason, **kwargs): + global global_session + if reason == 0: + print "[CI_Assignment] activating ci configs:" + activate_all(global_session) + elif reason == 1: + global_session = None + +def main(session, **kwargs): + session.open(CIselectMainMenu) + +def menu(menuid, **kwargs): + if menuid == "setup" and eDVBCIInterfaces.getInstance().getNumOfSlots(): + return [(_("Common Interface Assignment"), main, "ci_assign", 11)] + return [ ] + +def Plugins(**kwargs): + if config.usage.setup_level.index > 1: + return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart ), + PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart ), + PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers/caids to common interface modules"), where = PluginDescriptor.WHERE_MENU, fnc = menu )] + else: + return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart ), + PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart ), + PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers to common interface modules"), where = PluginDescriptor.WHERE_MENU, fnc = menu )] diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py index 07861954..bb4df74a 100644 --- a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py +++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py @@ -78,6 +78,14 @@ class ResultParser: text += " ==> " text += str(transponder[0]) text += "\n" + if reason == "pids_failed": + text += "(tsid, onid): " + text += str(transponder[3]['real']) + text += "(read from sat) != " + text += str(transponder[3]['expected']) + text += "(read from file)" + text += "\n" + text += "\n" if countsuccessful > 0: text += "\n" text += "Successfully tuned transponders' previous planes:\n" @@ -265,7 +273,7 @@ class DiseqcTester(Screen, TuneTest, ResultParser): for sat in nimmanager.getSatListForNim(self.feid): for transponder in nimmanager.getTransponders(sat[0]): #print transponder - mytransponder = (transponder[1] / 1000, transponder[2] / 1000, transponder[3], transponder[4], transponder[5], sat[0], None, None, transponder[10], transponder[11]) + mytransponder = (transponder[1] / 1000, transponder[2] / 1000, transponder[3], transponder[4], transponder[7], sat[0], transponder[5], transponder[6], transponder[8], transponder[9], transponder[10], transponder[11]) self.analyseTransponder(mytransponder) def getIndexForTransponder(self, transponder): @@ -623,7 +631,7 @@ class DiseqcTesterNimSelection(NimSelection): def showNim(self, nim): nimConfig = nimmanager.getNimConfig(nim.slot) if nim.isCompatible("DVB-S"): - if nimConfig.configMode.value in ["loopthrough", "equal", "satposdepends", "nothing"]: + if nimConfig.configMode.value in ("loopthrough", "equal", "satposdepends", "nothing"): return False if nimConfig.configMode.value == "simple": if nimConfig.diseqcMode.value == "positioner": diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index 10151f2c..634c7f42 100755 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -1 +1,3 @@ -SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug DefaultServicesScanner NFIFlash DiseqcTester +SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder \ + SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug \ + DefaultServicesScanner NFIFlash DiseqcTester CommonInterfaceAssignment diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py index ec223d3e..ec472e72 100644 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py @@ -25,7 +25,8 @@ class SecParameterSetup(Screen, ConfigListScreen): list = [ ("Delay after diseqc reset command", config.sec.delay_after_diseqc_reset_cmd), ("Delay after diseqc peripherial poweron command", config.sec.delay_after_diseqc_peripherial_poweron_cmd), - ("Delay after continuous tone change", config.sec.delay_after_continuous_tone_change), + ("Delay after continuous tone disable before diseqc", config.sec.delay_after_continuous_tone_disable_before_diseqc), + ("Delay after final continuous tone change", config.sec.delay_after_final_continuous_tone_change), ("Delay after last voltage change", config.sec.delay_after_final_voltage_change), ("Delay between diseqc commands", config.sec.delay_between_diseqc_repeats), ("Delay after last diseqc command", config.sec.delay_after_last_diseqc_command), diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index 947452e9..327f08ed 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -308,5 +308,3 @@ class RestoreScreen(Screen, ConfigListScreen): def runAsync(self, finished_cb): self.finished_cb = finished_cb self.doRestore() - -
\ 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 09b61bd5..3eefa47d 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -19,7 +19,7 @@ from Components.SelectionList import SelectionList from Components.PluginComponent import plugins from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop 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 @@ -82,7 +82,7 @@ class UpdatePluginMenu(Screen): <widget source="menu" render="Listbox" position="280,10" size="230,300" scrollbarMode="showNever" selectionDisabled="1"> <convert type="TemplatedMultiContent"> {"template": [ - MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 0 is the MenuText, + MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, ], "fonts": [gFont("Regular", 20)], "itemHeight": 230 @@ -157,7 +157,8 @@ class UpdatePluginMenu(Screen): if (current == "ipkg-manager"): self.session.open(PacketManager, self.skin_path) elif (current == "ipkg-source"): - self.session.open(IPKGSource) + self.session.open(IPKGMenu, self.skin_path) + #self.session.open(IPKGSource) elif (current == "ipkg-install"): try: from Plugins.Extensions.MediaScanner.plugin import main @@ -223,34 +224,123 @@ class UpdatePluginMenu(Screen): self.exe = True self.session.open(RestoreScreen, runRestore = True) +class IPKGMenu(Screen): + skin = """ + <screen name="IPKGMenu" position="135,144" size="450,320" title="Select IPKG source......" > + <widget name="filelist" position="10,10" size="430,240" scrollbarMode="showOnDemand" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,280" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="closetext" position="20,290" size="140,21" zPosition="10" font="Regular;21" transparent="1" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,280" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="edittext" position="170,290" size="300,21" zPosition="10" font="Regular;21" transparent="1" /> + </screen>""" + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.skin_path = plugin_path + + self["closetext"] = Label(_("Close")) + self["edittext"] = Label(_("Edit")) + + self.sel = [] + self.val = [] + self.entry = False + self.exe = False + + self.path = "" + + self["actions"] = NumberActionMap(["SetupActions"], + { + "ok": self.KeyOk, + "cancel": self.keyCancel + }, -1) + + self["shortcuts"] = ActionMap(["ShortcutActions"], + { + "red": self.keyCancel, + "green": self.KeyOk, + }) + self.flist = [] + self["filelist"] = MenuList(self.flist) + self.fill_list() + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + + def setWindowTitle(self): + self.setTitle(_("Select IPKG source to edit...")) + + + def fill_list(self): + self.flist = [] + self.path = '/etc/ipkg/' + if (os_path.exists(self.path) == False): + self.entry = False + return + for file in listdir(self.path): + if (file.endswith(".conf")): + if file != 'arch.conf': + self.flist.append((file)) + self.entry = True + self["filelist"].l.setList(self.flist) + + def KeyOk(self): + if (self.exe == False) and (self.entry == True): + self.sel = self["filelist"].getCurrent() + self.val = self.path + self.sel + self.session.open(IPKGSource, self.val) + + def keyCancel(self): + self.close() + + def Exit(self): + self.close() + class IPKGSource(Screen): skin = """ - <screen position="100,100" size="550,60" title="IPKG source" > - <widget name="text" position="0,0" size="550,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" /> + <screen name="IPKGSource" position="100,100" size="550,80" title="IPKG source" > + <widget name="text" position="10,10" size="530,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,40" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="closetext" position="20,50" size="140,21" zPosition="10" font="Regular;21" transparent="1" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,40" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="edittext" position="170,50" size="300,21" zPosition="10" font="Regular;21" transparent="1" /> </screen>""" - def __init__(self, session, args = None): + def __init__(self, session, configfile = None): Screen.__init__(self, session) self.session = session - - #FIXMEEEE add handling for more than one feed conf file! + self.configfile = configfile text = "" - try: - fp = file('/etc/ipkg/official-feed.conf', 'r') - sources = fp.readlines() - if sources: - text = sources[0] - fp.close() - except IOError: - pass - - self["text"] = Input(text, maxSize=False, type=Input.TEXT) - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"], + if self.configfile: + try: + fp = file(configfile, 'r') + sources = fp.readlines() + if sources: + text = sources[0] + fp.close() + except IOError: + pass + + desk = getDesktop(0) + x= int(desk.size().width()) + y= int(desk.size().height()) + #print "[IPKGSource] mainscreen: current desktop size: %dx%d" % (x,y) + + self["closetext"] = Label(_("Cancel")) + self["edittext"] = Label(_("Save")) + + if (y>=720): + self["text"] = Input(text, maxSize=False, type=Input.TEXT) + else: + self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], { "ok": self.go, "back": self.close, + "red": self.close, + "green": self.go, "left": self.keyLeft, "right": self.keyRight, "home": self.keyHome, @@ -268,12 +358,22 @@ class IPKGSource(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + self["text"].right() + + def setWindowTitle(self): + self.setTitle(_("Edit IPKG source URL...")) def go(self): text = self["text"].getText() if text: - fp = file('/etc/ipkg/official-feed.conf', 'w') - fp.write() + fp = file(self.configfile, 'w') + fp.write(text) + fp.write("\n") fp.close() self.close() @@ -715,7 +815,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Ipkg", - description = "Install software updates...", + description = _("Install software updates..."), openfnc = filescan_open, ) def UpgradeMain(session, **kwargs): diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 6a85c4da..64f79e04 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -67,7 +67,7 @@ class VideoHardware: else: mode = config.av.videomode[port].value force_widescreen = self.isWidescreenMode(port, mode) - is_widescreen = force_widescreen or config.av.aspect.value in ["16_9", "16_10"] + is_widescreen = force_widescreen or config.av.aspect.value in ("16_9", "16_10") is_auto = config.av.aspect.value == "auto" if is_widescreen: if force_widescreen: @@ -283,7 +283,7 @@ class VideoHardware: force_widescreen = self.isWidescreenMode(port, mode) - is_widescreen = force_widescreen or config.av.aspect.value in ["16_9", "16_10"] + is_widescreen = force_widescreen or config.av.aspect.value in ("16_9", "16_10") is_auto = config.av.aspect.value == "auto" policy2 = "policy" # use main policy diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 1d7ce7b5..8f8bea09 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -13,8 +13,8 @@ config.misc.showtestcard = ConfigBoolean(default = False) class VideoWizardSummary(WizardSummary): skin = """ <screen position="0,0" size="132,64"> - <widget name="text" position="6,4" size="120,42" font="Regular;14" transparent="1" /> - <widget source="parent.list" render="Label" position="6,25" size="120,21" font="Regular;16"> + <widget name="text" position="6,4" size="120,40" font="Regular;12" transparent="1" /> + <widget source="parent.list" render="Label" position="6,40" size="120,21" font="Regular;14"> <convert type="StringListSelection" /> </widget> <!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/--> @@ -165,7 +165,7 @@ class VideoWizard(WizardLanguage, Rc): config.misc.showtestcard.value = False def keyNumberGlobal(self, number): - if number in [1,2,3]: + if number in (1,2,3): if number == 1: self.hw.saveMode("DVI", "720p", "multi") elif number == 2: diff --git a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py index 30bdf796..6b6d5045 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py @@ -52,8 +52,9 @@ class VideoSetup(Screen, ConfigListScreen): def createSetup(self): level = config.usage.setup_level.index - self.list = [ ] - self.list.append(getConfigListEntry(_("Video Output"), config.av.videoport)) + self.list = [ + getConfigListEntry(_("Video Output"), config.av.videoport) + ] # if we have modes for this port: if config.av.videoport.value in config.av.videomode: @@ -76,9 +77,11 @@ class VideoSetup(Screen, ConfigListScreen): if not force_wide: self.list.append(getConfigListEntry(_("Aspect Ratio"), config.av.aspect)) - if force_wide or config.av.aspect.value in ["16_9", "16_10"]: - self.list.append(getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43)) - self.list.append(getConfigListEntry(_("Display >16:9 content as"), config.av.policy_169)) + if force_wide or config.av.aspect.value in ("16_9", "16_10"): + self.list.extend(( + getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43), + getConfigListEntry(_("Display >16:9 content as"), config.av.policy_169) + )) elif config.av.aspect.value == "4_3": self.list.append(getConfigListEntry(_("Display 16:9 content as"), config.av.policy_169)) @@ -95,6 +98,10 @@ class VideoSetup(Screen, ConfigListScreen): self.list.append(getConfigListEntry(_("AC3 default"), config.av.defaultac3)) if SystemInfo["CanDownmixAC3"]: self.list.append(getConfigListEntry(_("AC3 downmix"), config.av.downmix_ac3)) + self.list.extend(( + getConfigListEntry(_("General AC3 Delay"), config.av.generalAC3delay), + getConfigListEntry(_("General PCM Delay"), config.av.generalPCMdelay) + )) if SystemInfo["CanChangeOsdAlpha"]: self.list.append(getConfigListEntry(_("OSD visibility"), config.av.osd_alpha)) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml index 2a592aae..29ac4297 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml +++ b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml @@ -1,7 +1,7 @@ <wizard> - <step id="inputselection" nextstep="modeselection" timeout="10" timeoutaction="selectnext"> + <step id="inputselection" nextstep="modeselection" timeout="20" timeoutaction="selectnext"> <text value="Video input selection\n\nPlease press OK if you can see this page on your TV (or select a different input port).\n\nThe next input port will be automatically probed in 10 seconds." /> - <displaytext value="Select video input" /> + <displaytext value="Select video input with up/down buttons" /> <list type="dynamic" source="listInputChannels" evaluation="inputSelectionMade" onselect="inputSelectionMoved" /> <code> self["portpic"].show() @@ -9,7 +9,7 @@ self.clearSelectedKeys() self.selectKey("OK") </code> </step> - <step id="modeselection" nextstep="rateselection" timeout="10" timeoutaction="selectnext"> + <step id="modeselection" nextstep="rateselection" timeout="20" timeoutaction="selectnext"> <text value="Video mode selection." /> <displaytext value="Select video mode" /> <list type="dynamic" source="listModes" evaluation="modeSelectionMade" onselect="modeSelectionMoved" /> @@ -20,7 +20,7 @@ self.selectKey("DOWN") self["portpic"].hide() </code> </step> - <step id="rateselection" nextstep="dvirateintroduction" timeout="10" timeoutaction="selectnext"> + <step id="rateselection" nextstep="dvirateintroduction" timeout="20" timeoutaction="selectnext"> <condition> self.condition = (self.port != "DVI" or self.mode == "PC") </condition> @@ -46,7 +46,7 @@ self.selectKey("DOWN") self.rateSelect("60Hz") </code> </step> - <step id="dvirateselection" timeout="10" timeoutaction="changestep" timeoutstep="notworking50Hz"> + <step id="dvirateselection" timeout="20" timeoutaction="changestep" timeoutstep="notworking50Hz"> <condition> self.condition = (self.port == "DVI" and self.mode in ["720p", "1080i"]) </condition> @@ -77,7 +77,7 @@ self.selectKey("UP") self.selectKey("DOWN") </code> </step> - <step id="working50Hz" nextstep="end" timeout="10" timeoutaction="nextstep"> + <step id="working50Hz" nextstep="end" timeout="20" timeoutaction="nextstep"> <condition> self.condition = (self.port == "DVI" and self.mode in ["720p", "1080i"]) </condition> |
