aboutsummaryrefslogtreecommitdiff
path: root/lib/python
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
parentb3658b04216ed3974047b4c4ec885ee0161d9267 (diff)
downloadenigma2-ed40f6f85c9c07c3c1224ae20601082c0309a631.tar.gz
enigma2-ed40f6f85c9c07c3c1224ae20601082c0309a631.zip
some python import cleanups
lesser swig overhead
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/AVSwitch.py2
-rw-r--r--lib/python/Components/About.py2
-rw-r--r--lib/python/Components/ActionMap.py7
-rw-r--r--lib/python/Components/ChoiceList.py16
-rw-r--r--lib/python/Components/Clock.py5
-rw-r--r--lib/python/Components/ConditionalWidget.py6
-rw-r--r--lib/python/Components/EpgList.py15
-rw-r--r--lib/python/Components/FileList.py19
-rw-r--r--lib/python/Components/Harddisk.py12
-rw-r--r--lib/python/Components/Language.py3
-rw-r--r--lib/python/Components/LanguageList.py41
-rw-r--r--lib/python/Components/MediaPlayer.py17
-rw-r--r--lib/python/Components/MovieList.py9
-rw-r--r--lib/python/Components/MultiContent.py13
-rw-r--r--lib/python/Components/Network.py2
-rw-r--r--lib/python/Components/ParentalControlList.py13
-rw-r--r--lib/python/Components/PluginComponent.py18
-rw-r--r--lib/python/Components/PluginList.py4
-rw-r--r--lib/python/Components/RFmod.py6
-rw-r--r--lib/python/Components/ServiceList.py2
-rw-r--r--lib/python/Components/ServicePosition.py2
-rw-r--r--lib/python/Components/TimerList.py15
-rw-r--r--lib/python/Components/Timezones.py5
-rw-r--r--lib/python/Components/components.py1
-rw-r--r--lib/python/Makefile.am3
-rw-r--r--lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py4
-rw-r--r--lib/python/Plugins/Extensions/CutListEditor/plugin.py4
-rw-r--r--lib/python/Plugins/Extensions/FileManager/plugin.py9
-rw-r--r--lib/python/Plugins/Extensions/MediaScanner/plugin.py12
-rw-r--r--lib/python/Plugins/Extensions/PicturePlayer/plugin.py4
-rw-r--r--lib/python/Plugins/Extensions/SimpleRSS/plugin.py4
-rw-r--r--lib/python/Plugins/Extensions/TuxboxPlugins/plugin.py9
-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
-rw-r--r--lib/python/Screens/ChannelSelection.py2
-rw-r--r--lib/python/Screens/ChoiceBox.py4
-rw-r--r--lib/python/Screens/Ci.py2
-rw-r--r--lib/python/Screens/Dish.py2
-rw-r--r--lib/python/Screens/EpgSelection.py2
-rw-r--r--lib/python/Screens/EventView.py2
-rw-r--r--lib/python/Screens/InfoBar.py7
-rw-r--r--lib/python/Screens/InfoBarGenerics.py25
-rw-r--r--lib/python/Screens/InputBox.py7
-rw-r--r--lib/python/Screens/MediaPlayer.py1
-rw-r--r--lib/python/Screens/PVRState.py2
-rw-r--r--lib/python/Screens/ParentalControlSetup.py6
-rw-r--r--lib/python/Screens/PiPSetup.py4
-rw-r--r--lib/python/Screens/Scart.py3
-rw-r--r--lib/python/Screens/Standby.py2
-rw-r--r--lib/python/enigma_py_patcher.py43
-rw-r--r--lib/python/enigma_python.i6
-rw-r--r--lib/python/python.h2
-rw-r--r--lib/python/swig.h26
57 files changed, 190 insertions, 348 deletions
diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py
index 8a7bd8d1..a8e471ba 100644
--- a/lib/python/Components/AVSwitch.py
+++ b/lib/python/Components/AVSwitch.py
@@ -1,6 +1,6 @@
from config import config, ConfigSelection, ConfigYesNo, ConfigEnableDisable, ConfigSubsection, ConfigBoolean
import os
-from enigma import *
+from enigma import eAVSwitch
class AVSwitch:
INPUT = { "ENCODER": (0, 4), "SCART": (1, 3), "AUX": (2, 4) }
diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py
index e5f9543e..2f3fec09 100644
--- a/lib/python/Components/About.py
+++ b/lib/python/Components/About.py
@@ -1,4 +1,4 @@
-from Tools.Directories import *
+from Tools.Directories import resolveFilename, SCOPE_SYSETC
class About:
def __init__(self):
diff --git a/lib/python/Components/ActionMap.py b/lib/python/Components/ActionMap.py
index d2e908e6..b65d6ebc 100644
--- a/lib/python/Components/ActionMap.py
+++ b/lib/python/Components/ActionMap.py
@@ -1,16 +1,15 @@
-from enigma import *
+from enigma import eActionMap
class ActionMap:
def __init__(self, contexts = [ ], actions = { }, prio=0):
self.actions = actions
self.contexts = contexts
self.prio = prio
- self.p = eActionMapPtr()
+ self.p = eActionMap.getInstance()
self.bound = False
self.exec_active = False
self.enabled = True
- eActionMap.getInstance(self.p)
-
+
def setEnabled(self, enabled):
self.enabled = enabled
self.checkBind()
diff --git a/lib/python/Components/ChoiceList.py b/lib/python/Components/ChoiceList.py
index a0fbde54..a2070c7d 100644
--- a/lib/python/Components/ChoiceList.py
+++ b/lib/python/Components/ChoiceList.py
@@ -1,20 +1,8 @@
from HTMLComponent import *
from GUIComponent import *
-
from MenuList import MenuList
-
-from Tools.Directories import *
-
-from enigma import *
-
-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
+from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, eListbox, gFont, loadPNG
def ChoiceEntryComponent(key, text):
res = [ text ]
diff --git a/lib/python/Components/Clock.py b/lib/python/Components/Clock.py
index 95f29b16..9a6031e6 100644
--- a/lib/python/Components/Clock.py
+++ b/lib/python/Components/Clock.py
@@ -2,10 +2,7 @@ from HTMLComponent import *
from GUIComponent import *
from VariableText import *
-#from enigma import eTimer
-#from enigma import eLabel
-
-from enigma import *
+from enigma import eTimer, eLabel
import time
# now some "real" components:
diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py
index 391b8871..7d35d956 100644
--- a/lib/python/Components/ConditionalWidget.py
+++ b/lib/python/Components/ConditionalWidget.py
@@ -1,7 +1,5 @@
-import skin
from GUIComponent import *
-
-from enigma import *
+from enigma import eTimer
class ConditionalWidget(GUIComponent):
def __init__(self, withTimer = True):
@@ -61,7 +59,7 @@ class BlinkingWidget(GUIComponent):
if self.visible:
self.hide()
self.timer.stop()
-
+
class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget):
def __init__(self):
BlinkingWidget.__init__(self)
diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py
index 902968d4..ca209bda 100644
--- a/lib/python/Components/EpgList.py
+++ b/lib/python/Components/EpgList.py
@@ -2,7 +2,9 @@
from HTMLComponent import *
from GUIComponent import *
-from enigma import *
+from enigma import eEPGCache, eListbox, eListboxPythonMultiContent, gFont, loadPNG, \
+ RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER, RT_VALIGN_CENTER
+
from re import *
from time import localtime, time
from ServiceReference import ServiceReference
@@ -12,17 +14,6 @@ EPG_TYPE_SINGLE = 0
EPG_TYPE_MULTI = 1
EPG_TYPE_SIMILAR = 2
-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
-
-RT_WRAP = 32
-
class Rect:
def __init__(self, x, y, width, height):
self.__left = x
diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py
index 7621ccb0..b85b8ea3 100644
--- a/lib/python/Components/FileList.py
+++ b/lib/python/Components/FileList.py
@@ -2,21 +2,14 @@ from HTMLComponent import *
from GUIComponent import *
import re
+from os import path as os_path, listdir
from MenuList import MenuList
from Components.Harddisk import harddiskmanager
-from Tools.Directories import *
+from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
-from enigma import *
-
-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
+from enigma import RT_HALIGN_LEFT, loadPNG, eListbox, eListboxPythonMultiContent, \
+ eServiceReference, eServiceCenter, gFont
EXTENSIONS = {
"mp3": "music",
@@ -111,11 +104,11 @@ class FileList(MenuList, HTMLComponent, GUIComponent):
directories.sort()
files.sort()
else:
- files = os.listdir(directory)
+ files = listdir(directory)
files.sort()
tmpfiles = files[:]
for x in tmpfiles:
- if os.path.isdir(directory + x):
+ if os_path.isdir(directory + x):
directories.append(directory + x + "/")
files.remove(x)
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
index f060c37a..fee1ed74 100644
--- a/lib/python/Components/Harddisk.py
+++ b/lib/python/Components/Harddisk.py
@@ -1,6 +1,6 @@
-import os
+from os import system
-from Tools.Directories import *
+from Tools.Directories import SCOPE_HDD, resolveFilename
def tryOpen(filename):
try:
@@ -105,7 +105,7 @@ class Harddisk:
def unmount(self):
cmd = "/bin/umount " + self.devidex + "part*"
- res = os.system(cmd)
+ res = system(cmd)
return (res >> 8)
def createPartition(self):
@@ -117,16 +117,16 @@ class Harddisk:
def mkfs(self):
cmd = "/sbin/mkfs.ext3 -T largefile -m0 " + self.devidex + "part1"
- res = os.system(cmd)
+ res = system(cmd)
return (res >> 8)
def mount(self):
cmd = "/bin/mount -t ext3 " + self.devidex + "part1 /hdd"
- res = os.system(cmd)
+ res = system(cmd)
return (res >> 8)
def createMovieFolder(self):
- res = os.system("mkdir " + resolveFilename(SCOPE_HDD))
+ res = system("mkdir " + resolveFilename(SCOPE_HDD))
return (res >> 8)
errorList = [ _("Everything is fine"), _("Creating partition failed"), _("Mkfs failed"), _("Mount failed"), _("Create movie folder failed"), _("Unmount failed")]
diff --git a/lib/python/Components/Language.py b/lib/python/Components/Language.py
index 1bbf0bc0..a27f247e 100644
--- a/lib/python/Components/Language.py
+++ b/lib/python/Components/Language.py
@@ -1,7 +1,6 @@
import gettext
-import os
-from Tools.Directories import *
+from Tools.Directories import SCOPE_LANGUAGE, resolveFilename
class Language:
def __init__(self):
diff --git a/lib/python/Components/LanguageList.py b/lib/python/Components/LanguageList.py
index e625d7c7..e69de29b 100644
--- a/lib/python/Components/LanguageList.py
+++ b/lib/python/Components/LanguageList.py
@@ -1,41 +0,0 @@
-from HTMLComponent import *
-from GUIComponent import *
-
-from MenuList import MenuList
-
-from Tools.Directories import *
-
-from enigma import *
-
-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 LanguageEntryComponent(file, name, index):
- res = [ index ]
- res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 10, 200, 50, 0, RT_HALIGN_LEFT ,name))
- png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "countries/" + file + ".png"))
- if png == None:
- png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "countries/missing.png"))
- res.append((eListboxPythonMultiContent.TYPE_PIXMAP, 10, 5, 60, 40, png))
-
- return res
-
-class LanguageList(MenuList, HTMLComponent, GUIComponent):
- def __init__(self, list):
- GUIComponent.__init__(self)
- self.l = eListboxPythonMultiContent()
- self.list = list
- self.l.setList(list)
- self.l.setFont(0, gFont("Regular", 20))
-
- GUI_WIDGET = eListbox
-
- def postWidgetCreate(self, instance):
- instance.setContent(self.l)
- instance.setItemHeight(50)
diff --git a/lib/python/Components/MediaPlayer.py b/lib/python/Components/MediaPlayer.py
index d88b6280..44937fa3 100644
--- a/lib/python/Components/MediaPlayer.py
+++ b/lib/python/Components/MediaPlayer.py
@@ -3,19 +3,10 @@ from GUIComponent import *
from MenuList import MenuList
-from Tools.Directories import *
-import os
+from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from os import path
-from enigma import *
-
-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
+from enigma import eListboxPythonMultiContent, eListbox, RT_VALIGN_CENTER, loadPNG, gFont
STATE_PLAY = 0
STATE_PAUSE = 1
@@ -32,7 +23,7 @@ ForwardIcon = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "ico_mp_forward.png"))
def PlaylistEntryComponent(serviceref, state):
res = [ serviceref ]
- res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, os.path.split(serviceref.getPath().split('/')[-1])[1]))
+ res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, path.split(serviceref.getPath().split('/')[-1])[1]))
png = None
if state == STATE_PLAY:
png = PlayIcon
diff --git a/lib/python/Components/MovieList.py b/lib/python/Components/MovieList.py
index 1da5a519..dcd99fea 100644
--- a/lib/python/Components/MovieList.py
+++ b/lib/python/Components/MovieList.py
@@ -1,13 +1,10 @@
from GUIComponent import *
from Tools.FuzzyDate import FuzzyTime
from ServiceReference import ServiceReference
-from Components.MultiContent import MultiContentEntryText, RT_HALIGN_LEFT, RT_HALIGN_RIGHT
+from Components.MultiContent import MultiContentEntryText
-from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation
-
-from enigma import eServiceReference, eServiceCenter, \
- eServiceCenterPtr, iListableServicePtr, \
- iStaticServiceInformationPtr
+from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation, \
+ RT_HALIGN_LEFT, RT_HALIGN_RIGHT, eServiceReference, eServiceCenter
class MovieList(GUIComponent):
def __init__(self, root):
diff --git a/lib/python/Components/MultiContent.py b/lib/python/Components/MultiContent.py
index 06ecde96..3031fb3a 100644
--- a/lib/python/Components/MultiContent.py
+++ b/lib/python/Components/MultiContent.py
@@ -1,15 +1,4 @@
-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
-
-RT_WRAP = 32
-
-from enigma import eListboxPythonMultiContent
+from enigma import eListboxPythonMultiContent, RT_HALIGN_LEFT, RT_VALIGN_TOP
def MultiContentEntryText(pos = (0, 0), size = (0, 0), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP, text = "", color = None):
add = ()
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index 5add0c01..f65863dc 100644
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -81,14 +81,12 @@ class Network:
print "[Network.py] parsing network failed"
def deactivateNetworkConfig(self):
- import os
os.system("ip addr flush eth0")
os.system("/etc/init.d/networking stop")
os.system("killall -9 udhcpc")
os.system("rm /var/run/udhcpc*")
def activateNetworkConfig(self):
- import os
os.system("/etc/init.d/networking start")
config.network.ip.value = self.getCurrentIP()
config.network.ip.save()
diff --git a/lib/python/Components/ParentalControlList.py b/lib/python/Components/ParentalControlList.py
index 9791e1b0..02e88002 100644
--- a/lib/python/Components/ParentalControlList.py
+++ b/lib/python/Components/ParentalControlList.py
@@ -3,18 +3,9 @@ from GUIComponent import *
from MenuList import MenuList
from Components.ParentalControl import parentalControl
-from Tools.Directories import *
+from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
-from enigma import *
-
-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
+from enigma import loadPNG, eListbox, eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
lockPicture = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "lock-fs8.png"))
diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py
index 120b4636..9425e56d 100644
--- a/lib/python/Components/PluginComponent.py
+++ b/lib/python/Components/PluginComponent.py
@@ -1,8 +1,8 @@
-import os
-import traceback
-import sys
+from os import path as os_path, listdir as os_listdir
+from traceback import print_exc
+from sys import stdout
-from Tools.Directories import *
+from Tools.Directories import fileExists
from Tools.Import import my_import
from Plugins.Plugin import PluginDescriptor
@@ -33,18 +33,18 @@ class PluginComponent:
def readPluginList(self, directory):
"""enumerates plugins"""
- categories = os.listdir(directory)
+ categories = os_listdir(directory)
new_plugins = [ ]
for c in categories:
directory_category = directory + c
- if not os.path.isdir(directory_category):
+ if not os_path.isdir(directory_category):
continue
open(directory_category + "/__init__.py", "a").close()
- for pluginname in os.listdir(directory_category):
+ for pluginname in os_listdir(directory_category):
path = directory_category + "/" + pluginname
- if os.path.isdir(path):
+ if os_path.isdir(path):
if fileExists(path + "/plugin.pyc") or fileExists(path + "/plugin.py"):
try:
plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"]))
@@ -56,7 +56,7 @@ class PluginComponent:
plugins = plugin.Plugins(path=path)
except Exception, exc:
print "Plugin ", c + "/" + pluginname, "failed to load:", exc
- traceback.print_exc(file=sys.stdout)
+ print_exc(file=stdout)
print "skipping plugin."
self.warnings.append( (c + "/" + pluginname, str(exc)) )
continue
diff --git a/lib/python/Components/PluginList.py b/lib/python/Components/PluginList.py
index 9b9cfea8..fd988065 100644
--- a/lib/python/Components/PluginList.py
+++ b/lib/python/Components/PluginList.py
@@ -4,9 +4,9 @@ from GUIComponent import *
from MenuList import MenuList
from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
-from Components.MultiContent import RT_HALIGN_LEFT, MultiContentEntryText, MultiContentEntryPixmapAlphaTest
+from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
-from enigma import *
+from enigma import loadPNG, eListboxPythonMultiContent, RT_HALIGN_LEFT, eListbox, gFont
def PluginEntryComponent(plugin):
res = [ plugin ]
diff --git a/lib/python/Components/RFmod.py b/lib/python/Components/RFmod.py
index 234ae4ca..0ab4a815 100644
--- a/lib/python/Components/RFmod.py
+++ b/lib/python/Components/RFmod.py
@@ -1,5 +1,5 @@
-from config import *
-from enigma import *
+from config import config, ConfigSelection, ConfigSubsection, ConfigOnOff, ConfigSlider
+from enigma import eRFmod
# CHECK ME.
RFMOD_CHANNEL_MIN = 21
@@ -24,7 +24,7 @@ class RFmod:
def InitRFmod():
- config.rfmod = ConfigSubsection();
+ config.rfmod = ConfigSubsection()
config.rfmod.enable = ConfigOnOff(default=False)
config.rfmod.test = ConfigOnOff(default=False)
config.rfmod.sound = ConfigOnOff(default=True)
diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py
index 6145adef..c2d58f2f 100644
--- a/lib/python/Components/ServiceList.py
+++ b/lib/python/Components/ServiceList.py
@@ -1,7 +1,7 @@
from HTMLComponent import *
from GUIComponent import *
-from enigma import *
+from enigma import loadPNG, eListboxServiceContent, eListbox, eServiceCenter, eServiceReference, gFont, eRect
from string import upper
diff --git a/lib/python/Components/ServicePosition.py b/lib/python/Components/ServicePosition.py
index d34d81fb..6f7082d5 100644
--- a/lib/python/Components/ServicePosition.py
+++ b/lib/python/Components/ServicePosition.py
@@ -1,6 +1,6 @@
from PerServiceDisplay import PerServiceDisplay, PerServiceBase
from Components.GUIComponent import GUIComponent
-from enigma import eTimer, iPlayableService, iSeekableServicePtr, ePositionGauge
+from enigma import eTimer, iPlayableService, ePositionGauge
import time
class ServicePosition(PerServiceDisplay, object):
diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py
index 2f60fcfb..d2ccbb9c 100644
--- a/lib/python/Components/TimerList.py
+++ b/lib/python/Components/TimerList.py
@@ -4,22 +4,11 @@ from GUIComponent import *
from Tools.FuzzyDate import FuzzyTime
import time
-from enigma import eListboxPythonMultiContent, eListbox, gFont, loadPNG
+from enigma import eListboxPythonMultiContent, eListbox, gFont, loadPNG, \
+ RT_HALIGN_CENTER, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_VALIGN_CENTER
from timer import TimerEntry
from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
-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
-
-RT_WRAP = 32
-
-
#
# | <Service> <Name of the Timer> |
# | <start, end> <state> |
diff --git a/lib/python/Components/Timezones.py b/lib/python/Components/Timezones.py
index 704b765e..ccc98279 100644
--- a/lib/python/Components/Timezones.py
+++ b/lib/python/Components/Timezones.py
@@ -4,8 +4,6 @@ from xml.sax.handler import ContentHandler
import os
import time
-from enigma import *
-
class Timezones:
class parseTimezones(ContentHandler):
def __init__(self, timezones):
@@ -42,7 +40,8 @@ class Timezones:
try:
time.tzset()
except:
- etimezone()
+ from enigma import e_tzset
+ e_tzset()
def getTimezoneList(self):
list = []
diff --git a/lib/python/Components/components.py b/lib/python/Components/components.py
index 512defb5..87159bf6 100644
--- a/lib/python/Components/components.py
+++ b/lib/python/Components/components.py
@@ -1,4 +1,3 @@
-from enigma import *
import time
import sys
diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am
index 1cc01544..9eb13df7 100644
--- a/lib/python/Makefile.am
+++ b/lib/python/Makefile.am
@@ -10,7 +10,8 @@ libenigma_python_a_SOURCES = \
python.cpp enigma_python_wrap.cxx connections.cpp
enigma_python_wrap.cxx: enigma_python.i
- swig -I$(top_srcdir)/ -c++ -python enigma_python.i
+ swig -I$(top_srcdir)/ -c++ -python -O -nortti -nothreads enigma_python.i
+ python enigma_py_patcher.py
installdir = $(LIBDIR)/enigma2/python
diff --git a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py
index e074aeec..dae4d4ab 100644
--- a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py
+++ b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py
@@ -1,17 +1,13 @@
-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 Screens.ChoiceBox import ChoiceBox
from Plugins.Plugin import PluginDescriptor
-import os
-
class Test(Screen):
skin = """
<screen position="100,100" size="550,400" title="Test" >
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 = """
<screen position="100,100" size="550,400" title="Test" >
@@ -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":
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
diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py
index 0eff5967..9cbb4221 100644
--- a/lib/python/Screens/ChannelSelection.py
+++ b/lib/python/Screens/ChannelSelection.py
@@ -5,7 +5,7 @@ from Components.ActionMap import NumberActionMap, ActionMap
from Components.MenuList import MenuList
from Components.ServiceEventTracker import ServiceEventTracker
from EpgSelection import EPGSelection
-from enigma import eServiceReference, eEPGCache, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer, eDVBDB, iPlayableService, iServiceInformation
+from enigma import eServiceReference, eEPGCache, eServiceCenter, eTimer, eDVBDB, iPlayableService, iServiceInformation
from Components.config import config, ConfigSubsection, ConfigText
from Screens.FixedMenu import FixedMenu
from Tools.NumericalTextInput import NumericalTextInput
diff --git a/lib/python/Screens/ChoiceBox.py b/lib/python/Screens/ChoiceBox.py
index a20983e6..37729887 100644
--- a/lib/python/Screens/ChoiceBox.py
+++ b/lib/python/Screens/ChoiceBox.py
@@ -1,14 +1,10 @@
-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.MenuList import MenuList
-from Components.GUIComponent import *
from Components.ChoiceList import ChoiceEntryComponent, ChoiceList
-import os
-
class ChoiceBox(Screen):
def __init__(self, session, title = "", list = [], keys = None, selection = 0):
Screen.__init__(self, session)
diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py
index c3302a1c..27ca5aa3 100644
--- a/lib/python/Screens/Ci.py
+++ b/lib/python/Screens/Ci.py
@@ -6,8 +6,6 @@ from Components.Header import Header
from Components.Button import Button
from Components.Label import Label
-from Components.HTMLComponent import *
-from Components.GUIComponent import *
from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSubList, getConfigListEntry, KEY_LEFT, KEY_RIGHT, KEY_0, ConfigNothing, ConfigPIN
from Components.ConfigList import ConfigList
diff --git a/lib/python/Screens/Dish.py b/lib/python/Screens/Dish.py
index bcc35807..a34f0c57 100644
--- a/lib/python/Screens/Dish.py
+++ b/lib/python/Screens/Dish.py
@@ -5,7 +5,7 @@ from Components.Pixmap import Pixmap
from Components.Button import Button
from Components.config import config
-from enigma import *
+from enigma import eDVBSatelliteEquipmentControl
class Dish(Screen):
def __init__(self, session):
diff --git a/lib/python/Screens/EpgSelection.py b/lib/python/Screens/EpgSelection.py
index 5d29df0d..0483f98b 100644
--- a/lib/python/Screens/EpgSelection.py
+++ b/lib/python/Screens/EpgSelection.py
@@ -7,7 +7,7 @@ from Components.ActionMap import ActionMap
from Components.ScrollLabel import ScrollLabel
from Screens.EventView import EventViewSimple
from TimeDateInput import TimeDateInput
-from enigma import eServiceReference, eServiceEventPtr
+from enigma import eServiceReference
from Screens.FixedMenu import FixedMenu
from RecordTimer import RecordTimerEntry, parseEvent
from TimerEdit import TimerEditList
diff --git a/lib/python/Screens/EventView.py b/lib/python/Screens/EventView.py
index 82bca9fd..8504165d 100644
--- a/lib/python/Screens/EventView.py
+++ b/lib/python/Screens/EventView.py
@@ -3,7 +3,7 @@ from Components.ActionMap import ActionMap
from Components.Button import Button
from Components.Label import Label
from Components.ScrollLabel import ScrollLabel
-from enigma import eServiceEventPtr, eEPGCache, eTimer, eServiceReference
+from enigma import eEPGCache, eTimer, eServiceReference
from ServiceReference import ServiceReference
from RecordTimer import RecordTimerEntry, parseEvent
from TimerEntry import TimerEntry
diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py
index f1123842..24c2b40b 100644
--- a/lib/python/Screens/InfoBar.py
+++ b/lib/python/Screens/InfoBar.py
@@ -4,10 +4,9 @@ from Screens.MovieSelection import MovieSelection
from Screens.ChannelSelection import ChannelSelectionRadio
from Screens.MessageBox import MessageBox
from Screens.Ci import CiHandler
-from ServiceReference import ServiceReference
from Components.Sources.Clock import Clock
-from Components.ActionMap import ActionMap, HelpableActionMap
+from Components.ActionMap import HelpableActionMap
from Components.config import config
from Tools.Notifications import AddNotificationWithCallback
@@ -23,10 +22,6 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \
from Screens.HelpMenu import HelpableScreen, HelpMenu
-from enigma import *
-
-import time
-
class InfoBar(InfoBarShowHide,
InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRadioText,
InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection,
diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
index 26bc0d41..646419c3 100644
--- a/lib/python/Screens/InfoBarGenerics.py
+++ b/lib/python/Screens/InfoBarGenerics.py
@@ -36,14 +36,14 @@ from Screens.SleepTimerEdit import SleepTimerEdit
from ServiceReference import ServiceReference
from Tools import Notifications
-from Tools.Directories import *
+from Tools.Directories import SCOPE_HDD, resolveFilename
-#from enigma import eTimer, eDVBVolumecontrol, quitMainloop
-from enigma import *
+from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \
+ iPlayableService, eServiceReference, eDVBResourceManager, iFrontendInformation
-import time
-import os
-import bisect
+from time import time
+from os import stat as os_stat
+from bisect import insort
# hack alert!
from Menu import MainMenu, mdom
@@ -953,7 +953,6 @@ class InfoBarTimeshift:
print "hu, timeshift already enabled?"
else:
if not ts.startTimeshift():
- import time
self.timeshift_enabled = 1
# we remove the "relative time" for now.
@@ -1240,8 +1239,8 @@ class InfoBarInstantRecord:
except:
pass
- begin = time.time()
- end = time.time() + 3600 * 10
+ begin = time()
+ end = time() + 3600 * 10
name = "instant record"
description = ""
eventid = None
@@ -1320,7 +1319,7 @@ class InfoBarInstantRecord:
def instantRecord(self):
try:
- stat = os.stat(resolveFilename(SCOPE_HDD))
+ stat = os_stat(resolveFilename(SCOPE_HDD))
except:
self.session.open(MessageBox, _("No HDD found or HDD not initialized!"), MessageBox.TYPE_ERROR)
return
@@ -1536,8 +1535,8 @@ class InfoBarAdditionalInfo:
self["ExtensionsAvailable"] = Boolean(fixed=1)
self.session.nav.event.append(self.gotServiceEvent) # we like to get service events
- res_mgr = eDVBResourceManagerPtr()
- if eDVBResourceManager.getInstance(res_mgr) == 0:
+ res_mgr = eDVBResourceManager.getInstance()
+ if res_mgr:
res_mgr.frontendUseMaskChanged.get().append(self.tunerUseMaskChanged)
def tunerUseMaskChanged(self, mask):
@@ -1729,7 +1728,7 @@ class InfoBarCueSheetSupport:
return None
def addMark(self, point):
- bisect.insort(self.cut_list, point)
+ insort(self.cut_list, point)
self.uploadCuesheet()
def removeMark(self, point):
diff --git a/lib/python/Screens/InputBox.py b/lib/python/Screens/InputBox.py
index bb8b63d9..6cdb42ee 100644
--- a/lib/python/Screens/InputBox.py
+++ b/lib/python/Screens/InputBox.py
@@ -1,15 +1,12 @@
-from enigma import *
+from enigma import eRCInput, getPrevAsciiCode
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 Tools.BoundFunction import boundFunction
from time import time
-import os
-
class InputBox(Screen):
def __init__(self, session, title = "", windowTitle = _("Input"), **kwargs):
Screen.__init__(self, session)
@@ -165,4 +162,4 @@ class PinInput(InputBox):
self.triesEntry.tries.save()
def showTries(self):
- self["tries"].setText(_("Tries left:") + " " + str(self.getTries())) \ No newline at end of file
+ self["tries"].setText(_("Tries left:") + " " + str(self.getTries()))
diff --git a/lib/python/Screens/MediaPlayer.py b/lib/python/Screens/MediaPlayer.py
index 1411b427..4e299b27 100644
--- a/lib/python/Screens/MediaPlayer.py
+++ b/lib/python/Screens/MediaPlayer.py
@@ -4,7 +4,6 @@ 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.Label import Label
from Components.FileList import FileEntryComponent, FileList
diff --git a/lib/python/Screens/PVRState.py b/lib/python/Screens/PVRState.py
index b2c8a4d9..f7b2abf7 100644
--- a/lib/python/Screens/PVRState.py
+++ b/lib/python/Screens/PVRState.py
@@ -3,8 +3,6 @@ from Screen import Screen
from Components.Label import Label
from Components.Sources.CurrentService import CurrentService
-from enigma import *
-
class PVRState(Screen):
def __init__(self, session):
Screen.__init__(self, session)
diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py
index 7c4c3ecf..045e8fb7 100644
--- a/lib/python/Screens/ParentalControlSetup.py
+++ b/lib/python/Screens/ParentalControlSetup.py
@@ -9,12 +9,10 @@ from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Screens.InputBox import InputBox, Input, PinInput
from Screens.ChannelSelection import service_types_tv
-from Tools.Directories import resolveFilename, SCOPE_CONFIG
from Tools.BoundFunction import boundFunction
from ServiceReference import ServiceReference
from enigma import eServiceCenter, eServiceReference, eTimer
-import os
-import operator
+from operator import itemgetter
class ProtectedScreen:
def __init__(self):
@@ -192,7 +190,7 @@ class ParentalControlEditor(Screen):
else:
x = (x, x)
mylist.append(x)
- mylist.sort(key=operator.itemgetter(1))
+ mylist.sort(key=itemgetter(1))
sel = ord(self.currentLetter) - SPECIAL_CHAR
self.session.openWithCallback(self.letterChosen, ChoiceBox, title=_("Show services beginning with"), list=mylist, keys = [], selection = sel)
diff --git a/lib/python/Screens/PiPSetup.py b/lib/python/Screens/PiPSetup.py
index af313930..67c5b84b 100644
--- a/lib/python/Screens/PiPSetup.py
+++ b/lib/python/Screens/PiPSetup.py
@@ -1,14 +1,10 @@
-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.MenuList import MenuList
-from Components.GUIComponent import *
from Components.ChoiceList import ChoiceEntryComponent, ChoiceList
-import os
-
# this is not so great.
MAX_X = 720
MAX_Y = 576
diff --git a/lib/python/Screens/Scart.py b/lib/python/Screens/Scart.py
index 329300a1..dc511448 100644
--- a/lib/python/Screens/Scart.py
+++ b/lib/python/Screens/Scart.py
@@ -1,10 +1,7 @@
from Screen import Screen
from MessageBox import MessageBox
-
from Components.AVSwitch import AVSwitch
-from enigma import *
-
class Scart(Screen):
def __init__(self, session, start_visible=True):
Screen.__init__(self, session)
diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py
index 9e3ade45..064171f1 100644
--- a/lib/python/Screens/Standby.py
+++ b/lib/python/Screens/Standby.py
@@ -2,7 +2,7 @@ from Screen import Screen
from Components.ActionMap import ActionMap
from Components.config import config
from Components.AVSwitch import AVSwitch
-from enigma import *
+from enigma import eDVBVolumecontrol, eDBoxLCD
class Standby(Screen):
def Power(self):
diff --git a/lib/python/enigma_py_patcher.py b/lib/python/enigma_py_patcher.py
new file mode 100644
index 00000000..52f9d232
--- /dev/null
+++ b/lib/python/enigma_py_patcher.py
@@ -0,0 +1,43 @@
+#read the comment to this file in lib/service/iservice.h !!
+
+import os
+
+os.rename("enigma.py", "enigma.py.org")
+
+source=open("enigma.py.org", "r")
+dest=open("enigma.py", "w")
+
+line=1
+for str in source.readlines():
+ oldstr = str[:]
+ str = str.replace('_ENUMS)', ')')
+ str = str.replace('_REPLACE)', ')')
+
+ pos = str.find('_ENUMS')
+ if pos != -1:
+ spacepos = pos
+ while spacepos > 0 and str[spacepos] != ' ':
+ spacepos -= 1
+ tmpstr = str[spacepos:pos]
+ if tmpstr.find('_enigma.') == -1:
+ str = str[:pos]+str[pos+6:]
+
+ pos = str.find('_REPLACE')
+ if pos != -1:
+ spacepos = pos
+ while spacepos > 0 and str[spacepos] != ' ':
+ spacepos -= 1
+ tmpstr = str[spacepos:pos]
+ if tmpstr.find('_enigma.') == -1:
+ str = str[:pos]+str[pos+8:]
+
+
+ if oldstr != str:
+ print "!!! Patch enigma.py line %d\n%s\n%s" %(line, oldstr[:len(oldstr)-1], str)
+
+ dest.write(str)
+ line += 1
+
+del source
+del dest
+os.remove("enigma.py.org")
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index 92484735..090585bd 100644
--- a/lib/python/enigma_python.i
+++ b/lib/python/enigma_python.i
@@ -91,7 +91,6 @@ is usually caused by not marking PSignals as immutable.
#include <lib/gdi/lcd.h>
#include <lib/dvb_ci/dvbci_ui.h>
#include <lib/python/python.h>
-#include <lib/gdi/picexif.h>
#include <lib/gdi/picload.h>
extern void runMainloop();
@@ -153,8 +152,6 @@ typedef long time_t;
%include <lib/base/smartptr.h>
%include <lib/service/iservice.h>
%include <lib/service/service.h>
-
-%template(eServiceCenterPtr) ePtr<eServiceCenter>;
%include <lib/service/event.h>
// TODO: embed these...
@@ -222,12 +219,9 @@ typedef long time_t;
%include <lib/dvb_ci/dvbci_ui.h>
%include <lib/dvb/db.h>
%include <lib/python/python.h>
-%include <lib/gdi/picexif.h>
%include <lib/gdi/picload.h>
/************** eptr **************/
-%template(eActionMapPtr) ePtr<eActionMap>;
-
/************** signals **************/
template<class R> class PSignal0
diff --git a/lib/python/python.h b/lib/python/python.h
index d0fe92a8..76d2d197 100644
--- a/lib/python/python.h
+++ b/lib/python/python.h
@@ -157,7 +157,7 @@ public:
TestObj();
~TestObj();
};
-TEMPLATE_TYPEDEF(ePtr<TestObj>, TestObjPtr);
+SWIG_TEMPLATE_TYPEDEF(ePtr<TestObj>, TestObjPtr);
#ifndef SWIG
extern PyObject *New_TestObj();
diff --git a/lib/python/swig.h b/lib/python/swig.h
index c094b646..da787eea 100644
--- a/lib/python/swig.h
+++ b/lib/python/swig.h
@@ -2,29 +2,27 @@
#define __lib_python_swig_h
#ifdef SWIG
-#define TEMPLATE_TYPEDEF(x, y) \
-%template(y) x; \
-typedef x y; \
-%typemap_output_ptr(x);
-#define SWIG_ALLOW_OUTPUT_SIMPLE(x) %typemap_output_simple(x);
-#else
-#define TEMPLATE_TYPEDEF(x, y) typedef x y
-#define SWIG_ALLOW_OUTPUT_SIMPLE(x)
-#endif
-
-
-#ifdef SWIG
+#define SWIG_IGNORE(x) %ignore x
+#define SWIG_EXTEND(x, code) %extend x { code }
+#define SWIG_TEMPLATE_TYPEDEF(x, y) %template(y) x; %typemap_output_ptr(x)
+#define SWIG_TEMPLATE_TYPEDEF_REPLACE(x, y) %template(y##_REPLACE) x; %typemap_output_ptr(x)
+#define SWIG_ALLOW_OUTPUT_SIMPLE(x) %typemap_output_simple(x)
#define SWIG_INPUT INPUT
#define SWIG_OUTPUT OUTPUT
#define SWIG_NAMED_OUTPUT(x) OUTPUT
#define SWIG_VOID(x) void
#define SWIG_PYOBJECT(x) PyObject*
#else
+#define SWIG_IGNORE(x)
+#define SWIG_EXTEND(x, code)
+#define SWIG_TEMPLATE_TYPEDEF(x, y)
+#define SWIG_TEMPLATE_TYPEDEF_REPLACE(x, y)
+#define SWIG_ALLOW_OUTPUT_SIMPLE(x)
#define SWIG_INPUT
#define SWIG_OUTPUT
#define SWIG_NAMED_OUTPUT(x) x
#define SWIG_VOID(x) x
#define SWIG_PYOBJECT(x) x
-#endif
+#endif // SWIG
-#endif
+#endif // __lib_python_swig_h