Merge branch 'master' of git.opendreambox.org:/git/enigma2
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 13 Feb 2009 00:05:42 +0000 (01:05 +0100)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 13 Feb 2009 00:05:42 +0000 (01:05 +0100)
27 files changed:
RecordTimer.py
lib/python/Components/About.py
lib/python/Components/ActionMap.py
lib/python/Components/EpgList.py
lib/python/Components/Harddisk.py
lib/python/Components/HelpMenuList.py
lib/python/Components/PluginComponent.py
lib/python/Components/Scanner.py
lib/python/Components/ServiceList.py
lib/python/Components/TimerList.py
lib/python/Components/TimerSanityCheck.py
lib/python/Components/UsageConfig.py
lib/python/Components/config.py
lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
lib/python/Plugins/Plugin.py
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/LocationBox.py
lib/python/Screens/PluginBrowser.py
lib/python/Screens/ServiceInfo.py
lib/python/Screens/TimerEdit.py
lib/python/Screens/TimerEntry.py
lib/python/Screens/Wizard.py
lib/python/Tools/Directories.py
lib/python/Tools/RedirectOutput.py
skin.py
timer.py

index 897c281abb9cea598946d0716c28bc6787e0c810..f8e0dbd7472ca5d9013b1ed8c2af6b509d1b980c 100644 (file)
@@ -363,7 +363,7 @@ class RecordTimerEntry(timer.TimerEntry, object):
                elif event == iRecordableService.evStart:
                        text = _("A record has been started:\n%s") % self.name
                        if self.dirnameHadToFallback:
-                               text = '\n'.join([text, _("Please note that the previously selected media could not be accessed and therefore the default directory is being used instead.")])
+                               text = '\n'.join((text, _("Please note that the previously selected media could not be accessed and therefore the default directory is being used instead.")))
 
                        # maybe this should be configurable?
                        Notifications.AddPopup(text = text, type = MessageBox.TYPE_INFO, timeout = 3)
@@ -657,7 +657,7 @@ class RecordTimer(timer.Timer):
                                                chktimecmp = chktime.tm_wday * 1440 + chktime.tm_hour * 60 + chktime.tm_min
                                                chktimecmp_end = chktimecmp + (duration / 60)
                                        time = localtime(x.begin)
-                                       for y in range(7):
+                                       for y in (0, 1, 2, 3, 4, 5, 6):
                                                if x.repeated & (2 ** y):
                                                        timecmp = y * 1440 + time.tm_hour * 60 + time.tm_min
                                                        if timecmp <= chktimecmp < (timecmp + ((x.end - x.begin) / 60)):
index ce1328cf279888332dd7cd3c1931b726c6df6586..bb2d75686a0b20e499de9aaf7ca27f73e469b9d2 100644 (file)
@@ -23,7 +23,7 @@ class About:
                                        month = version[8:10]
                                        day = version[10:12]
 
-                                       return '-'.join(["dev", year, month, day])
+                                       return '-'.join(("dev", year, month, day))
                        file.close()
                except IOError:
                        pass
index b65d6ebc218ec7f9ced446da62f5d3ed06973c8e..a018983a9e52893dfc6728bbbcc0cac7e557f782 100644 (file)
@@ -56,7 +56,7 @@ class ActionMap:
 
 class NumberActionMap(ActionMap):
        def action(self, contexts, action):
-               numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+               numbers = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
                if (action in numbers and self.actions.has_key(action)):
                        res = self.actions[action](int(action))
                        if res is not None:
@@ -83,7 +83,7 @@ class HelpableActionMap(ActionMap):
                adict = { }
                for (action, funchelp) in actions.iteritems():
                        # check if this is a tuple
-                       if type(funchelp) is type(()):
+                       if isinstance(funchelp, tuple):
                                alist.append((action, funchelp[1]))
                                adict[action] = funchelp[0]
                        else:
index 8a7c8d45e9f472b6aab88663fc8839279f3e71bb..8bd8e75922ba83f8189f2ac8a492f7eb28164117 100644 (file)
@@ -35,7 +35,7 @@ class Rect:
 
 class EPGList(HTMLComponent, GUIComponent):
        def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None, timer = None):
-               self.days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]
+               self.days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun"))
                self.timer = timer
                self.onSelChanged = [ ]
                if selChangedCB is not None:
@@ -43,6 +43,8 @@ class EPGList(HTMLComponent, GUIComponent):
                GUIComponent.__init__(self)
                self.type=type
                self.l = eListboxPythonMultiContent()
+               self.l.setFont(0, gFont("Regular", 22))
+               self.l.setFont(1, gFont("Regular", 16))
                if type == EPG_TYPE_SINGLE:
                        self.l.setBuildFunc(self.buildSingleEntry)
                elif type == EPG_TYPE_MULTI:
@@ -116,8 +118,6 @@ class EPGList(HTMLComponent, GUIComponent):
 
        def recalcEntrySize(self):
                esize = self.l.getItemSize()
-               self.l.setFont(0, gFont("Regular", 22))
-               self.l.setFont(1, gFont("Regular", 16))
                width = esize.width()
                height = esize.height()
                if self.type == EPG_TYPE_SINGLE:
@@ -169,14 +169,18 @@ class EPGList(HTMLComponent, GUIComponent):
                r1=self.weekday_rect
                r2=self.datetime_rect
                r3=self.descr_rect
-               res = [ None ]  # no private data needed
                t = localtime(beginTime)
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]))
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r1.height(), 0, RT_HALIGN_RIGHT, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4])))
+               res = [
+                       None, # no private data needed
+                       (eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
+                       (eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r1.height(), 0, RT_HALIGN_RIGHT, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
+               ]
                if rec:
                        clock_pic = self.getClockPixmap(service, beginTime, duration, eventId)
-                       res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left(), r3.top(), 21, 21, clock_pic))
-                       res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + 25, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, EventName))
+                       res.extend((
+                               (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left(), r3.top(), 21, 21, clock_pic),
+                               (eListboxPythonMultiContent.TYPE_TEXT, r3.left() + 25, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, EventName)
+                       ))
                else:
                        res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, EventName))
                return res
@@ -186,14 +190,18 @@ class EPGList(HTMLComponent, GUIComponent):
                r1=self.weekday_rect
                r2=self.datetime_rect
                r3=self.service_rect
-               res = [ None ]  # no private data needed
                t = localtime(beginTime)
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]))
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r1.height(), 0, RT_HALIGN_RIGHT, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4])))
+               res = [
+                       None,  # no private data needed
+                       (eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]),
+                       (eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r1.height(), 0, RT_HALIGN_RIGHT, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4]))
+               ]
                if rec:
                        clock_pic = self.getClockPixmap(service, beginTime, duration, eventId)
-                       res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left(), r3.top(), 21, 21, clock_pic))
-                       res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + 25, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, service_name))
+                       res.extend((
+                               (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left(), r3.top(), 21, 21, clock_pic),
+                               (eListboxPythonMultiContent.TYPE_TEXT, r3.left() + 25, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, service_name)
+                       ))
                else:
                        res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, service_name))
                return res
@@ -207,8 +215,10 @@ class EPGList(HTMLComponent, GUIComponent):
                res = [ None ] # no private data needed
                if rec:
                        clock_pic = self.getClockPixmap(service, begTime, duration, eventId)
-                       res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width()-21, r1.height(), 0, RT_HALIGN_LEFT, service_name))
-                       res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r1.left()+r1.width()-16, r1.top(), 21, 21, clock_pic))
+                       res.extend((
+                               (eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width()-21, r1.height(), 0, RT_HALIGN_LEFT, service_name),
+                               (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r1.left()+r1.width()-16, r1.top(), 21, 21, clock_pic)
+                       ))
                else:
                        res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_LEFT, service_name))
                if begTime is not None:
@@ -217,12 +227,16 @@ class EPGList(HTMLComponent, GUIComponent):
                                end = localtime(begTime+duration)
 #                              print "begin", begin
 #                              print "end", end
-                               res.append((eListboxPythonMultiContent.TYPE_TEXT, r4.left(), r4.top(), r4.width(), r4.height(), 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER, "%02d.%02d - %02d.%02d"%(begin[3],begin[4],end[3],end[4])));
-                               res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, EventName))
+                               res.extend((
+                                       (eListboxPythonMultiContent.TYPE_TEXT, r4.left(), r4.top(), r4.width(), r4.height(), 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER, "%02d.%02d - %02d.%02d"%(begin[3],begin[4],end[3],end[4])),
+                                       (eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, EventName)
+                               ))
                        else:
                                percent = (nowTime - begTime) * 100 / duration
-                               res.append((eListboxPythonMultiContent.TYPE_PROGRESS, r2.left(), r2.top(), r2.width(), r2.height(), percent));
-                               res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, EventName))
+                               res.extend((
+                                       (eListboxPythonMultiContent.TYPE_PROGRESS, r2.left(), r2.top(), r2.width(), r2.height(), percent),
+                                       (eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT, EventName)
+                               ))
                return res
 
        def queryEPG(self, list, buildFunc=None):
@@ -234,16 +248,16 @@ class EPGList(HTMLComponent, GUIComponent):
                return [ ]
 
        def fillMultiEPG(self, services, stime=-1):
-               t = time()
+               #t = time()
                test = [ (service.ref.toString(), 0, stime) for service in services ]
                test.insert(0, 'X0RIBDTCn')
                self.list = self.queryEPG(test)
                self.l.setList(self.list)
-               print time() - t
+               #print time() - t
                self.selectionChanged()
 
        def updateMultiEPG(self, direction):
-               t = time()
+               #t = time()
                test = [ x[3] and (x[1], direction, x[3]) or (x[1], direction, 0) for x in self.list ]
                test.insert(0, 'XRIBDTCn')
                tmp = self.queryEPG(test)
@@ -255,40 +269,40 @@ class EPGList(HTMLComponent, GUIComponent):
                                        self.list[cnt]=(changecount, x[0], x[1], x[2], x[3], x[4], x[5], x[6])
                        cnt+=1
                self.l.setList(self.list)
-               print time() - t
+               #print time() - t
                self.selectionChanged()
 
        def fillSingleEPG(self, service):
-               t = time()
+               #t = time()
                test = [ 'RIBDT', (service.ref.toString(), 0, -1, -1) ]
                self.list = self.queryEPG(test)
                self.l.setList(self.list)
-               print time() - t
+               #print time() - t
                self.selectionChanged()
 
        def sortSingleEPG(self, type):
-               if len(self.list):
+               list = self.list
+               if list:
+                       event_id = self.getSelectedEventId()
                        if type == 1:
-                               event_id = self.getSelectedEventId()
-                               self.list.sort(key=lambda x: (x[4] and x[4].lower(), x[2]))
-                               self.l.setList(self.list)
-                               self.moveToEventId(event_id)
+                               list.sort(key=lambda x: (x[4] and x[4].lower(), x[2]))
                        else:
                                assert(type == 0)
-                               event_id = self.getSelectedEventId()
-                               self.list.sort(key=lambda x: x[2])
-                               self.l.setList(self.list)
-                               self.moveToEventId(event_id)
+                               list.sort(key=lambda x: x[2])
+                       self.moveToEventId(event_id)
 
        def getSelectedEventId(self):
                x = self.l.getCurrentSelection()
                return x and x[1]
 
        def moveToService(self,serviceref):
-               for x in range(len(self.list)):
-                       if self.list[x][1] == serviceref.toString():
-                               self.instance.moveSelectionTo(x)
+               index = 0
+               refstr = serviceref.toString()
+               for x in self.list:
+                       if x[1] == refstr:
+                               self.instance.moveSelectionTo(index)
                                break
+                       index += 1
                        
        def moveToEventId(self, eventId):
                index = 0
index 6c6c3c6c9a579b093acf87884e565aea0baa4541..d165e26cd66ac2187e1d716866d235c7c47df11e 100644 (file)
@@ -2,7 +2,7 @@ from os import system, listdir, statvfs, popen, makedirs, readlink, stat, major,
 from Tools.Directories import SCOPE_HDD, resolveFilename
 from Tools.CList import CList
 from SystemInfo import SystemInfo
-import string, time
+import time
 from Components.Console import Console
 
 def tryOpen(filename):
@@ -442,7 +442,7 @@ class HarddiskManager:
 
                # see if this is a harddrive
                l = len(device)
-               if l and device[l-1] not in string.digits:
+               if l and not device[l-1].isdigit():
                        error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device)
                        if not blacklisted and not removable and not is_cdrom and medium_found:
                                self.hdd.append(Harddisk(device))
@@ -456,7 +456,7 @@ class HarddiskManager:
                                self.partitions.remove(x)
                                self.on_partition_list_change("remove", x)
                l = len(device)
-               if l and device[l-1] not in string.digits:
+               if l and not device[l-1].isdigit():
                        idx = 0
                        for hdd in self.hdd:
                                if hdd.device == device:
@@ -499,7 +499,7 @@ class HarddiskManager:
                dev = devname[:3]
                part = devname[3:]
                for p in part:
-                       if p not in string.digits:
+                       if not p.isdigit():
                                return devname, 0
                return dev, part and int(part) or 0
 
index 04815c8d92573df9097e863c3ad821fd5f77e5c6..2a7bd9958de374a4d337cc7b8c49ce98b8b330b5 100755 (executable)
@@ -38,7 +38,7 @@ class HelpMenuList(GUIComponent):
                                        
                                entry.append( (actionmap, context, action, name ) )
                                        
-                               if type(help).__name__== 'list':
+                               if isinstance(help, list):
                                        self.extendedHelp = True
                                        print "extendedHelpEntry found"
                                        entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 26, 0, 0, help[0]) )
index d72e2af36f1414c8ee4cc43c1ede6845c5644e6e..6e357cd0431aa3367f10ad4a71644625b7e37ab4 100644 (file)
@@ -63,7 +63,7 @@ class PluginComponent:
                                                        continue
 
                                                # allow single entry not to be a list
-                                               if type(plugins) is not list:
+                                               if not isinstance(plugins, list):
                                                        plugins = [ plugins ]
 
                                                for p in plugins:
@@ -91,7 +91,7 @@ class PluginComponent:
        def getPlugins(self, where):
                """Get list of plugins in a specific category"""
 
-               if type(where) is not list:
+               if not isinstance(where, list):
                        where = [ where ]
                res = [ ]
 
index 86a5431d6279de86d5c1311831f744b878a76354..17c4aaa8d062b361dbbdc09871502cb4ae38285a 100644 (file)
@@ -2,41 +2,29 @@ from Plugins.Plugin import PluginDescriptor
 from Components.PluginComponent import plugins
 
 from os import path as os_path, walk as os_walk
-from string import lower
-from mimetypes import guess_type
+from mimetypes import guess_type, add_type
 
-def getExtension(file):
-       p = file.rfind('.')
-       if p == -1:
-               ext = ""
-       else:   
-               ext = file[p+1:]
-
-       return lower(ext)
+add_type("application/x-debian-package", ".ipk")
+add_type("application/ogg", ".ogg")
+add_type("audio/x-flac", ".flac")
+add_type("application/x-dream-package", ".dmpkg")
+add_type("application/x-dream-image", ".nfi")
+add_type("video/MP2T", ".ts")
+add_type("video/x-dvd-iso", ".iso")
 
 def getType(file):
        (type, _) = guess_type(file)
        if type is None:
-               # Detect some mimetypes unknown to dm7025
-               # TODO: do mimetypes.add_type once should be better
-               ext = getExtension(file)
-               if ext == "ipk":
-                       return "application/x-debian-package"
-               elif ext == "ogg":
-                       return "application/ogg"
-               elif ext == "flac":
-                       return "audio/x-flac"
-               elif ext == "dmpkg":
-                       return "application/x-dream-package"
-               elif ext == "nfi":
-                       return "application/x-dream-image"
-               elif ext == "ts":
-                       return "video/MP2T"
-               elif ext == "iso":
-                       return "video/x-dvd-iso"
-               elif file[-12:].lower() == "video_ts.ifo":
+               # Detect some unknown types
+               if file[-12:].lower() == "video_ts.ifo":
                        return "video/x-dvd"
-               elif ext == "dat" and file[-11:-6].lower() == "avseq":
+
+               p = file.rfind('.')
+               if p == -1:
+                       return None
+               ext = file[p+1:].lower()
+
+               if ext == "dat" and file[-11:-6].lower() == "avseq":
                        return "video/x-vcd"
        return type
 
index b5e44b4d3ef72a38c6b7a32e2bf4e30901726552..b0283c11fcaa65b9b69bc25f7f81668a9b21be75 100644 (file)
@@ -5,8 +5,6 @@ from skin import parseColor, parseFont
 from enigma import eListboxServiceContent, eListbox, eServiceCenter, eServiceReference, gFont, eRect
 from Tools.LoadPixmap import LoadPixmap
 
-from string import upper
-
 from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
 
 class ServiceList(HTMLComponent, GUIComponent):
@@ -113,7 +111,7 @@ class ServiceList(HTMLComponent, GUIComponent):
                # TODO fill with life
                print "Next char: "
                index = self.l.getNextBeginningWithChar(char)
-               indexup = self.l.getNextBeginningWithChar(upper(char))
+               indexup = self.l.getNextBeginningWithChar(char.upper())
                if indexup != 0:
                        if (index > indexup or index == 0):
                                index = indexup
index f84743749e79ef2167b42a35688d70eec65b20fa..a237c3644026ebcf805b6ee4119f70a3d978944c 100644 (file)
@@ -25,7 +25,7 @@ class TimerList(HTMLComponent, GUIComponent, object):
                if timer.repeated:
                        flags = timer.repeated
                        count = 0
-                       for x in range(0, 7):
+                       for x in (0, 1, 2, 3, 4, 5, 6):
                                        if (flags & 1 == 1):
                                                if (count != 0):
                                                        repeatedtext += ", "
index 99b2fba52cebc151c8afbf1a3b575084f26fd105..cf02459de26f56e614f605736d2b2b0dcdfdfb46 100644 (file)
@@ -37,7 +37,7 @@ class TimerSanityCheck:
                                        if timer.begin == self.newtimer.begin:
                                                getUnsignedDataRef1 = timer.service_ref.ref.getUnsignedData
                                                getUnsignedDataRef2 = self.newtimer.service_ref.ref.getUnsignedData
-                                               for x in range(1,5):
+                                               for x in (1, 2, 3, 4):
                                                        if getUnsignedDataRef1(x) != getUnsignedDataRef2(x):
                                                                break;
                                                else:
index 21e057f27b980054e08f5374f1912a40f2c64824..26138f200a72c21c8f8f56f8fcd73cbfdce9e654 100644 (file)
@@ -118,7 +118,7 @@ def updateChoices(sel, choices):
                defval = None
                val = int(sel.value)
                if not val in choices:
-                       tmp = choices+[]
+                       tmp = choices[:]
                        tmp.reverse()
                        for x in tmp:
                                if x < val:
index c999f2aaeb9c13718de7aa35dbb14d19fd0abf32..a813d3cadda77a8b5d9167a4d88f750248017658 100755 (executable)
@@ -1426,8 +1426,8 @@ class ConfigSubList(list, object):
 
        def getSavedValue(self):
                res = { }
-               for i in range(len(self)):
-                       sv = self[i].saved_value
+               for i, val in enumerate(self):
+                       sv = val.saved_value
                        if sv is not None:
                                res[str(i)] = sv
                return res
@@ -1448,7 +1448,7 @@ class ConfigSubList(list, object):
                        item.load()
 
        def dict(self):
-               return dict([(str(index), value) for index, value in self.enumerate()])
+               return dict([(str(index), value) for index, value in enumerate(self)])
 
 # same as ConfigSubList, just as a dictionary.
 # care must be taken that the 'key' has a proper
index b0b8197a5e606a8d692333987ebcba533f3a7237..7ea32dfed264648d6ce287aabad1aca3b3322a45 100644 (file)
@@ -41,8 +41,7 @@ class DVDProject:
                return title
 
        def saveProject(self, path):
-               import xml.dom.minidom
-               from Tools.XMLTools import elementsWithTag, mergeText, stringToXML
+               from Tools.XMLTools import stringToXML
                list = []
                list.append('<?xml version="1.0" encoding="utf-8" ?>\n')
                list.append('<DreamDVDBurnerProject>\n')
index 6df4fce74a87b075819c93ff65d72404594e5fc2..53e7b0b893e48dd164f42925ece4998185240e9f 100644 (file)
@@ -52,13 +52,13 @@ class PluginDescriptor:
        def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False):
                self.name = name
                self.internal = internal
-               if type(where) is list:
+               if isinstance(where, list):
                        self.where = where
                else:
                        self.where = [ where ]
                self.description = description
 
-               if type(icon) is str or icon is None:
+               if icon is None or isinstance(icon, str):
                        self.iconstr = icon
                        self.icon = None
                else:
@@ -69,8 +69,8 @@ class PluginDescriptor:
                self.__call__ = fnc
 
        def updateIcon(self, path):
-               if type(self.iconstr) is str:
-                       self.icon = LoadPixmap(path + "/" + self.iconstr)
+               if isinstance(self.iconstr, str):
+                       self.icon = LoadPixmap('/'.join((path, self.iconstr)))
                else:
                        self.icon = None
 
index 31a325635274e2f0ee25b0bbb29dfd405e6adf3c..bd9ea182a7040e62e02eec0a067ee07b70c8d4cb 100644 (file)
@@ -159,15 +159,19 @@ class MoviePlayer(InfoBarBase, InfoBarShowHide, \
        def handleLeave(self, how):
                self.is_closing = True
                if how == "ask":
-                       list = []
-                       list.append((_("Yes"), "quit"))
-                       if config.usage.setup_level.index >= 2: # expert+
-                               list.append((_("Yes, returning to movie list"), "movielist"))
-                       if config.usage.setup_level.index >= 2: # expert+
-                               list.append((_("Yes, and delete this movie"), "quitanddelete"))
-                       list.append((_("No"), "continue"))
-                       if config.usage.setup_level.index >= 2: # expert+
-                               list.append((_("No, but restart from begin"), "restart"))
+                       if config.usage.setup_level.index < 2: # -expert
+                               list = (
+                                       (_("Yes"), "quit"),
+                                       (_("No"), "continue")
+                               )
+                       else:
+                               list = (
+                                       (_("Yes"), "quit"),
+                                       (_("Yes, returning to movie list"), "movielist"),
+                                       (_("Yes, and delete this movie"), "quitanddelete"),
+                                       (_("No"), "continue"),
+                                       (_("No, but restart from begin"), "restart")
+                               )
 
                        from Screens.ChoiceBox import ChoiceBox
                        self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
@@ -184,26 +188,26 @@ class MoviePlayer(InfoBarBase, InfoBarShowHide, \
        def leavePlayerConfirmed(self, answer):
                answer = answer and answer[1]
 
-               if answer in ["quitanddelete", "quitanddeleteconfirmed"]:
+               if answer in ("quitanddelete", "quitanddeleteconfirmed"):
                        ref = self.session.nav.getCurrentlyPlayingServiceReference()
                        from enigma import eServiceCenter
                        serviceHandler = eServiceCenter.getInstance()
                        info = serviceHandler.info(ref)
                        name = info and info.getName(ref) or _("this recording")
 
-               if answer == "quitanddelete":
-                       from Screens.MessageBox import MessageBox
-                       self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % name)
-                       return
-
-               if answer == "quitanddeleteconfirmed":
-                       offline = serviceHandler.offlineOperations(ref)
-                       if offline.deleteFromDisk(0):
+                       if answer == "quitanddelete":
                                from Screens.MessageBox import MessageBox
-                               self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)
+                               self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % name)
                                return
 
-               if answer in ["quit", "quitanddeleteconfirmed"]:
+                       elif answer == "quitanddeleteconfirmed":
+                               offline = serviceHandler.offlineOperations(ref)
+                               if offline.deleteFromDisk(0):
+                                       from Screens.MessageBox import MessageBox
+                                       self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)
+                                       return
+
+               if answer in ("quit", "quitanddeleteconfirmed"):
                        config.movielist.last_videodir.cancel()
                        self.close()
                elif answer == "movielist":
index 2b678fbd72fe5a36b265bb9e0063e656c74e27ef..3f9fe213734e25cb1321683824ff7188feffebfb 100644 (file)
@@ -490,10 +490,9 @@ class InfoBarEPG:
                self.session.open(EPGSelection, ref)
 
        def showEventInfoPlugins(self):
-               list = []
-               for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO):
-                       list.append((p.name, boundFunction(self.runPlugin, p)))
-               if len(list):
+               list = [(p.name, boundFunction(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO)]
+
+               if list:
                        list.append((_("show single service EPG..."), self.openSingleServiceEPG))
                        self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list)
                else:
@@ -510,38 +509,40 @@ class InfoBarEPG:
                self.session.open(EPGSelection, refstr, None, eventid)
 
        def getNowNext(self):
-               self.epglist = [ ]
+               epglist = [ ]
                service = self.session.nav.getCurrentService()
                info = service and service.info()
                ptr = info and info.getEvent(0)
                if ptr:
-                       self.epglist.append(ptr)
+                       epglist.append(ptr)
                ptr = info and info.getEvent(1)
                if ptr:
-                       self.epglist.append(ptr)
+                       epglist.append(ptr)
+               self.epglist = epglist
 
        def __evEventInfoChanged(self):
                if self.is_now_next and len(self.dlg_stack) == 1:
                        self.getNowNext()
                        assert self.eventView
-                       if len(self.epglist):
+                       if self.epglist:
                                self.eventView.setEvent(self.epglist[0])
 
        def openEventView(self):
                ref = self.session.nav.getCurrentlyPlayingServiceReference()
                self.getNowNext()
-               if len(self.epglist) == 0:
+               epglist = self.epglist
+               if not epglist:
                        self.is_now_next = False
                        epg = eEPGCache.getInstance()
                        ptr = ref and ref.valid() and epg.lookupEventTime(ref, -1)
                        if ptr:
-                               self.epglist.append(ptr)
+                               epglist.append(ptr)
                                ptr = epg.lookupEventTime(ref, ptr.getBeginTime(), +1)
                                if ptr:
-                                       self.epglist.append(ptr)
+                                       epglist.append(ptr)
                else:
                        self.is_now_next = True
-               if len(self.epglist) > 0:
+               if epglist:
                        self.eventView = self.session.openWithCallback(self.closed, EventViewEPGSelect, self.epglist[0], ServiceReference(ref), self.eventViewCallback, self.openSingleServiceEPG, self.openMultiServiceEPG, self.openSimilarList)
                        self.dlg_stack.append(self.eventView)
                else:
@@ -549,11 +550,12 @@ class InfoBarEPG:
                        self.openMultiServiceEPG(False)
 
        def eventViewCallback(self, setEvent, setService, val): #used for now/next displaying
-               if len(self.epglist) > 1:
-                       tmp = self.epglist[0]
-                       self.epglist[0]=self.epglist[1]
-                       self.epglist[1]=tmp
-                       setEvent(self.epglist[0])
+               epglist = self.epglist
+               if len(epglist) > 1:
+                       tmp = epglist[0]
+                       epglist[0]=epglist[1]
+                       epglist[1]=tmp
+                       setEvent(epglist[0])
 
 class InfoBarRdsDecoder:
        """provides RDS and Rass support/display"""
@@ -712,7 +714,7 @@ class InfoBarSeek:
                return False
 
        def getLower(self, n, lst):
-               lst = lst+[]
+               lst = lst[:]
                lst.reverse()
                for x in lst:
                        if x < n:
@@ -782,7 +784,7 @@ class InfoBarSeek:
                oldstate = self.seekstate
                self.seekstate = state
 
-               for i in range(3):
+               for i in (0, 1, 2):
                        if oldstate[i] != self.seekstate[i]:
                                (self.session.nav.pause, pauseable.setFastForward, pauseable.setSlowMotion)[i](self.seekstate[i])
 
@@ -1270,8 +1272,8 @@ class InfoBarExtensions:
                                        extensionsList.remove(extension)
                                else:
                                        extensionsList.remove(extension)
-               for x in extensionsList:
-                       list.append((x[0](), x))
+               list.extend([(x[0](), x) for x in extensionsList])
+
                keys += [""] * len(extensionsList)
                self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list, keys = keys)
 
@@ -1291,10 +1293,7 @@ class InfoBarPlugins:
                return name
 
        def getPluginList(self):
-               list = []
-               for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU):
-                       list.append(((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None))
-               return list
+               return [((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU)]
 
        def runPlugin(self, plugin):
                if isinstance(self, InfoBarChannelSelection):
@@ -1308,10 +1307,7 @@ class InfoBarJobman:
                self.addExtension(extension = self.getJobList, type = InfoBarExtensions.EXTENSION_LIST)
 
        def getJobList(self):
-               list = []
-               for job in job_manager.getPendingJobs():
-                       list.append(((boundFunction(self.getJobName, job), boundFunction(self.showJobView, job), lambda: True), None))
-               return list
+               return [((boundFunction(self.getJobName, job), boundFunction(self.showJobView, job), lambda: True), None) for job in job_manager.getPendingJobs()]
 
        def getJobName(self, job):
                return "%s: %s (%d%%)" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
@@ -1469,7 +1465,7 @@ class InfoBarInstantRecord:
                                simulTimerList = self.session.nav.RecordTimer.record(recording)
                                if simulTimerList is not None:  # conflict with other recording
                                        name = simulTimerList[1].name
-                                       name_date = name + strftime(" %c", localtime(simulTimerList[1].begin))
+                                       name_date = ' '.join((name, strftime('%c', localtime(simulTimerList[1].begin))))
                                        print "[TIMER] conflicts with", name_date
                                        recording.autoincrease = True   # start with max available length, then increment
                                        if recording.setAutoincreaseEnd():
@@ -1551,10 +1547,11 @@ class InfoBarInstantRecord:
        def inputCallback(self, value):
                if value is not None:
                        print "stopping recording after", int(value), "minutes."
+                       entry = self.recording[self.selectedEntry]
                        if int(value) != 0:
-                               self.recording[self.selectedEntry].autoincrease = False
-                       self.recording[self.selectedEntry].end = int(time()) + 60 * int(value)
-                       self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry])
+                               entry.autoincrease = False
+                       entry.end = int(time()) + 60 * int(value)
+                       self.session.nav.RecordTimer.timeChanged(entry)
 
        def instantRecord(self):
                dir = config.movielist.last_videodir.value
@@ -1570,22 +1567,22 @@ class InfoBarInstantRecord:
                if self.isInstantRecordRunning():
                        self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, \
                                title=_("A recording is currently running.\nWhat do you want to do?"), \
-                               list=[(_("add recording (stop after current event)"), "event"), \
+                               list=((_("add recording (stop after current event)"), "event"), \
                                (_("add recording (enter recording duration)"), "manualduration"), \
                                (_("add recording (enter recording endtime)"), "manualendtime"), \
                                (_("add recording (indefinitely)"), "indefinitely"), \
                                (_("change recording (duration)"), "changeduration"), \
                                (_("change recording (endtime)"), "changeendtime"), \
                                (_("stop recording"), "stop"), \
-                               (_("do nothing"), "no")])
+                               (_("do nothing"), "no")))
                else:
                        self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, \
                                title=_("Start recording?"), \
-                               list=[(_("add recording (stop after current event)"), "event"), \
+                               list=((_("add recording (stop after current event)"), "event"), \
                                (_("add recording (enter recording duration)"), "manualduration"), \
                                (_("add recording (enter recording endtime)"), "manualendtime"), \
                                (_("add recording (indefinitely)"), "indefinitely"), \
-                               (_("don't record"), "no")])
+                               (_("don't record"), "no")))
 
 from Tools.ISO639 import LanguageCodes
 
@@ -1604,8 +1601,9 @@ class InfoBarAudioSelection:
                if n > 0:
                        self.audioChannel = service.audioChannel()
 
-                       for x in range(n):
-                               i = audio.getTrackInfo(x)
+                       idx = 0
+                       while idx < n:
+                               i = audio.getTrackInfo(idx)
                                language = i.getLanguage()
                                description = i.getDescription()
 
@@ -1617,7 +1615,8 @@ class InfoBarAudioSelection:
                                else:
                                        description = language
 
-                               tlist.append((description, x))
+                               tlist.append((description, idx))
+                               idx += 1
 
                        tlist.sort(key=lambda x: x[0])
 
@@ -1664,7 +1663,7 @@ class InfoBarAudioSelection:
                                if audio[1] == "mode":
                                        keys = ["red", "green", "yellow"]
                                        selection = self.audioChannel.getCurrentChannel()
-                                       tlist = [(_("left"), 0), (_("stereo"), 1), (_("right"), 2)]
+                                       tlist = ((_("left"), 0), (_("stereo"), 1), (_("right"), 2))
                                        self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys)
                        else:
                                del self.audioChannel
@@ -1719,9 +1718,12 @@ class InfoBarSubserviceSelection:
                if n and n > 0:
                        selection = -1
                        ref = self.session.nav.getCurrentlyPlayingServiceReference()
-                       for x in range(n):
-                               if subservices.getSubservice(x).toString() == ref.toString():
-                                       selection = x
+                       idx = 0
+                       while idx < n:
+                               if subservices.getSubservice(idx).toString() == ref.toString():
+                                       selection = idx
+                                       break
+                               idx += 1
                        if selection != -1:
                                selection += direction
                                if selection >= n:
@@ -1743,11 +1745,13 @@ class InfoBarSubserviceSelection:
                if n and n > 0:
                        ref = self.session.nav.getCurrentlyPlayingServiceReference()
                        tlist = []
-                       for x in range(n):
-                               i = subservices.getSubservice(x)
+                       idx = 0
+                       while idx < n:
+                               i = subservices.getSubservice(idx)
                                if i.toString() == ref.toString():
-                                       selection = x
+                                       selection = idx
                                tlist.append((i.getName(), i))
+                               idx += 1
 
                        if self.bouquets and len(self.bouquets):
                                keys = ["red", "blue", "",  "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
@@ -1824,10 +1828,11 @@ class InfoBarNotifications:
                        self.checkNotifications()
 
        def checkNotifications(self):
-               if len(Notifications.notifications):
-                       n = Notifications.notifications[0]
+               notifications = Notifications.notifications
+               if notifications:
+                       n = notifications[0]
 
-                       Notifications.notifications = Notifications.notifications[1:]
+                       del notifications[0]
                        cb = n[0]
 
                        if n[3].has_key("onSessionOpenCallback"):
@@ -1980,7 +1985,7 @@ class InfoBarCueSheetSupport:
                        if bestdiff >= 0:
                                nearest = [0, False]
                for cp in self.cut_list:
-                       if beforecut and cp[1] in [self.CUT_TYPE_IN, self.CUT_TYPE_OUT]:
+                       if beforecut and cp[1] in (self.CUT_TYPE_IN, self.CUT_TYPE_OUT):
                                beforecut = False
                                if cp[1] == self.CUT_TYPE_IN:  # Start is here, disregard previous marks
                                        diff = cmp(cp[0] - pts)
@@ -1989,7 +1994,7 @@ class InfoBarCueSheetSupport:
                                                bestdiff = diff
                                        else:
                                                nearest = None
-                       if cp[1] in [self.CUT_TYPE_MARK, self.CUT_TYPE_LAST]:
+                       if cp[1] in (self.CUT_TYPE_MARK, self.CUT_TYPE_LAST):
                                diff = cmp(cp[0] - pts)
                                if diff >= 0 and (nearest is None or bestdiff > diff):
                                        nearest = cp
index 68d4f772ca09b79ce78d36ffed764e2a2155a59f..389d3624716402d3b84fd3dc05e06d3e8ccfecff 100644 (file)
@@ -326,7 +326,7 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen):
 
        def selectConfirmed(self, ret):
                if ret:
-                       ret = ''.join([self.getPreferredFolder(), self.filename])
+                       ret = ''.join((self.getPreferredFolder(), self.filename))
                        if self.realBookmarks:
                                if self.autoAdd and not ret in self.bookmarks:
                                        self.bookmarks.append(self.getPreferredFolder())
@@ -390,23 +390,28 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen):
                # Write Combination of Folder & Filename when Folder is valid
                currFolder = self.getPreferredFolder()
                if currFolder is not None:
-                       self["target"].setText(''.join([currFolder, self.filename]))
+                       self["target"].setText(''.join((currFolder, self.filename)))
                # Display a Warning otherwise
                else:
                        self["target"].setText(_("Invalid Location"))
 
        def showMenu(self):
                if not self.userMode and self.realBookmarks:
-                       menu = []
                        if self.currList == "filelist":
-                               menu.append((_("switch to bookmarks"), self.switchToBookList))
-                               menu.append((_("add bookmark"), self.addRemoveBookmark))
+                               menu = [
+                                       (_("switch to bookmarks"), self.switchToBookList),
+                                       (_("add bookmark"), self.addRemoveBookmark)
+                               ]
                                if self.editDir:
-                                       menu.append((_("create directory"), self.createDir))
-                                       menu.append((_("remove directory"), self.removeDir))
+                                       menu.extend((
+                                               (_("create directory"), self.createDir),
+                                               (_("remove directory"), self.removeDir)
+                                       ))
                        else:
-                               menu.append((_("switch to filelist"), self.switchToFileList))
-                               menu.append((_("remove bookmark"), self.addRemoveBookmark))
+                               menu = (
+                                       (_("switch to filelist"), self.switchToFileList)
+                                       (_("remove bookmark"), self.addRemoveBookmark)
+                               )
 
                        self.session.openWithCallback(
                                self.menuCallback,
index 520d6d7a4b7bc9527c8d0dc7d6f0d5994add86b7..0f6ee746b773bbd35a108c827df422f838de05a5 100644 (file)
@@ -106,17 +106,18 @@ class PluginDownloadBrowser(Screen):
                if sel is None:
                        return
 
-               if type(sel[0]) is str: # category
-                       if sel[0] in self.expanded:
-                               self.expanded.remove(sel[0])
+               sel = sel[0]
+               if isinstance(sel, str): # category
+                       if sel in self.expanded:
+                               self.expanded.remove(sel)
                        else:
-                               self.expanded.append(sel[0])
+                               self.expanded.append(sel)
                        self.updateList()
                else:
                        if self.type == self.DOWNLOAD:
-                               self.session.openWithCallback(self.runInstall, MessageBox, _("Do you really want to download\nthe plugin \"%s\"?") % sel[0].name)
+                               self.session.openWithCallback(self.runInstall, MessageBox, _("Do you really want to download\nthe plugin \"%s\"?") % sel.name)
                        elif self.type == self.REMOVE:
-                               self.session.openWithCallback(self.runInstall, MessageBox, _("Do you really want to REMOVE\nthe plugin \"%s\"?") % sel[0].name)
+                               self.session.openWithCallback(self.runInstall, MessageBox, _("Do you really want to REMOVE\nthe plugin \"%s\"?") % sel.name)
 
        def runInstall(self, val):
                if val:
index e07b32082d514bfab7f4cee03461f781b75499a6..df8af4b4173881e42bbb34ebeb00b993d0c38478 100644 (file)
@@ -25,7 +25,7 @@ def ServiceInfoListEntry(a, b, valueType=TYPE_TEXT, param=4):
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 30, 0, RT_HALIGN_LEFT, ""))
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 25, 0, RT_HALIGN_LEFT, a))
        print "b:", b
-       if type(b) is not str:
+       if not isinstance(b, str):
                if valueType == TYPE_VALUE_HEX:
                        b = ("0x%0" + str(param) + "x") % to_unsigned(b)
                elif valueType == TYPE_VALUE_DEC:
index bb2d3c763e2dfaac1bc08ea1f6b3057292eeaf87..cdff4c5ba36f22fe803727d93a966694adb48e86 100644 (file)
@@ -95,10 +95,11 @@ class TimerEditList(Screen):
                        else:
                                if t.isRunning():
                                        if t.repeated:
-                                               list = []
-                                               list.append((_("Stop current event but not coming events"), "stoponlycurrent"))
-                                               list.append((_("Stop current event and disable coming events"), "stopall"))
-                                               list.append((_("Don't stop current event but disable coming events"), "stoponlycoming"))
+                                               list = (
+                                                       (_("Stop current event but not coming events"), "stoponlycurrent"),
+                                                       (_("Stop current event and disable coming events"), "stopall"),
+                                                       (_("Don't stop current event but disable coming events"), "stoponlycoming")
+                                               )
                                                self.session.openWithCallback(boundFunction(self.runningEventCallback, t), ChoiceBox, title=_("Repeating event currently recording... What do you want to do?"), list = list)
                                else:
                                        t.disable()
index 0544eff1ca5927185df1a09d55ec144961ae7b5f..92a16af8f0b27432cfe5683d98412a34503651a3 100644 (file)
@@ -97,7 +97,7 @@ class TimerEntry(Screen, ConfigListScreen):
                        self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
                        self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
                        self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
-                       self.timerentry_tags = self.timer.tags + []
+                       self.timerentry_tags = self.timer.tags[:]
                        self.timerentry_tagsset = ConfigSelection(choices = [len(self.timerentry_tags) == 0 and "None" or " ".join(self.timerentry_tags)])
 
                        self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
index feba8ac224672bad58893be5560c0d070671c8cc..2326b9156ca5fc4c862b941c16e49a830ab5e375 100755 (executable)
@@ -1,7 +1,5 @@
 from Screen import Screen
 
-import string
-
 from Screens.HelpMenu import HelpableScreen
 from Components.config import config, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS
 
@@ -87,9 +85,9 @@ class Wizard(Screen):
                                        timeoutstep = ''
                                self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "code_async": "", "codeafter_async": "", "nextstep": nextstep}
                        elif (name == "text"):
-                               self.wizard[self.lastStep]["text"] = string.replace(str(attrs.get('value')), "\\n", "\n")
+                               self.wizard[self.lastStep]["text"] = str(attrs.get('value')).replace("\\n", "\n")
                        elif (name == "displaytext"):
-                               self.wizard[self.lastStep]["displaytext"] = string.replace(str(attrs.get('value')), "\\n", "\n")
+                               self.wizard[self.lastStep]["displaytext"] = str(attrs.get('value')).replace("\\n", "\n")
                        elif (name == "list"):
                                if (attrs.has_key('type')):
                                        if attrs["type"] == "dynamic":
index 0d238b3043a2a5041d98d6e613677af1425e571f..7dcd5876e9660c16911520512146b15b3a036b1f 100644 (file)
@@ -172,7 +172,7 @@ def getRecordingFilename(basename, dirname = None):
                filename += c
 
        if dirname is not None:
-               filename = ''.join([dirname, filename])
+               filename = ''.join((dirname, filename))
 
        i = 0
        while True:
index b4d4e401429ed46fa081a27cd8f605079a277a13..d03a1d97cc802c345a835b16949bc1da1195ec2d 100644 (file)
@@ -3,7 +3,7 @@ from enigma import ePythonOutput
 
 class EnigmaOutput:
        def write(self, data):
-               if type(data) is unicode:
+               if isinstance(data, unicode):
                        data = data.encode("UTF-8")
                ePythonOutput(data)
 
diff --git a/skin.py b/skin.py
index 011110a293300b6f2c20d20d43b392fedb19c651..c8805f01d74b8703c97ab2f6f667826bded5db87 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -14,8 +14,6 @@ from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCO
 from Tools.Import import my_import
 from Tools.LoadPixmap import LoadPixmap
 
-from Tools.XMLTools import mergeText
-
 colorNames = dict()
 
 def dump(x, i=0):
@@ -474,13 +472,12 @@ def readSkin(screen, skin, names, desktop):
                                ctype = converter.get('type')
                                assert ctype, "'convert'-tag needs a 'type'-attribute"
                                #print "Converter:", ctype
-                               #parms = mergeText(converter.childNodes).strip()
                                try:
                                        parms = converter.text.strip()
                                except:
                                        parms = ""
-                               #print "Params:", ctype
-                               converter_class = my_import('.'.join(["Components", "Converter", ctype])).__dict__.get(ctype)
+                               #print "Params:", parms
+                               converter_class = my_import('.'.join(("Components", "Converter", ctype))).__dict__.get(ctype)
 
                                c = None
 
@@ -497,7 +494,7 @@ def readSkin(screen, skin, names, desktop):
 
                                source = c
 
-                       renderer_class = my_import('.'.join(["Components", "Renderer", wrender])).__dict__.get(wrender)
+                       renderer_class = my_import('.'.join(("Components", "Renderer", wrender))).__dict__.get(wrender)
 
                        renderer = renderer_class() # instantiate renderer
 
index 750a8c0300e2537c90628fd4c1e23f07a3deeeff..fd5bb5afe00e6655ce1c0ccc28df57a06d6a95c4 100644 (file)
--- a/timer.py
+++ b/timer.py
@@ -66,7 +66,7 @@ class TimerEntry:
 
                        day = []
                        flags = self.repeated
-                       for x in range(0, 7):
+                       for x in (0, 1, 2, 3, 4, 5, 6):
                                if (flags & 1 == 1):
                                        day.append(0)
                                        print "Day: " + str(x)