diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2009-02-16 18:25:23 +0100 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2009-02-16 18:25:23 +0100 |
| commit | d58ca4cf34b7621aea4e2c1ff07bed6b2cd6b763 (patch) | |
| tree | f96b8eae81d7aa0c2d11eda8bcda1e4b87f96e78 /lib/python/Components | |
| parent | 4510fa62a33b31fec442fd0d77eb682d93ebf7e6 (diff) | |
| parent | fbaf2a5f2fa5236b09a4d14f059d99eace24f2d5 (diff) | |
| download | enigma2-d58ca4cf34b7621aea4e2c1ff07bed6b2cd6b763.tar.gz enigma2-d58ca4cf34b7621aea4e2c1ff07bed6b2cd6b763.zip | |
Merge branch 'master' of /home/tmbinc/enigma2-git into tmbinc/FixTimingBugs
Diffstat (limited to 'lib/python/Components')
| -rwxr-xr-x[-rw-r--r--] | lib/python/Components/Console.py | 9 | ||||
| -rw-r--r-- | lib/python/Components/Converter/StringList.py | 7 | ||||
| -rw-r--r-- | lib/python/Components/EpgList.py | 1 | ||||
| -rwxr-xr-x[-rw-r--r--] | lib/python/Components/FileList.py | 186 | ||||
| -rwxr-xr-x[-rw-r--r--] | lib/python/Components/Harddisk.py | 14 | ||||
| -rwxr-xr-x | lib/python/Components/HelpMenuList.py | 4 | ||||
| -rwxr-xr-x[-rw-r--r--] | lib/python/Components/Ipkg.py | 4 | ||||
| -rw-r--r-- | lib/python/Components/Language.py | 1 | ||||
| -rw-r--r-- | lib/python/Components/NimManager.py | 4 | ||||
| -rw-r--r-- | lib/python/Components/Sources/List.py | 5 | ||||
| -rw-r--r-- | lib/python/Components/TimerSanityCheck.py | 11 | ||||
| -rwxr-xr-x | lib/python/Components/config.py | 2 |
12 files changed, 242 insertions, 6 deletions
diff --git a/lib/python/Components/Console.py b/lib/python/Components/Console.py index f1f3fd95..a41317ea 100644..100755 --- a/lib/python/Components/Console.py +++ b/lib/python/Components/Console.py @@ -55,3 +55,12 @@ class Console(object): if self.callbacks[name]: self.callbacks[name](data,retval,extra_args) del self.callbacks[name] + + def kill(self,name): + if name in self.appContainers: + print "[Console] killing: ",self.appContainers[name] + self.appContainers[name].kill() + + def killAll(self): + for name in self.appContainers: + self.kill(name) diff --git a/lib/python/Components/Converter/StringList.py b/lib/python/Components/Converter/StringList.py index d424d39f..226247c4 100644 --- a/lib/python/Components/Converter/StringList.py +++ b/lib/python/Components/Converter/StringList.py @@ -18,6 +18,8 @@ class StringList(Converter): def selectionChanged(self, index): self.source.selectionChanged(index) + + def setIndex(self, index): # update all non-master targets print "changed selection in listbox!" for x in self.downstream_elements: @@ -26,6 +28,11 @@ class StringList(Converter): print "is not master, so update to index", index x.index = index + def getIndex(self, index): + return None + + index = property(getIndex, setIndex) + @cached def getCurrent(self): if self.source is None or self.index is None or self.index >= len(self.source.list): diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py index 8bd8e759..2494ca08 100644 --- a/lib/python/Components/EpgList.py +++ b/lib/python/Components/EpgList.py @@ -289,6 +289,7 @@ class EPGList(HTMLComponent, GUIComponent): else: assert(type == 0) list.sort(key=lambda x: x[2]) + self.l.invalidate() self.moveToEventId(event_id) def getSelectedEventId(self): diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 84abf328..f9697094 100644..100755 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -248,3 +248,189 @@ class FileList(MenuList): self.refreshMountpoints() if self.current_directory is None: self.refresh() + + +def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected = False): + res = [ (absolute, isDir, selected, name) ] + res.append((eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 20, 0, RT_HALIGN_LEFT, name)) + if isDir: + png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/directory.png")) + else: + extension = name.split('.') + extension = extension[-1].lower() + if EXTENSIONS.has_key(extension): + png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/" + EXTENSIONS[extension] + ".png")) + else: + png = None + if png is not None: + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 30, 2, 20, 20, png)) + + if not name.startswith('<'): + if selected is False: + icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_off.png")) + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon)) + else: + icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_on.png")) + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon)) + + return res + + +class MultiFileSelectList(FileList): + def __init__(self, preselectedFiles, directory, showMountpoints = False, matchingPattern = None, showDirectories = True, showFiles = True, useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None): + self.selectedFiles = preselectedFiles + if self.selectedFiles is None: + self.selectedFiles = [] + FileList.__init__(self, directory, showMountpoints = showMountpoints, matchingPattern = matchingPattern, showDirectories = showDirectories, showFiles = showFiles, useServiceRef = useServiceRef, inhibitDirs = inhibitDirs, inhibitMounts = inhibitMounts, isTop = isTop, enableWrapAround = enableWrapAround, additionalExtensions = additionalExtensions) + self.changeDir(directory) + self.l.setItemHeight(25) + self.l.setFont(0, gFont("Regular", 20)) + self.onSelectionChanged = [ ] + + def selectionChanged(self): + for f in self.onSelectionChanged: + f() + + def changeSelectionState(self): + idx = self.l.getCurrentSelectionIndex() + count = 0 + newList = [] + for x in self.list: + if idx == count: + if x[0][3].startswith('<'): + newList.append(x) + else: + if x[0][1] is True: + realPathname = x[0][0] + else: + realPathname = self.current_directory + x[0][0] + if x[0][2] == True: + SelectState = False + for entry in self.selectedFiles: + if entry == realPathname: + self.selectedFiles.remove(entry) + + else: + SelectState = True + alreadyinList = False + for entry in self.selectedFiles: + if entry == realPathname: + alreadyinList = True + if not alreadyinList: + self.selectedFiles.append(realPathname) + newList.append(MultiFileSelectEntryComponent(name = x[0][3], absolute = x[0][0], isDir = x[0][1], selected = SelectState )) + else: + newList.append(x) + + count += 1 + + self.list = newList + self.l.setList(self.list) + + def getSelectedList(self): + return self.selectedFiles + + def changeDir(self, directory, select = None): + self.list = [] + + # if we are just entering from the list of mount points: + if self.current_directory is None: + if directory and self.showMountpoints: + self.current_mountpoint = self.getMountpointLink(directory) + else: + self.current_mountpoint = None + self.current_directory = directory + directories = [] + files = [] + + if directory is None and self.showMountpoints: # present available mountpoints + for p in harddiskmanager.getMountedPartitions(): + path = os_path.join(p.mountpoint, "") + if path not in self.inhibitMounts and not self.inParentDirs(path, self.inhibitDirs): + self.list.append(MultiFileSelectEntryComponent(name = p.description, absolute = path, isDir = True)) + files = [ ] + directories = [ ] + elif directory is None: + files = [ ] + directories = [ ] + elif self.useServiceRef: + root = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + directory) + if self.additional_extensions: + root.setName(self.additional_extensions) + serviceHandler = eServiceCenter.getInstance() + list = serviceHandler.list(root) + + while 1: + s = list.getNext() + if not s.valid(): + del list + break + if s.flags & s.mustDescent: + directories.append(s.getPath()) + else: + files.append(s) + directories.sort() + files.sort() + else: + if os_path.exists(directory): + files = listdir(directory) + files.sort() + tmpfiles = files[:] + for x in tmpfiles: + if os_path.isdir(directory + x): + directories.append(directory + x + "/") + files.remove(x) + + if directory is not None and self.showDirectories and not self.isTop: + if directory == self.current_mountpoint and self.showMountpoints: + self.list.append(MultiFileSelectEntryComponent(name = "<" +_("List of Storage Devices") + ">", absolute = None, isDir = True)) + elif (directory != "/") and not (self.inhibitMounts and self.getMountpoint(directory) in self.inhibitMounts): + self.list.append(MultiFileSelectEntryComponent(name = "<" +_("Parent Directory") + ">", absolute = '/'.join(directory.split('/')[:-2]) + '/', isDir = True)) + + if self.showDirectories: + for x in directories: + if not (self.inhibitMounts and self.getMountpoint(x) in self.inhibitMounts) and not self.inParentDirs(x, self.inhibitDirs): + name = x.split('/')[-2] + alreadySelected = False + for entry in self.selectedFiles: + if entry == x: + alreadySelected = True + if alreadySelected: + self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x, isDir = True, selected = True)) + else: + self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x, isDir = True, selected = False)) + + if self.showFiles: + for x in files: + if self.useServiceRef: + path = x.getPath() + name = path.split('/')[-1] + else: + path = directory + x + name = x + + if (self.matchingPattern is None) or re_compile(self.matchingPattern).search(path): + alreadySelected = False + for entry in self.selectedFiles: + if os_path.basename(entry) == x: + alreadySelected = True + if alreadySelected: + self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x , isDir = False, selected = True)) + else: + self.list.append(MultiFileSelectEntryComponent(name = name, absolute = x , isDir = False, selected = False)) + + self.l.setList(self.list) + + if select is not None: + i = 0 + self.moveToIndex(0) + for x in self.list: + p = x[0][0] + + if isinstance(p, eServiceReference): + p = p.getPath() + + if p == select: + self.moveToIndex(i) + i += 1 + diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index d165e26c..75d68fad 100644..100755 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -519,4 +519,18 @@ class HarddiskManager: description += " (Partition %d)" % part return description + def addMountedPartition(self, device, desc): + already_mounted = False + for x in self.partitions[:]: + if x.mountpoint == device: + already_mounted = True + if not already_mounted: + self.partitions.append(Partition(mountpoint = device, description = desc)) + + def removeMountedPartition(self, mountpoint): + for x in self.partitions[:]: + if x.mountpoint == mountpoint: + self.partitions.remove(x) + self.on_partition_list_change("remove", x) + harddiskmanager = HarddiskManager() diff --git a/lib/python/Components/HelpMenuList.py b/lib/python/Components/HelpMenuList.py index 2a7bd995..ddf871a7 100755 --- a/lib/python/Components/HelpMenuList.py +++ b/lib/python/Components/HelpMenuList.py @@ -7,7 +7,7 @@ from Tools.KeyBindings import queryKeyBinding, getKeyDescription # [ ( actionmap, context, [(action, help), (action, help), ...] ), (actionmap, ... ), ... ] class HelpMenuList(GUIComponent): - def __init__(self, list, callback): + def __init__(self, helplist, callback): GUIComponent.__init__(self) self.onSelChanged = [ ] self.l = eListboxPythonMultiContent() @@ -15,7 +15,7 @@ class HelpMenuList(GUIComponent): self.extendedHelp = False l = [ ] - for (actionmap, context, actions) in list: + for (actionmap, context, actions) in helplist: for (action, help) in actions: entry = [ ] diff --git a/lib/python/Components/Ipkg.py b/lib/python/Components/Ipkg.py index 31889bcf..0ba1165c 100644..100755 --- a/lib/python/Components/Ipkg.py +++ b/lib/python/Components/Ipkg.py @@ -52,6 +52,8 @@ class IpkgComponent: self.runCmd("list") elif cmd == self.CMD_INSTALL: self.runCmd("install " + args['package']) + elif cmd == self.CMD_REMOVE: + self.runCmd("remove " + args['package']) self.setCurrentCommand(cmd) def cmdFinished(self, retval): @@ -90,6 +92,8 @@ class IpkgComponent: 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: + self.callCallbacks(self.EVENT_REMOVE, data.split(' ', 1)[1].split(' ')[1]) elif data.find('Configuring') == 0: self.callCallbacks(self.EVENT_CONFIGURING, data.split(' ', 1)[1].split(' ')[0]) elif data.find('An error occurred') == 0: diff --git a/lib/python/Components/Language.py b/lib/python/Components/Language.py index 395f6829..74dd67d8 100644 --- a/lib/python/Components/Language.py +++ b/lib/python/Components/Language.py @@ -26,6 +26,7 @@ class Language: self.addLanguage(_("Greek"), "el", "GR") self.addLanguage(_("Hungarian"), "hu", "HU") self.addLanguage(_("Lithuanian"), "lt", "LT") + self.addLanguage(_("Latvian"), "lv", "LV") self.addLanguage(_("Icelandic"), "is", "IS") self.addLanguage(_("Italian"), "it", "IT") self.addLanguage(_("Norwegian"), "no", "NO") diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 4be10d53..6dc49dcf 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -287,8 +287,8 @@ class SecConfigure: sec.setLNBSatCR(manufacturer.scr[product_name].index) sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) elif currLnb.unicable.value == "unicable_lnb": - manufacturer_name = currLnb.unicableMatrixManufacturer.value - manufacturer = currLnb.unicableMatrix[manufacturer_name] + 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) diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py index 23b53957..dbe442d1 100644 --- a/lib/python/Components/Sources/List.py +++ b/lib/python/Components/Sources/List.py @@ -40,6 +40,11 @@ to generate HTML.""" if self.disable_callbacks: return + # update all non-master targets + for x in self.downstream_elements: + if x is not self.master: + x.index = index + for x in self.onSelectionChanged: x() diff --git a/lib/python/Components/TimerSanityCheck.py b/lib/python/Components/TimerSanityCheck.py index cf02459d..cf505022 100644 --- a/lib/python/Components/TimerSanityCheck.py +++ b/lib/python/Components/TimerSanityCheck.py @@ -1,11 +1,12 @@ import NavigationInstance -from time import localtime +from time import localtime, mktime, gmtime from ServiceReference import ServiceReference from enigma import iServiceInformation, eServiceCenter, eServiceReference class TimerSanityCheck: def __init__(self, timerlist, newtimer=None): print "sanitycheck" + self.localtimediff = 25*3600 - mktime(gmtime(25*3600)) self.timerlist = timerlist self.newtimer = newtimer self.simultimer = [] @@ -70,6 +71,10 @@ class TimerSanityCheck: rflags = ((rflags & 0x7F)>> 3)|((rflags & 0x07)<<4) if rflags: begin = self.newtimer.begin % 86400 # map to first day + if (self.localtimediff > 0) and ((begin + self.localtimediff) > 86400): + rflags = ((rflags >> 1)& 0x3F)|((rflags << 6)& 0x40) + elif (self.localtimediff < 0) and (begin < self.localtimediff): + rflags = ((rflags << 1)& 0x7E)|((rflags >> 6)& 0x01) while rflags: # then arrange on the week if rflags & 1: self.rep_eventlist.append((begin, -1)) @@ -87,6 +92,10 @@ class TimerSanityCheck: rflags = timer.repeated rflags = ((rflags & 0x7F)>> 3)|((rflags & 0x07)<<4) begin = timer.begin % 86400 # map all to first day + if (self.localtimediff > 0) and ((begin + self.localtimediff) > 86400): + rflags = ((rflags >> 1)& 0x3F)|((rflags << 6)& 0x40) + elif (self.localtimediff < 0) and (begin < self.localtimediff): + rflags = ((rflags << 1)& 0x7E)|((rflags >> 6)& 0x01) while rflags: if rflags & 1: self.rep_eventlist.append((begin, idx)) diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index a813d3ca..a6d34152 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1385,7 +1385,7 @@ class ConfigLocations(ConfigElement): # nothing. class ConfigNothing(ConfigSelection): def __init__(self): - ConfigSelection.__init__(self, choices = [""]) + ConfigSelection.__init__(self, choices = [("","")]) # until here, 'saved_value' always had to be a *string*. # now, in ConfigSubsection, and only there, saved_value |
