aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins/SystemPlugins
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-19 02:12:57 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-19 02:12:57 +0000
commited40f6f85c9c07c3c1224ae20601082c0309a631 (patch)
tree4082515a3e85107bd4a278b6613857b58da1770f /lib/python/Plugins/SystemPlugins
parentb3658b04216ed3974047b4c4ec885ee0161d9267 (diff)
downloadenigma2-ed40f6f85c9c07c3c1224ae20601082c0309a631.tar.gz
enigma2-ed40f6f85c9c07c3c1224ae20601082c0309a631.zip
some python import cleanups
lesser swig overhead
Diffstat (limited to 'lib/python/Plugins/SystemPlugins')
-rw-r--r--lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py25
-rw-r--r--lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py21
-rw-r--r--lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py16
-rw-r--r--lib/python/Plugins/SystemPlugins/Satfinder/plugin.py14
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SkinSelector/plugin.py11
-rw-r--r--lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py19
6 files changed, 40 insertions, 66 deletions
diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py
index fae1f26d..05a2824a 100644
--- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py
@@ -1,9 +1,7 @@
-from enigma import *
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.Console import Console
from Components.ActionMap import ActionMap, NumberActionMap
-from Components.Pixmap import *
from Components.Pixmap import Pixmap
from Components.Label import Label
from Components.MenuList import MenuList
@@ -13,10 +11,9 @@ from Plugins.Plugin import PluginDescriptor
from Tools.NumericalTextInput import *
from Tools.Directories import *
-import os
-import string
-import time
-import datetime
+from os import path, makedirs, listdir
+from time import localtime
+from datetime import date
plugin_path = ""
@@ -116,8 +113,8 @@ class BackupSetup(Screen):
def createBackupfolders(self):
self.path = BackupPath[self.backup.location.value]
print "Creating Backup Folder if not already there..."
- if (os.path.exists(self.path) == False):
- os.makedirs(self.path)
+ if (path.exists(self.path) == False):
+ makedirs(self.path)
def Backup(self):
print "this will start the backup now!"
@@ -129,10 +126,10 @@ class BackupSetup(Screen):
def runBackup(self, result):
if result:
- if os.path.ismount(MountPoints[self.backup.location.value]):
+ if path.ismount(MountPoints[self.backup.location.value]):
self.createBackupfolders()
- d = time.localtime()
- dt = datetime.date(d.tm_year, d.tm_mon, d.tm_mday)
+ d = localtime()
+ dt = date(d.tm_year, d.tm_mon, d.tm_mday)
self.path = BackupPath[self.backup.location.value]
if self.backup.type.value == "full":
print "Backup Mode: Full"
@@ -194,9 +191,9 @@ class RestoreMenu(Screen):
def fill_list(self):
self.flist = []
self.path = BackupPath[self.backup.location.value]
- if (os.path.exists(self.path) == False):
- os.makedirs(self.path)
- for file in os.listdir(self.path):
+ if (path.exists(self.path) == False):
+ makedirs(self.path)
+ for file in listdir(self.path):
if (file.endswith(".tar.gz")):
self.flist.append((file))
self.entry = True
diff --git a/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py
index 72279c1a..0f6c4e84 100644
--- a/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py
@@ -1,4 +1,4 @@
-from enigma import *
+from enigma import RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, eTimer, gFont
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap, NumberActionMap
@@ -10,7 +10,7 @@ from Components.Input import Input
from Screens.Console import Console
from Plugins.Plugin import PluginDescriptor
-import os
+from os import popen
class Upgrade(Screen):
skin = """
@@ -43,7 +43,7 @@ class Upgrade(Screen):
self.close()
def doUpdateDelay(self):
- lines = os.popen("ipkg update && ipkg upgrade -force-defaults -force-overwrite", "r").readlines()
+ lines = popen("ipkg update && ipkg upgrade -force-defaults -force-overwrite", "r").readlines()
string = ""
for x in lines:
string += x
@@ -58,15 +58,6 @@ class Upgrade(Screen):
else:
self.close()
-RT_HALIGN_LEFT = 0
-RT_HALIGN_RIGHT = 1
-RT_HALIGN_CENTER = 2
-RT_HALIGN_BLOCK = 4
-
-RT_VALIGN_TOP = 0
-RT_VALIGN_CENTER = 8
-RT_VALIGN_BOTTOM = 16
-
def PacketEntryComponent(packet):
res = [ packet ]
@@ -122,13 +113,13 @@ class Ipkg(Screen):
def fillPacketList(self):
- lines = os.popen("ipkg list", "r").readlines()
+ lines = popen("ipkg list", "r").readlines()
packetlist = []
for x in lines:
split = x.split(' - ')
packetlist.append([split[0].strip(), split[1].strip()])
- lines = os.popen("ipkg list_installed", "r").readlines()
+ lines = popen("ipkg list_installed", "r").readlines()
installedlist = {}
for x in lines:
@@ -151,7 +142,7 @@ class Ipkg(Screen):
self.close()
def doUpdateDelay(self):
- lines = os.popen("ipkg update && ipkg upgrade", "r").readlines()
+ lines = popen("ipkg update && ipkg upgrade", "r").readlines()
string = ""
for x in lines:
string += x
diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
index 4d9e611d..db16f77f 100644
--- a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
@@ -1,4 +1,4 @@
-from enigma import eTimer, eDVBSatelliteEquipmentControl, eDVBResourceManager, eDVBDiseqcCommand, eDVBResourceManagerPtr, iDVBChannelPtr, iDVBFrontendPtr, iDVBFrontend, eDVBFrontendParametersSatellite, eDVBFrontendParameters
+from enigma import eTimer, eDVBSatelliteEquipmentControl, eDVBResourceManager, eDVBDiseqcCommand, eDVBFrontendParametersSatellite, eDVBFrontendParameters
from Screens.Screen import Screen
from Screens.ScanSetup import ScanSetup
from Screens.MessageBox import MessageBox
@@ -140,12 +140,12 @@ class PositionerSetup(Screen):
return self.frontend
def openFrontend(self):
- res_mgr = eDVBResourceManagerPtr()
- if eDVBResourceManager.getInstance(res_mgr) == 0:
- self.raw_channel = iDVBChannelPtr()
- if res_mgr.allocateRawChannel(self.raw_channel, self.feid) == 0:
- self.frontend = iDVBFrontendPtr()
- if self.raw_channel.getFrontend(self.frontend) == 0:
+ res_mgr = eDVBResourceManager.getInstance()
+ if res_mgr:
+ self.raw_channel = res_mgr.allocateRawChannel(self.feid)
+ if self.raw_channel:
+ self.frontend = self.raw_channel.getFrontend(self.frontend)
+ if self.frontend:
return True
else:
print "getFrontend failed"
@@ -446,8 +446,8 @@ class TunerScreen(ScanSetup):
self.createSetup()
def createConfig(self, foo):
+ global tuning
if not tuning:
- global tuning
tuning = ConfigSubsection()
tuning.type = ConfigSelection(
default = "manual_transponder",
diff --git a/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py b/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py
index 6325a82f..89fbc4bb 100644
--- a/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py
@@ -1,4 +1,4 @@
-from enigma import eTimer, eDVBSatelliteEquipmentControl, eDVBResourceManager, eDVBDiseqcCommand, eDVBResourceManagerPtr, iDVBChannelPtr, iDVBFrontendPtr, iDVBFrontend, eDVBFrontendParametersSatellite, eDVBFrontendParameters
+from enigma import eTimer, eDVBSatelliteEquipmentControl, eDVBResourceManager, eDVBDiseqcCommand, eDVBFrontendParametersSatellite, eDVBFrontendParameters
from Screens.Screen import Screen
from Screens.ScanSetup import ScanSetup
from Screens.MessageBox import MessageBox
@@ -56,12 +56,12 @@ class Satfinder(ScanSetup):
</screen>"""
def openFrontend(self):
- res_mgr = eDVBResourceManagerPtr()
- if eDVBResourceManager.getInstance(res_mgr) == 0:
- self.raw_channel = iDVBChannelPtr()
- if res_mgr.allocateRawChannel(self.raw_channel, self.feid) == 0:
- self.frontend = iDVBFrontendPtr()
- if self.raw_channel.getFrontend(self.frontend) == 0:
+ res_mgr = eDVBResourceManager.getInstance()
+ if res_mgr:
+ self.raw_channel = res_mgr.allocateRawChannel(self.feid)
+ if self.raw_channel:
+ self.frontend = self.raw_channel.getFrontend()
+ if self.frontend:
return True
else:
print "getFrontend failed"
diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
index 844b75f9..18ffd994 100755
--- a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
@@ -1,22 +1,17 @@
# -*- coding: iso-8859-1 -*-
# (c) 2006 Stephan Reichholf
# This Software is Free, use it where you want, when you want for whatever you want and modify it if you want but don't remove my copyright!
-
-from enigma import *
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import NumberActionMap
from Components.Pixmap import Pixmap
-from Components.GUIComponent import *
from Components.MenuList import MenuList
from Plugins.Plugin import PluginDescriptor
-
from Components.config import config
from Tools.Directories import SCOPE_SKIN
-
from Components.config import config
-import os, sys
+from os import path, walk
class SkinSelector(Screen):
# for i18n:
@@ -40,7 +35,7 @@ class SkinSelector(Screen):
self.session = session
self.previewPath = ""
- os.path.walk(self.root, self.find, "")
+ path.walk(self.root, self.find, "")
self.skinlist.sort()
self["SkinList"] = MenuList(self.skinlist)
@@ -107,7 +102,7 @@ class SkinSelector(Screen):
else:
pngpath = self.root+self["SkinList"].getCurrent()+"/prev.png"
- if not os.path.exists(pngpath):
+ if not path.exists(pngpath):
# FIXME: don't use hardcoded path
pngpath = "/usr/lib/enigma2/python/Plugins/SystemPlugins/SkinSelector/noprev.png"
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py
index dc494e6f..b5034b63 100644
--- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py
@@ -1,4 +1,4 @@
-from enigma import eTimer, quitMainloop
+from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap, NumberActionMap
@@ -14,7 +14,7 @@ from Components.Ipkg import Ipkg
from Components.Slider import Slider
from Components.Label import Label
-import os
+from os import popen
class UpdatePluginMenu(Screen):
skin = """
@@ -125,15 +125,6 @@ class IPKGSource(Screen):
print "pressed", number
self["text"].number(number)
-RT_HALIGN_LEFT = 0
-RT_HALIGN_RIGHT = 1
-RT_HALIGN_CENTER = 2
-RT_HALIGN_BLOCK = 4
-
-RT_VALIGN_TOP = 0
-RT_VALIGN_CENTER = 8
-RT_VALIGN_BOTTOM = 16
-
def PacketEntryComponent(packet):
res = [ packet ]
@@ -189,13 +180,13 @@ class Ipkg2(Screen):
def fillPacketList(self):
- lines = os.popen("ipkg list", "r").readlines()
+ lines = popen("ipkg list", "r").readlines()
packetlist = []
for x in lines:
split = x.split(' - ')
packetlist.append([split[0].strip(), split[1].strip()])
- lines = os.popen("ipkg list_installed", "r").readlines()
+ lines = popen("ipkg list_installed", "r").readlines()
installedlist = {}
for x in lines:
@@ -218,7 +209,7 @@ class Ipkg2(Screen):
self.close()
def doUpdateDelay(self):
- lines = os.popen("ipkg update && ipkg upgrade", "r").readlines()
+ lines = popen("ipkg update && ipkg upgrade", "r").readlines()
string = ""
for x in lines:
string += x