aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2009-02-24 20:56:21 +0100
committerghost <andreas.monzner@multimedia-labs.de>2009-02-24 20:56:21 +0100
commit574f425cc1ebece0aa5f09fb77a8cb7ad0310a1f (patch)
treee2ded87bb0e66cd9e88ae8d4ffc3846f788343bf /lib/python/Plugins
parent5a6bde9419249a78c957093e0cc438d7c6eeb46c (diff)
downloadenigma2-574f425cc1ebece0aa5f09fb77a8cb7ad0310a1f.tar.gz
enigma2-574f425cc1ebece0aa5f09fb77a8cb7ad0310a1f.zip
small optimizations and cleanups by Moritz Venn
Diffstat (limited to 'lib/python/Plugins')
-rw-r--r--lib/python/Plugins/Extensions/CutListEditor/plugin.py6
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py7
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/plugin.py5
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/plugin.py2
-rw-r--r--lib/python/Plugins/Extensions/FileManager/plugin.py5
-rw-r--r--lib/python/Plugins/Extensions/MediaPlayer/plugin.py8
-rwxr-xr-xlib/python/Plugins/Extensions/MediaScanner/plugin.py10
-rw-r--r--lib/python/Plugins/Extensions/PicturePlayer/plugin.py2
-rw-r--r--lib/python/Plugins/Extensions/SocketMMI/plugin.py2
-rw-r--r--lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py2
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py2
-rw-r--r--lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py4
-rw-r--r--lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py2
-rw-r--r--lib/python/Plugins/SystemPlugins/Videomode/plugin.py13
14 files changed, 36 insertions, 34 deletions
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/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py
index 40b85b70..1c2099fb 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py
@@ -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 6a8ffc6f..80629c5d 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
@@ -705,7 +705,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/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 e81750ba..e26c65d4 100644
--- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
@@ -991,7 +991,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"],
@@ -1001,7 +1001,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"],
@@ -1010,7 +1010,7 @@ def filescan(**kwargs):
ScanPath(path = "", with_subdirs = False),
],
name = "Music",
- description = "Play Music...",
+ description = _("Play Music..."),
openfnc = filescan_open,
)]
try:
@@ -1022,7 +1022,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/SystemPlugins/DiseqcTester/plugin.py b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py
index cbd6bc89..a4793949 100644
--- a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py
@@ -623,7 +623,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/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/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 095e94c0..8f8bea09 100644
--- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py
+++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py
@@ -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..5a7dfd1b 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))