From ed40f6f85c9c07c3c1224ae20601082c0309a631 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Tue, 19 Dec 2006 02:12:57 +0000 Subject: some python import cleanups lesser swig overhead --- lib/python/Plugins/Extensions/CutListEditor/plugin.py | 4 ++-- lib/python/Plugins/Extensions/FileManager/plugin.py | 9 +-------- lib/python/Plugins/Extensions/MediaScanner/plugin.py | 12 ++++++------ lib/python/Plugins/Extensions/PicturePlayer/plugin.py | 4 +--- lib/python/Plugins/Extensions/SimpleRSS/plugin.py | 4 ++-- lib/python/Plugins/Extensions/TuxboxPlugins/plugin.py | 9 ++------- 6 files changed, 14 insertions(+), 28 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index 28ed7d64..ba946f98 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -5,11 +5,11 @@ from Screens.MessageBox import MessageBox from Components.ServicePosition import ServicePositionGauge from Components.ActionMap import HelpableActionMap from Components.MenuList import MenuList -from Components.MultiContent import MultiContentEntryText, RT_HALIGN_RIGHT +from Components.MultiContent import MultiContentEntryText from Components.ServiceEventTracker import ServiceEventTracker from Screens.InfoBarGenerics import InfoBarSeek, InfoBarCueSheetSupport from Components.GUIComponent import GUIComponent -from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService +from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService, RT_HALIGN_RIGHT from Screens.FixedMenu import FixedMenu import bisect diff --git a/lib/python/Plugins/Extensions/FileManager/plugin.py b/lib/python/Plugins/Extensions/FileManager/plugin.py index d2b19719..3cbef343 100644 --- a/lib/python/Plugins/Extensions/FileManager/plugin.py +++ b/lib/python/Plugins/Extensions/FileManager/plugin.py @@ -1,16 +1,9 @@ -from enigma import * from Screens.Screen import Screen -from Screens.MessageBox import MessageBox from Components.ActionMap import NumberActionMap -from Components.Label import Label -from Components.Input import Input -from Components.GUIComponent import * from Components.Pixmap import Pixmap from Components.FileList import FileEntryComponent, FileList from Plugins.Plugin import PluginDescriptor -import os - class FileManager(Screen): skin = """ @@ -52,7 +45,7 @@ class FileManager(Screen): self["text"].right() def ok(self): - + if self["list"].canDescent(): # isDir self["list"].descent() else: diff --git a/lib/python/Plugins/Extensions/MediaScanner/plugin.py b/lib/python/Plugins/Extensions/MediaScanner/plugin.py index 5fc35ee1..71f2f1c8 100644 --- a/lib/python/Plugins/Extensions/MediaScanner/plugin.py +++ b/lib/python/Plugins/Extensions/MediaScanner/plugin.py @@ -1,6 +1,6 @@ from Plugins.Plugin import PluginDescriptor -import os -import string +from os import path as os_path, walk as os_walk +from string import lower def getExtension(file): p = file.rfind('.') @@ -9,7 +9,7 @@ def getExtension(file): else: ext = file[p+1:] - return string.lower(ext) + return lower(ext) class Scanner: def __init__(self, name, extensions = [], paths_to_scan = [], description = "", openfnc = None): @@ -128,12 +128,12 @@ def ScanDevice(mountpoint): # now scan the paths for p in paths_to_scan: - path = os.path.join(mountpoint, p.path) + path = os_path.join(mountpoint, p.path) - for root, dirs, files in os.walk(path): + for root, dirs, files in os_walk(path): for f in files: ext = getExtension(f) - pathname = os.path.join(root, f) + pathname = os_path.join(root, f) for s in scanner: s.handleFile(res, pathname, ext) diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index 8db85ced..34e8c10f 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -1,5 +1,4 @@ -from enigma import * - +from enigma import eTimer, loadPic, getExif from Screens.Screen import Screen from Screens.ServiceInfo import ServiceInfoList, ServiceInfoListEntry from Components.ActionMap import ActionMap, NumberActionMap @@ -15,7 +14,6 @@ from Components.AVSwitch import AVSwitch from Plugins.Plugin import PluginDescriptor - config.pic = ConfigSubsection() config.pic.slidetime = ConfigInteger(default=10, limits=(5, 60)) config.pic.resize = ConfigSelection(default="0", choices = [("0", _("simple")), ("1", _("better"))]) diff --git a/lib/python/Plugins/Extensions/SimpleRSS/plugin.py b/lib/python/Plugins/Extensions/SimpleRSS/plugin.py index 88db4857..49da5e63 100644 --- a/lib/python/Plugins/Extensions/SimpleRSS/plugin.py +++ b/lib/python/Plugins/Extensions/SimpleRSS/plugin.py @@ -6,9 +6,9 @@ from Screens.MessageBox import MessageBox from Components.ActionMap import ActionMap from Components.GUIComponent import GUIComponent from Components.Label import Label -from Components.MultiContent import MultiContentEntryText, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_WRAP +from Components.MultiContent import MultiContentEntryText from Plugins.Plugin import PluginDescriptor -from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation +from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_WRAP from twisted.web import server from twisted.web.resource import Resource diff --git a/lib/python/Plugins/Extensions/TuxboxPlugins/plugin.py b/lib/python/Plugins/Extensions/TuxboxPlugins/plugin.py index 8d4e1581..5142d16b 100644 --- a/lib/python/Plugins/Extensions/TuxboxPlugins/plugin.py +++ b/lib/python/Plugins/Extensions/TuxboxPlugins/plugin.py @@ -1,14 +1,9 @@ # must be fixed for the new plugin interface -from enigma import * -from Screens.Screen import Screen -from Screens.MessageBox import MessageBox -from Components.ActionMap import ActionMap -from Components.Label import Label from Tools.BoundFunction import boundFunction from Tools.Directories import pathExists from Plugins.Plugin import PluginDescriptor -import os +from os import listdir TUXBOX_PLUGINS_PATH = "/usr/lib/tuxbox/plugins/" @@ -16,7 +11,7 @@ def getPlugins(): pluginlist = [] if pathExists(TUXBOX_PLUGINS_PATH): - dir = os.listdir(TUXBOX_PLUGINS_PATH) + dir = listdir(TUXBOX_PLUGINS_PATH) for x in dir: if x[-3:] == "cfg": -- cgit v1.2.3