From 3349a1015d694554637ffc905bacfa4ea32b100d Mon Sep 17 00:00:00 2001 From: persianpros Date: Sat, 10 Apr 2021 11:47:14 +0430 Subject: [PATCH] PEP8 double aggressive E301 ~ E306 --- lib/actions/parseactions.py | 3 + lib/python/Components/AVSwitch.py | 2 + lib/python/Components/About.py | 18 +++++ lib/python/Components/BlinkingPixmap.py | 2 + lib/python/Components/Button.py | 1 + lib/python/Components/ChoiceList.py | 2 + lib/python/Components/Clock.py | 1 + lib/python/Components/ConditionalWidget.py | 3 + lib/python/Components/ConfigList.py | 2 + lib/python/Components/Console.py | 4 + .../Components/Converter/AnalogClock.py | 2 +- .../Components/Converter/ClientsStreaming.py | 1 + .../Components/Converter/ClockToText.py | 1 + lib/python/Components/Converter/Combine.py | 1 + .../Converter/ConditionalShowHide.py | 1 + .../Components/Converter/ConfigEntryTest.py | 1 + lib/python/Components/Converter/Converter.py | 1 + lib/python/Components/Converter/EventName.py | 1 + lib/python/Components/Converter/EventTime.py | 1 + .../Components/Converter/FrontendInfo.py | 1 + .../Components/Converter/MenuEntryCompare.py | 1 + lib/python/Components/Converter/MovieInfo.py | 1 + .../Components/Converter/PliExtraInfo.py | 2 + lib/python/Components/Converter/Poll.py | 1 + .../Components/Converter/ProgressToText.py | 1 + lib/python/Components/Converter/RdsInfo.py | 1 + .../Components/Converter/RemainingToText.py | 1 + .../Components/Converter/RotorPosition.py | 1 + .../Components/Converter/SensorToText.py | 1 + .../Components/Converter/ServiceInfo.py | 1 + .../Components/Converter/ServiceName.py | 1 + .../Converter/ServiceOrbitalPosition.py | 1 + .../Components/Converter/ServicePosition.py | 1 + .../Components/Converter/ServiceTime.py | 1 + .../Components/Converter/StaticMultiList.py | 2 + lib/python/Components/Converter/StaticText.py | 1 + lib/python/Components/Converter/Streaming.py | 1 + lib/python/Components/Converter/Streaming2.py | 1 + lib/python/Components/Converter/StringList.py | 2 + .../Converter/StringListSelection.py | 2 + .../Converter/TemplatedMultiContent.py | 1 + lib/python/Components/Converter/TextCase.py | 1 + .../Components/Converter/TransponderInfo.py | 1 + lib/python/Components/Converter/TunerInfo.py | 1 + .../Components/Converter/ValueBitTest.py | 1 + lib/python/Components/Converter/ValueRange.py | 1 + lib/python/Components/Converter/genre.py | 3 + lib/python/Components/DiskInfo.py | 2 + lib/python/Components/Element.py | 4 + lib/python/Components/EpgList.py | 9 +++ lib/python/Components/FIFOList.py | 1 + lib/python/Components/FanControl.py | 3 + lib/python/Components/FileList.py | 2 + lib/python/Components/GUIComponent.py | 1 + lib/python/Components/Harddisk.py | 19 +++++ lib/python/Components/HdmiCec.py | 1 + lib/python/Components/HelpMenuList.py | 1 + lib/python/Components/ImportChannels.py | 1 + lib/python/Components/Input.py | 1 + lib/python/Components/InputDevice.py | 4 +- lib/python/Components/InputHotplug.py | 6 ++ lib/python/Components/Label.py | 5 ++ lib/python/Components/Language.py | 2 + lib/python/Components/Lcd.py | 9 +++ lib/python/Components/MediaPlayer.py | 1 + lib/python/Components/MenuList.py | 1 + lib/python/Components/MovieList.py | 34 ++++++++ lib/python/Components/MultiContent.py | 9 +++ lib/python/Components/Netlink.py | 2 + lib/python/Components/Network.py | 4 + lib/python/Components/NimManager.py | 15 ++++ lib/python/Components/Opkg.py | 8 ++ lib/python/Components/PackageInfo.py | 3 + lib/python/Components/ParentalControl.py | 2 + lib/python/Components/PerServiceDisplay.py | 3 + lib/python/Components/Pixmap.py | 4 + lib/python/Components/Playlist.py | 4 + lib/python/Components/PluginComponent.py | 2 + lib/python/Components/PluginList.py | 3 + lib/python/Components/ProgressBar.py | 2 + lib/python/Components/RFmod.py | 7 ++ lib/python/Components/RcModel.py | 2 + lib/python/Components/RecordingConfig.py | 1 + lib/python/Components/Renderer/Canvas.py | 1 + .../Components/Renderer/ChannelNumber.py | 1 + .../Components/Renderer/CiModuleControl.py | 1 + lib/python/Components/Renderer/FixedLabel.py | 1 + .../Components/Renderer/FrontpanelLed.py | 2 + lib/python/Components/Renderer/GaugeRender.py | 3 +- lib/python/Components/Renderer/Label.py | 1 + lib/python/Components/Renderer/Listbox.py | 1 + lib/python/Components/Renderer/NextEpgInfo.py | 1 + lib/python/Components/Renderer/Picon.py | 8 ++ lib/python/Components/Renderer/Pig.py | 1 + lib/python/Components/Renderer/Pixmap.py | 1 + .../Components/Renderer/PositionGauge.py | 1 + lib/python/Components/Renderer/Progress.py | 1 + lib/python/Components/Renderer/Renderer.py | 1 + lib/python/Components/Renderer/VideoSize.py | 2 + lib/python/Components/ResourceManager.py | 2 +- lib/python/Components/Scanner.py | 8 ++ lib/python/Components/ScrollLabel.py | 1 + lib/python/Components/SelectionList.py | 2 + lib/python/Components/Sensors.py | 3 +- lib/python/Components/ServiceEventTracker.py | 2 + lib/python/Components/ServiceList.py | 37 +++++++++ lib/python/Components/ServicePosition.py | 2 + lib/python/Components/ServiceScan.py | 1 + lib/python/Components/SetupDevices.py | 1 + lib/python/Components/Slider.py | 1 + lib/python/Components/Sources/Boolean.py | 2 + lib/python/Components/Sources/CanvasSource.py | 1 + lib/python/Components/Sources/Clock.py | 1 + lib/python/Components/Sources/Config.py | 1 + .../Components/Sources/CurrentService.py | 1 + lib/python/Components/Sources/Event.py | 1 + lib/python/Components/Sources/EventInfo.py | 1 + lib/python/Components/Sources/FrontendInfo.py | 1 + .../Components/Sources/FrontendStatus.py | 1 + lib/python/Components/Sources/HddState.py | 1 + lib/python/Components/Sources/List.py | 2 + lib/python/Components/Sources/Progress.py | 1 + lib/python/Components/Sources/RdsDecoder.py | 1 + lib/python/Components/Sources/RecordState.py | 1 + lib/python/Components/Sources/Sensor.py | 1 + lib/python/Components/Sources/ServiceEvent.py | 1 + lib/python/Components/Sources/ServiceList.py | 1 + lib/python/Components/Sources/StaticText.py | 1 + .../Components/Sources/StreamService.py | 1 + lib/python/Components/Sources/TunerInfo.py | 1 + lib/python/Components/SystemInfo.py | 4 + lib/python/Components/Task.py | 29 +++++++ lib/python/Components/TimerList.py | 9 +++ lib/python/Components/TimerSanityCheck.py | 1 + lib/python/Components/Timezones.py | 1 + lib/python/Components/TuneTest.py | 4 + lib/python/Components/TunerInfo.py | 1 + lib/python/Components/UsageConfig.py | 18 +++++ lib/python/Components/VideoWindow.py | 1 + lib/python/Components/VolumeBar.py | 1 + lib/python/Components/VolumeControl.py | 3 + lib/python/Components/config.py | 63 +++++++++++++++ lib/python/Navigation.py | 2 + .../Extensions/CutListEditor/plugin.py | 2 + .../Plugins/Extensions/CutListEditor/ui.py | 3 + .../Plugins/Extensions/DVDBurn/DVDProject.py | 5 ++ .../Plugins/Extensions/DVDBurn/DVDTitle.py | 3 + .../Plugins/Extensions/DVDBurn/DVDToolbox.py | 6 ++ .../Plugins/Extensions/DVDBurn/Process.py | 33 ++++++++ .../Extensions/DVDBurn/ProjectSettings.py | 2 + .../Plugins/Extensions/DVDBurn/TitleCutter.py | 2 + .../Plugins/Extensions/DVDBurn/TitleList.py | 8 ++ .../Extensions/DVDBurn/TitleProperties.py | 5 ++ .../Plugins/Extensions/DVDBurn/plugin.py | 3 + .../Plugins/Extensions/DVDPlayer/plugin.py | 9 +++ .../Extensions/GraphMultiEPG/GraphMultiEpg.py | 35 ++++++++ .../GraphMultiEPG/GraphMultiEpgSetup.py | 1 + .../Extensions/GraphMultiEPG/plugin.py | 11 +++ .../Plugins/Extensions/MediaPlayer/plugin.py | 17 ++++ .../Extensions/MediaPlayer/settings.py | 2 + .../Plugins/Extensions/MediaScanner/plugin.py | 12 +++ .../Extensions/PicturePlayer/plugin.py | 6 ++ .../Plugins/Extensions/PicturePlayer/ui.py | 8 ++ .../Plugins/Extensions/SocketMMI/SocketMMI.py | 1 + .../Plugins/Extensions/SocketMMI/plugin.py | 5 ++ lib/python/Plugins/Plugin.py | 2 +- .../Plugins/SystemPlugins/CableScan/plugin.py | 15 ++++ .../CommonInterfaceAssignment/plugin.py | 17 +++- .../DefaultServicesScanner/plugin.py | 4 + .../SystemPlugins/DiseqcTester/plugin.py | 7 ++ .../Plugins/SystemPlugins/FastScan/plugin.py | 14 ++++ .../Plugins/SystemPlugins/HdmiCEC/plugin.py | 4 + .../Plugins/SystemPlugins/Hotplug/plugin.py | 5 ++ .../NetworkWizard/NetworkWizard.py | 3 +- .../SystemPlugins/NetworkWizard/plugin.py | 4 + .../SystemPlugins/OSD3DSetup/plugin.py | 8 ++ .../OSDPositionSetup/overscanwizard.py | 1 + .../SystemPlugins/OSDPositionSetup/plugin.py | 6 ++ .../SystemPlugins/PositionerSetup/log.py | 4 + .../SystemPlugins/PositionerSetup/plugin.py | 13 ++- .../PositionerSetup/rotor_calc.py | 4 + .../SatelliteEquipmentControl/plugin.py | 4 + .../Plugins/SystemPlugins/Satfinder/plugin.py | 5 ++ .../SoftwareManager/BackupRestore.py | 4 +- .../SoftwareManager/SoftwareTools.py | 2 +- .../SystemPlugins/SoftwareManager/plugin.py | 11 ++- .../SystemPlugins/TempFanControl/plugin.py | 4 + .../VideoClippingSetup/plugin.py | 6 ++ .../VideoEnhancement/VideoEnhancement.py | 2 + .../SystemPlugins/VideoEnhancement/plugin.py | 4 + .../SystemPlugins/VideoTune/VideoFinetune.py | 6 ++ .../Plugins/SystemPlugins/VideoTune/plugin.py | 3 + .../SystemPlugins/Videomode/VideoHardware.py | 2 + .../SystemPlugins/Videomode/VideoWizard.py | 3 +- .../Plugins/SystemPlugins/Videomode/plugin.py | 9 +++ .../Plugins/SystemPlugins/WirelessLan/Wlan.py | 8 ++ .../SystemPlugins/WirelessLan/plugin.py | 3 + lib/python/RecordTimer.py | 8 +- lib/python/Screens/About.py | 6 ++ lib/python/Screens/AudioSelection.py | 4 + lib/python/Screens/AutoDiseqc.py | 1 - lib/python/Screens/ChannelSelection.py | 16 ++++ lib/python/Screens/ChoiceBox.py | 2 + lib/python/Screens/Ci.py | 9 +++ lib/python/Screens/ClockDisplay.py | 2 + lib/python/Screens/ConfigMenu.py | 3 +- lib/python/Screens/Console.py | 2 +- lib/python/Screens/CopyFiles.py | 13 +++ lib/python/Screens/DVD.py | 4 + lib/python/Screens/Dish.py | 3 + lib/python/Screens/EpgSelection.py | 3 + lib/python/Screens/EventView.py | 5 ++ lib/python/Screens/FactoryReset.py | 1 + lib/python/Screens/FixedMenu.py | 1 + lib/python/Screens/FlashImage.py | 5 ++ lib/python/Screens/Globals.py | 1 + lib/python/Screens/HarddiskSetup.py | 4 + lib/python/Screens/HelpMenu.py | 2 + lib/python/Screens/Hotkey.py | 9 +++ lib/python/Screens/InfoBar.py | 2 + lib/python/Screens/InfoBarGenerics.py | 79 ++++++++++++++++++- lib/python/Screens/InputBox.py | 2 + lib/python/Screens/InputDeviceSetup.py | 3 +- lib/python/Screens/InstallWizard.py | 2 + lib/python/Screens/LanguageSelection.py | 3 + lib/python/Screens/LocationBox.py | 4 + lib/python/Screens/Menu.py | 4 + lib/python/Screens/MessageBox.py | 1 + lib/python/Screens/MinuteInput.py | 1 + lib/python/Screens/MovieSelection.py | 22 ++++++ lib/python/Screens/Mute.py | 1 + lib/python/Screens/NetworkSetup.py | 2 +- .../Screens/NumericalTextInputHelpDialog.py | 1 + lib/python/Screens/Opkg.py | 1 + lib/python/Screens/PVRState.py | 2 + lib/python/Screens/ParentalControlSetup.py | 2 + lib/python/Screens/PiPSetup.py | 2 + lib/python/Screens/PictureInPicture.py | 5 ++ lib/python/Screens/PluginBrowser.py | 2 + lib/python/Screens/Rc.py | 1 + lib/python/Screens/RdsDisplay.py | 3 + lib/python/Screens/RecordPaths.py | 1 + lib/python/Screens/Satconfig.py | 7 ++ lib/python/Screens/ScanSetup.py | 12 +++ lib/python/Screens/Scart.py | 1 + lib/python/Screens/ScreenSaver.py | 2 + lib/python/Screens/ServiceInfo.py | 5 ++ lib/python/Screens/ServiceScan.py | 2 + lib/python/Screens/ServiceStopScreen.py | 1 + lib/python/Screens/SessionGlobals.py | 1 + lib/python/Screens/Setup.py | 5 ++ lib/python/Screens/SetupFallbacktuner.py | 1 + lib/python/Screens/SkinSelector.py | 2 + lib/python/Screens/SleepTimerEdit.py | 3 + lib/python/Screens/SoftcamSetup.py | 2 + lib/python/Screens/SoftwareUpdate.py | 1 + lib/python/Screens/Standby.py | 8 ++ lib/python/Screens/StartWizard.py | 9 +++ lib/python/Screens/StreamingClientsInfo.py | 1 + lib/python/Screens/SubservicesQuickzap.py | 1 + lib/python/Screens/SubtitleDisplay.py | 1 + lib/python/Screens/TaskView.py | 1 + lib/python/Screens/TextBox.py | 1 + lib/python/Screens/TimeDateInput.py | 1 + lib/python/Screens/TimerEdit.py | 4 + lib/python/Screens/TimerEntry.py | 3 + lib/python/Screens/TimerSelection.py | 1 + lib/python/Screens/UnhandledKey.py | 1 + lib/python/Screens/Volume.py | 1 + lib/python/Screens/Wizard.py | 3 + lib/python/Screens/WizardLanguage.py | 1 + lib/python/ServiceReference.py | 4 + lib/python/StartEnigma.py | 19 +++++ lib/python/Tools/ASCIItranslit.py | 1 + lib/python/Tools/Alternatives.py | 5 ++ lib/python/Tools/BoundFunction.py | 1 + lib/python/Tools/CIHelper.py | 4 + lib/python/Tools/Directories.py | 24 ++++++ lib/python/Tools/Downloader.py | 2 + lib/python/Tools/FallbackTimer.py | 3 + lib/python/Tools/FuzzyDate.py | 1 - lib/python/Tools/Geolocation.py | 2 + lib/python/Tools/GetEcmInfo.py | 1 + lib/python/Tools/HardwareInfo.py | 1 + lib/python/Tools/Hex2strColor.py | 1 + lib/python/Tools/KeyBindings.py | 8 ++ lib/python/Tools/Multiboot.py | 9 +++ lib/python/Tools/Notifications.py | 9 +++ lib/python/Tools/Profile.py | 2 + lib/python/Tools/StbHardware.py | 8 ++ lib/python/Tools/TextBoundary.py | 2 + lib/python/Tools/Transponder.py | 8 ++ lib/python/Tools/Trashcan.py | 8 ++ lib/python/Tools/XMLTools.py | 3 + lib/python/Tools/camcontrol.py | 2 + lib/python/e2reactor.py | 6 +- lib/python/keyids.py | 1 + lib/python/keymapparser.py | 3 + lib/python/skin.py | 32 ++++++++ lib/python/timer.py | 2 + po/xml2po-python3.py | 2 + po/xml2po.py | 2 + tests/enigma.py | 25 ++++++ tests/events.py | 7 ++ tests/fake_time.py | 8 ++ tests/test_timer.py | 4 +- tools/genmetaindex.py | 2 + .../host_tools/FormatConverter/datasource.py | 2 + tools/host_tools/FormatConverter/input.py | 2 + tools/host_tools/FormatConverter/lamedb.py | 1 + tools/host_tools/FormatConverter/satxml.py | 1 + tools/svg2skin.py | 6 ++ 312 files changed, 1414 insertions(+), 24 deletions(-) diff --git a/lib/actions/parseactions.py b/lib/actions/parseactions.py index 665f8c305f1..d90d7ff0234 100644 --- a/lib/actions/parseactions.py +++ b/lib/actions/parseactions.py @@ -3,6 +3,7 @@ import tokenize import sys + def filter(g): while 1: t = g.next() @@ -19,6 +20,7 @@ def filter(g): # print t yield t[1] + def do_file(f, mode): tokens = filter(tokenize.generate_tokens(open(f, 'r').readline)) @@ -101,6 +103,7 @@ def do_file(f, mode): counter += 1 + mode = sys.argv[1] if mode == "parse": diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 88b4257dd6e..ca743775d61 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -3,6 +3,7 @@ from SystemInfo import SystemInfo import os + class AVSwitch: def setInput(self, input): INPUT = {"ENCODER": 0, "SCART": 1, "AUX": 2} @@ -63,6 +64,7 @@ def setAspectWSS(self, aspect=None): value = 1 # auto eAVSwitch.getInstance().setWSS(value) + def InitAVSwitch(): config.av = ConfigSubsection() config.av.yuvenabled = ConfigBoolean(default=True) diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py index 02bf75a5101..e17e9f5d535 100644 --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -5,9 +5,11 @@ import re from Tools.HardwareInfo import HardwareInfo + def getVersionString(): return getImageVersionString() + def getImageVersionString(): try: if os.path.isfile('/var/lib/opkg/status'): @@ -20,9 +22,12 @@ def getImageVersionString(): return _("unavailable") # WW -placeholder for BC purposes, commented out for the moment in the Screen + + def getFlashDateString(): return _("unknown") + def getBuildDateString(): try: if os.path.isfile('/etc/version'): @@ -32,6 +37,7 @@ def getBuildDateString(): pass return _("unknown") + def getUpdateDateString(): try: from glob import glob @@ -42,6 +48,7 @@ def getUpdateDateString(): pass return _("unknown") + def getEnigmaVersionString(): import enigma enigma_version = enigma.getEnigmaVersionString() @@ -49,6 +56,7 @@ def getEnigmaVersionString(): enigma_version = enigma_version[:-12] return enigma_version + def getGStreamerVersionString(): try: from glob import glob @@ -57,6 +65,7 @@ def getGStreamerVersionString(): except: return _("Not Installed") + def getffmpegVersionString(): try: from glob import glob @@ -65,15 +74,18 @@ def getffmpegVersionString(): except: return _("Not Installed") + def getKernelVersionString(): try: return open("/proc/version", "r").read().split(' ', 4)[2].split('-', 2)[0] except: return _("unknown") + def getHardwareTypeString(): return HardwareInfo().get_device_string() + def getImageTypeString(): try: image_type = open("/etc/issue").readlines()[-2].strip()[:-6] @@ -81,6 +93,7 @@ def getImageTypeString(): except: return _("undefined") + def getCPUInfoString(): try: cpu_count = 0 @@ -131,6 +144,7 @@ def getCPUInfoString(): except: return _("undefined") + def getDriverInstalledDate(): try: from glob import glob @@ -147,6 +161,7 @@ def getDriverInstalledDate(): except: return _("unknown") + def getPythonVersionString(): try: import commands @@ -155,6 +170,7 @@ def getPythonVersionString(): except: return _("unknown") + def GetIPsFromNetworkInterfaces(): import socket import fcntl @@ -188,6 +204,7 @@ def GetIPsFromNetworkInterfaces(): ifaces.append((iface_name, iface_addr)) return ifaces + def getBoxUptime(): try: time = '' @@ -206,5 +223,6 @@ def getBoxUptime(): except: return '-' + # For modules that do "from About import about" about = sys.modules[__name__] diff --git a/lib/python/Components/BlinkingPixmap.py b/lib/python/Components/BlinkingPixmap.py index 91943cd5f29..eef54ba00bd 100644 --- a/lib/python/Components/BlinkingPixmap.py +++ b/lib/python/Components/BlinkingPixmap.py @@ -1,10 +1,12 @@ from Pixmap import PixmapConditional from ConditionalWidget import BlinkingWidgetConditional, BlinkingWidget + class BlinkingPixmap(BlinkingWidget): def __init__(self): Widget.__init__(self) + class BlinkingPixmapConditional(BlinkingWidgetConditional, PixmapConditional): def __init__(self): BlinkingWidgetConditional.__init__(self) diff --git a/lib/python/Components/Button.py b/lib/python/Components/Button.py index b634bda4476..e22241ce9d8 100644 --- a/lib/python/Components/Button.py +++ b/lib/python/Components/Button.py @@ -3,6 +3,7 @@ from enigma import eButton + class Button(VariableText, GUIComponent): def __init__(self, text="", onClick=[]): GUIComponent.__init__(self) diff --git a/lib/python/Components/ChoiceList.py b/lib/python/Components/ChoiceList.py index 5a94953d0f1..899d2f0ecbd 100644 --- a/lib/python/Components/ChoiceList.py +++ b/lib/python/Components/ChoiceList.py @@ -4,6 +4,7 @@ from Tools.LoadPixmap import LoadPixmap import skin + def ChoiceEntryComponent(key=None, text=["--"]): res = [text] if text[0] == "--": @@ -33,6 +34,7 @@ def ChoiceEntryComponent(key=None, text=["--"]): res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, text[0])) return res + class ChoiceList(MenuList): def __init__(self, list, selection=0, enableWrapAround=False): MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) diff --git a/lib/python/Components/Clock.py b/lib/python/Components/Clock.py index 30aadd5a72f..6d41d305ce2 100644 --- a/lib/python/Components/Clock.py +++ b/lib/python/Components/Clock.py @@ -6,6 +6,7 @@ import time # now some "real" components: + class Clock(VariableText, GUIComponent): def __init__(self): VariableText.__init__(self) diff --git a/lib/python/Components/ConditionalWidget.py b/lib/python/Components/ConditionalWidget.py index 497820f7895..e26eabe0620 100644 --- a/lib/python/Components/ConditionalWidget.py +++ b/lib/python/Components/ConditionalWidget.py @@ -1,6 +1,7 @@ from GUIComponent import GUIComponent from enigma import eTimer + class ConditionalWidget(GUIComponent): def __init__(self, withTimer=True): GUIComponent.__init__(self) @@ -32,6 +33,7 @@ def update(self): self.conditionalFunction = None self.activateCondition(False) + class BlinkingWidget(GUIComponent): def __init__(self): GUIComponent.__init__(self) @@ -57,6 +59,7 @@ def stopBlinking(self): self.hide() self.timer.stop() + class BlinkingWidgetConditional(BlinkingWidget, ConditionalWidget): def __init__(self): BlinkingWidget.__init__(self) diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 1d3daddbae2..3fc79051140 100644 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -6,6 +6,7 @@ from Screens.ChoiceBox import ChoiceBox import skin + class ConfigList(GUIComponent, object): def __init__(self, list, session=None): GUIComponent.__init__(self) @@ -130,6 +131,7 @@ def selectionEnabled(self, enabled): if self.instance is not None: self.instance.setSelectionEnable(enabled) + class ConfigListScreen: def __init__(self, list, session=None, on_change=None): self["config_actions"] = NumberActionMap(["SetupActions", "InputAsciiActions", "KeyboardInputActions"], { diff --git a/lib/python/Components/Console.py b/lib/python/Components/Console.py index 36b918c32d7..aa37064698b 100644 --- a/lib/python/Components/Console.py +++ b/lib/python/Components/Console.py @@ -2,6 +2,7 @@ import ctypes import os + class ConsoleItem: def __init__(self, containers, cmd, callback, extra_args): self.extra_args = extra_args @@ -30,8 +31,10 @@ def __init__(self, containers, cmd, callback, extra_args): os.waitpid(self.container.getPID(), 0) except: pass + def dataAvailCB(self, data): self.appResults.append(data) + def finishedCB(self, retval): print "[Console] finished:", self.name del self.containers[self.name] @@ -43,6 +46,7 @@ def finishedCB(self, retval): data = ''.join(self.appResults) callback(data, retval, self.extra_args) + class Console(object): def __init__(self): # Still called appContainers because Network.py accesses it to diff --git a/lib/python/Components/Converter/AnalogClock.py b/lib/python/Components/Converter/AnalogClock.py index a8abc4efc1c..151c200dfc6 100644 --- a/lib/python/Components/Converter/AnalogClock.py +++ b/lib/python/Components/Converter/AnalogClock.py @@ -2,6 +2,7 @@ from Components.Element import cached from time import localtime, strftime + class AnalogClock(Converter, object): def __init__(self, type): @@ -30,5 +31,4 @@ def getValue(self): elif self.type == 3: return int(((t.tm_hour * 100) / 12) + (t.tm_min / 8)) - value = property(getValue) diff --git a/lib/python/Components/Converter/ClientsStreaming.py b/lib/python/Components/Converter/ClientsStreaming.py index 6d394dfee8d..ef8bcae761d 100644 --- a/lib/python/Components/Converter/ClientsStreaming.py +++ b/lib/python/Components/Converter/ClientsStreaming.py @@ -6,6 +6,7 @@ from ServiceReference import ServiceReference import socket + class ClientsStreaming(Converter, Poll, object): UNKNOWN = -1 REF = 0 diff --git a/lib/python/Components/Converter/ClockToText.py b/lib/python/Components/Converter/ClockToText.py index 6b9150a48ec..5858aa9b908 100644 --- a/lib/python/Components/Converter/ClockToText.py +++ b/lib/python/Components/Converter/ClockToText.py @@ -2,6 +2,7 @@ from time import localtime, strftime from Components.Element import cached + class ClockToText(Converter, object): DEFAULT = 0 WITH_SECONDS = 1 diff --git a/lib/python/Components/Converter/Combine.py b/lib/python/Components/Converter/Combine.py index f068e10de22..c566ceaa3f6 100644 --- a/lib/python/Components/Converter/Combine.py +++ b/lib/python/Components/Converter/Combine.py @@ -1,6 +1,7 @@ from Converter import Converter from Components.Element import cached + class Combine(Converter, object): SINGLE_SOURCE = False diff --git a/lib/python/Components/Converter/ConditionalShowHide.py b/lib/python/Components/Converter/ConditionalShowHide.py index ade91b7bb98..09e036d58c0 100644 --- a/lib/python/Components/Converter/ConditionalShowHide.py +++ b/lib/python/Components/Converter/ConditionalShowHide.py @@ -1,6 +1,7 @@ from enigma import eTimer from Converter import Converter + class ConditionalShowHide(Converter, object): def __init__(self, argstr): Converter.__init__(self, argstr) diff --git a/lib/python/Components/Converter/ConfigEntryTest.py b/lib/python/Components/Converter/ConfigEntryTest.py index 127141e0425..e3a68c09c3f 100644 --- a/lib/python/Components/Converter/ConfigEntryTest.py +++ b/lib/python/Components/Converter/ConfigEntryTest.py @@ -3,6 +3,7 @@ from Components.config import configfile + class ConfigEntryTest(Converter, object): def __init__(self, argstr): Converter.__init__(self, argstr) diff --git a/lib/python/Components/Converter/Converter.py b/lib/python/Components/Converter/Converter.py index 424a2323a85..69835469e2b 100644 --- a/lib/python/Components/Converter/Converter.py +++ b/lib/python/Components/Converter/Converter.py @@ -1,5 +1,6 @@ from Components.Element import Element + class Converter(Element): def __init__(self, arguments): Element.__init__(self) diff --git a/lib/python/Components/Converter/EventName.py b/lib/python/Components/Converter/EventName.py index 668beb32ad9..fecc30dad62 100644 --- a/lib/python/Components/Converter/EventName.py +++ b/lib/python/Components/Converter/EventName.py @@ -2,6 +2,7 @@ from Components.Element import cached from Components.Converter.genre import getGenreStringSub + class EventName(Converter, object): NAME = 0 SHORT_DESCRIPTION = 1 diff --git a/lib/python/Components/Converter/EventTime.py b/lib/python/Components/Converter/EventTime.py index a6c6a25c989..b17cb2511f2 100644 --- a/lib/python/Components/Converter/EventTime.py +++ b/lib/python/Components/Converter/EventTime.py @@ -3,6 +3,7 @@ from time import time from Components.Element import cached, ElementError + class EventTime(Poll, Converter, object): STARTTIME = 0 ENDTIME = 1 diff --git a/lib/python/Components/Converter/FrontendInfo.py b/lib/python/Components/Converter/FrontendInfo.py index 085a48d4fbf..650b5532904 100644 --- a/lib/python/Components/Converter/FrontendInfo.py +++ b/lib/python/Components/Converter/FrontendInfo.py @@ -5,6 +5,7 @@ from skin import parameters from Tools.Hex2strColor import Hex2strColor + class FrontendInfo(Converter): BER = 0 SNR = 1 diff --git a/lib/python/Components/Converter/MenuEntryCompare.py b/lib/python/Components/Converter/MenuEntryCompare.py index 9f8228e19a6..f8f8f9159bf 100644 --- a/lib/python/Components/Converter/MenuEntryCompare.py +++ b/lib/python/Components/Converter/MenuEntryCompare.py @@ -1,6 +1,7 @@ from Components.Converter.Converter import Converter from Components.Element import cached + class MenuEntryCompare(Converter, object): def __init__(self, type): Converter.__init__(self, type) diff --git a/lib/python/Components/Converter/MovieInfo.py b/lib/python/Components/Converter/MovieInfo.py index 60160774630..ee74fa811de 100644 --- a/lib/python/Components/Converter/MovieInfo.py +++ b/lib/python/Components/Converter/MovieInfo.py @@ -3,6 +3,7 @@ from enigma import iServiceInformation, eServiceReference from ServiceReference import ServiceReference + class MovieInfo(Converter): MOVIE_SHORT_DESCRIPTION = 0 # meta description when available.. when not .eit short description MOVIE_META_DESCRIPTION = 1 # just meta description when available diff --git a/lib/python/Components/Converter/PliExtraInfo.py b/lib/python/Components/Converter/PliExtraInfo.py index aeec80dc35c..280d021dd9f 100644 --- a/lib/python/Components/Converter/PliExtraInfo.py +++ b/lib/python/Components/Converter/PliExtraInfo.py @@ -57,11 +57,13 @@ 21: "SPARK", } + def addspace(text): if text: text += " " return text + class PliExtraInfo(Poll, Converter): def __init__(self, type): Converter.__init__(self, type) diff --git a/lib/python/Components/Converter/Poll.py b/lib/python/Components/Converter/Poll.py index 55d6fb1f856..3565429ab00 100644 --- a/lib/python/Components/Converter/Poll.py +++ b/lib/python/Components/Converter/Poll.py @@ -1,5 +1,6 @@ from enigma import eTimer + class Poll(object): def __init__(self): self.__poll_timer = eTimer() diff --git a/lib/python/Components/Converter/ProgressToText.py b/lib/python/Components/Converter/ProgressToText.py index 0ad3a88c812..ed3f931ebcf 100644 --- a/lib/python/Components/Converter/ProgressToText.py +++ b/lib/python/Components/Converter/ProgressToText.py @@ -1,6 +1,7 @@ from Components.Converter.Converter import Converter from Components.Element import cached + class ProgressToText(Converter, object): def __init__(self, type): Converter.__init__(self, type) diff --git a/lib/python/Components/Converter/RdsInfo.py b/lib/python/Components/Converter/RdsInfo.py index f3f2b673173..59e1a7b6de3 100644 --- a/lib/python/Components/Converter/RdsInfo.py +++ b/lib/python/Components/Converter/RdsInfo.py @@ -2,6 +2,7 @@ from Components.Converter.Converter import Converter from Components.Element import cached + class RdsInfo(Converter, object): RASS_INTERACTIVE_AVAILABLE = 0 RTP_TEXT_CHANGED = 1 diff --git a/lib/python/Components/Converter/RemainingToText.py b/lib/python/Components/Converter/RemainingToText.py index 305944ce543..0d38f0c1fa2 100644 --- a/lib/python/Components/Converter/RemainingToText.py +++ b/lib/python/Components/Converter/RemainingToText.py @@ -1,6 +1,7 @@ from Components.Converter.Converter import Converter from Components.Element import cached + class RemainingToText(Converter, object): DEFAULT = 0 WITH_SECONDS = 1 diff --git a/lib/python/Components/Converter/RotorPosition.py b/lib/python/Components/Converter/RotorPosition.py index eef362ef8bb..9b9f61e8375 100644 --- a/lib/python/Components/Converter/RotorPosition.py +++ b/lib/python/Components/Converter/RotorPosition.py @@ -6,6 +6,7 @@ from Components.NimManager import nimmanager from enigma import eDVBSatelliteEquipmentControl + class RotorPosition(Converter, object): DEFAULT = 0 WITH_TEXT = 1 diff --git a/lib/python/Components/Converter/SensorToText.py b/lib/python/Components/Converter/SensorToText.py index 4cc918bdca8..e2dfc0a4b1f 100644 --- a/lib/python/Components/Converter/SensorToText.py +++ b/lib/python/Components/Converter/SensorToText.py @@ -1,5 +1,6 @@ from Components.Converter.Converter import Converter + class SensorToText(Converter, object): def __init__(self, arguments): Converter.__init__(self, arguments) diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py index 7f96f8ba679..3e3c2661f15 100644 --- a/lib/python/Components/Converter/ServiceInfo.py +++ b/lib/python/Components/Converter/ServiceInfo.py @@ -5,6 +5,7 @@ WIDESCREEN = [3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10] + class ServiceInfo(Converter): HAS_TELETEXT = 0 IS_MULTICHANNEL = 1 diff --git a/lib/python/Components/Converter/ServiceName.py b/lib/python/Components/Converter/ServiceName.py index 76e08e020f6..ff740de6a14 100644 --- a/lib/python/Components/Converter/ServiceName.py +++ b/lib/python/Components/Converter/ServiceName.py @@ -4,6 +4,7 @@ from ServiceReference import resolveAlternate from Components.Element import cached + class ServiceName(Converter, object): NAME = 0 PROVIDER = 1 diff --git a/lib/python/Components/Converter/ServiceOrbitalPosition.py b/lib/python/Components/Converter/ServiceOrbitalPosition.py index 55dfb169784..66e3d2d50b5 100644 --- a/lib/python/Components/Converter/ServiceOrbitalPosition.py +++ b/lib/python/Components/Converter/ServiceOrbitalPosition.py @@ -5,6 +5,7 @@ from Components.Element import cached + class ServiceOrbitalPosition(Converter, object): FULL = 0 SHORT = 1 diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py index 0f3c8d0a0ab..0a2df727004 100644 --- a/lib/python/Components/Converter/ServicePosition.py +++ b/lib/python/Components/Converter/ServicePosition.py @@ -4,6 +4,7 @@ from Components.Element import cached, ElementError from time import localtime, strftime, time + class ServicePosition(Poll, Converter, object): TYPE_LENGTH = 0 TYPE_POSITION = 1 diff --git a/lib/python/Components/Converter/ServiceTime.py b/lib/python/Components/Converter/ServiceTime.py index 61cba2e9c2d..2a67a6cb030 100644 --- a/lib/python/Components/Converter/ServiceTime.py +++ b/lib/python/Components/Converter/ServiceTime.py @@ -2,6 +2,7 @@ from Components.Element import cached, ElementError from enigma import iServiceInformation + class ServiceTime(Converter, object): STARTTIME = 0 ENDTIME = 1 diff --git a/lib/python/Components/Converter/StaticMultiList.py b/lib/python/Components/Converter/StaticMultiList.py index 139375c54bc..9067c8c6571 100644 --- a/lib/python/Components/Converter/StaticMultiList.py +++ b/lib/python/Components/Converter/StaticMultiList.py @@ -1,8 +1,10 @@ from enigma import eListboxPythonMultiContent from Components.Converter.StringList import StringList + class StaticMultiList(StringList): """Turns a python list in 'multi list format' into a list which can be used in a listbox.""" + def changed(self, what): if not self.content: self.content = eListboxPythonMultiContent() diff --git a/lib/python/Components/Converter/StaticText.py b/lib/python/Components/Converter/StaticText.py index 1b69bfa3a41..88ee523544d 100644 --- a/lib/python/Components/Converter/StaticText.py +++ b/lib/python/Components/Converter/StaticText.py @@ -1,5 +1,6 @@ from Components.Converter.Converter import Converter + class StaticText(Converter, object): def __init__(self, text): Converter.__init__(self, type) diff --git a/lib/python/Components/Converter/Streaming.py b/lib/python/Components/Converter/Streaming.py index 777c1decece..de4bb158c5d 100644 --- a/lib/python/Components/Converter/Streaming.py +++ b/lib/python/Components/Converter/Streaming.py @@ -8,6 +8,7 @@ # lines starting with '+' are PIDs to record: # "+d:[p:t[,p:t...]]" with d=demux nr, p: pid, t: type + class Streaming(Converter): @cached def getText(self): diff --git a/lib/python/Components/Converter/Streaming2.py b/lib/python/Components/Converter/Streaming2.py index 1f094ee7710..29b9d3d03b9 100644 --- a/lib/python/Components/Converter/Streaming2.py +++ b/lib/python/Components/Converter/Streaming2.py @@ -9,6 +9,7 @@ # lines starting with '+' are PIDs to record: # "+d:[p:t[,p:t...]]" with d=demux nr, p: pid, t: type + class Streaming2(Converter): @cached def getText(self): diff --git a/lib/python/Components/Converter/StringList.py b/lib/python/Components/Converter/StringList.py index 9f05125590a..85f89e22d89 100644 --- a/lib/python/Components/Converter/StringList.py +++ b/lib/python/Components/Converter/StringList.py @@ -2,8 +2,10 @@ from enigma import eListboxPythonStringContent from Components.Element import cached + class StringList(Converter): """Turns a simple python list into a list which can be used in a listbox.""" + def __init__(self, type): Converter.__init__(self, type) self.content = None diff --git a/lib/python/Components/Converter/StringListSelection.py b/lib/python/Components/Converter/StringListSelection.py index 747a82a61bb..64fb782308b 100644 --- a/lib/python/Components/Converter/StringListSelection.py +++ b/lib/python/Components/Converter/StringListSelection.py @@ -1,8 +1,10 @@ from Components.Converter.Converter import Converter from Components.Element import cached + class StringListSelection(Converter, object): "extracts the first element of a the current string list element for displaying it on LCD" + def __init__(self, args): Converter.__init__(self, args) diff --git a/lib/python/Components/Converter/TemplatedMultiContent.py b/lib/python/Components/Converter/TemplatedMultiContent.py index 31c38af92f9..f5315cde903 100644 --- a/lib/python/Components/Converter/TemplatedMultiContent.py +++ b/lib/python/Components/Converter/TemplatedMultiContent.py @@ -1,5 +1,6 @@ from Components.Converter.StringList import StringList + class TemplatedMultiContent(StringList): """Turns a python tuple list into a multi-content list which can be used in a listbox renderer.""" diff --git a/lib/python/Components/Converter/TextCase.py b/lib/python/Components/Converter/TextCase.py index 7e24740ba77..6dcad8f73bf 100644 --- a/lib/python/Components/Converter/TextCase.py +++ b/lib/python/Components/Converter/TextCase.py @@ -1,6 +1,7 @@ from Converter import Converter from Components.Element import cached + class TextCase(Converter): """Converts a StaticText into upper/lower case.""" UPPER = 0 diff --git a/lib/python/Components/Converter/TransponderInfo.py b/lib/python/Components/Converter/TransponderInfo.py index 7a9be8e231c..d7b625ab79c 100644 --- a/lib/python/Components/Converter/TransponderInfo.py +++ b/lib/python/Components/Converter/TransponderInfo.py @@ -6,6 +6,7 @@ from Tools.Transponder import ConvertToHumanReadable import Screens.InfoBar + class TransponderInfo(Converter, object): def __init__(self, type): Converter.__init__(self, type) diff --git a/lib/python/Components/Converter/TunerInfo.py b/lib/python/Components/Converter/TunerInfo.py index 2ed71e34714..b2ad4a9afcd 100644 --- a/lib/python/Components/Converter/TunerInfo.py +++ b/lib/python/Components/Converter/TunerInfo.py @@ -2,6 +2,7 @@ from Components.Converter.Converter import Converter from Components.Element import cached + class TunerInfo(Converter, object): def __init__(self, type): Converter.__init__(self, type) diff --git a/lib/python/Components/Converter/ValueBitTest.py b/lib/python/Components/Converter/ValueBitTest.py index b53a8fcb0e4..85374db9ad1 100644 --- a/lib/python/Components/Converter/ValueBitTest.py +++ b/lib/python/Components/Converter/ValueBitTest.py @@ -1,6 +1,7 @@ from Converter import Converter from Components.Element import cached + class ValueBitTest(Converter, object): def __init__(self, arg): Converter.__init__(self, arg) diff --git a/lib/python/Components/Converter/ValueRange.py b/lib/python/Components/Converter/ValueRange.py index ec69c6ac3f8..75c937b905f 100644 --- a/lib/python/Components/Converter/ValueRange.py +++ b/lib/python/Components/Converter/ValueRange.py @@ -1,6 +1,7 @@ from Converter import Converter from Components.Element import cached + class ValueRange(Converter, object): def __init__(self, arg): Converter.__init__(self, arg) diff --git a/lib/python/Components/Converter/genre.py b/lib/python/Components/Converter/genre.py index 50d4be797de..70a090d6d7d 100644 --- a/lib/python/Components/Converter/genre.py +++ b/lib/python/Components/Converter/genre.py @@ -131,6 +131,7 @@ _("unpublished"), _("live broadcast")] + def getGenreStringMain(hn, ln): # if hn == 0: # return _("Undefined content") @@ -141,6 +142,7 @@ def getGenreStringMain(hn, ln): # return _("Reserved") + " " + str(hn) return "" + def getGenreStringSub(hn, ln): # if hn == 0: # return _("Undefined content") + " " + str(ln) @@ -155,6 +157,7 @@ def getGenreStringSub(hn, ln): # return _("Reserved") + " " + str(hn) + "," + str(ln) return "" + def getGenreStringLong(hn, ln): # if hn == 0: # return _("Undefined content") + " " + str(ln) diff --git a/lib/python/Components/DiskInfo.py b/lib/python/Components/DiskInfo.py index b1255ed9d09..b7c56966092 100644 --- a/lib/python/Components/DiskInfo.py +++ b/lib/python/Components/DiskInfo.py @@ -6,6 +6,8 @@ # TODO: Harddisk.py has similiar functions, but only similiar. # fix this to use same code + + class DiskInfo(VariableText, GUIComponent): FREE = 0 USED = 1 diff --git a/lib/python/Components/Element.py b/lib/python/Components/Element.py index d29c441aced..3f9ed3b3e08 100644 --- a/lib/python/Components/Element.py +++ b/lib/python/Components/Element.py @@ -5,8 +5,10 @@ # a bidirectional connection + def cached(f): name = f.__name__ + def wrapper(self): cache = self.cache if cache is None: @@ -16,6 +18,7 @@ def wrapper(self): return cache[name][1] return wrapper + class ElementError(Exception): def __init__(self, message): self.msg = message @@ -23,6 +26,7 @@ def __init__(self, message): def __str__(self): return self.msg + class Element(object): CHANGED_DEFAULT = 0 # initial "pull" state CHANGED_ALL = 1 # really everything changed diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py index f4f1ec5663e..e550ab18fab 100644 --- a/lib/python/Components/EpgList.py +++ b/lib/python/Components/EpgList.py @@ -15,6 +15,7 @@ EPG_TYPE_MULTI = 1 EPG_TYPE_SIMILAR = 2 + class Rect: def __init__(self, x, y, width, height): self.x = x @@ -35,6 +36,7 @@ def height(self): def width(self): return self.w + class EPGList(GUIComponent): def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None, timer=None): self.days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")) @@ -402,22 +404,29 @@ def fillSimilarList(self, refstr, event_id): def applySkin(self, desktop, parent): def warningWrongSkinParameter(string): print "[EPGList] wrong '%s' skin parameters" % string + def setEventItemFont(value): self.eventItemFont = parseFont(value, ((1, 1), (1, 1))) + def setEventTimeFont(value): self.eventTimeFont = parseFont(value, ((1, 1), (1, 1))) + def setIconDistance(value): self.iconDistance = int(value) + def setIconShift(value): self.dy = int(value) + def setTimeWidth(value): self.tw = int(value) + def setColWidths(value): self.col = map(int, value.split(',')) if len(self.col) == 2: self.skinColumns = True else: warningWrongSkinParameter(attrib) + def setColGap(value): self.colGap = int(value) for (attrib, value) in self.skinAttributes[:]: diff --git a/lib/python/Components/FIFOList.py b/lib/python/Components/FIFOList.py index 667bec949f5..c0b18b7fad2 100644 --- a/lib/python/Components/FIFOList.py +++ b/lib/python/Components/FIFOList.py @@ -1,5 +1,6 @@ from Components.MenuList import MenuList + class FIFOList(MenuList): def __init__(self, list=[], len=10): self.list = list diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index 45c3de509a1..7a59bc817e3 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -6,6 +6,7 @@ import NavigationInstance from enigma import iRecordableService + class FanControl: # ATM there's only support for one fan def __init__(self): @@ -56,6 +57,7 @@ def standbyCounterChanged(self, configElement): def createConfig(self): def setVlt(fancontrol, fanid, configElement): fancontrol.setVoltage(fanid, configElement.value) + def setPWM(fancontrol, fanid, configElement): fancontrol.setPWM(fanid, configElement.value) @@ -101,4 +103,5 @@ def setPWM(self, fanid, value): return open("/proc/stb/fp/fan_pwm", "w").write("%x" % value) + fancontrol = FanControl() diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index c5ae70597df..5d64421a90d 100644 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -62,6 +62,7 @@ "wtv": "movie", } + def FileEntryComponent(name, absolute=None, isDir=False): res = [(absolute, isDir)] x, y, w, h = skin.parameters.get("FileListName", (35, 1, 600, 20)) @@ -81,6 +82,7 @@ def FileEntryComponent(name, absolute=None, isDir=False): return res + class FileList(MenuList): def __init__(self, directory, showDirectories=True, showFiles=True, showMountpoints=True, matchingPattern=None, useServiceRef=False, inhibitDirs=False, inhibitMounts=False, isTop=False, enableWrapAround=False, additionalExtensions=None): MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) diff --git a/lib/python/Components/GUIComponent.py b/lib/python/Components/GUIComponent.py index 97c61a45220..5f2761cd1c2 100644 --- a/lib/python/Components/GUIComponent.py +++ b/lib/python/Components/GUIComponent.py @@ -2,6 +2,7 @@ from enigma import ePoint, eSize + class GUIComponent(object): """ GUI component """ diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 3ff295a8453..af7ae0e6ed2 100644 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -5,12 +5,14 @@ from Components.Console import Console import Task + def readFile(filename): file = open(filename) data = file.read().strip() file.close() return data + def getProcMounts(): try: mounts = open("/proc/mounts", 'r') @@ -23,6 +25,7 @@ def getProcMounts(): item[1] = item[1].replace('\\040', ' ') return result + def isFileSystemSupported(filesystem): try: for fs in open('/proc/filesystems', 'r'): @@ -32,6 +35,7 @@ def isFileSystemSupported(filesystem): except Exception, ex: print "[Harddisk] Failed to read /proc/filesystems:", ex + def findMountPoint(path): 'Example: findMountPoint("/media/hdd/some/file") returns "/media/hdd"' path = os.path.abspath(path) @@ -39,9 +43,11 @@ def findMountPoint(path): path = os.path.dirname(path) return path + DEVTYPE_UDEV = 0 DEVTYPE_DEVFS = 1 + class Harddisk: def __init__(self, device, removable=False): self.device = device @@ -501,6 +507,7 @@ def setIdleTime(self, idle): def isSleeping(self): return self.is_sleeping + class Partition: # for backward compatibility, force_mounted actually means "hotplug" def __init__(self, mountpoint, device=None, description="", force_mounted=False): @@ -509,6 +516,7 @@ def __init__(self, mountpoint, device=None, description="", force_mounted=False) self.force_mounted = mountpoint and force_mounted self.is_hotplug = force_mounted # so far; this might change. self.device = device + def __str__(self): return "Partition(mountpoint=%s,description=%s,device=%s)" % (self.mountpoint, self.description, self.device) @@ -564,6 +572,7 @@ def filesystem(self, mounts=None): return fields[2] return '' + def addInstallTask(job, package): task = Task.LoggingTask(job, "update packages") task.setTool('opkg') @@ -573,6 +582,7 @@ def addInstallTask(job, package): task.args.append('install') task.args.append(package) + class HarddiskManager: def __init__(self): self.hdd = [] @@ -812,11 +822,13 @@ def setDVDSpeed(self, device, speed=0): except Exception, ex: print "[Harddisk] Failed to set %s speed to %s" % (device, speed), ex + class UnmountTask(Task.LoggingTask): def __init__(self, job, hdd): Task.LoggingTask.__init__(self, job, _("Unmount")) self.hdd = hdd self.mountpoints = [] + def prepare(self): try: dev = self.hdd.disk_path.split('/')[-1] @@ -833,6 +845,7 @@ def prepare(self): print "UnmountTask: No mountpoints found?" self.cmd = 'true' self.args = [self.cmd] + def afterRun(self): for path in self.mountpoints: try: @@ -840,10 +853,12 @@ def afterRun(self): except Exception, ex: print "Failed to remove path '%s':" % path, ex + class MountTask(Task.LoggingTask): def __init__(self, job, hdd): Task.LoggingTask.__init__(self, job, _("Mount")) self.hdd = hdd + def prepare(self): try: dev = self.hdd.disk_path.split('/')[-1] @@ -877,6 +892,7 @@ def prepare(self): class MkfsTask(Task.LoggingTask): def prepare(self): self.fsck_state = None + def processOutput(self, data): print "[Mkfs]", data if 'Writing inode tables:' in data: @@ -901,6 +917,7 @@ def processOutput(self, data): harddiskmanager = HarddiskManager() + def isSleepStateDevice(device): ret = os.popen("hdparm -C %s" % device).read() if 'SG_IO' in ret or 'HDIO_DRIVE_CMD' in ret: @@ -911,6 +928,7 @@ def isSleepStateDevice(device): return False return None + def internalHDDNotSleeping(external=False): state = False if harddiskmanager.HDDCount(): @@ -920,4 +938,5 @@ def internalHDDNotSleeping(external=False): state = True return state + SystemInfo["ext4"] = isFileSystemSupported("ext4") diff --git a/lib/python/Components/HdmiCec.py b/lib/python/Components/HdmiCec.py index e17e4d6269e..9b836678f51 100644 --- a/lib/python/Components/HdmiCec.py +++ b/lib/python/Components/HdmiCec.py @@ -525,4 +525,5 @@ def fdebug(self, output): fp.write(output) fp.close() + hdmi_cec = HdmiCec() diff --git a/lib/python/Components/HelpMenuList.py b/lib/python/Components/HelpMenuList.py index 9e04afc4895..c16dc291ad6 100644 --- a/lib/python/Components/HelpMenuList.py +++ b/lib/python/Components/HelpMenuList.py @@ -7,6 +7,7 @@ # [ ( actionmap, context, [(action, help), (action, help), ...] ), (actionmap, ... ), ... ] + class HelpMenuList(GUIComponent): def __init__(self, helplist, callback): GUIComponent.__init__(self) diff --git a/lib/python/Components/ImportChannels.py b/lib/python/Components/ImportChannels.py index c2468c8cda9..7915209b929 100644 --- a/lib/python/Components/ImportChannels.py +++ b/lib/python/Components/ImportChannels.py @@ -13,6 +13,7 @@ settingfiles = ('lamedb', 'bouquets.', 'userbouquet.', 'blacklist', 'whitelist', 'alternatives.') + class ImportChannels(): def __init__(self): diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py index 8cb4676fb6a..f60d407701d 100644 --- a/lib/python/Components/Input.py +++ b/lib/python/Components/Input.py @@ -5,6 +5,7 @@ from Tools.NumericalTextInput import NumericalTextInput + class Input(VariableText, GUIComponent, NumericalTextInput): TEXT = 0 PIN = 1 diff --git a/lib/python/Components/InputDevice.py b/lib/python/Components/InputDevice.py index fb747db2254..45e4754d10b 100644 --- a/lib/python/Components/InputDevice.py +++ b/lib/python/Components/InputDevice.py @@ -18,6 +18,7 @@ IOC_READ = 2L + def EVIOCGNAME(length): return (IOC_READ << IOC_DIRSHIFT) | (length << IOC_SIZESHIFT) | (0x45 << IOC_TYPESHIFT) | (0x06 << IOC_NRSHIFT) @@ -46,7 +47,6 @@ def getInputDevices(self): if self.name: self.Devices[evdev] = {'name': self.name, 'type': self.getInputDeviceType(self.name), 'enabled': False, 'configuredName': None} - def getInputDeviceType(self, name): if "remote control" in str(name).lower(): return "remote" @@ -195,6 +195,7 @@ def setupConfigEntries(self, device): config.plugins.remotecontroltype = ConfigSubsection() config.plugins.remotecontroltype.rctype = ConfigInteger(default=0) + class RcTypeControl(): def __init__(self): if SystemInfo["RcTypeChangable"] and os.path.exists('/proc/stb/info/boxtype'): @@ -221,4 +222,5 @@ def readRcType(self): rc = open('/proc/stb/ir/rc/type', 'r').read().strip() return int(rc) + iRcTypeControl = RcTypeControl() diff --git a/lib/python/Components/InputHotplug.py b/lib/python/Components/InputHotplug.py index 0e0dca0ebae..05a8c2f65f4 100644 --- a/lib/python/Components/InputHotplug.py +++ b/lib/python/Components/InputHotplug.py @@ -2,13 +2,16 @@ import enigma import os + class NetlinkReader(): def __init__(self): from twisted.internet import reactor self.nls = Netlink.NetlinkSocket() reactor.addReader(self) + def fileno(self): return self.nls.fileno() + def doRead(self): for event in self.nls.parse(): try: @@ -28,11 +31,14 @@ def doRead(self): except KeyError: # Ignore "not found" pass + def connectionLost(self, failure): # Ignore... print "connectionLost?", failure self.nls.close() + def logPrefix(self): return 'NetlinkReader' + reader = NetlinkReader() diff --git a/lib/python/Components/Label.py b/lib/python/Components/Label.py index 781f77d01f6..64e6f1141a9 100644 --- a/lib/python/Components/Label.py +++ b/lib/python/Components/Label.py @@ -5,6 +5,7 @@ from enigma import eLabel + class Label(VariableText, GUIComponent): def __init__(self, text=""): GUIComponent.__init__(self) @@ -28,21 +29,25 @@ def getSize(self): s = self.instance.calculateSize() return (s.width(), s.height()) + class LabelConditional(Label, ConditionalWidget): def __init__(self, text="", withTimer=True): ConditionalWidget.__init__(self, withTimer=withTimer) Label.__init__(self, text=text) + class BlinkingLabel(Label, BlinkingWidget): def __init__(self, text=""): Label.__init__(text=text) BlinkingWidget.__init__() + class BlinkingLabelConditional(BlinkingWidgetConditional, LabelConditional): def __init__(self, text=""): LabelConditional.__init__(self, text=text) BlinkingWidgetConditional.__init__(self) + class MultiColorLabel(Label): def __init__(self, text=""): Label.__init__(self, text) diff --git a/lib/python/Components/Language.py b/lib/python/Components/Language.py index 04a5d56c187..85181fa7753 100644 --- a/lib/python/Components/Language.py +++ b/lib/python/Components/Language.py @@ -5,6 +5,7 @@ from Tools.Directories import SCOPE_LANGUAGE, resolveFilename + class Language: def __init__(self): gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8") @@ -131,4 +132,5 @@ def getGStreamerSubtitleEncoding(self): def addCallback(self, callback): self.callbacks.append(callback) + language = Language() diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index b9dee8aba3a..02232a9fa0d 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -4,14 +4,17 @@ from Screens.InfoBar import InfoBar from Screens.Screen import Screen + class dummyScreen(Screen): skin = """ """ + def __init__(self, session, args=None): Screen.__init__(self, session) self.close() + class LCD: def __init__(self): pass @@ -41,14 +44,17 @@ def setFlipped(self, value): def isOled(self): return eDBoxLCD.getInstance().isOled() + def leaveStandby(): config.lcd.bright.apply() + def standbyCounterChanged(dummy): from Screens.Standby import inStandby inStandby.onClose.append(leaveStandby) config.lcd.standby.apply() + def InitLcd(): detected = eDBoxLCD.getInstance() and eDBoxLCD.getInstance().detected() config.lcd = ConfigSubsection() @@ -147,6 +153,7 @@ def doNothing(): config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call=False) + def setLCDLiveTv(value): if "live_enable" in SystemInfo["LcdLiveTV"]: open(SystemInfo["LcdLiveTV"], "w").write(value and "enable" or "disable") @@ -159,10 +166,12 @@ def setLCDLiveTv(value): except: pass + def leaveStandbyLCDLiveTV(): if config.lcd.showTv.value: setLCDLiveTv(True) + def standbyCounterChangedLCDLiveTV(dummy): if config.lcd.showTv.value: from Screens.Standby import inStandby diff --git a/lib/python/Components/MediaPlayer.py b/lib/python/Components/MediaPlayer.py index b16d6316ef6..08874f54f3a 100644 --- a/lib/python/Components/MediaPlayer.py +++ b/lib/python/Components/MediaPlayer.py @@ -15,6 +15,7 @@ STATE_FORWARD = 4 STATE_NONE = 5 + class PlayList(MenuList): def __init__(self, enableWrapAround=False): MenuList.__init__(self, [], enableWrapAround, eListboxPythonMultiContent) diff --git a/lib/python/Components/MenuList.py b/lib/python/Components/MenuList.py index d528e2afe3b..31626d3e9b6 100644 --- a/lib/python/Components/MenuList.py +++ b/lib/python/Components/MenuList.py @@ -2,6 +2,7 @@ from enigma import eListboxPythonStringContent, eListbox + class MenuList(GUIComponent): def __init__(self, list, enableWrapAround=True, content=eListboxPythonStringContent): GUIComponent.__init__(self) diff --git a/lib/python/Components/MovieList.py b/lib/python/Components/MovieList.py index c35c268b978..e19cd7bae5f 100644 --- a/lib/python/Components/MovieList.py +++ b/lib/python/Components/MovieList.py @@ -22,19 +22,26 @@ cutsParser = struct.Struct('>QI') # big-endian, 64-bit PTS and 32-bit type + class MovieListData: pass # iStaticServiceInformation + + class StubInfo: def getName(self, serviceref): return os.path.split(serviceref.getPath())[1] + def getLength(self, serviceref): return -1 + def getEvent(self, serviceref, *args): return None + def isPlayable(self): return True + def getInfo(self, serviceref, w): if w == iServiceInformation.sTimeCreate: return os.stat(serviceref.getPath()).st_ctime @@ -43,14 +50,19 @@ def getInfo(self, serviceref, w): if w == iServiceInformation.sDescription: return serviceref.getPath() return 0 + def getInfoString(self, serviceref, w): return '' + + justStubInfo = StubInfo() + def lastPlayPosFromCache(ref): from Screens.InfoBarGenerics import resumePointCache return resumePointCache.get(ref.toString(), None) + def moviePlayState(cutsFileName, ref, length): '''Returns None, 0..100 for percentage''' try: @@ -99,6 +111,7 @@ def moviePlayState(cutsFileName, ref, length): return 50 return None + def resetMoviePlayState(cutsFileName, ref=None): try: if ref is not None: @@ -254,56 +267,76 @@ def setSortType(self, type): def applySkin(self, desktop, parent): def warningWrongSkinParameter(string): print "[MovieList] wrong '%s' skin parameters" % string + def fontName(value): self.fontName = value + def fontSizesOriginal(value): self.fontSizesOriginal = map(parseScale, value.split(",")) if len(self.fontSizesOriginal) != 3: warningWrongSkinParameter(attrib) + def fontSizesCompact(value): self.fontSizesCompact = map(parseScale, value.split(",")) if len(self.fontSizesCompact) != 2: warningWrongSkinParameter(attrib) + def fontSizesMinimal(value): self.fontSizesMinimal = map(parseScale, value.split(",")) if len(self.fontSizesMinimal) != 2: warningWrongSkinParameter(attrib) + def itemHeights(value): self.itemHeights = map(parseScale, value.split(",")) if len(self.itemHeights) != 3: warningWrongSkinParameter(attrib) + def pbarShift(value): self.pbarShift = parseScale(value) + def pbarHeight(value): self.pbarHeight = parseScale(value) + def pbarLargeWidth(value): self.pbarLargeWidth = parseScale(value) + def partIconeShiftMinimal(value): self.partIconeShiftMinimal = parseScale(value) + def partIconeShiftCompact(value): self.partIconeShiftCompact = parseScale(value) + def partIconeShiftOriginal(value): self.partIconeShiftOriginal = parseScale(value) + def spaceIconeText(value): self.spaceIconeText = parseScale(value) + def iconsWidth(value): self.iconsWidth = parseScale(value) + def trashShift(value): self.trashShift = parseScale(value) + def dirShift(value): self.dirShift = parseScale(value) + def spaceRight(value): self.spaceRight = parseScale(value) + def columnsOriginal(value): self.columnsOriginal = map(parseScale, value.split(",")) if len(self.columnsOriginal) != 2: warningWrongSkinParameter(attrib) + def columnsCompactDescription(value): self.columnsCompactDescription = map(parseScale, value.split(",")) if len(self.columnsCompactDescription) != 3: warningWrongSkinParameter(attrib) + def compactColumn(value): self.compactColumn = parseScale(value) + def treeDescription(value): self.treeDescription = parseScale(value) for (attrib, value) in self.skinAttributes[:]: @@ -855,6 +888,7 @@ def _moveToChrStr(self): if self._lbl: self._lbl.visible = False + def getShortName(name, serviceref): if serviceref.flags & eServiceReference.mustDescent: #Directory pathName = serviceref.getPath() diff --git a/lib/python/Components/MultiContent.py b/lib/python/Components/MultiContent.py index 9d65fb007ee..e671c75757b 100644 --- a/lib/python/Components/MultiContent.py +++ b/lib/python/Components/MultiContent.py @@ -4,6 +4,7 @@ from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename from Tools.LoadPixmap import LoadPixmap + def __resolveColor(color): if isinstance(color, str): try: @@ -13,6 +14,7 @@ def __resolveColor(color): return None return color + def __resolvePixmap(pixmap): if isinstance(pixmap, str): try: @@ -22,23 +24,30 @@ def __resolvePixmap(pixmap): return None return pixmap + def MultiContentTemplateColor(n): return 0xff000000 | n + def MultiContentEntryText(pos=(0, 0), size=(0, 0), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_TOP, text="", color=None, color_sel=None, backcolor=None, backcolor_sel=None, border_width=None, border_color=None): return eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text, __resolveColor(color), __resolveColor(color_sel), __resolveColor(backcolor), __resolveColor(backcolor_sel), border_width, __resolveColor(border_color) + def MultiContentEntryPixmap(pos=(0, 0), size=(0, 0), png=None, backcolor=None, backcolor_sel=None, flags=0): return eListboxPythonMultiContent.TYPE_PIXMAP, pos[0], pos[1], size[0], size[1], __resolvePixmap(png), __resolveColor(backcolor), __resolveColor(backcolor_sel), flags + def MultiContentEntryPixmapAlphaTest(pos=(0, 0), size=(0, 0), png=None, backcolor=None, backcolor_sel=None, flags=0): return eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, pos[0], pos[1], size[0], size[1], __resolvePixmap(png), __resolveColor(backcolor), __resolveColor(backcolor_sel), flags + def MultiContentEntryPixmapAlphaBlend(pos=(0, 0), size=(0, 0), png=None, backcolor=None, backcolor_sel=None, flags=0): return eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, pos[0], pos[1], size[0], size[1], __resolvePixmap(png), __resolveColor(backcolor), __resolveColor(backcolor_sel), flags + def MultiContentEntryProgress(pos=(0, 0), size=(0, 0), percent=None, borderWidth=None, foreColor=None, foreColorSelected=None, backColor=None, backColorSelected=None): return eListboxPythonMultiContent.TYPE_PROGRESS, pos[0], pos[1], size[0], size[1], percent, borderWidth, __resolveColor(foreColor), __resolveColor(foreColorSelected), __resolveColor(backColor), __resolveColor(backColorSelected) + def MultiContentEntryProgressPixmap(pos=(0, 0), size=(0, 0), percent=None, pixmap=None, borderWidth=None, foreColor=None, foreColorSelected=None, backColor=None, backColorSelected=None): return eListboxPythonMultiContent.TYPE_PROGRESS_PIXMAP, pos[0], pos[1], size[0], size[1], percent, __resolvePixmap(pixmap), borderWidth, __resolveColor(foreColor), __resolveColor(foreColorSelected), __resolveColor(backColor), __resolveColor(backColorSelected) diff --git a/lib/python/Components/Netlink.py b/lib/python/Components/Netlink.py index 716123fe182..302027af942 100644 --- a/lib/python/Components/Netlink.py +++ b/lib/python/Components/Netlink.py @@ -3,6 +3,7 @@ import os import socket + class NetlinkSocket(socket.socket): def __init__(self): NETLINK_KOBJECT_UEVENT = 15 # hasn't landed in socket yet, see linux/netlink.h @@ -24,6 +25,7 @@ def parse(self): except: event[None] = item + # Quick unit test (you can run this on any Linux machine) if __name__ == '__main__': nls = NetlinkSocket() diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 91d604c841c..a0f6b5f24e1 100644 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -6,6 +6,7 @@ from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor + class Network: def __init__(self): self.ifaces = {} @@ -472,6 +473,7 @@ def deactivateInterface(self, ifaces, callback=None): self.config_ready = False self.msgPlugins() commands = [] + def buildCommands(iface): commands.append(("/sbin/ifdown", "/sbin/ifdown", "-f", iface)) commands.append(("/sbin/ip", "/sbin/ip", "addr", "flush", "dev", iface, "scope", "global")) @@ -617,7 +619,9 @@ def hotplug(self, event): except KeyError: pass + iNetwork = Network() + def InitNetwork(): pass diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index edbb021d15f..8022bf01a9f 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -15,6 +15,7 @@ config.unicable = ConfigSubsection() + def getConfigSatlist(orbpos, satlist): default_orbpos = None for x in satlist: @@ -23,6 +24,7 @@ def getConfigSatlist(orbpos, satlist): break return ConfigSatlist(satlist, default_orbpos) + class SecConfigure: def getConfiguredSats(self): return self.configuredSatellites @@ -496,6 +498,7 @@ def __init__(self, nimmgr): self.configuredSatellites = set() self.update() + class NIM(object): def __init__(self, slot, type, description, has_outputs=True, internally_connectable=None, multi_type={}, frontend_id=None, i2c=None, is_empty=False, supports_blind_scan=False, number_of_slots=0): nim_types = ["DVB-S", "DVB-S2", "DVB-S2X", "DVB-C", "DVB-T", "DVB-T2", "ATSC"] @@ -694,6 +697,7 @@ def isEnabled(self): empty = property(lambda self: self.getType() is None) enabled = property(isEnabled) + class NimManager: def getConfiguredSats(self): return self.sec.getConfiguredSats() @@ -1154,6 +1158,7 @@ def getRotorSatListForNim(self, slotid): list.append(user_sat) return list + def InitSecParams(): config.sec = ConfigSubsection() config.sec.delay_after_continuous_tone_disable_before_diseqc = ConfigInteger(default=25, limits=(0, 9999)) @@ -1206,6 +1211,7 @@ def InitSecParams(): # the C(++) part should can handle this # the configElement should be only visible when diseqc 1.2 is disabled + def InitNimManager(nimmgr, update_slots=[]): hw = HardwareInfo() @@ -1283,10 +1289,13 @@ def configLOFChanged(configElement): if isinstance(section.unicable, ConfigNothing): def setPowerInserter(configEntry): section.bootuptime.value = 0 if configEntry.value else section.bootuptime.default + def getformat(value, index): return ("jess" if index >= int(value.split(",")[1] if "," in value else 4) else "unicable") if value.startswith("dSCR") else value + def positionsChanged(configEntry): section.positionNumber = ConfigSelection(["%d" % (x + 1) for x in range(configEntry.value)], default="%d" % min(lnb, configEntry.value)) + def scrListChanged(productparameters, srcfrequencylist, configEntry): section.format = ConfigSelection(["unicable", "jess"], default=getformat(productparameters.get("format", "unicable"), configEntry.index)) section.scrfrequency = ConfigInteger(default=int(srcfrequencylist[configEntry.index])) @@ -1296,6 +1305,7 @@ def scrListChanged(productparameters, srcfrequencylist, configEntry): section.lofl = ConfigInteger(default=int(productparameters.get("lofl", 9750)), limits=(0, 99999)) section.lofh = ConfigInteger(default=int(productparameters.get("lofh", 10600)), limits=(0, 99999)) section.threshold = ConfigInteger(default=int(productparameters.get("threshold", 11700)), limits=(0, 99999)) + def unicableProductChanged(manufacturer, lnb_or_matrix, configEntry): config.unicable.unicableProduct.value = configEntry.value config.unicable.unicableProduct.save() @@ -1309,6 +1319,7 @@ def unicableProductChanged(manufacturer, lnb_or_matrix, configEntry): section.scrList = ConfigSelection([("%d" % (x + 1), "User Band %d (%s)" % ((x + 1), srcfrequencylist[x])) for x in range(len(srcfrequencylist))]) section.scrList.save_forced = True section.scrList.addNotifier(boundFunction(scrListChanged, productparameters, srcfrequencylist)) + def unicableManufacturerChanged(lnb_or_matrix, configEntry): config.unicable.unicableManufacturer.value = configEntry.value config.unicable.unicableManufacturer.save() @@ -1319,11 +1330,13 @@ def unicableManufacturerChanged(lnb_or_matrix, configEntry): section.unicableProduct = ConfigSelection(productslist, default=config.unicable.unicableProduct.value) section.unicableProduct.save_forced = True section.unicableProduct.addNotifier(boundFunction(unicableProductChanged, configEntry.value, lnb_or_matrix)) + def userScrListChanged(srcfrequencyList, configEntry): section.scrfrequency = ConfigInteger(default=int(srcfrequencyList[configEntry.index]), limits=(0, 99999)) section.lofl = ConfigInteger(default=9750, limits=(0, 99999)) section.lofh = ConfigInteger(default=10600, limits=(0, 99999)) section.threshold = ConfigInteger(default=11700, limits=(0, 99999)) + def formatChanged(configEntry): section.positions = ConfigInteger(default=configEntry.value == "jess" and 64 or 2) section.positions.addNotifier(positionsChanged) @@ -1338,6 +1351,7 @@ def formatChanged(configEntry): section.powerinserter = ConfigYesNo(default=SystemInfo["FbcTunerPowerAlwaysOn"]) section.powerinserter.save_forced = True section.powerinserter.addNotifier(setPowerInserter) + def unicableChanged(configEntry): config.unicable.unicable.value = configEntry.value config.unicable.unicable.save() @@ -1702,4 +1716,5 @@ def createConfig(nim, slot): nimmgr.sec = SecConfigure(nimmgr) + nimmanager = NimManager() diff --git a/lib/python/Components/Opkg.py b/lib/python/Components/Opkg.py index 0b53cc3df2c..a304a376446 100644 --- a/lib/python/Components/Opkg.py +++ b/lib/python/Components/Opkg.py @@ -6,16 +6,19 @@ opkgDestinations = [] opkgStatusPath = '' + def opkgExtraDestinations(): global opkgDestinations return ''.join([" --add-dest %s:%s" % (i, i) for i in opkgDestinations]) + def opkgAddDestination(mountpoint): global opkgDestinations if mountpoint not in opkgDestinations: opkgDestinations.append(mountpoint) print "[Opkg] Added to OPKG destinations:", mountpoint + def onPartitionChange(why, part): global opkgDestinations global opkgStatusPath @@ -37,6 +40,7 @@ def onPartitionChange(why, part): except: pass + def enumFeeds(): for fn in os.listdir('/etc/opkg'): if fn.endswith('-feed.conf'): @@ -48,6 +52,7 @@ def enumFeeds(): except IOError: pass + def enumPlugins(filter_start=''): list_dir = listsDirPath() for feed in enumFeeds(): @@ -82,6 +87,7 @@ def enumPlugins(filter_start=''): except IOError: pass + def listsDirPath(): try: for line in open('/etc/opkg/opkg.conf', "r"): @@ -93,6 +99,7 @@ def listsDirPath(): print "[opkg]", ex return '/var/lib/opkg/lists' + if __name__ == '__main__': for p in enumPlugins('enigma'): print p @@ -101,6 +108,7 @@ def listsDirPath(): for part in harddiskmanager.getMountedPartitions(): onPartitionChange('add', part) + class OpkgComponent: EVENT_INSTALL = 0 EVENT_DOWNLOAD = 1 diff --git a/lib/python/Components/PackageInfo.py b/lib/python/Components/PackageInfo.py index e7102c9a175..b2504f2a4f8 100644 --- a/lib/python/Components/PackageInfo.py +++ b/lib/python/Components/PackageInfo.py @@ -8,12 +8,15 @@ from enigma import eConsoleAppContainer, eDVBDB import os + class InfoHandlerParseError(Exception): def __init__(self, value): self.value = value + def __str__(self): return repr(self.value) + class InfoHandler(xml.sax.ContentHandler): def __init__(self, prerequisiteMet, directory): self.attributes = {} diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index 62898e1b8b1..f78118a6ff7 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -17,6 +17,7 @@ FLAG_IS_PARENTAL_PROTECTED_HIDDEN = 256 + def InitParentalControl(): config.ParentalControl = ConfigSubsection() config.ParentalControl.storeservicepin = ConfigSelection(default="never", choices=[("never", _("never")), ("5", _("%d minutes") % 5), ("15", _("%d minutes") % 15), ("30", _("%d minutes") % 30), ("60", _("%d minutes") % 60), ("120", _("%d minutes") % 120), ("standby", _("until standby/restart"))]) @@ -51,6 +52,7 @@ def InitParentalControl(): global parentalControl parentalControl = ParentalControl() + class ParentalControl: def __init__(self): self.filesOpened = False diff --git a/lib/python/Components/PerServiceDisplay.py b/lib/python/Components/PerServiceDisplay.py index dfcd8e1fc42..249a8e92562 100644 --- a/lib/python/Components/PerServiceDisplay.py +++ b/lib/python/Components/PerServiceDisplay.py @@ -59,8 +59,10 @@ def disablePolling(self): def poll(self): pass + class PerServiceDisplay(PerServiceBase, VariableText, GUIComponent): """Mixin for building components which display something which changes on navigation events, for example "service name" """ + def __init__(self, navcore, eventmap): GUIComponent.__init__(self) VariableText.__init__(self) @@ -72,6 +74,7 @@ def destroy(self): GUI_WIDGET = eLabel + class PerServiceDisplayProgress(PerServiceBase, VariableValue, GUIComponent): def __init__(self, navcore, eventmap): GUIComponent.__init__(self) diff --git a/lib/python/Components/Pixmap.py b/lib/python/Components/Pixmap.py index 9f3f97434f4..36ff0b49339 100644 --- a/lib/python/Components/Pixmap.py +++ b/lib/python/Components/Pixmap.py @@ -7,6 +7,7 @@ from os import path from skin import loadPixmap + class Pixmap(GUIComponent): GUI_WIDGET = ePixmap @@ -14,11 +15,13 @@ def getSize(self): s = self.instance.size() return (s.width(), s.height()) + class PixmapConditional(ConditionalWidget, Pixmap): def __init__(self, withTimer=True): ConditionalWidget.__init__(self) Pixmap.__init__(self) + class MovingPixmap(Pixmap): def __init__(self): Pixmap.__init__(self) @@ -85,6 +88,7 @@ def doMove(self): self.moving = False self.startMoving() + class MultiPixmap(Pixmap): def __init__(self): Pixmap.__init__(self) diff --git a/lib/python/Components/Playlist.py b/lib/python/Components/Playlist.py index 54d44837a50..812493ab454 100644 --- a/lib/python/Components/Playlist.py +++ b/lib/python/Components/Playlist.py @@ -2,6 +2,7 @@ from enigma import eServiceReference import os + class PlaylistIO: def __init__(self): self.list = [] @@ -38,6 +39,7 @@ def getRef(self, filename, entry): ref = eServiceReference(4097, 0, path) return ServiceReference(ref) + class PlaylistIOInternal(PlaylistIO): def __init__(self): PlaylistIO.__init__(self) @@ -65,6 +67,7 @@ def save(self, filename=None): return self.OK + class PlaylistIOM3U(PlaylistIO): def __init__(self): PlaylistIO.__init__(self) @@ -97,6 +100,7 @@ def open(self, filename): def save(self, filename=None): return self.ERROR + class PlaylistIOPLS(PlaylistIO): def __init__(self): PlaylistIO.__init__(self) diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index ee5613a2dd8..8de960a517e 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -6,6 +6,7 @@ from Plugins.Plugin import PluginDescriptor import keymapparser + class PluginComponent: firstRun = True restartRequired = False @@ -156,4 +157,5 @@ def getNextWakeupTime(self): wakeup = current return int(wakeup) + plugins = PluginComponent() diff --git a/lib/python/Components/PluginList.py b/lib/python/Components/PluginList.py index 86fde06ad47..ffac2a0db11 100644 --- a/lib/python/Components/PluginList.py +++ b/lib/python/Components/PluginList.py @@ -7,6 +7,7 @@ from Tools.LoadPixmap import LoadPixmap import skin + def PluginEntryComponent(plugin, width=440): if plugin.icon is None: png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "icons/plugin.png")) @@ -22,6 +23,7 @@ def PluginEntryComponent(plugin, width=440): MultiContentEntryPixmapAlphaTest(pos=(ix, iy), size=(iw, ih), png=png, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO | BT_HALIGN_CENTER | BT_VALIGN_CENTER) ] + def PluginCategoryComponent(name, png, width=440): x, y, h = skin.parameters.get("PluginBrowserDownloadName", (80, 5, 25)) ix, iy, iw, ih = skin.parameters.get("PluginBrowserDownloadIcon", (10, 0, 60, 50)) @@ -31,6 +33,7 @@ def PluginCategoryComponent(name, png, width=440): MultiContentEntryPixmapAlphaTest(pos=(ix, iy), size=(iw, ih), png=png) ] + def PluginDownloadComponent(plugin, name, version=None, width=440): if plugin.icon is None: png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "icons/plugin.png")) diff --git a/lib/python/Components/ProgressBar.py b/lib/python/Components/ProgressBar.py index 734c047bf09..1e713d257d3 100644 --- a/lib/python/Components/ProgressBar.py +++ b/lib/python/Components/ProgressBar.py @@ -4,6 +4,8 @@ from enigma import eSlider # a general purpose progress bar + + class ProgressBar(VariableValue, GUIComponent, object): def __init__(self): GUIComponent.__init__(self) diff --git a/lib/python/Components/RFmod.py b/lib/python/Components/RFmod.py index 7873da4a0b7..076df9737b2 100644 --- a/lib/python/Components/RFmod.py +++ b/lib/python/Components/RFmod.py @@ -6,23 +6,30 @@ RFMOD_CHANNEL_MIN = 21 RFMOD_CHANNEL_MAX = 69 + 1 + class RFmod: def __init__(self): pass def setFunction(self, value): eRFmod.getInstance().setFunction(not value) + def setTestmode(self, value): eRFmod.getInstance().setTestmode(value) + def setSoundFunction(self, value): eRFmod.getInstance().setSoundFunction(not value) + def setSoundCarrier(self, value): eRFmod.getInstance().setSoundCarrier(value) + def setChannel(self, value): eRFmod.getInstance().setChannel(value) + def setFinetune(self, value): eRFmod.getInstance().setFinetune(value) + def InitRFmod(): detected = eRFmod.getInstance().detected() SystemInfo["RfModulator"] = detected diff --git a/lib/python/Components/RcModel.py b/lib/python/Components/RcModel.py index 51230747974..1316d8f2024 100644 --- a/lib/python/Components/RcModel.py +++ b/lib/python/Components/RcModel.py @@ -2,6 +2,7 @@ from Tools.HardwareInfo import HardwareInfo from Tools.Directories import SCOPE_SKIN, resolveFilename + class RcModel: RcModels = {} @@ -43,4 +44,5 @@ def getRcImg(self): def getRcPositions(self): return self.getRcFile('xml') + rc_model = RcModel() diff --git a/lib/python/Components/RecordingConfig.py b/lib/python/Components/RecordingConfig.py index e01ecfc4d64..25ce5b57760 100644 --- a/lib/python/Components/RecordingConfig.py +++ b/lib/python/Components/RecordingConfig.py @@ -1,5 +1,6 @@ from config import ConfigNumber, ConfigYesNo, ConfigSubsection, ConfigSelection, config + def InitRecordingConfig(): config.recording = ConfigSubsection() # actually this is "recordings always have priority". "Yes" does mean: don't ask. The RecordTimer will ask when value is 0. diff --git a/lib/python/Components/Renderer/Canvas.py b/lib/python/Components/Renderer/Canvas.py index 2c17340b3c0..53c748f5629 100644 --- a/lib/python/Components/Renderer/Canvas.py +++ b/lib/python/Components/Renderer/Canvas.py @@ -2,6 +2,7 @@ from enigma import eCanvas, eRect, gRGB + class Canvas(Renderer): GUI_WIDGET = eCanvas diff --git a/lib/python/Components/Renderer/ChannelNumber.py b/lib/python/Components/Renderer/ChannelNumber.py index ea3550c93d5..5e7e89d2936 100644 --- a/lib/python/Components/Renderer/ChannelNumber.py +++ b/lib/python/Components/Renderer/ChannelNumber.py @@ -2,6 +2,7 @@ from enigma import eLabel, iPlayableService from Renderer import Renderer + class ChannelNumber(Renderer, VariableText): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/CiModuleControl.py b/lib/python/Components/Renderer/CiModuleControl.py index 6eec46caafd..dfcd62812cb 100644 --- a/lib/python/Components/Renderer/CiModuleControl.py +++ b/lib/python/Components/Renderer/CiModuleControl.py @@ -3,6 +3,7 @@ from Components.SystemInfo import SystemInfo from Components.VariableText import VariableText + class CiModuleControl(Renderer, VariableText): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/FixedLabel.py b/lib/python/Components/Renderer/FixedLabel.py index 15f64b518b0..42028b8df86 100644 --- a/lib/python/Components/Renderer/FixedLabel.py +++ b/lib/python/Components/Renderer/FixedLabel.py @@ -2,5 +2,6 @@ from enigma import eLabel + class FixedLabel(Renderer): GUI_WIDGET = eLabel diff --git a/lib/python/Components/Renderer/FrontpanelLed.py b/lib/python/Components/Renderer/FrontpanelLed.py index b4f962d057e..55796cc7542 100644 --- a/lib/python/Components/Renderer/FrontpanelLed.py +++ b/lib/python/Components/Renderer/FrontpanelLed.py @@ -1,6 +1,8 @@ from Components.Element import Element # this is not a GUI renderer. + + class FrontpanelLed(Element): def __init__(self, which=0, patterns=[(20, 0, 0xffffffff), (20, 0x55555555, 0x84fc8c04)], boolean=True): self.which = which diff --git a/lib/python/Components/Renderer/GaugeRender.py b/lib/python/Components/Renderer/GaugeRender.py index 28ed0ee5e9d..1a4d297a85a 100644 --- a/lib/python/Components/Renderer/GaugeRender.py +++ b/lib/python/Components/Renderer/GaugeRender.py @@ -3,6 +3,7 @@ from enigma import eGauge + class GaugeRender(VariableValue, Renderer): def __init__(self): Renderer.__init__(self) @@ -24,11 +25,9 @@ def changed(self, what): def postWidgetCreate(self, instance): instance.setValue(0) - def setValue(self, value): #self.instance.setValue(5) if self.instance is not None: self.instance.setValue(value) - #value = property(setValue) diff --git a/lib/python/Components/Renderer/Label.py b/lib/python/Components/Renderer/Label.py index 9f18185b4b7..7fade85f4b0 100644 --- a/lib/python/Components/Renderer/Label.py +++ b/lib/python/Components/Renderer/Label.py @@ -3,6 +3,7 @@ from enigma import eLabel + class Label(VariableText, Renderer): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/Listbox.py b/lib/python/Components/Renderer/Listbox.py index 856f108b417..847b0ef8c6f 100644 --- a/lib/python/Components/Renderer/Listbox.py +++ b/lib/python/Components/Renderer/Listbox.py @@ -13,6 +13,7 @@ # it should expose exactly the non-content related functions # of the eListbox class. more or less. + class Listbox(Renderer, object): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/NextEpgInfo.py b/lib/python/Components/Renderer/NextEpgInfo.py index 976ba17542d..8c2c3a3d52a 100644 --- a/lib/python/Components/Renderer/NextEpgInfo.py +++ b/lib/python/Components/Renderer/NextEpgInfo.py @@ -5,6 +5,7 @@ from skin import parseColor from Tools.Hex2strColor import Hex2strColor + class NextEpgInfo(Renderer, VariableText): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/Picon.py b/lib/python/Components/Renderer/Picon.py index ab9b1047698..701ce245e76 100644 --- a/lib/python/Components/Renderer/Picon.py +++ b/lib/python/Components/Renderer/Picon.py @@ -12,6 +12,7 @@ searchPaths = [] lastPiconPath = None + def initPiconPaths(): global searchPaths searchPaths = [] @@ -20,6 +21,7 @@ def initPiconPaths(): for part in harddiskmanager.getMountedPartitions(): onMountpointAdded(part.mountpoint) + def onMountpointAdded(mountpoint): global searchPaths try: @@ -33,6 +35,7 @@ def onMountpointAdded(mountpoint): except Exception, ex: print "[Picon] Failed to investigate %s:" % mountpoint, ex + def onMountpointRemoved(mountpoint): global searchPaths path = os.path.join(mountpoint, 'picon') + '/' @@ -42,12 +45,14 @@ def onMountpointRemoved(mountpoint): except: pass + def onPartitionChange(why, part): if why == 'add': onMountpointAdded(part.mountpoint) elif why == 'remove': onMountpointRemoved(part.mountpoint) + def findPicon(serviceName): global lastPiconPath if lastPiconPath is not None: @@ -65,6 +70,7 @@ def findPicon(serviceName): return pngname return "" + def getPiconName(serviceRef): service = eServiceReference(serviceRef) if service.getPath().startswith("/") and serviceRef.startswith("1:"): @@ -101,6 +107,7 @@ def getPiconName(serviceRef): pngname = findPicon(series) return pngname + class Picon(Renderer): def __init__(self): Renderer.__init__(self) @@ -160,5 +167,6 @@ def changed(self, what): elif self.visible: self.instance.hide() + harddiskmanager.on_partition_list_change.append(onPartitionChange) initPiconPaths() diff --git a/lib/python/Components/Renderer/Pig.py b/lib/python/Components/Renderer/Pig.py index 8950d6998ca..56efd242b88 100644 --- a/lib/python/Components/Renderer/Pig.py +++ b/lib/python/Components/Renderer/Pig.py @@ -5,6 +5,7 @@ from enigma import eVideoWidget, getDesktop from Screens.PictureInPicture import PipPigMode + class Pig(Renderer): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/Pixmap.py b/lib/python/Components/Renderer/Pixmap.py index 32b615d4636..c8930925447 100644 --- a/lib/python/Components/Renderer/Pixmap.py +++ b/lib/python/Components/Renderer/Pixmap.py @@ -2,6 +2,7 @@ from enigma import ePixmap + class Pixmap(Renderer): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/PositionGauge.py b/lib/python/Components/Renderer/PositionGauge.py index b5e233646a4..8fe2e7c3027 100644 --- a/lib/python/Components/Renderer/PositionGauge.py +++ b/lib/python/Components/Renderer/PositionGauge.py @@ -1,6 +1,7 @@ from Renderer import Renderer from enigma import ePositionGauge + class PositionGauge(Renderer): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/Progress.py b/lib/python/Components/Renderer/Progress.py index a5968aa8ee0..9d09045d65c 100644 --- a/lib/python/Components/Renderer/Progress.py +++ b/lib/python/Components/Renderer/Progress.py @@ -3,6 +3,7 @@ from enigma import eSlider + class Progress(VariableValue, Renderer): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Renderer/Renderer.py b/lib/python/Components/Renderer/Renderer.py index 872e9c02f66..ee4202302ae 100644 --- a/lib/python/Components/Renderer/Renderer.py +++ b/lib/python/Components/Renderer/Renderer.py @@ -1,6 +1,7 @@ from Components.GUIComponent import GUIComponent from Components.Element import Element + class Renderer(GUIComponent, Element): def __init__(self): Element.__init__(self) diff --git a/lib/python/Components/Renderer/VideoSize.py b/lib/python/Components/Renderer/VideoSize.py index f27dd2bfb26..86515b62d5c 100644 --- a/lib/python/Components/Renderer/VideoSize.py +++ b/lib/python/Components/Renderer/VideoSize.py @@ -5,6 +5,8 @@ # # borrowed from vali, addapter for openpli # + + class VideoSize(Renderer, VariableText): def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/ResourceManager.py b/lib/python/Components/ResourceManager.py index d97bdde6682..2dbaeed40c3 100644 --- a/lib/python/Components/ResourceManager.py +++ b/lib/python/Components/ResourceManager.py @@ -7,7 +7,6 @@ def addResource(self, name, resource): self.resourceList[name] = resource print "resources:", self.resourceList - def getResource(self, name): if not self.hasResource(name): return None @@ -20,4 +19,5 @@ def removeResource(self, name): if self.hasResource(name): del self.resourceList[name] + resourcemanager = ResourceManager() diff --git a/lib/python/Components/Scanner.py b/lib/python/Components/Scanner.py index 667db3fe6cd..fb162bc37d5 100644 --- a/lib/python/Components/Scanner.py +++ b/lib/python/Components/Scanner.py @@ -62,6 +62,7 @@ add_type("video/mpeg", ".pva") add_type("video/mpeg", ".wtv") + def getType(file): (type, _) = guess_type(file) if type is None: @@ -80,6 +81,7 @@ def getType(file): return "video/x-vcd" return type + class Scanner: def __init__(self, name, mimetypes=[], paths_to_scan=[], description="", openfnc=None): self.mimetypes = mimetypes @@ -102,6 +104,7 @@ def open(self, list, *args, **kwargs): if self.openfnc is not None: self.openfnc(list, *args, **kwargs) + class ScanPath: def __init__(self, path, with_subdirs=False): self.path = path @@ -122,6 +125,7 @@ def __cmp__(self, other): else: return self.with_subdirs.__cmp__(other.with_subdirs) + class ScanFile: def __init__(self, path, mimetype=None, size=None, autodetect=True): self.path = path @@ -134,6 +138,7 @@ def __init__(self, path, mimetype=None, size=None, autodetect=True): def __repr__(self): return "" + def execute(option): print "execute", option if option is None: @@ -142,6 +147,7 @@ def execute(option): (_, scanner, files, session) = option scanner.open(files, session) + def scanDevice(mountpoint): scanner = [] @@ -195,6 +201,7 @@ def scanDevice(mountpoint): # res is a dict with scanner -> [ScanFiles] return res + def openList(session, files): if not isinstance(files, list): files = [files] @@ -234,5 +241,6 @@ def openList(session, files): return False + def openFile(session, mimetype, file): return openList(session, [ScanFile(file, mimetype)]) diff --git a/lib/python/Components/ScrollLabel.py b/lib/python/Components/ScrollLabel.py index a9875184fbc..8504d9c58bd 100644 --- a/lib/python/Components/ScrollLabel.py +++ b/lib/python/Components/ScrollLabel.py @@ -2,6 +2,7 @@ from GUIComponent import GUIComponent from enigma import eLabel, eWidget, eSlider, fontRenderClass, ePoint, eSize + class ScrollLabel(GUIComponent): def __init__(self, text="", showscrollbar=True): GUIComponent.__init__(self) diff --git a/lib/python/Components/SelectionList.py b/lib/python/Components/SelectionList.py index c2a2aac6c6f..fc5ab36f51c 100644 --- a/lib/python/Components/SelectionList.py +++ b/lib/python/Components/SelectionList.py @@ -4,6 +4,7 @@ from Tools.LoadPixmap import LoadPixmap import skin + def SelectionEntryComponent(description, value, index, selected): dx, dy, dw, dh = skin.parameters.get("SelectionListDescr", (25, 3, 650, 30)) res = [ @@ -18,6 +19,7 @@ def SelectionEntryComponent(description, value, index, selected): res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, ix, iy, iw, ih, selectionpng)) return res + class SelectionList(MenuList): def __init__(self, list=None, enableWrapAround=False): MenuList.__init__(self, list or [], enableWrapAround, content=eListboxPythonMultiContent) diff --git a/lib/python/Components/Sensors.py b/lib/python/Components/Sensors.py index 84ba587a55b..e7206619c25 100644 --- a/lib/python/Components/Sensors.py +++ b/lib/python/Components/Sensors.py @@ -1,5 +1,6 @@ from Components.FanControl import fancontrol + class Sensors: # (type, name, unit, directory) TYPE_TEMPERATURE = 0 @@ -30,7 +31,6 @@ def getSensorsList(self, type=None): list.append(sensorid) return list - def getSensorType(self, sensorid): return self.sensors_list[sensorid][0] @@ -61,4 +61,5 @@ def addSensors(self): if fancontrol.hasRPMSensor(fanid): self.sensors_list.append((self.TYPE_FAN_RPM, _("Fan %d") % (fanid + 1), "rpm", fanid)) + sensors = Sensors() diff --git a/lib/python/Components/ServiceEventTracker.py b/lib/python/Components/ServiceEventTracker.py index c8305a11b45..9d63e7aa324 100644 --- a/lib/python/Components/ServiceEventTracker.py +++ b/lib/python/Components/ServiceEventTracker.py @@ -1,5 +1,6 @@ InfoBarCount = 0 + class InfoBarBase: onInfoBarOpened = [] @@ -52,6 +53,7 @@ def __close(self): global InfoBarCount InfoBarCount -= 1 + class ServiceEventTracker: """Tracks service events into a screen""" InfoBarStack = [] diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py index 6502ac43141..08617983669 100644 --- a/lib/python/Components/ServiceList.py +++ b/lib/python/Components/ServiceList.py @@ -10,6 +10,7 @@ from Components.Renderer.Picon import getPiconName from Components.config import config + def refreshServiceList(configElement=None): from Screens.InfoBar import InfoBar InfoBarInstance = InfoBar.instance @@ -18,6 +19,7 @@ def refreshServiceList(configElement=None): if servicelist: servicelist.setMode() + class ServiceList(GUIComponent): MODE_NORMAL = 0 MODE_FAVOURITES = 1 @@ -62,78 +64,113 @@ def __init__(self, serviceList): def applySkin(self, desktop, parent): def foregroundColorMarked(value): self.l.setColor(eListboxServiceContent.markedForeground, parseColor(value)) + def foregroundColorMarkedSelected(value): self.l.setColor(eListboxServiceContent.markedForegroundSelected, parseColor(value)) + def backgroundColorMarked(value): self.l.setColor(eListboxServiceContent.markedBackground, parseColor(value)) + def backgroundColorMarkedSelected(value): self.l.setColor(eListboxServiceContent.markedBackgroundSelected, parseColor(value)) + def foregroundColorServiceNotAvail(value): self.l.setColor(eListboxServiceContent.serviceNotAvail, parseColor(value)) + def foregroundColorEvent(value): self.l.setColor(eListboxServiceContent.eventForeground, parseColor(value)) + def foregroundColorNextEvent(value): self.l.setColor(eListboxServiceContent.eventNextForeground, parseColor(value)) + def colorServiceDescription(value): self.l.setColor(eListboxServiceContent.eventForeground, parseColor(value)) + def foregroundColorEventSelected(value): self.l.setColor(eListboxServiceContent.eventForegroundSelected, parseColor(value)) + def foregroundColorEventNextSelected(value): self.l.setColor(eListboxServiceContent.eventForegroundNextSelected, parseColor(value)) + def colorServiceDescriptionSelected(value): self.l.setColor(eListboxServiceContent.eventForegroundSelected, parseColor(value)) + def foregroundColorEventborder(value): self.l.setColor(eListboxServiceContent.eventborderForeground, parseColor(value)) + def foregroundColorEventborderSelected(value): self.l.setColor(eListboxServiceContent.eventborderForegroundSelected, parseColor(value)) + def colorEventProgressbar(value): self.l.setColor(eListboxServiceContent.serviceEventProgressbarColor, parseColor(value)) + def colorEventProgressbarSelected(value): self.l.setColor(eListboxServiceContent.serviceEventProgressbarColorSelected, parseColor(value)) + def colorEventProgressbarBorder(value): self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColor, parseColor(value)) + def colorEventProgressbarBorderSelected(value): self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColorSelected, parseColor(value)) + def colorServiceRecorded(value): self.l.setColor(eListboxServiceContent.serviceRecorded, parseColor(value)) + def colorFallbackItem(value): self.l.setColor(eListboxServiceContent.serviceItemFallback, parseColor(value)) + def colorServiceSelectedFallback(value): self.l.setColor(eListboxServiceContent.serviceSelectedFallback, parseColor(value)) + def colorServiceDescriptionFallback(value): self.l.setColor(eListboxServiceContent.eventForegroundFallback, parseColor(value)) + def colorServiceDescriptionSelectedFallback(value): self.l.setColor(eListboxServiceContent.eventForegroundSelectedFallback, parseColor(value)) + def colorServiceNextDescriptionFallback(value): self.l.setColor(eListboxServiceContent.eventNextForegroundFallback, parseColor(value)) + def colorServiceNextDescriptionSelectedFallback(value): self.l.setColor(eListboxServiceContent.eventNextForegroundSelectedFallback, parseColor(value)) + def picServiceEventProgressbar(value): pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, value)) pic and self.l.setPixmap(self.l.picServiceEventProgressbar, pic) + def serviceItemHeight(value): self.ItemHeight = parseScale(value) + def serviceNameFont(value): self.ServiceNameFont = parseFont(value, ((1, 1), (1, 1))) + def serviceInfoFont(value): self.ServiceInfoFont = parseFont(value, ((1, 1), (1, 1))) self.ServiceNextInfoFont = parseFont(value, ((5, 6), (1, 1))) #def serviceNextInfoFont(value): # self.ServiceNextInfoFont = parseFont(value, ((1,1),(1,1))) + def serviceNumberFont(value): self.ServiceNumberFont = parseFont(value, ((1, 1), (1, 1))) + def progressbarHeight(value): self.l.setProgressbarHeight(parseScale(value)) + def progressbarBorderWidth(value): self.l.setProgressbarBorderWidth(parseScale(value)) + def progressBarWidth(value): self.progressBarWidth = parseScale(value) + def progressPercentWidth(value): self.progressPercentWidth = parseScale(value) + def fieldMargins(value): self.fieldMargins = parseScale(value) + def nonplayableMargins(value): self.l.setNonplayableMargins(parseScale(value)) + def itemsDistances(value): self.l.setItemsDistances(parseScale(value)) for (attrib, value) in list(self.skinAttributes): diff --git a/lib/python/Components/ServicePosition.py b/lib/python/Components/ServicePosition.py index bffc3777d1e..04121a340e1 100644 --- a/lib/python/Components/ServicePosition.py +++ b/lib/python/Components/ServicePosition.py @@ -3,6 +3,7 @@ from enigma import eTimer, iPlayableService, ePositionGauge import time + class ServicePosition(PerServiceDisplay, object): TYPE_LENGTH = 0, TYPE_POSITION = 1, @@ -86,6 +87,7 @@ def stopEvent(self): self.updateTimer.stop() self.setText("") + class ServicePositionGauge(PerServiceBase, GUIComponent): def __init__(self, navcore): GUIComponent.__init__(self) diff --git a/lib/python/Components/ServiceScan.py b/lib/python/Components/ServiceScan.py index 72ade3f319b..648e04d5b84 100644 --- a/lib/python/Components/ServiceScan.py +++ b/lib/python/Components/ServiceScan.py @@ -2,6 +2,7 @@ from Components.NimManager import nimmanager as nimmgr from Tools.Transponder import getChannelNumber + class ServiceScan: Idle = 1 diff --git a/lib/python/Components/SetupDevices.py b/lib/python/Components/SetupDevices.py index 52cf14c2e13..97f499230c4 100644 --- a/lib/python/Components/SetupDevices.py +++ b/lib/python/Components/SetupDevices.py @@ -2,6 +2,7 @@ from Components.Keyboard import keyboard from Components.Language import language + def InitSetupDevices(): def languageNotifier(configElement): language.activateLanguage(configElement.value) diff --git a/lib/python/Components/Slider.py b/lib/python/Components/Slider.py index 248701fee61..ca1a3eb63b7 100644 --- a/lib/python/Components/Slider.py +++ b/lib/python/Components/Slider.py @@ -3,6 +3,7 @@ from enigma import eSlider + class Slider(VariableValue, GUIComponent): def __init__(self, min, max): VariableValue.__init__(self) diff --git a/lib/python/Components/Sources/Boolean.py b/lib/python/Components/Sources/Boolean.py index 791ab6eb557..ab574c3b2d1 100644 --- a/lib/python/Components/Sources/Boolean.py +++ b/lib/python/Components/Sources/Boolean.py @@ -9,6 +9,8 @@ # however, if you think that there is ANY interest that another # screen could use your expression, please put your calculation # into a seperate Source, providing a "boolean"-property. + + class Boolean(Source, object): def __init__(self, fixed=False, function=None, destroy=None, poll=0): Source.__init__(self) diff --git a/lib/python/Components/Sources/CanvasSource.py b/lib/python/Components/Sources/CanvasSource.py index be4241ac5db..058ab96028f 100644 --- a/lib/python/Components/Sources/CanvasSource.py +++ b/lib/python/Components/Sources/CanvasSource.py @@ -1,5 +1,6 @@ from Source import Source + class CanvasSource(Source): def __init__(self): Source.__init__(self) diff --git a/lib/python/Components/Sources/Clock.py b/lib/python/Components/Sources/Clock.py index ba672825cd0..921889040f0 100644 --- a/lib/python/Components/Sources/Clock.py +++ b/lib/python/Components/Sources/Clock.py @@ -4,6 +4,7 @@ from Source import Source + class Clock(Source): def __init__(self): Source.__init__(self) diff --git a/lib/python/Components/Sources/Config.py b/lib/python/Components/Sources/Config.py index 209334de512..fbf2b53b0ad 100644 --- a/lib/python/Components/Sources/Config.py +++ b/lib/python/Components/Sources/Config.py @@ -1,5 +1,6 @@ from Source import Source + class Config(Source): def __init__(self, config): Source.__init__(self) diff --git a/lib/python/Components/Sources/CurrentService.py b/lib/python/Components/Sources/CurrentService.py index 3ecb7e95064..76020d358b4 100644 --- a/lib/python/Components/Sources/CurrentService.py +++ b/lib/python/Components/Sources/CurrentService.py @@ -4,6 +4,7 @@ from Components.Element import cached import NavigationInstance + class CurrentService(PerServiceBase, Source): def __init__(self, navcore): Source.__init__(self) diff --git a/lib/python/Components/Sources/Event.py b/lib/python/Components/Sources/Event.py index 6cab6d39eed..61f75ac6e94 100644 --- a/lib/python/Components/Sources/Event.py +++ b/lib/python/Components/Sources/Event.py @@ -1,5 +1,6 @@ from Source import Source + class Event(Source, object): def __init__(self): Source.__init__(self) diff --git a/lib/python/Components/Sources/EventInfo.py b/lib/python/Components/Sources/EventInfo.py index a579020f1ef..5dda07e7001 100644 --- a/lib/python/Components/Sources/EventInfo.py +++ b/lib/python/Components/Sources/EventInfo.py @@ -3,6 +3,7 @@ from enigma import iPlayableService, iServiceInformation, eServiceReference, eEPGCache from Source import Source + class EventInfo(PerServiceBase, Source, object): NOW = 0 NEXT = 1 diff --git a/lib/python/Components/Sources/FrontendInfo.py b/lib/python/Components/Sources/FrontendInfo.py index 5f1c7f8b5ef..7ca68f10f83 100644 --- a/lib/python/Components/Sources/FrontendInfo.py +++ b/lib/python/Components/Sources/FrontendInfo.py @@ -3,6 +3,7 @@ from Components.PerServiceDisplay import PerServiceBase from enigma import eDVBResourceManager + class FrontendInfo(Source, PerServiceBase): def __init__(self, service_source=None, frontend_source=None, navcore=None): self.navcore = None diff --git a/lib/python/Components/Sources/FrontendStatus.py b/lib/python/Components/Sources/FrontendStatus.py index 7207f970fca..b6c9955e235 100644 --- a/lib/python/Components/Sources/FrontendStatus.py +++ b/lib/python/Components/Sources/FrontendStatus.py @@ -1,6 +1,7 @@ from Source import Source from enigma import eTimer + class FrontendStatus(Source): def __init__(self, service_source=None, frontend_source=None, update_interval=1000): Source.__init__(self) diff --git a/lib/python/Components/Sources/HddState.py b/lib/python/Components/Sources/HddState.py index c5e085465bd..d927de5f67e 100644 --- a/lib/python/Components/Sources/HddState.py +++ b/lib/python/Components/Sources/HddState.py @@ -5,6 +5,7 @@ from enigma import eTimer from Components.SystemInfo import SystemInfo + class HddState(Source): ALL = 0 INTERNAL = 1 diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py index 92ffd2b4fe0..4c930941b53 100644 --- a/lib/python/Components/Sources/List.py +++ b/lib/python/Components/Sources/List.py @@ -1,6 +1,7 @@ from Source import Source from Components.Element import cached + class List(Source, object): """The datasource of a listbox. Currently, the format depends on the used converter. So if you put a simple string list in here, you need to use a StringList converter, if you are @@ -9,6 +10,7 @@ class List(Source, object): This has been done so another converter could convert the list to a different format, for example to generate HTML.""" + def __init__(self, list=[], enableWrapAround=False, item_height=25, fonts=[]): Source.__init__(self) self.__list = list diff --git a/lib/python/Components/Sources/Progress.py b/lib/python/Components/Sources/Progress.py index 3cd8d03f668..94190879821 100644 --- a/lib/python/Components/Sources/Progress.py +++ b/lib/python/Components/Sources/Progress.py @@ -1,5 +1,6 @@ from Source import Source + class Progress(Source): def __init__(self, value=0, range=100): Source.__init__(self) diff --git a/lib/python/Components/Sources/RdsDecoder.py b/lib/python/Components/Sources/RdsDecoder.py index 26a3e5a74c3..f771c9f0788 100644 --- a/lib/python/Components/Sources/RdsDecoder.py +++ b/lib/python/Components/Sources/RdsDecoder.py @@ -3,6 +3,7 @@ from enigma import iPlayableService from Source import Source + class RdsDecoder(PerServiceBase, Source, object): def __init__(self, navcore): Source.__init__(self) diff --git a/lib/python/Components/Sources/RecordState.py b/lib/python/Components/Sources/RecordState.py index 1808b1ac069..2a459f90e9d 100644 --- a/lib/python/Components/Sources/RecordState.py +++ b/lib/python/Components/Sources/RecordState.py @@ -3,6 +3,7 @@ from enigma import iRecordableService from Components.SystemInfo import SystemInfo + class RecordState(Source): def __init__(self, session): Source.__init__(self) diff --git a/lib/python/Components/Sources/Sensor.py b/lib/python/Components/Sources/Sensor.py index 139b6168630..36020df1dd1 100644 --- a/lib/python/Components/Sources/Sensor.py +++ b/lib/python/Components/Sources/Sensor.py @@ -4,6 +4,7 @@ from Source import Source + class SensorSource(Source): def __init__(self, update_interval=500, sensorid=None): self.update_interval = update_interval diff --git a/lib/python/Components/Sources/ServiceEvent.py b/lib/python/Components/Sources/ServiceEvent.py index a6dec79516e..c271dfa4d34 100644 --- a/lib/python/Components/Sources/ServiceEvent.py +++ b/lib/python/Components/Sources/ServiceEvent.py @@ -2,6 +2,7 @@ from enigma import eServiceCenter from Source import Source + class ServiceEvent(Source, object): def __init__(self): Source.__init__(self) diff --git a/lib/python/Components/Sources/ServiceList.py b/lib/python/Components/Sources/ServiceList.py index 93a7f017c2b..173eaf38759 100644 --- a/lib/python/Components/Sources/ServiceList.py +++ b/lib/python/Components/Sources/ServiceList.py @@ -1,6 +1,7 @@ from Source import Source from enigma import eServiceCenter, eServiceReference + class ServiceList(Source): def __init__(self, root, command_func=None, validate_commands=True): Source.__init__(self) diff --git a/lib/python/Components/Sources/StaticText.py b/lib/python/Components/Sources/StaticText.py index adb2f67bb07..23c5d6df4c2 100644 --- a/lib/python/Components/Sources/StaticText.py +++ b/lib/python/Components/Sources/StaticText.py @@ -1,5 +1,6 @@ from Source import Source + class StaticText(Source): # filter is a function which filters external, untrusted strings # this must be done to avoid XSS attacks! diff --git a/lib/python/Components/Sources/StreamService.py b/lib/python/Components/Sources/StreamService.py index 4bdb138c7eb..7aba1c639fc 100644 --- a/lib/python/Components/Sources/StreamService.py +++ b/lib/python/Components/Sources/StreamService.py @@ -5,6 +5,7 @@ StreamServiceList = [] + class StreamService(Source): def __init__(self, navcore): Source.__init__(self) diff --git a/lib/python/Components/Sources/TunerInfo.py b/lib/python/Components/Sources/TunerInfo.py index 7ac34915cf2..57274750c18 100644 --- a/lib/python/Components/Sources/TunerInfo.py +++ b/lib/python/Components/Sources/TunerInfo.py @@ -1,6 +1,7 @@ from Source import Source from enigma import eDVBResourceManager + class TunerInfo(Source): FE_USE_MASK = 0 diff --git a/lib/python/Components/SystemInfo.py b/lib/python/Components/SystemInfo.py index a39091ad717..501e1702e4a 100644 --- a/lib/python/Components/SystemInfo.py +++ b/lib/python/Components/SystemInfo.py @@ -14,22 +14,26 @@ cmdline = fd.read() cmdline = {k: v.strip('"') for k, v in re.findall(r'(\S+)=(".*?"|\S+)', cmdline)} + def getNumVideoDecoders(): numVideoDecoders = 0 while fileExists("/dev/dvb/adapter0/video%d" % numVideoDecoders, "f"): numVideoDecoders += 1 return numVideoDecoders + def countFrontpanelLEDs(): numLeds = fileExists("/proc/stb/fp/led_set_pattern") and 1 or 0 while fileExists("/proc/stb/fp/led%d_pattern" % numLeds): numLeds += 1 return numLeds + def hassoftcaminstalled(): from Tools.camcontrol import CamControl return len(CamControl("softcam").getList()) > 1 + def getBootdevice(): dev = ("root" in cmdline and cmdline["root"].startswith("/dev/")) and cmdline["root"][5:] while dev and not fileExists("/sys/block/%s" % dev): diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index c11fd2d188e..07bae9ec00d 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -3,8 +3,10 @@ from Tools.CList import CList + class Job(object): NOT_STARTED, IN_PROGRESS, FINISHED, FAILED = range(4) + def __init__(self, name): self.tasks = [] self.resident_tasks = [] @@ -112,6 +114,7 @@ def cancel(self): def __str__(self): return "Components.Task.Job name=%s #tasks=%s" % (self.name, len(self.tasks)) + class Task(object): def __init__(self, job, name): self.name = name @@ -261,10 +264,12 @@ def setProgress(self, progress): def __str__(self): return "Components.Task.Task name=%s" % (self.name) + class LoggingTask(Task): def __init__(self, job, name): Task.__init__(self, job, name) self.log = [] + def processOutput(self, data): print "[%s]" % self.name, data, self.log.append(data) @@ -280,20 +285,25 @@ def _run(self): self.timer = eTimer() self.timer.callback.append(self.onTimer) self.timer.start(5) + def work(self): raise NotImplemented, "work" + def abort(self): self.aborted = True if self.callback is None: self.finish(aborted=True) + def onTimer(self): self.setProgress(self.pos) + def onComplete(self, result): self.postconditions.append(FailedPostcondition(result)) self.timer.stop() del self.timer self.finish() + class ConditionTask(Task): """ Reactor-driven pthread_condition. @@ -303,23 +313,29 @@ class ConditionTask(Task): Default is to call trigger() once per second, override prepare/cleanup to do something else (like waiting for hotplug)... """ + def __init__(self, job, name, timeoutCount=None): Task.__init__(self, job, name) self.timeoutCount = timeoutCount + def _run(self): self.triggerCount = 0 + def prepare(self): from enigma import eTimer self.timer = eTimer() self.timer.callback.append(self.trigger) self.timer.start(1000) + def cleanup(self, failed): if hasattr(self, 'timer'): self.timer.stop() del self.timer + def check(self): # override to return True only when condition triggers return True + def trigger(self): self.triggerCount += 1 try: @@ -335,6 +351,8 @@ def trigger(self): # The jobmanager will execute multiple jobs, each after another. # later, it will also support suspending jobs (and continuing them after reboot etc) # It also supports a notification when some error occurred, and possibly a retry. + + class JobManager: def __init__(self): self.active_jobs = [] @@ -442,16 +460,19 @@ def getPendingJobs(self): # self.args += ["-t", filesystem] # self.args.append(device + "part%d" % partition) + class Condition: RECOVERABLE = False def getErrorMessage(self, task): return _("An unknown error occurred!") + " (%s @ task %s)" % (self.__class__.__name__, task.__class__.__name__) + class WorkspaceExistsPrecondition(Condition): def check(self, task): return os.access(task.job.workspace, os.W_OK) + class DiskspacePrecondition(Condition): def __init__(self, diskspace_required): self.diskspace_required = diskspace_required @@ -469,6 +490,7 @@ def check(self, task): def getErrorMessage(self, task): return _("Not enough disk space. Please free up some disk space and try again. (%d MB required, %d MB available)") % (self.diskspace_required / 1024 / 1024, self.diskspace_available / 1024 / 1024) + class ToolExistsPrecondition(Condition): def check(self, task): import os @@ -489,13 +511,16 @@ def check(self, task): def getErrorMessage(self, task): return _("A required tool (%s) was not found.") % (self.realpath) + class AbortedPostcondition(Condition): def getErrorMessage(self, task): return _("Cancelled upon user request") + class ReturncodePostcondition(Condition): def check(self, task): return task.returncode == 0 + def getErrorMessage(self, task): if hasattr(task, 'log') and task.log: log = ''.join(task.log).strip() @@ -505,9 +530,11 @@ def getErrorMessage(self, task): else: return _("Error code") + ": %s" % task.returncode + class FailedPostcondition(Condition): def __init__(self, exception): self.exception = exception + def getErrorMessage(self, task): if isinstance(self.exception, int): if hasattr(task, 'log'): @@ -518,6 +545,7 @@ def getErrorMessage(self, task): else: return _("Error code") + " %s" % self.exception return str(self.exception) + def check(self, task): return (self.exception is None) or (self.exception == 0) @@ -536,4 +564,5 @@ def check(self, task): # def createDescription(self): # return {"device": self.device} + job_manager = JobManager() diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py index 65d2e7a9e6f..5599d614409 100644 --- a/lib/python/Components/TimerList.py +++ b/lib/python/Components/TimerList.py @@ -10,6 +10,7 @@ from timer import TimerEntry from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN + class TimerList(GUIComponent, object): # # | | @@ -118,20 +119,28 @@ def __init__(self, list): def applySkin(self, desktop, parent): def itemHeight(value): self.itemHeight = parseScale(value) + def setServiceNameFont(value): self.serviceNameFont = parseFont(value, ((1, 1), (1, 1))) + def setEventNameFont(value): self.eventNameFont = parseFont(value, ((1, 1), (1, 1))) + def setFont(value): self.font = parseFont(value, ((1, 1), (1, 1))) + def rowSplit(value): self.rowSplit = parseScale(value) + def iconMargin(value): self.iconMargin = parseScale(value) + def satPosLeft(value): self.satPosLeft = parseScale(value) + def backupColor(value): self.backupColor = int(value) + def backupColorSel(value): self.backupColorSel = int(value) for (attrib, value) in list(self.skinAttributes): diff --git a/lib/python/Components/TimerSanityCheck.py b/lib/python/Components/TimerSanityCheck.py index 71b52815869..aa3c6d1dc5c 100644 --- a/lib/python/Components/TimerSanityCheck.py +++ b/lib/python/Components/TimerSanityCheck.py @@ -6,6 +6,7 @@ from Tools.CIHelper import cihelper from Components.config import config + class TimerSanityCheck: def __init__(self, timerlist, newtimer=None): self.localtimediff = 25 * 3600 - mktime(gmtime(25 * 3600)) diff --git a/lib/python/Components/Timezones.py b/lib/python/Components/Timezones.py index c18be0f719a..bcb11a99fae 100644 --- a/lib/python/Components/Timezones.py +++ b/lib/python/Components/Timezones.py @@ -51,6 +51,7 @@ TIMEZONE_FILE = "/etc/timezone.xml" # This should be SCOPE_TIMEZONES_FILE! This file moves arond the filesystem!!! :( TIMEZONE_DATA = "/usr/share/zoneinfo/" # This should be SCOPE_TIMEZONES_DATA! + def InitTimeZones(): config.timezone = ConfigSubsection() config.timezone.area = ConfigSelection(default=DEFAULT_AREA, choices=timezones.getTimezoneAreaList()) diff --git a/lib/python/Components/TuneTest.py b/lib/python/Components/TuneTest.py index af7d4720182..62780b40ea1 100644 --- a/lib/python/Components/TuneTest.py +++ b/lib/python/Components/TuneTest.py @@ -1,5 +1,6 @@ from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eDVBFrontendParametersATSC, eDVBFrontendParameters, eDVBResourceManager, eTimer + class Tuner: def __init__(self, frontend, ignore_rotor=False): self.frontend = frontend @@ -111,6 +112,8 @@ def getTransponderData(self): # 1) add transponders with addTransponder() # 2) call run() # 3) finishedChecking() is called, when the run is finished + + class TuneTest: def __init__(self, feid, stopOnSuccess=-1, stopOnError=-1): self.stopOnSuccess = stopOnSuccess @@ -307,5 +310,6 @@ def getProgressLength(self): STATUS_NOOP = 3 # can be overwritten # progress = (range, value, status, transponder) + def progressCallback(self, progress): pass diff --git a/lib/python/Components/TunerInfo.py b/lib/python/Components/TunerInfo.py index 9630ad7c118..492887ed368 100644 --- a/lib/python/Components/TunerInfo.py +++ b/lib/python/Components/TunerInfo.py @@ -4,6 +4,7 @@ from math import log + class TunerInfo(GUIComponent): SNR = 0 SNR_DB = 1 diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 0e962210504..7dc4075b5bc 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -10,6 +10,7 @@ import os import time + def InitUsageConfig(): config.usage = ConfigSubsection() config.usage.subnetwork = ConfigYesNo(default=True) @@ -20,6 +21,7 @@ def InitUsageConfig(): config.usage.multibouquet = ConfigYesNo(default=True) config.usage.alternative_number_mode = ConfigYesNo(default=False) + def alternativeNumberModeChange(configElement): eDVBDB.getInstance().setNumberingMode(configElement.value) refreshServiceList() @@ -348,6 +350,7 @@ def PreferredTunerChanged(configElement): if os.path.exists("/proc/stb/fp/fan_choices"): choicelist = [x for x in choicelist if x[0] in open("/proc/stb/fp/fan_choices", "r").read().strip().split(" ")] config.usage.fan = ConfigSelection(choicelist) + def fanChanged(configElement): open(SystemInfo["Fan"], "w").write(configElement.value) config.usage.fan.addNotifier(fanChanged) @@ -426,6 +429,7 @@ def setLcdLiveDecoder(configElement): config.epg.virgin = ConfigYesNo(default=False) config.epg.opentv = ConfigYesNo(default=False) config.misc.showradiopic = ConfigYesNo(default=True) + def EpgSettingsChanged(configElement): from enigma import eEPGCache mask = 0xffffffff @@ -453,6 +457,7 @@ def EpgSettingsChanged(configElement): config.epg.opentv.addNotifier(EpgSettingsChanged) config.epg.histminutes = ConfigSelectionNumber(min=0, max=120, stepwidth=15, default=0, wraparound=True) + def EpgHistorySecondsChanged(configElement): from enigma import eEPGCache eEPGCache.getInstance().setEpgHistorySeconds(config.epg.histminutes.getValue() * 60) @@ -507,6 +512,7 @@ def updateEnterBackward(configElement): def updateEraseSpeed(el): eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.value)) + def updateEraseFlags(el): eBackgroundFileEraser.getInstance().setEraseFlags(int(el.value)) config.misc.erase_speed = ConfigSelection(default="20", choices=[ @@ -722,10 +728,13 @@ def setDisable10Bit(configElement): ("ukr Ukr", _("Ukrainian"))] epg_language_choices = audio_language_choices[:1] + audio_language_choices[2:] + def setEpgLanguage(configElement): eServiceEvent.setEPGLanguage(configElement.value) + def setEpgLanguageAlternative(configElement): eServiceEvent.setEPGLanguageAlternative(configElement.value) + def epglanguage(configElement): config.autolanguage.audio_epglanguage.setChoices([x for x in epg_language_choices if x[0] and x[0] != config.autolanguage.audio_epglanguage_alternative.value or not x[0] and not config.autolanguage.audio_epglanguage_alternative.value]) config.autolanguage.audio_epglanguage_alternative.setChoices([x for x in epg_language_choices if x[0] and x[0] != config.autolanguage.audio_epglanguage.value or not x[0]]) @@ -738,6 +747,7 @@ def epglanguage(configElement): def getselectedlanguages(range): return [eval("config.autolanguage.audio_autoselect%x.value" % x) for x in range] + def autolanguage(configElement): config.autolanguage.audio_autoselect1.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((2, 3, 4)) or not x[0] and not config.autolanguage.audio_autoselect2.value]) config.autolanguage.audio_autoselect2.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((1, 3, 4)) or not x[0] and not config.autolanguage.audio_autoselect3.value]) @@ -756,8 +766,10 @@ def autolanguage(configElement): config.autolanguage.audio_usecache = ConfigYesNo(default=True) subtitle_language_choices = audio_language_choices[:1] + audio_language_choices[2:] + def getselectedsublanguages(range): return [eval("config.autolanguage.subtitle_autoselect%x.value" % x) for x in range] + def autolanguagesub(configElement): config.autolanguage.subtitle_autoselect1.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((2, 3, 4)) or not x[0] and not config.autolanguage.subtitle_autoselect2.value]) config.autolanguage.subtitle_autoselect2.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((1, 3, 4)) or not x[0] and not config.autolanguage.subtitle_autoselect3.value]) @@ -799,6 +811,7 @@ def autolanguagesub(configElement): config.misc.softcam_setup.extension_menu = ConfigYesNo(default=True) config.ntp = ConfigSubsection() + def timesyncChanged(configElement): if configElement.value == "dvb" or not GetIPsFromNetworkInterfaces(): eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) @@ -814,6 +827,7 @@ def timesyncChanged(configElement): config.ntp.timesync.addNotifier(timesyncChanged) config.ntp.server = ConfigText("pool.ntp.org", fixed_size=False) + def updateChoices(sel, choices): if choices: defval = None @@ -827,6 +841,7 @@ def updateChoices(sel, choices): break sel.setChoices(map(str, choices), defval) + def preferredPath(path): if config.usage.setup_level.index < 2 or path == "" or not path: return None # config.usage.default_path.value, but delay lookup until usage @@ -837,11 +852,14 @@ def preferredPath(path): else: return path + def preferredTimerPath(): return preferredPath(config.usage.timer_path.value) + def preferredInstantRecordPath(): return preferredPath(config.usage.instantrec_path.value) + def defaultMoviePath(): return defaultRecordingLocation(config.usage.default_path.value) diff --git a/lib/python/Components/VideoWindow.py b/lib/python/Components/VideoWindow.py index f360d198847..708dd952ec4 100644 --- a/lib/python/Components/VideoWindow.py +++ b/lib/python/Components/VideoWindow.py @@ -1,6 +1,7 @@ from GUIComponent import GUIComponent from enigma import eVideoWidget, eSize + class VideoWindow(GUIComponent): def __init__(self, decoder=1, fb_width=720, fb_height=576): GUIComponent.__init__(self) diff --git a/lib/python/Components/VolumeBar.py b/lib/python/Components/VolumeBar.py index 9d2c3624485..6b26e95cbfa 100644 --- a/lib/python/Components/VolumeBar.py +++ b/lib/python/Components/VolumeBar.py @@ -3,6 +3,7 @@ from enigma import eSlider + class VolumeBar(VariableValue, GUIComponent): def __init__(self): VariableValue.__init__(self) diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index b60b49e0dcd..882d5849e60 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -7,10 +7,13 @@ profile("VolumeControl") #TODO .. move this to a own .py file + + class VolumeControl: instance = None """Volume control, handles volUp, volDown, volMute actions and display a corresponding dialog""" + def __init__(self, session): globalActionMap.actions["volumeUp"] = self.volUp globalActionMap.actions["volumeDown"] = self.volDown diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 9e310a1c20e..d87a633bfe4 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -27,6 +27,8 @@ # the default if saved_value is 'None' (default) # or invalid. # + + class ConfigElement(object): def __init__(self): self.saved_value = None @@ -169,10 +171,12 @@ def showHelp(self, session): KEY_0 = 12 KEY_9 = 12 + 9 + def getKeyNumber(key): assert key in KEY_NUMBERS return key - KEY_0 + class choicesList(object): # XXX: we might want a better name for this LIST_TYPE_LIST = 1 LIST_TYPE_DICT = 2 @@ -250,6 +254,7 @@ def default(self): default = choices.keys()[0] return default + class descriptionList(choicesList): # XXX: we might want a better name for this def __list__(self): if self.type == choicesList.LIST_TYPE_LIST: @@ -313,6 +318,8 @@ def __setitem__(self, index, value): # This replaces the former requirement that all ids MUST be plain # strings, but is compatible with that requirement. # + + class ConfigSelection(ConfigElement): def __init__(self, choices, default=None, graphic=True): ConfigElement.__init__(self) @@ -427,6 +434,8 @@ def unsafeAssign(self, value): # several customized versions exist for different # descriptions. # + + class ConfigBoolean(ConfigElement): def __init__(self, default=False, descriptions={False: _("false"), True: _("true")}, graphic=True): ConfigElement.__init__(self) @@ -483,18 +492,22 @@ def onDeselect(self, session): self.changedFinal() self.last_value = self.value + class ConfigYesNo(ConfigBoolean): def __init__(self, default=False, graphic=True): ConfigBoolean.__init__(self, default=default, descriptions={False: _("no"), True: _("yes")}, graphic=graphic) + class ConfigOnOff(ConfigBoolean): def __init__(self, default=False, graphic=True): ConfigBoolean.__init__(self, default=default, descriptions={False: _("off"), True: _("on")}, graphic=graphic) + class ConfigEnableDisable(ConfigBoolean): def __init__(self, default=False, graphic=True): ConfigBoolean.__init__(self, default=default, descriptions={False: _("disable"), True: _("enable")}, graphic=graphic) + class ConfigDateTime(ConfigElement): def __init__(self, default, formatstring, increment=86400): ConfigElement.__init__(self) @@ -525,6 +538,8 @@ def fromstring(self, val): # can be used for IP-addresses, dates, plain integers, ... # several helper exist to ease this up a bit. # + + class ConfigSequence(ConfigElement): def __init__(self, seperator, limits, default, censor_char=""): ConfigElement.__init__(self) @@ -687,6 +702,8 @@ def onDeselect(self, session): ip_limits = [(0, 255), (0, 255), (0, 255), (0, 255)] + + class ConfigIP(ConfigSequence): def __init__(self, default, auto_jump=False): ConfigSequence.__init__(self, seperator=".", limits=ip_limits, default=default) @@ -769,16 +786,21 @@ def getHTML(self, id): mac_limits = [(1, 255), (1, 255), (1, 255), (1, 255), (1, 255), (1, 255)] + + class ConfigMAC(ConfigSequence): def __init__(self, default): ConfigSequence.__init__(self, seperator=":", limits=mac_limits, default=default) + class ConfigPosition(ConfigSequence): def __init__(self, default, args): ConfigSequence.__init__(self, seperator=",", limits=[(0, args[0]), (0, args[1]), (0, args[2]), (0, args[3])], default=default) clock_limits = [(0, 23), (0, 59)] + + class ConfigClock(ConfigSequence): def __init__(self, default): t = localtime(default) @@ -814,13 +836,19 @@ def decrement(self): # Trigger change self.changed() + date_limits = [(1, 31), (1, 12), (1970, 2050)] + + class ConfigDate(ConfigSequence): def __init__(self, default): d = localtime(default) ConfigSequence.__init__(self, seperator=".", limits=date_limits, default=[d.tm_mday, d.tm_mon, d.tm_year]) + integer_limits = (0, 9999999999) + + class ConfigInteger(ConfigSequence): def __init__(self, default, limits=integer_limits): ConfigSequence.__init__(self, seperator=":", limits=[limits], default=default) @@ -841,6 +869,7 @@ def fromstring(self, value): def tostring(self, value): return str(value) + class ConfigPIN(ConfigInteger): def __init__(self, default, len=4, censor=""): assert isinstance(default, int), "ConfigPIN default must be an integer" @@ -850,6 +879,7 @@ def __init__(self, default, len=4, censor=""): def getLength(self): return self.len + class ConfigFloat(ConfigSequence): def __init__(self, default, limits): ConfigSequence.__init__(self, seperator=".", limits=limits, default=default) @@ -869,6 +899,8 @@ def setFloatInt(self, val): floatint = property(getFloatInt, setFloatInt) # an editable text... + + class ConfigText(ConfigElement, NumericalTextInput): def __init__(self, default="", fixed_size=True, visible_width=False): ConfigElement.__init__(self) @@ -1071,6 +1103,7 @@ def getHTML(self, id): def unsafeAssign(self, value): self.value = str(value) + class ConfigPassword(ConfigText): def __init__(self, default="", fixed_size=False, visible_width=False, censor="*"): ConfigText.__init__(self, default=default, fixed_size=fixed_size, visible_width=visible_width) @@ -1095,6 +1128,8 @@ def onDeselect(self, session): # on the stepwidth # min, max, stepwidth, default are int values # wraparound: pressing RIGHT key at max value brings you to min value and vice versa if set to True + + class ConfigSelectionNumber(ConfigSelection): def __init__(self, min, max, stepwidth, default=None, wraparound=False): self.wraparound = wraparound @@ -1125,6 +1160,7 @@ def handleKey(self, key): return ConfigSelection.handleKey(self, key) + class ConfigNumber(ConfigText): def __init__(self, default=0): ConfigText.__init__(self, str(default), fixed_size=False) @@ -1184,11 +1220,13 @@ def onDeselect(self, session): self.changedFinal() self.last_value = self.value + class ConfigSearchText(ConfigText): def __init__(self, default="", fixed_size=False, visible_width=False): ConfigText.__init__(self, default=default, fixed_size=fixed_size, visible_width=visible_width) NumericalTextInput.__init__(self, nextFunc=self.nextFunc, handleTimeout=False, search=True) + class ConfigDirectory(ConfigText): def __init__(self, default="", visible_width=60): ConfigText.__init__(self, default, fixed_size=True, visible_width=visible_width) @@ -1217,6 +1255,8 @@ def onSelect(self, session): self.allmarked = (self.value != "") # a slider. + + class ConfigSlider(ConfigElement): def __init__(self, default=0, increment=1, limits=(0, 100)): ConfigElement.__init__(self) @@ -1256,6 +1296,8 @@ def fromstring(self, value): return int(value) # a satlist. in fact, it's a ConfigSelection. + + class ConfigSatlist(ConfigSelection): def __init__(self, list, default=None): if default is not None: @@ -1269,6 +1311,7 @@ def getOrbitalPosition(self): orbital_position = property(getOrbitalPosition) + class ConfigSet(ConfigElement): def __init__(self, choices, default=[]): ConfigElement.__init__(self) @@ -1353,6 +1396,7 @@ def fromstring(self, val): description = property(lambda self: descriptionList(self.choices.choices, choicesList.LIST_TYPE_LIST)) + class ConfigDictionarySet(ConfigElement): def __init__(self, default={}): ConfigElement.__init__(self) @@ -1423,6 +1467,7 @@ def save(self): self.changed() self.saved_value = self.tostring(self.dirs) + class ConfigLocations(ConfigElement): def __init__(self, default=[], visible_width=False): ConfigElement.__init__(self) @@ -1570,6 +1615,8 @@ def onDeselect(self, session): self.pos = -1 # nothing. + + class ConfigNothing(ConfigSelection): def __init__(self): ConfigSelection.__init__(self, choices=[("", "")]) @@ -1585,6 +1632,7 @@ def __init__(self): # config.saved_value == {"foo": {"bar": "True"}, "foobar": "False"} # + class ConfigSubsectionContent(object): pass @@ -1598,6 +1646,8 @@ class ConfigSubsectionContent(object): # config.dipswitches.append(ConfigYesNo()) # config.dipswitches.append(ConfigYesNo()) # config.dipswitches.append(ConfigYesNo()) + + class ConfigSubList(list, object): def __init__(self): list.__init__(self) @@ -1641,6 +1691,8 @@ def dict(self): # care must be taken that the 'key' has a proper # str() method, because it will be used in the config # file. + + class ConfigSubDict(dict, object): def __init__(self): dict.__init__(self) @@ -1690,6 +1742,8 @@ def dict(self): # __setattr__. # If you don't understand this, try adding # __setattr__ to a usual exisiting class and you will. + + class ConfigSubsection(object): def __init__(self): self.__dict__["content"] = ConfigSubsectionContent() @@ -1751,6 +1805,8 @@ def dict(self): # a new config entry is added to a subsection # also, non-existing config entries will be saved, so they won't be # lost when a config entry disappears. + + class Config(ConfigSubsection): def __init__(self): ConfigSubsection.__init__(self) @@ -1825,6 +1881,7 @@ def loadFromFile(self, filename, base_file=True): config = Config() config.misc = ConfigSubsection() + class ConfigFile: CONFIG_FILE = resolveFilename(SCOPE_CONFIG, "settings") @@ -1857,6 +1914,7 @@ def getResolvedKey(self, key): print "getResolvedKey", key, "failed !! (Typo??)" return "" + def NoSave(element): element.disableSave() return element @@ -1866,10 +1924,12 @@ def NoSave(element): configfile.load() + def getConfigListEntry(*args): assert len(args) > 1, "getConfigListEntry needs a minimum of two arguments (descr, configElement)" return args + def updateConfigElement(element, newelement): newelement.value = element.value return newelement @@ -1899,6 +1959,8 @@ def updateConfigElement(element, newelement): cec_limits = [(0, 15), (0, 15), (0, 15), (0, 15)] + + class ConfigCECAddress(ConfigSequence): def __init__(self, default, auto_jump=False): ConfigSequence.__init__(self, seperator=".", limits=cec_limits, default=default) @@ -1979,6 +2041,7 @@ def getHTML(self, id): # we definitely don't want leading zeros return '.'.join(["%d" % d for d in self.value]) + class ConfigAction(ConfigElement): def __init__(self, action, *args): ConfigElement.__init__(self) diff --git a/lib/python/Navigation.py b/lib/python/Navigation.py index a733da993ca..13bccfc99c2 100644 --- a/lib/python/Navigation.py +++ b/lib/python/Navigation.py @@ -16,6 +16,8 @@ from Components.Sources.StreamService import StreamServiceList # TODO: remove pNavgation, eNavigation and rewrite this stuff in python. + + class Navigation: def __init__(self): if NavigationInstance.instance is not None: diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index 8d4439d29eb..db4cd4a44a7 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -5,9 +5,11 @@ def CutListEditor(session, service=None): import ui return ui.CutListEditor(session, service) + def main(session, service, **kwargs): session.open(CutListEditor, service) + def Plugins(**kwargs): return PluginDescriptor(name=_("Cutlist editor"), description=_("Cutlist editor..."), where=PluginDescriptor.WHERE_MOVIELIST, needsRestart=False, fnc=main) diff --git a/lib/python/Plugins/Extensions/CutListEditor/ui.py b/lib/python/Plugins/Extensions/CutListEditor/ui.py index 0f05bdae7fe..4eeaf0f29da 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/ui.py +++ b/lib/python/Plugins/Extensions/CutListEditor/ui.py @@ -27,6 +27,7 @@ config.plugins.CutListEditor = ConfigSubsection() config.plugins.CutListEditor.showIntro = ConfigYesNo(default=True) + def CutListEntry(where, what): w = where / 90 ms = w % 1000 @@ -47,6 +48,7 @@ def CutListEntry(where, what): type_col = 0x000000 return ((where, what), "%dh:%02dm:%02ds:%03d" % (h, m, s, ms), type, type_col) + class CutListContextMenu(FixedMenu): RET_STARTCUT = 0 RET_ENDCUT = 1 @@ -134,6 +136,7 @@ def toggleIntro(self): def callMovieCut(self): self.close(self.RET_MOVIECUT) + class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, HelpableScreen): skin = """ diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 4d21f9f0618..588a4a53e16 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py @@ -4,10 +4,12 @@ import xml.dom.minidom from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_FONTS + class ConfigColor(ConfigSequence): def __init__(self, default=[128, 128, 128]): ConfigSequence.__init__(self, seperator="#", limits=[(0, 255), (0, 255), (0, 255)], default=default) + class ConfigFilename(ConfigText): def __init__(self): ConfigText.__init__(self, default="", fixed_size=True, visible_width=False) @@ -23,9 +25,11 @@ def getMulti(self, selected): mark = [filename] return ("mtext"[1 - selected:], filename, mark) + class DVDProject: MAX_SL = 4480 MAX_DL = 8150 + def __init__(self): self.titles = [] self.target = None @@ -196,6 +200,7 @@ def getSize(self): size = property(getSize) + class MenuTemplate(DVDProject): def __init__(self): self.settings = ConfigSubsection() diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py index 6e79db66d22..8e4b2e7fd08 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py @@ -1,12 +1,15 @@ from Components.config import config, ConfigSubsection, ConfigSubList, ConfigInteger, ConfigText, ConfigSelection import TitleCutter + class ConfigFixedText(ConfigText): def __init__(self, text, visible_width=60): ConfigText.__init__(self, default=text, fixed_size=True, visible_width=visible_width) + def handleKey(self, key): pass + class DVDTitle: def __init__(self, project): self.properties = ConfigSubsection() diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py index 89e852e3c80..30d98b36b5f 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py @@ -9,6 +9,7 @@ from Components.Console import Console from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier + class DVDToolbox(Screen): skin = """ @@ -156,6 +157,7 @@ def exit(self): hotplugNotifier.remove(self.update) self.close() + class DVDformatJob(Job): def __init__(self, toolbox): Job.__init__(self, _("DVD media toolbox")) @@ -166,8 +168,10 @@ def retry(self): self.tasks[0].args += self.tasks[0].retryargs Job.retry(self) + class DVDformatTaskPostcondition(Condition): RECOVERABLE = True + def check(self, task): return task.error is None @@ -178,8 +182,10 @@ def getErrorMessage(self, task): task.ERROR_UNKNOWN: _("An unknown error occurred!") }[task.error] + class DVDformatTask(Task): ERROR_ALREADYFORMATTED, ERROR_NOTWRITEABLE, ERROR_UNKNOWN = range(3) + def __init__(self, job, extra_args=[]): Task.__init__(self, job, ("RW medium format")) self.toolbox = job.toolbox diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index e18b893f48a..8f12421118a 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -3,6 +3,7 @@ from Screens.MessageBox import MessageBox import os + class png2yuvTask(Task): def __init__(self, job, inputfile, outputfile): Task.__init__(self, job, "Creating menu video") @@ -19,6 +20,7 @@ def run(self, callback): def processStderr(self, data): print "[png2yuvTask]", data[:-1] + class mpeg2encTask(Task): def __init__(self, job, inputfile, outputfile): Task.__init__(self, job, "Encoding menu video") @@ -34,6 +36,7 @@ def run(self, callback): def processOutputLine(self, line): print "[mpeg2encTask]", line[:-1] + class spumuxTask(Task): def __init__(self, job, xmlfile, inputfile, outputfile): Task.__init__(self, job, "Muxing buttons into menu") @@ -52,6 +55,7 @@ def run(self, callback): def processStderr(self, data): print "[spumuxTask]", data[:-1] + class MakeFifoNode(Task): def __init__(self, job, number): Task.__init__(self, job, "Make FIFO nodes") @@ -60,6 +64,7 @@ def __init__(self, job, number): self.args += [nodename, "p"] self.weighting = 10 + class LinkTS(Task): def __init__(self, job, sourcefile, link_name): Task.__init__(self, job, "Creating symlink for source titles") @@ -67,6 +72,7 @@ def __init__(self, job, sourcefile, link_name): self.args += ["-s", sourcefile, link_name] self.weighting = 10 + class CopyMeta(Task): def __init__(self, job, sourcefile): Task.__init__(self, job, "Copy title meta files") @@ -80,6 +86,7 @@ def __init__(self, job, sourcefile): self.args += [self.job.workspace] self.weighting = 15 + class DemuxTask(Task): def __init__(self, job, inputfile): Task.__init__(self, job, "Demux video into ES") @@ -187,6 +194,7 @@ def cleanup(self, failed): except OSError: pass + class MplexTaskPostcondition(Condition): def check(self, task): if task.error == task.ERROR_UNDERRUN: @@ -199,8 +207,10 @@ def getErrorMessage(self, task): task.ERROR_UNKNOWN: ("An unknown error occurred!") }[task.error] + class MplexTask(Task): ERROR_UNDERRUN, ERROR_UNKNOWN = range(2) + def __init__(self, job, outputfile, inputfiles=None, demux_task=None, weighting=500): Task.__init__(self, job, "Mux ES into PS") self.weighting = weighting @@ -230,6 +240,7 @@ def processOutputLine(self, line): else: self.error = self.ERROR_UNKNOWN + class RemoveESFiles(Task): def __init__(self, job, demux_task): Task.__init__(self, job, "Remove temp. files") @@ -242,6 +253,7 @@ def prepare(self): self.args += self.demux_task.generated_files self.args += [self.demux_task.cutfile] + class ReplexTask(Task): def __init__(self, job, outputfile, inputfile): Task.__init__(self, job, "ReMux TS into PS") @@ -252,6 +264,7 @@ def __init__(self, job, outputfile, inputfile): def processOutputLine(self, line): print "[ReplexTask] ", line[:-1] + class DVDAuthorTask(Task): def __init__(self, job): Task.__init__(self, job, "Authoring DVD") @@ -274,12 +287,14 @@ def processOutputLine(self, line): except: print "couldn't set mux progress" + class DVDAuthorFinalTask(Task): def __init__(self, job): Task.__init__(self, job, "dvdauthor finalize") self.setTool("dvdauthor") self.args += ["-T", "-o", self.job.workspace + "/dvd"] + class WaitForResidentTasks(Task): def __init__(self, job): Task.__init__(self, job, "waiting for dvdauthor to finalize") @@ -290,8 +305,10 @@ def run(self, callback): if self.job.resident_tasks == 0: callback(self, []) + class BurnTaskPostcondition(Condition): RECOVERABLE = True + def check(self, task): if task.returncode == 0: return True @@ -312,8 +329,10 @@ def getErrorMessage(self, task): task.ERROR_UNKNOWN: _("An unknown error occurred!") }[task.error] + class BurnTask(Task): ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_MINUSRWBUG, ERROR_UNKNOWN = range(10) + def __init__(self, job, extra_args=[], tool="growisofs"): Task.__init__(self, job, job.name) self.weighting = 500 @@ -376,6 +395,7 @@ def setTool(self, tool): self.args = [tool] self.global_preconditions.append(ToolExistsPrecondition()) + class RemoveDVDFolder(Task): def __init__(self, job): Task.__init__(self, job, "Remove temp. files") @@ -383,6 +403,7 @@ def __init__(self, job): self.args += ["-rf", self.job.workspace] self.weighting = 10 + class CheckDiskspaceTask(Task): def __init__(self, job): Task.__init__(self, job, "Checking free space") @@ -410,6 +431,7 @@ def run(self, callback): return Task.processFinished(self, 0) + class PreviewTask(Task): def __init__(self, job, path): Task.__init__(self, job, "Preview") @@ -456,6 +478,7 @@ def previewProject(self): from Screens.DVD import DVDPlayer self.job.project.session.openWithCallback(self.playerClosed, DVDPlayer, dvd_filelist=[self.path]) + class PreviewTaskPostcondition(Condition): def check(self, task): return task.returncode == 0 @@ -463,6 +486,7 @@ def check(self, task): def getErrorMessage(self, task): return "Cancel" + class ImagingPostcondition(Condition): def check(self, task): return task.returncode == 0 @@ -470,6 +494,7 @@ def check(self, task): def getErrorMessage(self, task): return _("Failed") + ": python-imaging" + class ImagePrepareTask(Task): def __init__(self, job): Task.__init__(self, job, _("please wait, loading picture...")) @@ -501,6 +526,7 @@ def conduct(self): except: Task.processFinished(self, 1) + class MenuImageTask(Task): def __init__(self, job, menu_count, spuxmlfilename, menubgpngfilename, highlightpngfilename): Task.__init__(self, job, "Create Menu %d Image" % menu_count) @@ -663,6 +689,7 @@ def getPosition(self, offset, left, top, right, bottom, size): pos[1] += ((bottom - top) - size[1]) / 2 return tuple(pos) + class Menus: def __init__(self, job): self.job = job @@ -698,6 +725,7 @@ def __init__(self, job): menuoutputfilename = job.workspace + "/dvdmenu" + num + ".mpg" spumuxTask(job, spuxmlfilename, menubgmpgfilename, menuoutputfilename) + def CreateAuthoringXML_singleset(job): nr_titles = len(job.project.titles) mode = job.project.settings.authormode.getValue() @@ -767,6 +795,7 @@ def CreateAuthoringXML_singleset(job): f.write(x) f.close() + def CreateAuthoringXML_multiset(job): nr_titles = len(job.project.titles) mode = job.project.settings.authormode.getValue() @@ -856,6 +885,7 @@ def CreateAuthoringXML_multiset(job): f.write(x) f.close() + def getISOfilename(isopath, volName): from Tools.Directories import fileExists i = 0 @@ -865,6 +895,7 @@ def getISOfilename(isopath, volName): filename = isopath + '/' + volName + str(i).zfill(3) + ".iso" return filename + class DVDJob(Job): def __init__(self, project, menupreview=False): Job.__init__(self, "DVDBurn Job") @@ -927,6 +958,7 @@ def conduct(self): BurnTask(self, burnargs, tool) RemoveDVDFolder(self) + class DVDdataJob(Job): def __init__(self, project): Job.__init__(self, "Data DVD Burn") @@ -973,6 +1005,7 @@ def conduct(self): BurnTask(self, burnargs, tool) RemoveDVDFolder(self) + class DVDisoJob(Job): def __init__(self, project, imagepath): Job.__init__(self, _("Burn DVD")) diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index 431740cda21..5f2699a3989 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py +++ b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py @@ -9,6 +9,7 @@ from Components.config import config, getConfigListEntry from Components.ConfigList import ConfigListScreen + class FileBrowser(Screen, HelpableScreen): def __init__(self, session, scope, configRef): @@ -82,6 +83,7 @@ def exit(self): self.close(self["filelist"].getCurrentDirectory(), self.scope, self.configRef) self.close(None, False, None) + class ProjectSettings(Screen, ConfigListScreen): skin = """ diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py index b72921dbf91..a5b344209bf 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py @@ -3,6 +3,7 @@ from enigma import iPlayableService, iServiceInformation from Tools.Directories import fileExists + class TitleCutter(CutListEditor): def __init__(self, session, t): CutListEditor.__init__(self, session, t.source) @@ -57,6 +58,7 @@ def exit(self): self.session.nav.stopService() self.close(self.cut_list[:]) + class CutlistReader(TitleCutter): skin = """ diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index d3bfa93fa37..ea739118fb5 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -20,6 +20,7 @@ from enigma import gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT from Tools.Directories import resolveFilename, SCOPE_PLUGINS + class TitleList(Screen, HelpableScreen): skin = """ @@ -160,6 +161,7 @@ def newProject(self): def addTitle(self): from Screens.MovieSelection import MovieSelection from Components.ActionMap import HelpableActionMap + class DVDMovieSelection(MovieSelection): skin = """ @@ -186,6 +188,7 @@ class DVDMovieSelection(MovieSelection): """ + def __init__(self, session): MovieSelection.__init__(self, session) self["key_red"] = StaticText(_("Close")) @@ -197,18 +200,23 @@ def __init__(self, session): "green": (self.insertWithoutEdit, ("insert without cutlist editor")), "yellow": (self.movieSelected, _("Add a new title")) }) + def updateTags(self): pass + def doContext(self): print "context menu forbidden inside DVDBurn to prevent calling multiple instances" + def updateButtons(self): # the original will hide red/green, and crash... pass + def insertWithoutEdit(self): current = self.getCurrent() if current is not None: current.edit = False self.close(current) + def movieSelected(self): current = self.getCurrent() if current is not None: diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index f62b572f250..53cafd515a9 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -9,6 +9,7 @@ from Components.AVSwitch import AVSwitch import DVDTitle + class TitleProperties(Screen, ConfigListScreen): skin = """ @@ -143,7 +144,10 @@ def ok(self): def cancel(self): self.close() + from Tools.ISO639 import LanguageCodes + + class LanguageChoices(): def __init__(self): from Components.Language import language as syslanguage @@ -183,4 +187,5 @@ def getLanguage(self, DVB_lang): return key return "nolang" + languageChoices = LanguageChoices() diff --git a/lib/python/Plugins/Extensions/DVDBurn/plugin.py b/lib/python/Plugins/Extensions/DVDBurn/plugin.py index 547ffa7f857..3aa035e79f9 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/plugin.py +++ b/lib/python/Plugins/Extensions/DVDBurn/plugin.py @@ -1,14 +1,17 @@ from Plugins.Plugin import PluginDescriptor + def main(session, **kwargs): import TitleList #project.addService(service) return session.open(TitleList.TitleList) + def main_add(session, service, **kwargs): dvdburn = main(session, **kwargs) dvdburn.selectedSource(service) + def Plugins(**kwargs): descr = _("Burn to DVD") return [PluginDescriptor(name=_("DVD Burn"), description=descr, where=PluginDescriptor.WHERE_MOVIELIST, needsRestart=True, fnc=main_add, icon="dvdburn.png"), diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 2d138f158c5..aa7f6ad3ca9 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -5,10 +5,12 @@ detected_DVD = None + def main(session, **kwargs): from Screens import DVD session.open(DVD.DVDPlayer) + def play(session, **kwargs): from Screens import DVD if (os.path.exists(os.path.join(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()), "VIDEO_TS")) @@ -17,16 +19,19 @@ def play(session, **kwargs): else: return + def DVDPlayer(*args, **kwargs): # for backward compatibility with plugins that do "from DVDPlayer.plugin import DVDPlayer" from Screens import DVD return DVD.DVDPlayer(*args, **kwargs) + def DVDOverlay(*args, **kwargs): # for backward compatibility with plugins that do "from DVDPlayer.plugin import DVDOverlay" from Screens import DVD return DVD.DVDOverlay(*args, **kwargs) + def filescan_open(list, session, **kwargs): from Screens import DVD if len(list) == 1 and list[0].mimetype == "video/x-dvd": @@ -45,6 +50,7 @@ def filescan_open(list, session, **kwargs): dvd_filelist.append(x.path.rsplit('/', 1)[0]) session.open(DVD.DVDPlayer, dvd_filelist=dvd_filelist) + def filescan(**kwargs): from Components.Scanner import Scanner, ScanPath @@ -65,6 +71,7 @@ def checkFile(self, file): openfnc=filescan_open, )] + def onPartitionChange(action, partition): print "[@] onPartitionChange", action, partition if partition != harddiskmanager.getCD(): @@ -76,6 +83,7 @@ def onPartitionChange(action, partition): print "[DVDplayer] DVD Inserted" detected_DVD = None + def menu(menuid, **kwargs): if menuid == "mainmenu": global detected_DVD @@ -93,6 +101,7 @@ def menu(menuid, **kwargs): return [(_("DVD player"), play, "dvd_player", 46)] return [] + def Plugins(**kwargs): return [PluginDescriptor(where=PluginDescriptor.WHERE_FILESCAN, needsRestart=False, fnc=filescan), PluginDescriptor(name=_("DVDPlayer"), description=_("Play DVDs"), where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=menu)] diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py b/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py index b0c0cf30c76..de9e5440c00 100644 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py @@ -76,6 +76,7 @@ listscreen = config.misc.graph_mepg.default_mode.value + class EPGList(GUIComponent): def __init__(self, selChangedCB=None, timer=None, time_epoch=120, overjump_empty=True, epg_bouquet=None): GUIComponent.__init__(self) @@ -188,58 +189,85 @@ def EntryFont(value): font = parseFont(value, ((1, 1), (1, 1))) self.entryFontName = font.family self.entryFontSize = font.pointSize + def EntryForegroundColor(value): self.foreColor = parseColor(value).argb() + def EntryForegroundColorSelected(value): self.foreColorSelected = parseColor(value).argb() + def EntryForegroundColorNow(value): self.foreColorNow = parseColor(value).argb() + def EntryForegroundColorSelectedRec(value): self.foreColorSelectedRec = parseColor(value).argb() + def EntryBackgroundColor(value): self.backColor = parseColor(value).argb() + def EntryBackgroundColorSelected(value): self.backColorSelected = parseColor(value).argb() + def EntryBackgroundColorNow(value): self.backColorNow = parseColor(value).argb() + def EntryBorderColor(value): self.borderColor = parseColor(value).argb() + def EventBorderWidth(value): # for solid backgrounds only (we are limited to the same horizontal and vertical border width) self.eventBorderWidth = int(value) + def EventBorderHorWidth(value): # for png backgrounds only self.eventBorderHorWidth = int(value) + def EventBorderVerWidth(value): # for png backgrounds only self.eventBorderVerWidth = int(value) + def EventNamePadding(value): self.eventNamePadding = int(value) + def ServiceFont(value): self.serviceFont = parseFont(value, ((1, 1), (1, 1))) + def ServiceForegroundColor(value): self.foreColorService = parseColor(value).argb() + def ServiceForegroundColorSelected(value): self.foreColorServiceSelected = parseColor(value).argb() + def ServiceForegroundColorRecording(value): self.foreColorRec = parseColor(value).argb() + def ServiceBackgroundColor(value): self.backColorService = parseColor(value).argb() + def ServiceBackgroundColorSelected(value): self.backColorServiceSelected = parseColor(value).argb() + def ServiceBackgroundColorRecording(value): self.backColorRec = parseColor(value).argb() + def ServiceBorderColor(value): self.borderColorService = parseColor(value).argb() + def ServiceBorderWidth(value): # for solid backgrounds only (we are limited to the same horizontal and vertical border width) self.serviceBorderWidth = int(value) + def ServiceBorderHorWidth(value): # for png backgrounds only self.serviceBorderHorWidth = int(value) + def ServiceBorderVerWidth(value): # for png backgrounds only self.serviceBorderVerWidth = int(value) + def ServiceNamePadding(value): self.serviceNamePadding = int(value) + def RecIconSize(value): self.recIconSize = int(value) + def IconXPadding(value): self.iconXPadding = int(value) + def IconYPadding(value): self.iconYPadding = int(value) for (attrib, value) in list(self.skinAttributes): @@ -732,6 +760,7 @@ def getTimeBase(self): def resetOffset(self): self.offs = 0 + class TimelineText(GUIComponent): def __init__(self): GUIComponent.__init__(self) @@ -749,8 +778,10 @@ def __init__(self): def applySkin(self, desktop, screen): def foregroundColor(value): self.foreColor = parseColor(value).argb() + def backgroundColor(value): self.backColor = parseColor(value).argb() + def font(value): self.font = parseFont(value, ((1, 1), (1, 1))) for (attrib, value) in list(self.skinAttributes): @@ -837,6 +868,7 @@ def setEntries(self, l, timeline_now, time_lines, force): else: timeline_now.visible = False + class GraphMultiEPG(Screen, HelpableScreen): EMPTY = 0 ADD_TIMER = 1 @@ -1147,6 +1179,7 @@ def furtherOptions(self): keys = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow"][:len(menu)] + (len(menu) - 13) * [""] + keys menu.append((_("Timer overview"), self.openTimerOverview)) menu.append((_("Setup menu"), self.showSetup, "menu")) + def boxAction(choice): if choice: choice[1]() @@ -1341,6 +1374,7 @@ def timerAdd(self): buttons.append("yellow") menu.append((_("Timer overview"), "timereditlist")) buttons.append("blue") + def timerAction(choice): if choice is not None: if choice[1] == "delete": @@ -1369,6 +1403,7 @@ def finishedEdit(self, answer=None): def removeEditTimer(): entry.service_ref, entry.begin, entry.end, entry.external = entry.service_ref_prev, entry.begin_prev, entry.end_prev, entry.external_prev self.removeTimer(entry) + def moveEditTimerError(): entry.external = entry.external_prev self.onSelectionChanged() diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpgSetup.py b/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpgSetup.py index fe1d088a10c..e76da988300 100644 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpgSetup.py +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpgSetup.py @@ -8,6 +8,7 @@ addnotifier = None + class GraphMultiEpgSetup(Screen, ConfigListScreen): skin = """ diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py index 36d2e297d61..dc28db31f67 100644 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py @@ -14,6 +14,7 @@ epg = None ref = None + def zapToService(service, preview=False, zapback=False): if Servicelist.startServiceRef is None: Servicelist.startServiceRef = Session.nav.getCurrentlyPlayingServiceOrGroup() @@ -36,6 +37,7 @@ def zapToService(service, preview=False, zapback=False): Servicelist.startServiceRef = None Servicelist.startRoot = None + def getBouquetServices(bouquet): services = [] Servicelist = eServiceCenter.getInstance().list(bouquet) @@ -49,6 +51,7 @@ def getBouquetServices(bouquet): services.append(ServiceReference(service)) return services + def selectBouquet(bouquet, epg): services = getBouquetServices(bouquet) if services: @@ -57,6 +60,7 @@ def selectBouquet(bouquet, epg): epg.setServices(services) epg.parent.setServices(services) + def cleanup(): global Session Session = None @@ -69,9 +73,11 @@ def cleanup(): global epg epg = None + def closed(ret=False): cleanup() + def onSelectBouquetClose(*args): if args and len(args) == 2: serviceref, bouquetref = args[:2] @@ -83,6 +89,7 @@ def onSelectBouquetClose(*args): if serviceref: epg["list"].moveToService(serviceref) + def changeBouquetCB(direction, epgcall): global epg epg = epgcall @@ -97,6 +104,7 @@ def changeBouquetCB(direction, epgcall): if epg["list"].getCurrent() and epg["list"].getCurrent()[1]: Session.openWithCallback(onSelectBouquetClose, SimpleChannelSelection, _("Select channel"), True, True, epg["list"].getCurrent()[1].ref) + def main(session, servicelist=None, **kwargs): global ref global Session @@ -110,6 +118,7 @@ def main(session, servicelist=None, **kwargs): ref = Servicelist.getCurrentSelection() runGraphMultiEpg() + def runGraphMultiEpg(): global bouquets global epg_bouquet @@ -121,6 +130,7 @@ def runGraphMultiEpg(): services = getBouquetServices(epg_bouquet) Session.openWithCallback(reopen, GraphMultiEPG, services, zapToService, cb, ServiceReference(epg_bouquet).getServiceName(), selectBouquet, epg_bouquet) + def reopen(answer): if answer is None: runGraphMultiEpg() @@ -131,6 +141,7 @@ def reopen(answer): Servicelist.setCurrentSelection(ref) closed(answer) + def Plugins(**kwargs): name = _("Graphical Multi EPG") descr = _("A graphical EPG for all services of a specific bouquet") diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index d59ad8dcc00..6f7d73bb9e1 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -26,6 +26,7 @@ from settings import MediaPlayerSettings import random + class MyPlayList(PlayList): def __init__(self): PlayList.__init__(self) @@ -36,6 +37,7 @@ def PlayListShuffle(self): self.currPlaying = -1 self.oldCurrPlaying = -1 + class MediaPixmap(Pixmap): def __init__(self): Pixmap.__init__(self) @@ -90,12 +92,14 @@ def embeddedCoverArt(self): self.coverArtFileName = "/tmp/.id3coverart" self.picload.startDecode(self.coverArtFileName) + class MediaPlayerInfoBar(Screen): def __init__(self, session): Screen.__init__(self, session) self.skinName = "MoviePlayer" + class MediaPlayer(Screen, InfoBarBase, InfoBarScreenSaver, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, HelpableScreen): ALLOW_SUSPEND = True ENABLE_RESUME_SUPPORT = True @@ -1136,6 +1140,7 @@ def prevBouquet(self): else: self.switchToFileList() + class MediaPlayerLCDScreen(Screen): skin = ( """ @@ -1168,18 +1173,22 @@ def setText(self, text, line): elif line == 4: self["text4"].setText(text) + def mainCheckTimeshiftCallback(session, answer): if answer: session.open(MediaPlayer) + def main(session, **kwargs): InfoBar.instance.checkTimeshiftRunning(boundFunction(mainCheckTimeshiftCallback, session)) + def menu(menuid, **kwargs): if menuid == "mainmenu" and config.mediaplayer.onMainMenu.getValue(): return [(_("Media player"), main, "media_player", 45)] return [] + def filescan_open(list, session, **kwargs): from enigma import eServiceReference @@ -1198,6 +1207,7 @@ def filescan_open(list, session, **kwargs): mp.changeEntry(0) mp.switchToPlayList() + def audioCD_open(list, session, **kwargs): from enigma import eServiceReference if os.path.isfile('/media/audiocd/cdplaylist.cdpls'): @@ -1216,6 +1226,7 @@ def audioCD_open(list, session, **kwargs): # to do : adding msgbox to inform user about failure of opening audiocd. return False + def audioCD_open_mn(session, **kwargs): from enigma import eServiceReference if os.path.isfile('/media/audiocd/cdplaylist.cdpls'): @@ -1234,6 +1245,7 @@ def audioCD_open_mn(session, **kwargs): # to do : adding msgbox to inform user about failure of opening audiocd. return False + def movielist_open(list, session, **kwargs): if not list: # sanity @@ -1252,6 +1264,7 @@ def movielist_open(list, session, **kwargs): config.movielist.last_videodir.value = path InfoBar.instance.showMovies(eServiceReference(stype, 0, f.path)) + def audiocdscan(menuid, **kwargs): try: from Plugins.SystemPlugins.Hotplug.plugin import AudiocdAdded @@ -1263,6 +1276,7 @@ def audiocdscan(menuid, **kwargs): else: return [] + def filescan(**kwargs): from Components.Scanner import Scanner, ScanPath return [ @@ -1302,7 +1316,10 @@ def filescan(**kwargs): ), ] + from Plugins.Plugin import PluginDescriptor + + def Plugins(**kwargs): return [ PluginDescriptor(name=_("Media player"), description=_("Play back media files"), where=PluginDescriptor.WHERE_PLUGINMENU, icon="MediaPlayer.png", needsRestart=False, fnc=main), diff --git a/lib/python/Plugins/Extensions/MediaPlayer/settings.py b/lib/python/Plugins/Extensions/MediaPlayer/settings.py index bddda257ac3..ff8c0062bbb 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/settings.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/settings.py @@ -15,6 +15,7 @@ config.mediaplayer.alwaysHideInfoBar = ConfigYesNo(default=True) config.mediaplayer.onMainMenu = ConfigYesNo(default=False) + class DirectoryBrowser(Screen, HelpableScreen): def __init__(self, session, currDir): @@ -54,6 +55,7 @@ def use(self): def exit(self): self.close(False) + class MediaPlayerSettings(Screen, ConfigListScreen): def __init__(self, session, parent): diff --git a/lib/python/Plugins/Extensions/MediaScanner/plugin.py b/lib/python/Plugins/Extensions/MediaScanner/plugin.py index e51e36e970a..8be095495d7 100644 --- a/lib/python/Plugins/Extensions/MediaScanner/plugin.py +++ b/lib/python/Plugins/Extensions/MediaScanner/plugin.py @@ -3,6 +3,7 @@ from Screens.InfoBar import InfoBar import os + def execute(option): print "execute", option if option is None: @@ -11,6 +12,7 @@ def execute(option): (_, scanner, files, session) = option scanner.open(files, session) + def mountpoint_choosen(option): if option is None: return @@ -35,28 +37,35 @@ def mountpoint_choosen(option): title=_("The following files were found..."), list=list) + def scan(session): from Screens.ChoiceBox import ChoiceBox parts = [(r.tabbedDescription(), r.mountpoint, session) for r in harddiskmanager.getMountedPartitions(onlyhotplug=False) if os.access(r.mountpoint, os.F_OK | os.R_OK)] parts.append((_("Memory") + "\t/tmp", "/tmp", session)) session.openWithCallback(mountpoint_choosen, ChoiceBox, title=_("Please select medium to be scanned"), list=parts) + def main(session, **kwargs): scan(session) + def menuEntry(*args): mountpoint_choosen(args) + from Components.Harddisk import harddiskmanager + def menuHook(menuid): if menuid != "mainmenu": return [] from Tools.BoundFunction import boundFunction return [(("%s (files)") % r.description, boundFunction(menuEntry, r.description, r.mountpoint), "hotplug_%s" % r.mountpoint, None) for r in harddiskmanager.getMountedPartitions(onlyhotplug=True)] + global_session = None + def partitionListChanged(action, device): if InfoBar.instance: if InfoBar.instance.execing: @@ -70,10 +79,12 @@ def partitionListChanged(action, device): else: print "hotplug event.. but no infobar" + def sessionstart(reason, session): global global_session global_session = session + def autostart(reason, **kwargs): global global_session if reason == 0: @@ -82,6 +93,7 @@ def autostart(reason, **kwargs): harddiskmanager.on_partition_list_change.remove(partitionListChanged) global_session = None + def Plugins(**kwargs): return [ PluginDescriptor(name=_("Media scanner"), description=_("Scan files..."), where=PluginDescriptor.WHERE_PLUGINMENU, icon="MediaScanner.png", needsRestart=True, fnc=main), diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index f7917191ddd..4a24296a47f 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -2,24 +2,29 @@ #------------------------------------------------------------------------------------------ + def Pic_Thumb(*args, **kwa): import ui return ui.Pic_Thumb(*args, **kwa) + def picshow(*args, **kwa): import ui return ui.picshow(*args, **kwa) + def main(session, **kwargs): from ui import picshow session.open(picshow) + def filescan_open(list, session, **kwargs): # Recreate List as expected by PicView filelist = [((file.path, False), None) for file in list] from ui import Pic_Full_View session.open(Pic_Full_View, filelist, 0, file.path) + def filescan(**kwargs): from Components.Scanner import Scanner, ScanPath import os @@ -40,6 +45,7 @@ def checkFile(self, file): openfnc=filescan_open, ) + def Plugins(**kwargs): return \ [PluginDescriptor(name=_("Picture player"), description=_("fileformats (BMP, PNG, JPG, GIF)"), icon="pictureplayer.png", where=PluginDescriptor.WHERE_PLUGINMENU, needsRestart=False, fnc=main), diff --git a/lib/python/Plugins/Extensions/PicturePlayer/ui.py b/lib/python/Plugins/Extensions/PicturePlayer/ui.py index 77221df09eb..f6d622797c0 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/ui.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/ui.py @@ -14,9 +14,11 @@ from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSelection, ConfigText, ConfigYesNo, KEY_LEFT, KEY_RIGHT, getConfigListEntry import skin + def getScale(): return AVSwitch().getFramebufferScale() + config.pic = ConfigSubsection() config.pic.framesize = ConfigInteger(default=30, limits=(5, 99)) config.pic.slidetime = ConfigInteger(default=10, limits=(1, 60)) @@ -30,6 +32,7 @@ def getScale(): config.pic.autoOrientation = ConfigYesNo(default=False) config.pic.textcolor = ConfigSelection(default="#0038FF48", choices=[("#00000000", _("black")), ("#009eb9ff", _("blue")), ("#00ff5a51", _("red")), ("#00ffe875", _("yellow")), ("#0038FF48", _("green"))]) + class picshow(Screen): skin = """ @@ -143,6 +146,7 @@ def KeyExit(self): #------------------------------------------------------------------------------------------ + class Pic_Setup(Screen, ConfigListScreen): def __init__(self, session): @@ -208,6 +212,7 @@ def createSummary(self): #--------------------------------------------------------------------------- + class Pic_Exif(Screen): skin = """ @@ -251,12 +256,14 @@ def layoutFinished(self): #---------------------------------------------------------------------------------------- + T_INDEX = 0 T_FRAME_POS = 1 T_PAGE = 2 T_NAME = 3 T_FULL = 4 + class Pic_Thumb(Screen): def __init__(self, session, piclist, lastindex, path): @@ -440,6 +447,7 @@ def Exit(self): #--------------------------------------------------------------------------- + class Pic_Full_View(Screen): def __init__(self, session, filelist, index, path): diff --git a/lib/python/Plugins/Extensions/SocketMMI/SocketMMI.py b/lib/python/Plugins/Extensions/SocketMMI/SocketMMI.py index 217595e1b38..bf19004dd5e 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/SocketMMI.py +++ b/lib/python/Plugins/Extensions/SocketMMI/SocketMMI.py @@ -1,6 +1,7 @@ from Screens.Ci import MMIDialog import socketmmi + class SocketMMIMessageHandler: def __init__(self): self.session = None diff --git a/lib/python/Plugins/Extensions/SocketMMI/plugin.py b/lib/python/Plugins/Extensions/SocketMMI/plugin.py index 1c37ab8a876..3f75680ef72 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/plugin.py +++ b/lib/python/Plugins/Extensions/SocketMMI/plugin.py @@ -3,25 +3,30 @@ socketHandler = None + def main(session, **kwargs): socketHandler.startMMI() + def menu(menuid, **kwargs): if menuid == "setup" and socketHandler and socketHandler.connected(): return [(socketHandler.getName(), main, "socket_mmi", 0)] return [] + def sessionstart(reason, session): global socketHandler if socketHandler is None: socketHandler = SocketMMIMessageHandler() socketHandler.setSession(session) + def autostart(reason, **kwargs): global socketHandler if reason == 1: socketHandler = None + def Plugins(**kwargs): return [PluginDescriptor(name=_("SocketMMI"), description=_("Python frontend for /tmp/mmi.socket"), where=PluginDescriptor.WHERE_MENU, needsRestart=True, fnc=menu), PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART, needsRestart=True, fnc=sessionstart), diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index 52a33f09d01..1b0fa1b404c 100644 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -3,6 +3,7 @@ config.plugins = ConfigSubsection() + class PluginDescriptor: """An object to describe a plugin.""" @@ -63,7 +64,6 @@ class PluginDescriptor: # start as channellist context menu plugin. session, serviceref (currently selected) WHERE_CHANNEL_CONTEXT_MENU = 15 - def __init__(self, name="Plugin", where=[], description="", icon=None, fnc=None, wakeupfnc=None, needsRestart=None, internal=False, weight=0): self.name = name self.internal = internal diff --git a/lib/python/Plugins/SystemPlugins/CableScan/plugin.py b/lib/python/Plugins/SystemPlugins/CableScan/plugin.py index ae04513f4b1..bfe5e1d06ad 100644 --- a/lib/python/Plugins/SystemPlugins/CableScan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/CableScan/plugin.py @@ -14,6 +14,7 @@ from enigma import eCableScan, eDVBFrontendParametersCable, eTimer + class CableScan: def __init__(self, text, progressbar, scanTuner, scanNetwork, scanFrequency, scanSymbolRate, scanModulation, keepNumbers, hdList): self.text = text @@ -56,6 +57,7 @@ def destroy(self): def isDone(self): return self.done + class CableScanStatus(Screen): skin = """ @@ -97,6 +99,7 @@ def ok(self): def cancel(self): self.close() + config.plugins.CableScan = ConfigSubsection() config.plugins.CableScan.keepnumbering = ConfigYesNo(default=False) config.plugins.CableScan.hdlist = ConfigYesNo(default=False) @@ -112,6 +115,7 @@ def cancel(self): default=str(eDVBFrontendParametersCable.Modulation_QAM64)) config.plugins.CableScan.auto = ConfigYesNo(default=True) + class CableScanScreen(ConfigListScreen, Screen): skin = """ @@ -197,6 +201,7 @@ def keyCancel(self): x[1].cancel() self.close() + class CableScanAutoScreen(CableScanScreen): def __init__(self, session, nimlist): print "[AutoCableScan] start" @@ -239,12 +244,15 @@ def createSummary(self): from Screens.Standby import StandbySummary return StandbySummary + Session = None CableScanAutoStartTimer = eTimer() + def CableScanMain(session, **kwargs): session.open(CableScanScreen, nimmanager.getEnabledNimListOfType("DVB-C")) + def restartScanAutoStartTimer(reply=False): if reply: CableScanAutoStartTimer.startLongTimer(86400) @@ -252,6 +260,7 @@ def restartScanAutoStartTimer(reply=False): print "[AutoCableScan] Scan was not successful retry in one hour" CableScanAutoStartTimer.startLongTimer(3600) + def CableScanAuto(): nimlist = nimmanager.getEnabledNimListOfType("DVB-C") if nimlist: @@ -260,17 +269,21 @@ def CableScanAuto(): else: Session.openWithCallback(restartScanAutoStartTimer, CableScanAutoScreen, nimlist) + CableScanAutoStartTimer.callback.append(CableScanAuto) + def leaveStandby(): CableScanAutoStartTimer.stop() + def standbyCountChanged(value): if config.plugins.CableScan.auto.value: from Screens.Standby import inStandby inStandby.onClose.append(leaveStandby) CableScanAutoStartTimer.startLongTimer(150) + def autostart(reason, **kwargs): global Session if reason == 0 and "session" in kwargs and not Session: @@ -280,12 +293,14 @@ def autostart(reason, **kwargs): Session = None config.misc.standbyCounter.removeNotifier(standbyCountChanged) + def CableScanStart(menuid, **kwargs): if menuid == "scan" and nimmanager.getEnabledNimListOfType("DVB-C"): return [(_("Cable Scan"), CableScanMain, "cablescan", None)] else: return [] + def Plugins(**kwargs): if nimmanager.hasNimType("DVB-C"): return [PluginDescriptor(name=_("Cable Scan"), description="Scan cable provider channels", where=PluginDescriptor.WHERE_MENU, fnc=CableScanStart), diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py index d99fd8234e1..1d7b89125c4 100644 --- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py @@ -22,6 +22,7 @@ import os + class CIselectMainMenu(Screen): skin = """ @@ -89,6 +90,7 @@ def greenPressed(self): else: self.session.open(easyCIconfigMenu, slot) + class CIconfigMenu(Screen): skin = """ @@ -356,6 +358,7 @@ def getValue(definitions, default): self["ServiceList"].l.setList(self.servicelist) self.setServiceListInfo() + class easyCIconfigMenu(CIconfigMenu): skin = """ @@ -381,6 +384,7 @@ def __init__(self, session, ci_slot="9"): "cancel": self.cancel }, -1) + class CAidSelect(Screen): skin = """ @@ -429,6 +433,7 @@ def greenPressed(self): def cancel(self): self.close() + class myProviderSelection(ChannelSelectionBase): skin = """ @@ -462,7 +467,6 @@ def __init__(self, session, title): self["key_blue"] = StaticText() self["introduction"] = StaticText(_("Press OK to select a provider.")) - def showProviders(self): pass @@ -487,6 +491,7 @@ def channelSelected(self): # just return selected service self.enterPath(ref) elif (ref.flags & 7) == 7 and 'provider' in ref.toString(): menu = [(_("Provider"), "provider"), (_("All services provider"), "providerlist")] + def addAction(choice): if choice is not None: if choice[1] == "provider": @@ -565,6 +570,7 @@ def showSatellites(self, changeMode=False): def cancel(self): self.close(None) + class myChannelSelection(ChannelSelectionBase): skin = """ @@ -670,15 +676,18 @@ def setModeRadio(self): def cancel(self): self.close(None) + def activate_all(session): cihelper.load_ci_assignment() + def find_in_list(list, search, listpos=0): for item in list: if item[listpos] == search: return True return False + def isModule(): NUM_CI = SystemInfo["CommonInterface"] if NUM_CI and NUM_CI > 0: @@ -688,12 +697,15 @@ def isModule(): return True return False + global_session = None + def sessionstart(reason, session): global global_session global_session = session + def autostart(reason, **kwargs): global global_session if reason == 0: @@ -702,14 +714,17 @@ def autostart(reason, **kwargs): elif reason == 1: global_session = None + def main(session, **kwargs): session.open(CIselectMainMenu) + def menu(menuid, **kwargs): if menuid == "cam" and isModule(): return [(_("Common Interface assignment"), main, "ci_assign", 11)] return [] + def Plugins(**kwargs): description = _("a gui to assign services/providers to common interface modules") if config.usage.setup_level.index > 1: diff --git a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/plugin.py b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/plugin.py index 51cdad548d0..1b2e8e9bd04 100644 --- a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/plugin.py +++ b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/plugin.py @@ -7,6 +7,7 @@ from os import unlink from enigma import eTimer, eDVBDB + class DefaultServiceScan(ServiceScan): skin = """ @@ -45,6 +46,7 @@ def __init__(self, session, scanList): self.timer.callback.append(self.ok) self.timer.start(1000) + class DefaultServicesScannerPlugin(ScanSetup): skin = """ @@ -123,8 +125,10 @@ def scanFinished(self, value=None): self.selectSat(self.scanIndex) self.keyGo() + def DefaultServicesScannerMain(session, **kwargs): session.open(DefaultServicesScannerPlugin) + def Plugins(**kwargs): return PluginDescriptor(name=_("Default Services Scanner"), description=_("Scans default lamedbs sorted by satellite with a connected dish positioner"), where=PluginDescriptor.WHERE_PLUGINMENU, needsRestart=False, fnc=DefaultServicesScannerMain) diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py index 507704e8384..4a1215be262 100644 --- a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py +++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py @@ -14,6 +14,7 @@ from Components.config import getConfigListEntry, ConfigSelection, ConfigYesNo import random + class ResultParser: TYPE_BYORBPOS = 0 TYPE_BYINDEX = 1 @@ -120,6 +121,7 @@ def getTextualResult(self): text += "\n-----------------------------------------------------\n" return text + class DiseqcTester(Screen, TuneTest, ResultParser): skin = """ @@ -500,6 +502,7 @@ def selectionChanged(self): if len(self.list) > 0 and not self.running: self["CmdText"].setText(_("Press OK to get further details for %s") % str(self["progress_list"].getCurrent()[1])) + class DiseqcTesterTestTypeSelection(Screen, ConfigListScreen): def __init__(self, session, feid): @@ -578,6 +581,7 @@ def createSummary(self): from Screens.Setup import SetupSummary return SetupSummary + class DiseqcTesterNimSelection(NimSelection): def __init__(self, session, args=None): @@ -599,6 +603,7 @@ def showNim(self, nim): return True return False + def DiseqcTesterMain(session, **kwargs): nimList = nimmanager.getNimListOfType("DVB-S") if len(nimList) == 0: @@ -609,12 +614,14 @@ def DiseqcTesterMain(session, **kwargs): else: session.open(DiseqcTesterNimSelection) + def DiseqcTesterStart(menuid, **kwargs): if menuid == "scan": return [(_("DiSEqC Tester"), DiseqcTesterMain, "diseqc_tester", None)] else: return [] + def Plugins(**kwargs): if (nimmanager.hasNimType("DVB-S")): return PluginDescriptor(name="DiSEqC Tester", description=_("Test DiSEqC settings"), where=PluginDescriptor.WHERE_MENU, fnc=DiseqcTesterStart) diff --git a/lib/python/Plugins/SystemPlugins/FastScan/plugin.py b/lib/python/Plugins/SystemPlugins/FastScan/plugin.py index 270cfc0ccc4..703ed53565a 100644 --- a/lib/python/Plugins/SystemPlugins/FastScan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/FastScan/plugin.py @@ -49,9 +49,11 @@ eDVBFrontendParametersSatellite.System_DVB_S, eDVBFrontendParametersSatellite.Modulation_QPSK, eDVBFrontendParametersSatellite.RollOff_alpha_0_35, eDVBFrontendParametersSatellite.Pilot_Off)) + def getProviderList(): return [x[0] for x in providers if nimmanager.getNimListForSat(transponders[x[1][0]][3])] + class FastScanStatus(Screen): skin = """ @@ -144,6 +146,7 @@ def cancel(self): self.restoreService() self.close() + class FastScanScreen(ConfigListScreen, Screen): skin = """ @@ -282,6 +285,7 @@ def startScan(self): def keyCancel(self): self.close() + class FastScanAutoScreen(FastScanScreen): def __init__(self, session, lastConfiguration): @@ -330,16 +334,19 @@ def createSummary(self): from Screens.Standby import StandbySummary return StandbySummary + def FastScanMain(session, **kwargs): if session.nav.RecordTimer.isRecording(): session.open(MessageBox, _("A recording is currently running. Please stop the recording before trying to scan."), MessageBox.TYPE_ERROR) else: session.open(FastScanScreen) + Session = None FastScanAutoStartTimer = eTimer() autoproviders = [] + def restartScanAutoStartTimer(reply=False): if not reply: print "[AutoFastScan] Scan was not succesfully retry in one hour" @@ -355,6 +362,7 @@ def restartScanAutoStartTimer(reply=False): return FastScanAutoStartTimer.startLongTimer(86400) + def FastScanAuto(): lastConfiguration = eval(config.misc.fastscan.last_configuration.value) if not lastConfiguration or Session.nav.RecordTimer.isRecording(): @@ -369,17 +377,21 @@ def FastScanAuto(): lastConfiguration = (lastConfiguration[0], provider, lastConfiguration[2], lastConfiguration[3], lastConfiguration[4], len(lastConfiguration) > 5 and lastConfiguration[5]) Session.openWithCallback(restartScanAutoStartTimer, FastScanAutoScreen, lastConfiguration) + FastScanAutoStartTimer.callback.append(FastScanAuto) + def leaveStandby(): FastScanAutoStartTimer.stop() + def standbyCountChanged(value): if config.misc.fastscan.auto.value != "false" and eval(config.misc.fastscan.last_configuration.value): from Screens.Standby import inStandby inStandby.onClose.append(leaveStandby) FastScanAutoStartTimer.startLongTimer(90) + def autostart(reason, **kwargs): global Session if reason == 0 and "session" in kwargs and not Session: @@ -389,12 +401,14 @@ def autostart(reason, **kwargs): Session = None config.misc.standbyCounter.removeNotifier(standbyCountChanged) + def FastScanStart(menuid, **kwargs): if menuid == "scan" and getProviderList(): return [(_("FastScan"), FastScanMain, "fastscan", None)] else: return [] + def Plugins(**kwargs): if (nimmanager.hasNimType("DVB-S")): return [PluginDescriptor(name=_("FastScan"), description="Scan M7 Brands, BE/NL/DE/AT/CZ", where=PluginDescriptor.WHERE_MENU, fnc=FastScanStart), diff --git a/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py b/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py index 41463510a43..13d28834ab5 100644 --- a/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py +++ b/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py @@ -4,6 +4,7 @@ from Components.Label import Label from Components.Sources.StaticText import StaticText + class HdmiCECSetupScreen(Screen, ConfigListScreen): def __init__(self, session): Screen.__init__(self, session) @@ -136,15 +137,18 @@ def set_path(self): inhibitDirs=inhibitDirs, minFree=1 ) + def main(session, **kwargs): session.open(HdmiCECSetupScreen) + def startSetup(menuid): # only show in the menu when set to intermediate or higher if menuid == "video" and config.av.videoport.value == "DVI" and config.usage.setup_level.index >= 1: return [(_("HDMI-CEC setup"), main, "hdmi_cec_setup", 0)] return [] + def Plugins(**kwargs): from os import path if path.exists("/dev/hdmi_cec") or path.exists("/dev/misc/hdmi_cec0"): diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py index d150898694b..822fcbfd686 100644 --- a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py @@ -7,6 +7,7 @@ hotplugNotifier = [] audiocd = False + def AudiocdAdded(): global audiocd if audiocd: @@ -14,6 +15,7 @@ def AudiocdAdded(): else: return False + def processHotplugData(self, v): print "[Hotplug.plugin.py]:", v action = v.get("ACTION") @@ -64,6 +66,7 @@ def processHotplugData(self, v): except AttributeError: hotplugNotifier.remove(callback) + class Hotplug(Protocol): def connectionMade(self): print "[Hotplug.plugin.py] connection!" @@ -83,6 +86,7 @@ def connectionLost(self, reason): v[var] = val processHotplugData(self, v) + def autostart(reason, **kwargs): if reason == 0: from twisted.internet import reactor @@ -94,5 +98,6 @@ def autostart(reason, **kwargs): factory.protocol = Hotplug reactor.listenUNIX("/tmp/hotplug.socket", factory) + def Plugins(**kwargs): return PluginDescriptor(name=_("Hotplug"), description=_("listens to hotplug events"), where=PluginDescriptor.WHERE_AUTOSTART, needsRestart=True, fnc=autostart) diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py index bb8bfd4fdac..9788563889e 100644 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py @@ -9,6 +9,7 @@ import enigma + class NetworkWizard(WizardLanguage, Rc): skin = """ @@ -30,6 +31,7 @@ class NetworkWizard(WizardLanguage, Rc): """ + def __init__(self, session, interface=None): self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml") WizardLanguage.__init__(self, session, showSteps=False, showStepSlider=False) @@ -338,7 +340,6 @@ def listAccessPoints(self): self.rescanTimer.start(4000) return self.APList - def AccessPointsSelectionMoved(self): self.ap = self.selection self.NextStep = 'wlanconfig' diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/plugin.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/plugin.py index 6bb6c9b9813..9e5eeaabf7a 100644 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/plugin.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/plugin.py @@ -4,19 +4,23 @@ config.misc.firstrun = ConfigBoolean(default=True) + def NetworkWizardMain(session, **kwargs): session.open(NetworkWizard) + def startSetup(menuid): if menuid != "system": return [] return [(_("Network wizard"), NetworkWizardMain, "nw_wizard", 40)] + def NetworkWizard(*args, **kwargs): from NetworkWizard import NetworkWizard return NetworkWizard(*args, **kwargs) + def Plugins(**kwargs): list = [] if config.misc.firstrun.value: diff --git a/lib/python/Plugins/SystemPlugins/OSD3DSetup/plugin.py b/lib/python/Plugins/SystemPlugins/OSD3DSetup/plugin.py index 722079e54fa..44b6428e123 100644 --- a/lib/python/Plugins/SystemPlugins/OSD3DSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/OSD3DSetup/plugin.py @@ -13,6 +13,7 @@ config.plugins.OSD3DSetup.mode = ConfigSelection(choices=modelist, default="auto") config.plugins.OSD3DSetup.znorm = ConfigInteger(default=0) + class OSD3DSetupScreen(Screen, ConfigListScreen): def __init__(self, session): Screen.__init__(self, session) @@ -69,9 +70,11 @@ def keyCancel(self): applySettings() self.close() + previous = None isDedicated3D = False + def applySettings(mode=config.plugins.OSD3DSetup.mode.value, znorm=int(config.plugins.OSD3DSetup.znorm.value)): global previous, isDedicated3D mode = isDedicated3D and mode == "auto" and "sidebyside" or mode @@ -84,6 +87,7 @@ def applySettings(mode=config.plugins.OSD3DSetup.mode.value, znorm=int(config.pl except: return + class auto3D(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -115,18 +119,22 @@ def __evStart(self): else: applySettings() + def main(session, **kwargs): session.open(OSD3DSetupScreen) + def startSetup(menuid): # show only in the menu when set at expert level if menuid == "video" and config.usage.setup_level.index == 2: return [(_("OSD 3D setup"), main, "auto_3d_setup", 0)] return [] + def autostart(reason, **kwargs): "session" in kwargs and kwargs["session"].open(auto3D) + def Plugins(**kwargs): if SystemInfo["3DMode"]: from Plugins.Plugin import PluginDescriptor diff --git a/lib/python/Plugins/SystemPlugins/OSDPositionSetup/overscanwizard.py b/lib/python/Plugins/SystemPlugins/OSDPositionSetup/overscanwizard.py index 6d455596887..73114a1a4a5 100644 --- a/lib/python/Plugins/SystemPlugins/OSDPositionSetup/overscanwizard.py +++ b/lib/python/Plugins/SystemPlugins/OSDPositionSetup/overscanwizard.py @@ -6,6 +6,7 @@ from enigma import quitMainloop, eTimer, getDesktop import os + class OverscanWizard(Screen, ConfigListScreen): def __init__(self, session, timeOut=True): if getDesktop(0).size().height() == 1080: diff --git a/lib/python/Plugins/SystemPlugins/OSDPositionSetup/plugin.py b/lib/python/Plugins/SystemPlugins/OSDPositionSetup/plugin.py index 298643e64f6..e7257871fb2 100644 --- a/lib/python/Plugins/SystemPlugins/OSDPositionSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/OSDPositionSetup/plugin.py @@ -7,6 +7,7 @@ config.plugins.OSDPositionSetup.dst_top = ConfigInteger(default=0) config.plugins.OSDPositionSetup.dst_height = ConfigInteger(default=576) + def setPosition(dst_left, dst_width, dst_top, dst_height): if dst_left + dst_width > 720: dst_width = 720 - dst_left @@ -20,19 +21,24 @@ def setPosition(dst_left, dst_width, dst_top, dst_height): except: return + def setConfiguredPosition(): setPosition(int(config.plugins.OSDPositionSetup.dst_left.value), int(config.plugins.OSDPositionSetup.dst_width.value), int(config.plugins.OSDPositionSetup.dst_top.value), int(config.plugins.OSDPositionSetup.dst_height.value)) + def main(session, **kwargs): from overscanwizard import OverscanWizard session.open(OverscanWizard, timeOut=False) + def startSetup(menuid): return menuid == "video" and [(_("Overscan wizard"), main, "sd_position_setup", 0)] or [] + def startup(reason, **kwargs): setConfiguredPosition() + def Plugins(**kwargs): from Plugins.Plugin import PluginDescriptor return [PluginDescriptor(name=_("Overscan wizard"), description="", where=PluginDescriptor.WHERE_SESSIONSTART, fnc=startup), diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/log.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/log.py index 7292c45266f..97734602e6b 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/log.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/log.py @@ -15,6 +15,7 @@ size = None + def open(buffersize=16384): global logfile, mutex, size if logfile is None: @@ -22,6 +23,7 @@ def open(buffersize=16384): mutex = threading.Lock() size = buffersize + def write(data): global logfile, mutex mutex.acquire() @@ -34,6 +36,7 @@ def write(data): mutex.release() sys.stdout.write(data) + def getvalue(): global logfile, mutex mutex.acquire() @@ -46,6 +49,7 @@ def getvalue(): mutex.release() return head + tail + def close(): global logfile if logfile: diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py index d0b03bb3f9e..ade8d5b6d81 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py @@ -30,6 +30,7 @@ import log import rotor_calc + class PositionerSetup(Screen): @staticmethod @@ -619,6 +620,7 @@ def greenKey(self): menu.append((_("Yes (save index in setup tuner)"), "save")) index = int(self.positioner_storage.value) text = _("Really store at index %2d for current position?") % index + def saveAction(choice): if choice: if choice[1] in ("yes", "save"): @@ -778,6 +780,7 @@ def furtherOptions(self): text = _("Select action") description = _("Open setup tuner ") + "%s" % chr(0x41 + self.feid) menu.append((description, self.openTunerSetup)) + def openAction(choice): if choice: choice[1]() @@ -890,7 +893,6 @@ def setLowRateAdapterCount(symbolrate): fec_text = str(fec_inner) self["fec_value"].setText(fec_text) - @staticmethod def rotorCmd2Step(rotorCmd, stepsize): return round(float(rotorCmd & 0xFFF) / 0x10 / stepsize) * (1 - ((rotorCmd & 0x1000) >> 11)) @@ -961,6 +963,7 @@ def sync(self): return True randomGenerator = None + def randomBool(self): if self.randomGenerator is None: self.randomGenerator = SystemRandom() @@ -1195,6 +1198,7 @@ def toGeoposEx(x): self.logMsg((_("Final position at index") + " %2d (%5.1f" + chr(176) + ")") % (x0, x0 * self.tuningstepsize), timeout=6) move(x0 - x) + class Diseqc: def __init__(self, frontend): self.frontend = frontend @@ -1235,6 +1239,7 @@ def command(self, what, param=0): sleep(0.050) self.frontend.sendDiseqc(cmd) # send 2nd time + class PositionerSetupLog(Screen): skin = """ @@ -1295,6 +1300,7 @@ def clear(self): log.logfile.truncate() self.close(False) + class TunerScreen(ConfigListScreen, Screen): skin = """ @@ -1551,6 +1557,7 @@ def keyGo(self): def keyCancel(self): self.close(None) + class RotorNimSelection(Screen): skin = """ @@ -1575,6 +1582,7 @@ def __init__(self, session, nimList): def okbuttonClick(self): self.session.openWithCallback(self.close, PositionerSetup, self["nimlist"].getCurrent()[1]) + def getUsableRotorNims(only_first=False): usableRotorNims = [] nimList = nimmanager.getNimListOfType("DVB-S") @@ -1585,6 +1593,7 @@ def getUsableRotorNims(only_first=False): break return usableRotorNims + def PositionerMain(session, **kwargs): usableRotorNims = getUsableRotorNims() if len(usableRotorNims) == 1: @@ -1592,11 +1601,13 @@ def PositionerMain(session, **kwargs): elif len(usableRotorNims) > 1: session.open(RotorNimSelection, usableRotorNims) + def PositionerSetupStart(menuid, **kwargs): if menuid == "scan" and getUsableRotorNims(True): return [(_("Positioner setup"), PositionerMain, "positioner_setup", None)] return [] + def Plugins(**kwargs): if nimmanager.hasNimType("DVB-S"): return PluginDescriptor(name=_("Positioner setup"), description=_("Setup your positioner"), where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=PositionerSetupStart) diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/rotor_calc.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/rotor_calc.py index 0854460ce70..419c637d7ec 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/rotor_calc.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/rotor_calc.py @@ -4,6 +4,7 @@ r_sat = 42164.57 # Distance from earth centre to satellite r_eq = 6378.14 # Earth radius + def calcElevation(SatLon, SiteLat, SiteLon, Height_over_ocean=0): a0 = 0.58804392 a1 = -0.17941557 @@ -45,6 +46,7 @@ def calcElevation(SatLon, SiteLat, SiteLon, Height_over_ocean=0): return El_observed + def calcAzimuth(SatLon, SiteLat, SiteLon, Height_over_ocean=0): def rev(number): @@ -71,6 +73,7 @@ def rev(number): Azimuth = 0 return Azimuth + def calcDeclination(SiteLat, Azimuth, Elevation): return math.degrees(math.asin(math.sin(math.radians(Elevation)) * math.sin(math.radians(SiteLat)) + @@ -79,6 +82,7 @@ def calcDeclination(SiteLat, Azimuth, Elevation): math.cos(math.radians(Azimuth)) )) + def calcSatHourangle(SatLon, SiteLat, SiteLon): Azimuth = calcAzimuth(SatLon, SiteLat, SiteLon) Elevation = calcElevation(SatLon, SiteLat, SiteLon) diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py index 295d34e75b6..349b3dad674 100644 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py @@ -8,6 +8,7 @@ from Components.NimManager import nimmanager as nimmgr from Components.Sources.StaticText import StaticText + class SecParameterSetup(Screen, ConfigListScreen): def __init__(self, session): Screen.__init__(self, session) @@ -61,12 +62,14 @@ def resetDefaults(self): secItem[1].value = secItem[1].default self.createSetup() # force new values to show + def SecSetupMain(session, **kwargs): def confirmed(answer): if answer is True: session.open(SecParameterSetup) session.openWithCallback(confirmed, MessageBox, _("Please do not change any values unless you know what you are doing!"), MessageBox.TYPE_INFO) + def SecSetupStart(menuid): # other menu than "scan"? if menuid != "scan": @@ -79,6 +82,7 @@ def SecSetupStart(menuid): return [] + def Plugins(**kwargs): if nimmgr.hasNimType("DVB-S"): return PluginDescriptor(name=_("Satellite equipment setup"), description=_("Setup your satellite equipment"), where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=SecSetupStart) diff --git a/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py b/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py index aa6b2dd8556..abde28cd94b 100644 --- a/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py @@ -14,6 +14,7 @@ from Tools.Transponder import getChannelNumber, channel2frequency from Tools.BoundFunction import boundFunction + class Satfinder(ScanSetup, ServiceScan): """Inherits StaticText [key_red] and [key_green] properties from ScanSetup""" @@ -566,10 +567,12 @@ def doCloseRecursive(self): del self.raw_channel self.close(True) + def SatfinderCallback(close, answer): if close and answer: close(True) + def SatfinderMain(session, close=None, **kwargs): nims = nimmanager.nim_slots nimList = [] @@ -587,12 +590,14 @@ def SatfinderMain(session, close=None, **kwargs): else: session.openWithCallback(boundFunction(SatfinderCallback, close), Satfinder) + def SatfinderStart(menuid, **kwargs): if menuid == "scan" and nimmanager.somethingConnected(): return [(_("Signal finder"), SatfinderMain, "satfinder", None)] else: return [] + def Plugins(**kwargs): if any([nimmanager.hasNimType(x) for x in "DVB-S", "DVB-T", "DVB-C", "ATSC"]): return PluginDescriptor(name=_("Signal finder"), description=_("Helps setting up your antenna"), where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=SatfinderStart) diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index 5dd8a24bbf8..958b14fd588 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -18,6 +18,7 @@ config.plugins.configurationbackup.backuplocation = ConfigText(default='/media/hdd/', visible_width=50, fixed_size=False) config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/wpa_supplicant.ath0.conf', '/etc/wpa_supplicant.wlan0.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) + def getBackupPath(): backuppath = config.plugins.configurationbackup.backuplocation.value if backuppath.endswith('/'): @@ -25,6 +26,7 @@ def getBackupPath(): else: return backuppath + '/backup' + def getBackupFilename(): return "enigma2settingsbackup.tar.gz" @@ -235,7 +237,6 @@ def layoutFinished(self): def setWindowTitle(self): self.setTitle(_("Restore backups")) - def fill_list(self): self.flist = [] self.path = getBackupPath() @@ -279,6 +280,7 @@ def startDelete(self, ret=False): self.exe = False self.fill_list() + class RestoreScreen(Screen, ConfigListScreen): skin = """ diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index aed30b66eeb..c4e915c0706 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -20,7 +20,6 @@ class SoftwareTools(PackageInfoHandler): available_packetlist = [] installed_packetlist = {} - def __init__(self): aboutInfo = about.getImageVersionString() if aboutInfo.startswith("dev-"): @@ -271,4 +270,5 @@ def verifyPrerequisites(self, prerequisites): return False return True + iSoftwareTools = SoftwareTools() diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 1d02bb1573b..66d3f5bd1ee 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -51,6 +51,7 @@ config.plugins.softwaremanager.onBlueButton = ConfigYesNo(default=False) config.plugins.softwaremanager.epgcache = ConfigYesNo(default=False) + def write_cache(cache_file, cache_data): try: path = os.path.dirname(cache_file) @@ -60,6 +61,7 @@ def write_cache(cache_file, cache_data): except Exception, ex: print "Failed to write cache data to %s:" % cache_file, ex + def valid_cache(cache_file, cache_ttl): #See if the cache file exists and is still living try: @@ -72,6 +74,7 @@ def valid_cache(cache_file, cache_ttl): else: return 1 + def load_cache(cache_file): return cPickle.load(open(cache_file)) @@ -323,6 +326,7 @@ def startRestore(self, ret=False): self.exe = True self.session.open(RestoreScreen, runRestore=True) + class SoftwareManagerSetup(Screen, ConfigListScreen): skin = """ @@ -634,7 +638,6 @@ def setState(self, status=None): self["list"].style = "default" self['list'].setList(self.statuslist) - def getUpdateInfos(self): if (iSoftwareTools.lastDownloadDate is not None and iSoftwareTools.NetworkConnectionAvailable is False): self.rebuildList() @@ -1150,6 +1153,7 @@ class PluginDetails(Screen, PackageInfoHandler): """ + def __init__(self, session, plugin_path, packagedata=None): Screen.__init__(self, session) self.skin_path = plugin_path @@ -1318,6 +1322,7 @@ def runUpgradeFinished(self): self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation has completed.") + "\n" + _("Do you want to reboot your receiver?"), MessageBox.TYPE_YESNO) else: self.close(True) + def UpgradeReboot(self, result): if result: self.session.open(TryQuitMainloop, retvalue=3) @@ -1337,6 +1342,7 @@ def fetchFailed(self, string): self.setThumbnail(noScreenshot=True) print "[PluginDetails] fetch failed " + string.getErrorMessage() + class OPKGMenu(Screen): skin = """ @@ -1890,6 +1896,7 @@ def filescan_open(list, session, **kwargs): filelist = [x.path for x in list] session.open(OpkgInstaller, filelist) # list + def filescan(**kwargs): from Components.Scanner import Scanner, ScanPath return \ @@ -1902,9 +1909,11 @@ def filescan(**kwargs): description=_("Install extensions"), openfnc=filescan_open, ) + def UpgradeMain(session, **kwargs): session.open(UpdatePluginMenu) + def startSetup(menuid): if menuid == "setup" and config.plugins.softwaremanager.onSetupMenu.value: return [(_("Software management"), UpgradeMain, "software_manager", 50)] diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 3c60be1e885..12f9fcce7b5 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -11,6 +11,7 @@ from Components.FanControl import fancontrol import skin + class TempFanControl(Screen, ConfigListScreen): skin = """ @@ -162,13 +163,16 @@ def revert(self): fancontrol.getConfig(count).pwm_standby.load() self.close() + def main(session, **kwargs): session.open(TempFanControl) + def startMenu(menuid): if menuid != "system": return [] return [(_("Temperature and fan control"), main, "tempfancontrol", 80)] + def Plugins(**kwargs): return PluginDescriptor(name=_("Temperature and fan control"), description=_("Temperature and fan control"), where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=startMenu) diff --git a/lib/python/Plugins/SystemPlugins/VideoClippingSetup/plugin.py b/lib/python/Plugins/SystemPlugins/VideoClippingSetup/plugin.py index dc956ac6db9..3709e5f897f 100644 --- a/lib/python/Plugins/SystemPlugins/VideoClippingSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/VideoClippingSetup/plugin.py @@ -8,6 +8,7 @@ config.plugins.VideoClippingSetup.clip_top = ConfigInteger(default=0) config.plugins.VideoClippingSetup.clip_height = ConfigInteger(default=576) + class VideoClippingCoordinates(Screen, ConfigListScreen): skin = """ @@ -92,6 +93,7 @@ def keyCancel(self): setConfiguredPosition() self.close() + def setPosition(clip_left, clip_width, clip_top, clip_height): if clip_left + clip_width > 720: clip_width = 720 - clip_left @@ -113,15 +115,19 @@ def setPosition(clip_left, clip_width, clip_top, clip_height): except: return + def setConfiguredPosition(): setPosition(int(config.plugins.VideoClippingSetup.clip_left.value), int(config.plugins.VideoClippingSetup.clip_width.value), int(config.plugins.VideoClippingSetup.clip_top.value), int(config.plugins.VideoClippingSetup.clip_height.value)) + def main(session, **kwargs): session.open(VideoClippingCoordinates) + def startup(reason, **kwargs): setConfiguredPosition() + def Plugins(**kwargs): from os import path if path.exists("/proc/stb/vmpeg/0/clip_left"): diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py b/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py index fcc9dabd214..0c21e243acf 100644 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py @@ -3,6 +3,7 @@ # The "VideoEnhancement" is the interface to /proc/stb/vmpeg/0. + class VideoEnhancement: firstRun = True @@ -303,4 +304,5 @@ def setConfiguredValues(self): except IOError: print "[VideoEnhancement] couldn't apply pep values." + VideoEnhancement() diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py index 111c708091a..3bed438ed32 100644 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py @@ -9,6 +9,7 @@ import os import skin + class VideoEnhancementSetup(Screen, ConfigListScreen): skin = """ @@ -382,14 +383,17 @@ def createSummary(self): from Screens.Setup import SetupSummary return SetupSummary + def videoEnhancementSetupMain(session, **kwargs): session.open(VideoEnhancementSetup) + def startSetup(menuid): if menuid == "video" and config.usage.setup_level.index == 2: return [(_("Video enhancement settings"), videoEnhancementSetupMain, "videoenhancement_setup", 41)] return [] + def Plugins(**kwargs): list = [] if config.usage.setup_level.index >= 2 and os.path.exists("/proc/stb/vmpeg/0/pep_apply"): diff --git a/lib/python/Plugins/SystemPlugins/VideoTune/VideoFinetune.py b/lib/python/Plugins/SystemPlugins/VideoTune/VideoFinetune.py index b1baa95d888..28710dfd152 100644 --- a/lib/python/Plugins/SystemPlugins/VideoTune/VideoFinetune.py +++ b/lib/python/Plugins/SystemPlugins/VideoTune/VideoFinetune.py @@ -7,9 +7,11 @@ from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS from enigma import gFont, getDesktop, gMainDC, eSize, RT_HALIGN_RIGHT, RT_WRAP + def RGB(r, g, b): return (r << 16) | (g << 8) | b + class OverscanTestScreen(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -41,6 +43,7 @@ def cancel(self): def keyNumber(self, key): self.close(key) + class FullHDTestScreen(OverscanTestScreen): skin = """ @@ -75,6 +78,7 @@ def __close(self): gMainDC.getInstance().setResolution(self.xres, self.yres) getDesktop(0).resize(eSize(self.xres, self.yres)) + class FullUHDTestScreen(OverscanTestScreen): skin = """""" @@ -104,6 +108,7 @@ def __init__(self, session): def __close(self): self.session.nav.playService(self.oldref) + class VideoFinetune(Screen): skin = """ @@ -406,6 +411,7 @@ def testpicCallback(self, key): else: self.close() + class PixelsTestScreen(Screen): skin = """ diff --git a/lib/python/Plugins/SystemPlugins/VideoTune/plugin.py b/lib/python/Plugins/SystemPlugins/VideoTune/plugin.py index 01158b36861..e5533b3a9f1 100644 --- a/lib/python/Plugins/SystemPlugins/VideoTune/plugin.py +++ b/lib/python/Plugins/SystemPlugins/VideoTune/plugin.py @@ -1,15 +1,18 @@ from Plugins.Plugin import PluginDescriptor from Components.config import config + def videoFinetuneMain(session, **kwargs): from VideoFinetune import VideoFinetune session.open(VideoFinetune) + def startSetup(menuid): # show only in the menu when set at expert level if menuid == "video" and config.usage.setup_level.index == 2: return [(_("Testscreens"), videoFinetuneMain, "video_finetune", None)] return [] + def Plugins(**kwargs): return PluginDescriptor(name=_("Testscreens"), description=_("Testscreens that are helpfull to fine-tune your display"), where=PluginDescriptor.WHERE_MENU, needsRestart=False, fnc=startSetup) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 26d57f5fe7c..fa41ff81e33 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -11,6 +11,7 @@ config.av.edid_override = ConfigYesNo(default=True) + class VideoHardware: rates = {} # high-level, use selectable modes. @@ -383,5 +384,6 @@ def updateAspect(self, cfgelement): except IOError: pass + video_hw = VideoHardware() video_hw.setConfiguredMode() diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 8585da8a12f..e7077f67fd1 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -12,6 +12,7 @@ config.misc.showtestcard = ConfigBoolean(default=False) + class VideoWizardSummary(WizardSummary): def __init__(self, session, parent): WizardSummary.__init__(self, session, parent) @@ -22,6 +23,7 @@ def setLCDPicCallback(self): def setLCDPic(self, file): self["pic"].instance.setPixmapFromFile(file) + class VideoWizard(WizardLanguage, Rc): skin = """ @@ -60,7 +62,6 @@ def __init__(self, session): self.mode = None self.rate = None - def createSummary(self): print "[VideoWizard] createSummary" from Screens.Wizard import WizardSummary diff --git a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py index 858e9a0aa46..90af8737563 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py @@ -10,6 +10,7 @@ config.misc.videowizardenabled = ConfigBoolean(default=True) + class VideoSetup(Screen, ConfigListScreen): def __init__(self, session, hw): @@ -203,6 +204,7 @@ def createSummary(self): from Screens.Setup import SetupSummary return SetupSummary + class VideomodeHotplug: def __init__(self, hw): self.hw = hw @@ -230,13 +232,16 @@ def hotplug(self, what): print "setting %s/%s/%s" % (port, mode, rate) self.hw.setMode(port, mode, rate) + hotplug = None + def startHotplug(): global hotplug, video_hw hotplug = VideomodeHotplug(video_hw) hotplug.start() + def stopHotplug(): global hotplug hotplug.stop() @@ -253,19 +258,23 @@ def autostart(reason, session=None, **kwargs): elif reason == 1: stopHotplug() + def videoSetupMain(session, **kwargs): session.open(VideoSetup, video_hw) + def startSetup(menuid): if menuid != "video": return [] return [(_("A/V settings"), videoSetupMain, "av_setup", 40)] + def VideoWizard(*args, **kwargs): from VideoWizard import VideoWizard return VideoWizard(*args, **kwargs) + def Plugins(**kwargs): list = [ # PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART, PluginDescriptor.WHERE_AUTOSTART], fnc = autostart), diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py index 3e3b0e7851c..47e3c285374 100644 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py @@ -27,15 +27,19 @@ config.plugins.wlan.wepkeytype = NoSave(ConfigSelection(weplist, default="ASCII")) config.plugins.wlan.psk = NoSave(ConfigPassword(default="", fixed_size=False)) + def existBcmWifi(iface): return os.path.exists("/tmp/bcm/" + iface) + def getWlConfName(iface): return "/etc/wl.conf.%s" % iface + def getWlanConfigName(iface): return '/etc/wpa_supplicant.' + iface + '.conf' + class Wlan: def __init__(self, iface=None): self.iface = iface @@ -145,8 +149,10 @@ def stopGetNetworkList(self): self.oldInterfaceState = None self.iface = None + iWlan = Wlan() + class wpaSupplicant: def __init__(self): pass @@ -342,6 +348,7 @@ def loadConfig(self, iface): #print "[Wlan.py] WS-CONFIG-->",wsconfig return wsconfig + class Status: def __init__(self): self.wlaniface = {} @@ -449,4 +456,5 @@ def getAdapterAttribute(self, iface, attribute): return self.wlaniface[self.iface][attribute] return None + iStatus = Status() diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index c9555609dc5..43f44bb0e8d 100644 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -371,6 +371,7 @@ def getWlanList(self): def WlanStatusScreenMain(session, iface): session.open(WlanStatus, iface) + def callFunction(iface): iWlan.setInterface(iface) i = iWlan.getWirelessInterfaces() @@ -378,6 +379,7 @@ def callFunction(iface): return WlanStatusScreenMain return None + def configStrings(iface): driver = iNetwork.detectWlanModule(iface) ret = "" @@ -394,5 +396,6 @@ def configStrings(iface): ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n" return ret + def Plugins(**kwargs): return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a wireless network"), where=PluginDescriptor.WHERE_NETWORKSETUP, needsRestart=False, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: _("Wireless network configuration...")}) diff --git a/lib/python/RecordTimer.py b/lib/python/RecordTimer.py index 2e580b1c2b1..a4f96bdc50c 100644 --- a/lib/python/RecordTimer.py +++ b/lib/python/RecordTimer.py @@ -50,12 +50,14 @@ def parseEvent(ev, description=True): end += config.recording.margin_after.value * 60 return (begin, end, name, description, eit) + class AFTEREVENT: NONE = 0 STANDBY = 1 DEEPSTANDBY = 2 AUTO = 3 + def findSafeRecordPath(dirname): if not dirname: return None @@ -73,12 +75,14 @@ def findSafeRecordPath(dirname): return None return dirname + def checkForRecordings(): if NavigationInstance.instance.getRecordings(): return True rec_time = NavigationInstance.instance.RecordTimer.getNextTimerTime(isWakeup=True) return rec_time > 0 and (rec_time - time()) < 360 + def createRecordTimerEntry(timer): return RecordTimerEntry(timer.service_ref, timer.begin, timer.end, timer.name, timer.description, timer.eit, timer.disabled, timer.justplay, timer.afterEvent, dirname=timer.dirname, @@ -638,6 +642,7 @@ def openChoiceActionBeforeZap(self): #if self.justplay or self.always_zap: # choice.insert(2, (_("Don't zap"), "continue")) choice.insert(2, (_("Don't zap"), "continue")) + def zapAction(choice): start_zap = True if choice: @@ -767,6 +772,7 @@ def setRecordService(self, service): record_service = property(lambda self: self.__record_service, setRecordService) + def createTimer(xml): begin = int(xml.get("begin")) end = int(xml.get("end")) @@ -821,6 +827,7 @@ def createTimer(xml): return entry + class RecordTimer(timer.Timer): def __init__(self): timer.Timer.__init__(self) @@ -922,7 +929,6 @@ def loadTimer(self): from Screens.MessageBox import MessageBox AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!") + timer_text, type=MessageBox.TYPE_ERROR, timeout=0, id="TimerLoadFailed") - def saveTimer(self): #root_element = xml.etree.cElementTree.Element('timers') #root_element.text = "\n" diff --git a/lib/python/Screens/About.py b/lib/python/Screens/About.py index c1ba7b1050e..982a57b9840 100644 --- a/lib/python/Screens/About.py +++ b/lib/python/Screens/About.py @@ -19,6 +19,7 @@ import skin import os + class About(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -140,6 +141,7 @@ def showMemoryInfo(self): def showTroubleshoot(self): self.session.open(Troubleshoot) + class TranslationInfo(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -177,6 +179,7 @@ def __init__(self, session): "ok": self.close, }) + class CommitInfo(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -261,6 +264,7 @@ def right(self): self.project = self.project != len(self.projects) - 1 and self.project + 1 or 0 self.updateCommitLogs() + class MemoryInfo(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -335,6 +339,7 @@ def clearMemory(self): open("/proc/sys/vm/drop_caches", "w").write("3") self.getMemoryInfo() + class MemoryInfoSkinParams(GUIComponent): def __init__(self): GUIComponent.__init__(self) @@ -351,6 +356,7 @@ def applySkin(self, desktop, screen): GUI_WIDGET = eLabel + class Troubleshoot(Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index 8b73c152697..d6d7caf0450 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -18,6 +18,7 @@ FOCUS_CONFIG, FOCUS_STREAMS = range(2) [PAGE_AUDIO, PAGE_SUBTITLES] = ["audio", "subtitles"] + class AudioSelection(Screen, ConfigListScreen): def __init__(self, session, infobar=None, page=PAGE_AUDIO): Screen.__init__(self, session) @@ -152,6 +153,7 @@ class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args + def __call__(self, *args, **kwargs): self.fnc(*self.args) @@ -386,11 +388,13 @@ def protectResult(self, answer): def cancel(self): self.close(0) + class SubtitleSelection(AudioSelection): def __init__(self, session, infobar=None): AudioSelection.__init__(self, session, infobar, page=PAGE_SUBTITLES) self.skinName = ["AudioSelection"] + class QuickSubtitlesConfigMenu(ConfigListScreen, Screen): skin = """ diff --git a/lib/python/Screens/AutoDiseqc.py b/lib/python/Screens/AutoDiseqc.py index db1587d97fc..5df959c9791 100644 --- a/lib/python/Screens/AutoDiseqc.py +++ b/lib/python/Screens/AutoDiseqc.py @@ -288,7 +288,6 @@ def __init__(self, session, feid, nr_of_ports, simple_tone, simple_sat_change): elif sat_found: self.sat_frequencies.remove(x) - if not self.openFrontend(): self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup() self.session.nav.stopService() diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 5944cf8d56f..8218d68012b 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -52,6 +52,7 @@ FLAG_IS_DEDICATED_3D = 128 FLAG_CENTER_DVB_SUBS = 2048 #define in lib/dvb/idvb.h as dxNewFound = 64 and dxIsDedicated3D = 128 + class BouquetSelector(Screen): def __init__(self, session, bouquets, selectedFunc, enableWrapAround=True): Screen.__init__(self, session) @@ -83,6 +84,7 @@ def down(self): def cancelClick(self): self.close(False) + class SilentBouquetSelector: def __init__(self, bouquets, enableWrapAround=False, current=0): self.bouquets = [b[1] for b in bouquets] @@ -101,21 +103,25 @@ def down(self): def getCurrent(self): return self.bouquets[self.pos] + # csel.bouquet_mark_edit values OFF = 0 EDIT_BOUQUET = 1 EDIT_ALTERNATIVES = 2 + def append_when_current_valid(current, menu, args, level=0, key="dummy"): if current and current.valid() and level <= config.usage.setup_level.index: menu.append(ChoiceEntryComponent(key, args)) + def removed_userbouquets_available(): for file in os.listdir("/etc/enigma2/"): if file.startswith("userbouquet") and file.endswith(".del"): return True return False + class ChannelContextMenu(Screen): def __init__(self, session, csel): @@ -655,6 +661,7 @@ def runPlugin(self, plugin): plugin(session=self.session, service=self.csel.getCurrentSelection()) self.close() + class SelectionEventInfo: def __init__(self): self["Service"] = self["ServiceEvent"] = ServiceEvent() @@ -699,6 +706,7 @@ def updateEventInfo(self): except: pass + class ChannelSelectionEPG(InfoBarHotkey): def __init__(self): self.hotkeys = [("Info (EPG)", "info", "Infobar/openEventView"), @@ -877,6 +885,7 @@ def zapToService(self, service, preview=False, zapback=False): self.startRoot = None self.revertMode = None + class ChannelSelectionEdit: def __init__(self): self.entry_marked = False @@ -1291,6 +1300,7 @@ def exitContext(self, close=False): if close: self.cancel() + MODE_TV = 0 MODE_RADIO = 1 @@ -1308,6 +1318,7 @@ def exitContext(self, close=False): service_types_tv = '1:7:1:0:0:0:0:0:0:0:(type == 1) || (type == 17) || (type == 22) || (type == 25) || (type == 31) || (type == 134) || (type == 195)' service_types_radio = '1:7:2:0:0:0:0:0:0:0:(type == 2) || (type == 10)' + class ChannelSelectionBase(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -1875,6 +1886,7 @@ def gotoCurrentServiceOrProvider(self, ref): if playingref: self.setCurrentSelectionAlternative(playingref) + HISTORYSIZE = 20 #config for lastservice @@ -1891,6 +1903,7 @@ def gotoCurrentServiceOrProvider(self, ref): config.servicelist.startuproot = ConfigText() config.servicelist.startupmode = ConfigText(default="tv") + class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG, SelectionEventInfo): def __init__(self, session): ChannelSelectionBase.__init__(self, session) @@ -2407,11 +2420,13 @@ def correctChannelNumber(self): self.setCurrentSelection(tmp_ref) self.revertMode = None + class RadioInfoBar(Screen): def __init__(self, session): Screen.__init__(self, session) self["RdsDecoder"] = RdsDecoder(self.session.nav) + class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG, InfoBarBase, SelectionEventInfo, InfoBarScreenSaver): ALLOW_SUSPEND = True @@ -2571,6 +2586,7 @@ def zapBack(self): def audioSelection(self): Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.instance.audioSelection() + class SimpleChannelSelection(ChannelSelectionBase, SelectionEventInfo): def __init__(self, session, title, currentBouquet=False, returnBouquet=False, setService=None, setBouquet=None): ChannelSelectionBase.__init__(self, session) diff --git a/lib/python/Screens/ChoiceBox.py b/lib/python/Screens/ChoiceBox.py index 60fb8b45bfb..87f6b3e763d 100644 --- a/lib/python/Screens/ChoiceBox.py +++ b/lib/python/Screens/ChoiceBox.py @@ -11,6 +11,7 @@ config.misc.pluginlist.eventinfo_order = ConfigText(default="") config.misc.pluginlist.extension_order = ConfigText(default="") + class ChoiceBox(Screen): def __init__(self, session, title="", list=[], keys=None, selection=0, skin_name=[], reorderConfig="", windowTitle=None): Screen.__init__(self, session) @@ -98,6 +99,7 @@ def __init__(self, session, title="", list=[], keys=None, selection=0, skin_name def autoResize(self): def x_offset(): return max([line[1][1] for line in self["list"].list]) + def x_width(textsize): def getListLineTextWidth(text): self["autoresize"].setText(text) diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index 6afd118f4fd..8a40fe0d2a3 100644 --- a/lib/python/Screens/Ci.py +++ b/lib/python/Screens/Ci.py @@ -13,16 +13,20 @@ forceNotShowCiMessages = False + def setCIBitrate(configElement): eDVBCI_UI.getInstance().setClockRate(configElement.slotid, eDVBCI_UI.rateNormal if configElement.value == "no" else eDVBCI_UI.rateHigh) + def setdvbCiDelay(configElement): open(SystemInfo["CommonInterfaceCIDelay"], "w").write(configElement.value) configElement.save() + def setRelevantPidsRouting(configElement): open(SystemInfo["CI%dRelevantPidsRoutingSupport" % configElement.slotid], "w").write("yes" if configElement.value else "no") + def InitCiConfig(): config.ci = ConfigSubList() config.cimisc = ConfigSubsection() @@ -45,6 +49,7 @@ def InitCiConfig(): config.cimisc.dvbCiDelay = ConfigSelection(default="256", choices=[("16"), ("32"), ("64"), ("128"), ("256")]) config.cimisc.dvbCiDelay.addNotifier(setdvbCiDelay) + class MMIDialog(Screen): def __init__(self, session, slotid, action, handler=eDVBCI_UI.getInstance(), wait_text="", screen_data=None): Screen.__init__(self, session) @@ -298,6 +303,7 @@ def ciStateChanged(self): #FIXME: check for mmi-session closed + class CiMessageHandler: def __init__(self): self.session = None @@ -355,8 +361,10 @@ def unregisterCIMessageHandler(self, slot): if slot in self.ci: del self.ci[slot] + CiHandler = CiMessageHandler() + class CiSelection(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -502,6 +510,7 @@ def cancel(self): CiHandler.unregisterCIMessageHandler(slot) self.close() + class PermanentPinEntry(Screen, ConfigListScreen): def __init__(self, session, pin, pin_slot): Screen.__init__(self, session) diff --git a/lib/python/Screens/ClockDisplay.py b/lib/python/Screens/ClockDisplay.py index 2e34f00cea6..716f3aec9de 100644 --- a/lib/python/Screens/ClockDisplay.py +++ b/lib/python/Screens/ClockDisplay.py @@ -1,6 +1,8 @@ from Screen import Screen # a clock display dialog + + class ClockDisplay(Screen): def okbutton(self): self.session.close() diff --git a/lib/python/Screens/ConfigMenu.py b/lib/python/Screens/ConfigMenu.py index a81e277fa02..6ac8e03cdc3 100644 --- a/lib/python/Screens/ConfigMenu.py +++ b/lib/python/Screens/ConfigMenu.py @@ -3,6 +3,7 @@ from Components.config import config from Components.ActionMap import ActionMap + class ConfigMenu(Screen): #create a generic class for view/edit settings #all stuff come from xml file @@ -17,12 +18,12 @@ def __init__(self, session): "cancel": self.close }) + class configTest(Screen): def __init__(self, session): Screen.__init__(self, session) - self["config"] = ConfigList( [ configEntry("HKEY_LOCAL_ENIGMA/IMPORTANT/USER_ANNOYING_STUFF/SDTV/FLASHES/GREEN"), diff --git a/lib/python/Screens/Console.py b/lib/python/Screens/Console.py index a72bc6c4186..4b7db56fcfb 100644 --- a/lib/python/Screens/Console.py +++ b/lib/python/Screens/Console.py @@ -5,6 +5,7 @@ from Components.Sources.StaticText import StaticText from Screens.MessageBox import MessageBox + class Console(Screen): #TODO move this to skin.xml skin = """ @@ -92,7 +93,6 @@ def toggleHideShow(self): else: self.show() - def cancel(self): if self.finished: self.closeConsole() diff --git a/lib/python/Screens/CopyFiles.py b/lib/python/Screens/CopyFiles.py index 485126897bb..a88bd251579 100644 --- a/lib/python/Screens/CopyFiles.py +++ b/lib/python/Screens/CopyFiles.py @@ -2,29 +2,38 @@ import Components.Task from twisted.internet import task + class GiveupOnSendfile(Exception): pass + def nosendfile(*args): raise GiveupOnSendfile("sendfile() not available") + try: from sendfile import sendfile except: sendfile = nosendfile + class FailedPostcondition(Components.Task.Condition): def __init__(self, exception): self.exception = exception + def getErrorMessage(self, task): return str(self.exception) + def check(self, task): return self.exception is None # Same as Python 3.3 open(filename, "x"), we must be the creator + + def openex(filename, flags=os.O_CREAT | os.O_EXCL | os.O_WRONLY): return os.fdopen(os.open(filename, flags), 'wb', 0) + class CopyFileTask(Components.Task.PythonTask): def openFiles(self, fileList): self.callback = None @@ -39,6 +48,7 @@ def openFiles(self, fileList): if not self.end: self.end = 1 print "[CopyFileTask] size:", self.end + def work(self): print "[CopyFileTask] handles ", len(self.handles) try: @@ -93,6 +103,7 @@ def work(self): pass raise + class MoveFileTask(CopyFileTask): def work(self): CopyFileTask.work(self) @@ -106,6 +117,7 @@ def work(self): if errors: raise errors[0] + def copyFiles(fileList, name): name = _("Copy") + " " + name job = Components.Task.Job(name) @@ -113,6 +125,7 @@ def copyFiles(fileList, name): task.openFiles(fileList) Components.Task.job_manager.AddJob(job) + def moveFiles(fileList, name): name = _("Move") + " " + name job = Components.Task.Job(name) diff --git a/lib/python/Screens/DVD.py b/lib/python/Screens/DVD.py index 99b087910ae..814a0919a83 100644 --- a/lib/python/Screens/DVD.py +++ b/lib/python/Screens/DVD.py @@ -15,6 +15,7 @@ lastpath = "" + class DVDSummary(Screen): def __init__(self, session, parent): Screen.__init__(self, session, parent) @@ -32,6 +33,7 @@ def updateFullChapters(self, chapters): def setTitle(self, title): self["Title"].setText(title) + class DVDOverlay(Screen): def __init__(self, session, args=None, height=None): desktop_size = getDesktop(0).size() @@ -42,6 +44,7 @@ def __init__(self, session, args=None, height=None): DVDOverlay.skin = """""" % (w, h) Screen.__init__(self, session) + class ChapterZap(Screen): skin = """ @@ -92,6 +95,7 @@ def __init__(self, session): self.Timer.callback.append(self.keyOK) self.Timer.start(3000, True) + class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarPVRState, InfoBarShowHide, HelpableScreen, InfoBarCueSheetSupport, InfoBarAudioSelection, InfoBarSubtitleSupport): ALLOW_SUSPEND = Screen.SUSPEND_PAUSES ENABLE_RESUME_SUPPORT = True diff --git a/lib/python/Screens/Dish.py b/lib/python/Screens/Dish.py index 5f4e0949618..153ae1346f6 100644 --- a/lib/python/Screens/Dish.py +++ b/lib/python/Screens/Dish.py @@ -12,6 +12,7 @@ INVALID_POSITION = 9999 config.misc.lastrotorposition = ConfigInteger(INVALID_POSITION) + class Dish(Screen): STATE_HIDDEN = 0 STATE_SHOWN = 1 @@ -253,6 +254,7 @@ def FormatTurnTime(self, time): t = abs(time) return "%s%02d:%02d" % (time < 0 and "- " or "", t / 60 % 60, t % 60) + class Dishpip(Dish, Screen): STATE_HIDDEN = 0 STATE_SHOWN = 1 @@ -272,6 +274,7 @@ class Dishpip(Dish, Screen): SNR """ + def __init__(self, session): self.skin = Dishpip.skin Screen.__init__(self, session) diff --git a/lib/python/Screens/EpgSelection.py b/lib/python/Screens/EpgSelection.py index 76335341091..751ba49e482 100644 --- a/lib/python/Screens/EpgSelection.py +++ b/lib/python/Screens/EpgSelection.py @@ -26,6 +26,7 @@ mepg_config_initialized = False + class EPGSelection(Screen): EMPTY = 0 ADD_TIMER = 1 @@ -384,6 +385,7 @@ def timerAdd(self): menu.append((_("Options disable timer"), "disablerepeatrunning")) buttons.append("yellow") menu.append((_("Timer Overview"), "timereditlist")) + def timerAction(choice): if choice is not None: if choice[1] == "delete": @@ -412,6 +414,7 @@ def finishedEdit(self, answer): def removeEditTimer(): entry.service_ref, entry.begin, entry.end, entry.external = entry.service_ref_prev, entry.begin_prev, entry.end_prev, entry.external_prev self.removeTimer(entry) + def moveEditTimerError(): entry.external = entry.external_prev self.onSelectionChanged() diff --git a/lib/python/Screens/EventView.py b/lib/python/Screens/EventView.py index b25c2f15fa1..709aaf3c0d9 100644 --- a/lib/python/Screens/EventView.py +++ b/lib/python/Screens/EventView.py @@ -19,6 +19,7 @@ from time import localtime from Components.config import config + class EventViewBase: ADD_TIMER = 0 REMOVE_TIMER = 1 @@ -113,6 +114,7 @@ def timerAdd(self): title_text = timer.repeated and _("Attention, this is repeated timer!\n") or "" menu = [(_("Delete timer"), "delete"), (_("Edit timer"), "edit")] buttons = ["red", "green"] + def timerAction(choice): if choice is not None: if choice[1] == "delete": @@ -133,6 +135,7 @@ def finishedEdit(self, answer): def removeEditTimer(): entry.service_ref, entry.begin, entry.end, entry.external = entry.service_ref_prev, entry.begin_prev, entry.end_prev, entry.external_prev self.removeTimer(entry) + def moveEditTimerError(): entry.external = entry.external_prev self.onSelectionChanged() @@ -331,12 +334,14 @@ def boxAction(choice): def runPlugin(self, plugin): plugin(session=self.session, service=self.currentService, event=self.event, eventName=self.event.getEventName()) + class EventViewSimple(Screen, EventViewBase): def __init__(self, session, Event, Ref, callback=None, similarEPGCB=None, parent=None): Screen.__init__(self, session) self.skinName = "EventView" EventViewBase.__init__(self, Event, Ref, callback, similarEPGCB, parent) + class EventViewEPGSelect(Screen, EventViewBase): def __init__(self, session, Event, Ref, callback=None, singleEPGCB=None, multiEPGCB=None, similarEPGCB=None, parent=None): Screen.__init__(self, session) diff --git a/lib/python/Screens/FactoryReset.py b/lib/python/Screens/FactoryReset.py index 5cb0a79b6c7..9a80e7e205a 100644 --- a/lib/python/Screens/FactoryReset.py +++ b/lib/python/Screens/FactoryReset.py @@ -3,6 +3,7 @@ from Screens.Standby import TryQuitMainloop, QUIT_MANUFACTURER_RESET from Components.config import config + class FactoryReset(MessageBox, ProtectedScreen): def __init__(self, session): MessageBox.__init__(self, session, _("Factory reset will restore your receiver to its default configuration. " diff --git a/lib/python/Screens/FixedMenu.py b/lib/python/Screens/FixedMenu.py index 97c2af05818..36f3db4282a 100644 --- a/lib/python/Screens/FixedMenu.py +++ b/lib/python/Screens/FixedMenu.py @@ -3,6 +3,7 @@ from Components.ActionMap import ActionMap from Components.Sources.StaticText import StaticText + class FixedMenu(Screen): def okbuttonClick(self): selection = self["menu"].getCurrent() diff --git a/lib/python/Screens/FlashImage.py b/lib/python/Screens/FlashImage.py index 56cb6893904..deb600e0529 100644 --- a/lib/python/Screens/FlashImage.py +++ b/lib/python/Screens/FlashImage.py @@ -25,9 +25,11 @@ from enigma import eEPGCache + def checkimagefiles(files): return len([x for x in files if 'kernel' in x and '.bin' in x or x in ('uImage', 'rootfs.bin', 'root_cfe_auto.bin', 'root_cfe_auto.jffs2', 'oe_rootfs.bin', 'e2jffs2.img', 'rootfs.tar.bz2', 'rootfs.ubi')]) == 2 + class SelectImage(Screen): def __init__(self, session, *args): Screen.__init__(self, session) @@ -181,6 +183,7 @@ def keyDown(self): self["list"].instance.moveSelection(self["list"].instance.moveDown) self.selectionChanged() + class FlashImage(Screen): skin = """ @@ -362,6 +365,7 @@ def doUnzip(self): def flashimage(self): self["header"].setText(_("Flashing Image")) + def findimagefiles(path): for path, subdirs, files in os.walk(path): if not subdirs and files: @@ -400,6 +404,7 @@ def ok(self): else: return 0 + class MultibootSelection(SelectImage): def __init__(self, session, *args): Screen.__init__(self, session) diff --git a/lib/python/Screens/Globals.py b/lib/python/Screens/Globals.py index 9ae10026662..31668f949a5 100644 --- a/lib/python/Screens/Globals.py +++ b/lib/python/Screens/Globals.py @@ -1,6 +1,7 @@ from Screens.Screen import Screen from Components.Sources.Clock import Clock + class Globals(Screen): def __init__(self): Screen.__init__(self, None) diff --git a/lib/python/Screens/HarddiskSetup.py b/lib/python/Screens/HarddiskSetup.py index 57fdfe23557..08512ffa1e4 100644 --- a/lib/python/Screens/HarddiskSetup.py +++ b/lib/python/Screens/HarddiskSetup.py @@ -6,6 +6,7 @@ from Components.Pixmap import Pixmap from Screens.MessageBox import MessageBox + class HarddiskSetup(Screen): def __init__(self, session, hdd, action, text, question): Screen.__init__(self, session) @@ -45,6 +46,7 @@ def hddConfirmed(self, confirmed): self.session.open(MessageBox, str(ex), type=MessageBox.TYPE_ERROR, timeout=10) self.close() + class HarddiskSelection(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -81,6 +83,8 @@ def okbuttonClick(self): self.doIt(selection[1]) # This is actually just HarddiskSelection but with correct type + + class HarddiskFsckSelection(HarddiskSelection): def doIt(self, selection): self.session.openWithCallback(self.close, HarddiskSetup, selection, diff --git a/lib/python/Screens/HelpMenu.py b/lib/python/Screens/HelpMenu.py index 7d454ba019f..05b4edc6213 100644 --- a/lib/python/Screens/HelpMenu.py +++ b/lib/python/Screens/HelpMenu.py @@ -4,6 +4,7 @@ from Components.HelpMenuList import HelpMenuList from Screens.Rc import Rc + class HelpMenu(Screen, Rc): def __init__(self, session, list): Screen.__init__(self, session) @@ -45,6 +46,7 @@ def SelectionChanged(self): # arrow.startMoving() # arrow.show() + class HelpableScreen: def __init__(self): self["helpActions"] = ActionMap(["HelpActions"], diff --git a/lib/python/Screens/Hotkey.py b/lib/python/Screens/Hotkey.py index 7133dcf38c1..2ef6894e6ee 100644 --- a/lib/python/Screens/Hotkey.py +++ b/lib/python/Screens/Hotkey.py @@ -16,6 +16,7 @@ from Components.Label import Label import os + class hotkey: functions = None hotkeys = [(_("Red") + " " + _("long"), "red_long", ""), @@ -115,6 +116,7 @@ class hotkey: ("WWW Portal", "www", ""), ("WWW Portal" + " " + _("long"), "www_long", "")] + def getHotkeyFunctions(): hotkey.functions = [] twinPlugins = [] @@ -241,13 +243,16 @@ def getHotkeyFunctions(): x = x[:-3] hotkey.functions.append((_("Shellscript") + " " + x, "Shellscript/" + x, "Shellscripts")) + config.misc.hotkey = ConfigSubsection() config.misc.hotkey.additional_keys = ConfigYesNo(default=False) for x in hotkey.hotkeys: exec "config.misc.hotkey.%s = ConfigText(default='%s')" % x[1:] + class HotkeySetup(Screen): ALLOW_SUSPEND = False + def __init__(self, session, args=None): Screen.__init__(self, session) self.session = session @@ -340,6 +345,7 @@ def getFunctions(self): self["choosen"].setList(selected) self["description"].setText(_("Press or select button and then press 'OK' for attach next function or edit attached.") if len(selected) else _("Press or select button and then press 'OK' for attach function.")) + class HotkeySetupSelect(Screen): def __init__(self, session, key, args=None): Screen.__init__(self, session) @@ -541,6 +547,7 @@ def cancel(self): def cancelCallback(self, answer): answer and self.close(None) + class hotkeyActionMap(ActionMap): def action(self, contexts, action): if action in tuple(x[1] for x in hotkey.hotkeys) and action in self.actions: @@ -551,6 +558,7 @@ def action(self, contexts, action): else: return ActionMap.action(self, contexts, action) + class helpableHotkeyActionMap(HelpableActionMap): def action(self, contexts, action): if action in tuple(x[1] for x in hotkey.hotkeys) and action in self.actions: @@ -561,6 +569,7 @@ def action(self, contexts, action): else: return ActionMap.action(self, contexts, action) + class InfoBarHotkey(): def __init__(self): if not hotkey.functions: diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 8246592fb3b..c2be2469daa 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -30,6 +30,7 @@ profile("LOAD:HelpableScreen") from Screens.HelpMenu import HelpableScreen + class InfoBar(InfoBarBase, InfoBarShowHide, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, InfoBarInstantRecord, InfoBarAudioSelection, InfoBarRedButton, InfoBarTimerButton, InfoBarVmodeButton, @@ -147,6 +148,7 @@ def movieSelected(self, service): def openMoviePlayer(self, ref): self.session.open(MoviePlayer, ref, slist=self.servicelist, lastservice=self.session.nav.getCurrentlyPlayingServiceOrGroup(), infobar=self) + class MoviePlayer(InfoBarBase, InfoBarShowHide, InfoBarMenu, InfoBarSeek, InfoBarShowMovies, InfoBarInstantRecord, InfoBarVmodeButton, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications, InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin, diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index d610bc1b847..256096b159e 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -53,9 +53,11 @@ # hack alert! from Menu import MainMenu, mdom + def isStandardInfoBar(self): return self.__class__.__name__ == "InfoBar" + def setResumePoint(session): global resumePointCache, resumePointCacheLast service = session.nav.getCurrentService() @@ -83,6 +85,7 @@ def setResumePoint(session): if lru - resumePointCacheLast > 3600: saveResumePoints() + def delResumePoint(ref): global resumePointCache, resumePointCacheLast try: @@ -92,6 +95,7 @@ def delResumePoint(ref): if int(time()) - resumePointCacheLast > 3600: saveResumePoints() + def getResumePoint(session): global resumePointCache ref = session.nav.getCurrentlyPlayingServiceOrGroup() @@ -103,6 +107,7 @@ def getResumePoint(session): except KeyError: return None + def saveResumePoints(): global resumePointCache, resumePointCacheLast import cPickle @@ -113,6 +118,7 @@ def saveResumePoints(): print "[InfoBar] Failed to write resumepoints:", ex resumePointCacheLast = int(time()) + def loadResumePoints(): import cPickle try: @@ -121,19 +127,26 @@ def loadResumePoints(): print "[InfoBar] Failed to load resumepoints:", ex return {} + resumePointCache = loadResumePoints() resumePointCacheLast = int(time()) + class whitelist: vbi = [] + def reload_whitelist_vbi(): whitelist.vbi = [line.strip() for line in open('/etc/enigma2/whitelist_vbi', 'r').readlines()] if os.path.isfile('/etc/enigma2/whitelist_vbi') else [] + + reload_whitelist_vbi() + class subservice: groupslist = None + def reload_subservice_groupslist(force=False): if subservice.groupslist is None or force: try: @@ -143,8 +156,11 @@ def reload_subservice_groupslist(force=False): subservice.groupslist = [list(g) for k, g in itertools.groupby([line.split('#')[0].strip() for line in open(groupedservices).readlines()], lambda x:not x) if not k] except: subservice.groupslist = [] + + reload_subservice_groupslist() + def getPossibleSubservicesForCurrentChannel(current_service): if current_service and subservice.groupslist: ref_in_subservices_group = [x for x in subservice.groupslist if current_service in x] @@ -152,6 +168,7 @@ def getPossibleSubservicesForCurrentChannel(current_service): return ref_in_subservices_group[0] return [] + def getActiveSubservicesForCurrentChannel(service): info = service and service.info() current_service = info and ':'.join(info.getInfoString(iServiceInformation.sServiceref).split(':')[:11]) @@ -176,13 +193,16 @@ def getActiveSubservicesForCurrentChannel(service): activeSubservices.append((subservice.getName(), subservice.toString())) return activeSubservices + def hasActiveSubservicesForCurrentChannel(service): return bool(getActiveSubservicesForCurrentChannel(service)) + class InfoBarDish: def __init__(self): self.dishDialog = self.session.instantiateDialog(Dish) + class InfoBarUnhandledKey: def __init__(self): self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey) @@ -217,16 +237,19 @@ def checkUnused(self): self.unhandledKeyDialog.show() self.hideUnhandledKeySymbolTimer.start(2000, True) + class HideVBILine(Screen): def __init__(self, session): self.skin = """""" % (getDesktop(0).size().width(), getDesktop(0).size().height() / 180 + 1) Screen.__init__(self, session) + class SecondInfoBar(Screen): def __init__(self, session, skinName): Screen.__init__(self, session) self.skinName = skinName + class InfoBarShowHide(InfoBarScreenSaver): """ InfoBar show/hide control, accepts toggleShow and hide actions, might start fancy animations. """ @@ -444,6 +467,7 @@ def ToggleHideVBI(self, service=None): open('/etc/enigma2/whitelist_vbi', 'w').write('\n'.join(whitelist.vbi)) self.showHideVBI() + class BufferIndicator(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -486,11 +510,13 @@ def getBufferValue(self): info = service and service.info() return info and info.getInfo(iServiceInformation.sBuffer) + class InfoBarBuffer(): def __init__(self): self.bufferScreen = self.session.instantiateDialog(BufferIndicator) self.bufferScreen.hide() + class NumberZap(Screen): def quit(self): self.Timer.stop() @@ -572,8 +598,10 @@ def endTimer(self): if self.timer_counter > self.timer_target: self.keyOK() + class InfoBarNumberZap: """ Handles an initial number for NumberZapping """ + def __init__(self): self["NumberActions"] = NumberActionMap(["NumberActions"], { @@ -660,11 +688,14 @@ def zapToNumber(self, number): service, bouquet = self.searchNumber(number) self.selectAndStartService(service, bouquet) + config.misc.initialchannelselection = ConfigBoolean(default=True) + class InfoBarChannelSelection: """ ChannelSelection - handles the channelSelection dialog and the initial channelChange actions which open the channelSelection dialog """ + def __init__(self): #instantiate forever self.servicelist = self.session.instantiateDialog(ChannelSelection) @@ -886,8 +917,10 @@ def volumeUp(self): def volumeDown(self): VolumeControl.instance and VolumeControl.instance.volDown() + class InfoBarMenu: """ Handles a menu action, to open the (main) menu """ + def __init__(self): self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions", { @@ -909,8 +942,10 @@ def mainMenu(self): def mainMenuClosed(self, *val): self.session.infobar = None + class InfoBarSimpleEventView: """ Opens the Eventview for now/next """ + def __init__(self): self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { @@ -949,6 +984,7 @@ def eventViewCallback(self, setEvent, setService, val): #used for now/next displ epglist[1] = tmp setEvent(epglist[0]) + class SimpleServicelist: def __init__(self, services): self.setServices(services) @@ -991,8 +1027,10 @@ def currentService(self): return None return self.services[self.current] + class InfoBarEPG: """ EPG - Opens an EPG list when the showEPGList action fires """ + def __init__(self): self.is_now_next = False self.dlg_stack = [] @@ -1254,8 +1292,10 @@ def eventViewCallback(self, setEvent, setService, val): #used for now/next displ epglist[1] = tmp setEvent(epglist[0]) + class InfoBarRdsDecoder: """provides RDS and Rass support/display""" + def __init__(self): self.rds_display = self.session.instantiateDialog(RdsInfoDisplay) self.session.instantiateSummaryDialog(self.rds_display) @@ -1302,6 +1342,7 @@ def RassInteractiveClosed(self, *val): self.RassSlidePicChanged() self.rds_display.show() + class InfoBarSeek: """handles actions like seeking, pause""" @@ -1701,8 +1742,10 @@ def seekNextMark(self): if isinstance(self, InfoBarCueSheetSupport): self.jumpNextMark() + from Screens.PVRState import PVRState, TimeshiftState + class InfoBarPVRState: def __init__(self, screen=PVRState, force_show=False): self.onPlayStateChanged.append(self.__playStateChanged) @@ -1725,10 +1768,12 @@ def __playStateChanged(self, state): else: self._mayShow() + class TimeshiftLive(Screen): def __init__(self, session): Screen.__init__(self, session) + class InfoBarTimeshiftState(InfoBarPVRState): def __init__(self): InfoBarPVRState.__init__(self, screen=TimeshiftState, force_show=True) @@ -1765,6 +1810,7 @@ def __hideTimeshiftState(self): self.pvrStateDialog.hide() self.timeshiftLiveScreen.hide() + class InfoBarShowMovies: # i don't really like this class. @@ -1806,6 +1852,7 @@ def __init__(self): # note that a timeshift can be enabled ("recording") and # activated (currently time-shifting). + class InfoBarTimeshift(): def __init__(self): self["TimeshiftActions"] = HelpableActionMap(self, "InfobarTimeshiftActions", @@ -2132,8 +2179,10 @@ def setCurrentEventTimer(self, duration=0): self.save_timeshift_only_current_event = True self.ts_current_event_timer.startLongTimer(duration) + from Screens.PiPSetup import PiPSetup + class InfoBarExtensions: EXTENSION_SINGLE = 0 EXTENSION_LIST = 1 @@ -2207,11 +2256,13 @@ def extensionCallback(self, answer): if answer is not None: answer[1][1]() + from Tools.BoundFunction import boundFunction import inspect # depends on InfoBarExtensions + class InfoBarPlugins: def __init__(self): self.addExtension(extension=self.getPluginList, type=InfoBarExtensions.EXTENSION_LIST) @@ -2234,7 +2285,10 @@ def runPlugin(self, plugin): else: plugin(session=self.session) + from Components.Task import job_manager + + class InfoBarJobman: def __init__(self): self.addExtension(extension=self.getJobList, type=InfoBarExtensions.EXTENSION_LIST) @@ -2256,6 +2310,8 @@ def JobViewCB(self, in_background): job_manager.in_background = in_background # depends on InfoBarExtensions + + class InfoBarPiP: def __init__(self): try: @@ -2402,11 +2458,14 @@ def pipDoHandle0Action(self): elif "stop" == use: self.showPiP() + from RecordTimer import parseEvent + class InfoBarInstantRecord: """Instant Record - handles the instantRecord action in order to start/stop instant records""" + def __init__(self): self["InstantRecordActions"] = HelpableActionMap(self, "InfobarInstantRecord", { @@ -2489,7 +2548,6 @@ def getProgramInfoAndEvent(self, info, name): info["eventid"] = curEvent[4] info["end"] = curEvent[1] - def startInstantRecording(self, limitEvent=False): begin = int(time()) end = begin + 3600 # dummy @@ -2718,6 +2776,7 @@ def instantRecord(self, serviceRef=None): else: return 0 + class InfoBarAudioSelection: def __init__(self): self["AudioSelectionAction"] = HelpableActionMap(self, "InfobarAudioSelectionActions", @@ -2732,6 +2791,7 @@ def audioSelection(self): def audioSelected(self, ret=None): print "[infobar::audioSelected]", ret + class InfoBarSubserviceSelection: def __init__(self): self["SubserviceSelectionAction"] = HelpableActionMap(self, "InfobarSubserviceSelectionActions", @@ -2858,6 +2918,7 @@ def addSubserviceToBouquet(self, dest): self.bsel.close(True) self.bouquets = self.bsel = self.selectedSubservice = None + class InfoBarRedButton: def __init__(self): self["RedButtonActions"] = HelpableActionMap(self, "InfobarRedButtonActions", @@ -2877,6 +2938,7 @@ def activateRedButton(self): for x in self.onRedButtonActivation: x() + class InfoBarTimerButton: def __init__(self): self["TimerButtonActions"] = HelpableActionMap(self, "InfobarTimerButtonActions", @@ -2888,6 +2950,7 @@ def timerSelection(self): from Screens.TimerEdit import TimerEditList self.session.open(TimerEditList) + class VideoMode(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -2900,6 +2963,7 @@ def setText(self, text=""): self.show() self.timer.startLongTimer(3) + class InfoBarVmodeButton: def __init__(self): self["VmodeButtonActions"] = HelpableActionMap(self, "InfobarVmodeButtonActions", @@ -2919,6 +2983,7 @@ def isWideScreen(self): info = service and service.info() return info and info.getInfo(iServiceInformation.sAspect) in WIDESCREEN + class InfoBarAdditionalInfo: def __init__(self): @@ -2930,6 +2995,7 @@ def __init__(self): self["ShowAudioOnYellow"] = Boolean(fixed=0) self["ShowRecordOnRed"] = Boolean(fixed=0) + class InfoBarNotifications: def __init__(self): self.onExecBegin.append(self.checkNotifications) @@ -3001,6 +3067,7 @@ def keypressNotification(self, key, flag): def __notificationClosed(self, d): Notifications.current_notifications.remove(d) + class InfoBarServiceNotifications: def __init__(self): self.__event_tracker = ServiceEventTracker(screen=self, eventmap={ @@ -3015,6 +3082,7 @@ def serviceHasEnded(self): except: pass + class InfoBarCueSheetSupport: CUT_TYPE_IN = 0 CUT_TYPE_OUT = 1 @@ -3222,6 +3290,7 @@ def downloadCuesheet(self): else: self.cut_list = cue.getCutList() + class InfoBarSummary(Screen): skin = """ @@ -3245,6 +3314,7 @@ class InfoBarSummary(Screen): # Reference # + class InfoBarSummarySupport: def __init__(self): pass @@ -3252,6 +3322,7 @@ def __init__(self): def createSummary(self): return InfoBarSummary + class InfoBarMoviePlayerSummary(Screen): skin = """ @@ -3270,6 +3341,7 @@ class InfoBarMoviePlayerSummary(Screen): """ + class InfoBarMoviePlayerSummarySupport: def __init__(self): pass @@ -3277,6 +3349,7 @@ def __init__(self): def createSummary(self): return InfoBarMoviePlayerSummary + class InfoBarTeletextPlugin: def __init__(self): self.teletext_plugin = None @@ -3295,6 +3368,7 @@ def __init__(self): def startTeletext(self): self.teletext_plugin and self.teletext_plugin(session=self.session, service=self.session.nav.getCurrentService()) + class InfoBarSubtitleSupport(object): def __init__(self): object.__init__(self) @@ -3385,6 +3459,7 @@ def showSubtitles(self): else: self.subtitle_window.hide() + class InfoBarServiceErrorPopupSupport: def __init__(self): self.__event_tracker = ServiceEventTracker(screen=self, eventmap={ @@ -3431,6 +3506,7 @@ def __tuneFailed(self): if hasattr(self, "dishDialog") and not self.dishDialog.dishState(): Notifications.AddPopup(text=error, type=MessageBox.TYPE_ERROR, timeout=5, id="ZapError") + class InfoBarPowersaver: def __init__(self): self.inactivityTimer = eTimer() @@ -3534,6 +3610,7 @@ def goStandby(self): print "[InfoBarPowersaver] goto standby" self.session.open(Screens.Standby.Standby) + class InfoBarHDMI: def HDMIIn(self): slist = self.servicelist diff --git a/lib/python/Screens/InputBox.py b/lib/python/Screens/InputBox.py index 43acb33d4c3..22102718cf8 100644 --- a/lib/python/Screens/InputBox.py +++ b/lib/python/Screens/InputBox.py @@ -9,6 +9,7 @@ from Tools.Notifications import AddPopup from time import time + class InputBox(Screen): def __init__(self, session, title="", windowTitle=None, useableChars=None, **kwargs): Screen.__init__(self, session) @@ -86,6 +87,7 @@ def keyTab(self): def keyInsert(self): self["input"].toggleOverwrite() + class PinInput(InputBox): def __init__(self, session, service="", triesEntry=None, pinList=[], popup=False, simple=True, zap=False, *args, **kwargs): InputBox.__init__(self, session=session, text=" ", maxSize=True, type=Input.PIN, *args, **kwargs) diff --git a/lib/python/Screens/InputDeviceSetup.py b/lib/python/Screens/InputDeviceSetup.py index eac78a4b713..adea197ebf7 100644 --- a/lib/python/Screens/InputDeviceSetup.py +++ b/lib/python/Screens/InputDeviceSetup.py @@ -10,6 +10,7 @@ from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN from Tools.LoadPixmap import LoadPixmap + class InputDeviceSelection(Screen, HelpableScreen): skin = """ @@ -37,7 +38,6 @@ class InputDeviceSelection(Screen, HelpableScreen): """ - def __init__(self, session): Screen.__init__(self, session) self.setTitle(_("Select input device")) @@ -279,6 +279,7 @@ def keyCancel(self): else: self.close() # for summary: + def changedEntry(self): for x in self.onChangedEntry: x() diff --git a/lib/python/Screens/InstallWizard.py b/lib/python/Screens/InstallWizard.py index 8a40c2c8a3d..405d2ac9ae8 100644 --- a/lib/python/Screens/InstallWizard.py +++ b/lib/python/Screens/InstallWizard.py @@ -12,6 +12,7 @@ config.misc.installwizard.opkgloaded = ConfigBoolean(default=False) config.misc.installwizard.channellistdownloaded = ConfigBoolean(default=False) + class InstallWizard(Screen, ConfigListScreen): STATE_UPDATE = 0 @@ -147,6 +148,7 @@ def run(self): else: self.doNextStep = True + class InstallWizardOpkgUpdater(Screen): skin = """ diff --git a/lib/python/Screens/LanguageSelection.py b/lib/python/Screens/LanguageSelection.py index ddff6ee38c9..8a7fa44b9f8 100644 --- a/lib/python/Screens/LanguageSelection.py +++ b/lib/python/Screens/LanguageSelection.py @@ -12,6 +12,7 @@ from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN from Tools.LoadPixmap import LoadPixmap + def LanguageEntryComponent(file, name, index): png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "countries/" + index + ".png")) if png is None: @@ -21,6 +22,7 @@ def LanguageEntryComponent(file, name, index): res = (index, name, png) return res + class LanguageSelection(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -86,6 +88,7 @@ def updateList(self): self.list = list self["languages"].list = list + class LanguageWizard(LanguageSelection, Rc): def __init__(self, session): LanguageSelection.__init__(self, session) diff --git a/lib/python/Screens/LocationBox.py b/lib/python/Screens/LocationBox.py index 3a83319ff45..e35f97c873e 100644 --- a/lib/python/Screens/LocationBox.py +++ b/lib/python/Screens/LocationBox.py @@ -32,6 +32,7 @@ defaultInhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/var"] + class LocationBox(Screen, NumericalTextInput, HelpableScreen): """Simple Class similar to MessageBox / ChoiceBox but used to choose a folder/pathname combination""" @@ -366,6 +367,7 @@ def selectConfirmed(self, ret): if self.filename and not os.path.exists(ret): menu = [(_("Create new folder and exit"), "folder"), (_("Save and exit"), "exit")] text = _("Select action") + def dirAction(choice): if choice: if choice[1] == "folder": @@ -547,9 +549,11 @@ def timeout(self, force=False): def __repr__(self): return str(type(self)) + "(" + self.text + ")" + def MovieLocationBox(session, text, dir, filename="", minFree=None): return LocationBox(session, text=text, filename=filename, currDir=dir, bookmarks=config.movielist.videodirs, autoAdd=config.movielist.add_bookmark.value, editDir=True, inhibitDirs=defaultInhibitDirs, minFree=minFree) + class TimeshiftLocationBox(LocationBox): def __init__(self, session): LocationBox.__init__( diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py index f9d786c3697..4577b092909 100644 --- a/lib/python/Screens/Menu.py +++ b/lib/python/Screens/Menu.py @@ -21,6 +21,7 @@ # read the menu mdom = xml.etree.cElementTree.parse(resolveFilename(SCOPE_SKIN, 'menu.xml')) + class MenuUpdater: def __init__(self): self.updatedMenuItems = {} @@ -39,6 +40,7 @@ def updatedMenuAvailable(self, id): def getUpdatedMenu(self, id): return self.updatedMenuItems[id] + menuupdater = MenuUpdater() @@ -351,6 +353,7 @@ def hide_show_entries(self): self.list.append(('', None, 'dummy', '10', 10)) self.list.sort(key=lambda listweight: int(listweight[4])) + class MenuSort(Menu): def __init__(self, session, parent): self.somethingChanged = False @@ -457,6 +460,7 @@ def moveChoosen(self, direction): else: self["menu"].up() + class MainMenu(Menu): #add file load functions for the xml-file diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py index 76c22f677f7..0a465285fe2 100644 --- a/lib/python/Screens/MessageBox.py +++ b/lib/python/Screens/MessageBox.py @@ -6,6 +6,7 @@ from Components.MenuList import MenuList from enigma import eTimer + class MessageBox(Screen): TYPE_YESNO = 0 TYPE_INFO = 1 diff --git a/lib/python/Screens/MinuteInput.py b/lib/python/Screens/MinuteInput.py index e7c1ea17970..5a12964a6f6 100644 --- a/lib/python/Screens/MinuteInput.py +++ b/lib/python/Screens/MinuteInput.py @@ -2,6 +2,7 @@ from Components.ActionMap import NumberActionMap from Components.Input import Input + class MinuteInput(Screen): def __init__(self, session, basemins=5): Screen.__init__(self, session) diff --git a/lib/python/Screens/MovieSelection.py b/lib/python/Screens/MovieSelection.py index dfa628e1ddf..3cef684338e 100644 --- a/lib/python/Screens/MovieSelection.py +++ b/lib/python/Screens/MovieSelection.py @@ -85,6 +85,7 @@ def defaultMoviePath(): from Tools import Directories return Directories.defaultRecordingLocation(config.usage.default_path.value) + def setPreferredTagEditor(te): global preferredTagEditor if preferredTagEditor is None: @@ -93,22 +94,26 @@ def setPreferredTagEditor(te): else: print "Preferred tag editor already set to", preferredTagEditor, "ignoring", te + def getPreferredTagEditor(): global preferredTagEditor return preferredTagEditor + def isTrashFolder(ref): if not config.usage.movielist_trashcan.value or not ref.flags & eServiceReference.mustDescent: return False path = os.path.realpath(ref.getPath()) return path.endswith('.Trash') and path.startswith(Tools.Trashcan.getTrashFolder(path)) + def isInTrashFolder(ref): if not config.usage.movielist_trashcan.value or not ref.flags & eServiceReference.mustDescent: return False path = os.path.realpath(ref.getPath()) return path.startswith(Tools.Trashcan.getTrashFolder(path)) + def isSimpleFile(item): if not item: return False @@ -116,6 +121,7 @@ def isSimpleFile(item): return False return (item[0].flags & eServiceReference.mustDescent) == 0 + def isFolder(item): if not item: return False @@ -133,8 +139,10 @@ def canMove(item): return not isTrashFolder(item[0]) return True + canDelete = canMove + def canCopy(item): if not item: return False @@ -144,6 +152,7 @@ def canCopy(item): return False return True + def createMoveList(serviceref, dest): #normpath is to remove the trailing '/' from directories src = isinstance(serviceref, str) and serviceref + ".ts" or os.path.normpath(serviceref.getPath()) @@ -167,6 +176,7 @@ def createMoveList(serviceref, dest): moveList.append((candidate, os.path.join(dest, baseName + ext))) return moveList + def moveServiceFiles(serviceref, dest, name=None, allowCopy=True): moveList = createMoveList(serviceref, dest) # Try to "atomically" move these files @@ -198,6 +208,7 @@ def moveServiceFiles(serviceref, dest, name=None, allowCopy=True): # rethrow exception raise + def copyServiceFiles(serviceref, dest, name=None): # current should be 'ref' type, dest a simple path string moveList = createMoveList(serviceref, dest) @@ -227,6 +238,8 @@ def copyServiceFiles(serviceref, dest, name=None): # Appends possible destinations to the bookmarks object. Appends tuples # in the form (description, path) to it. + + def buildMovieLocationList(bookmarks): inlist = [] for d in config.movielist.videodirs.value: @@ -245,6 +258,7 @@ def buildMovieLocationList(bookmarks): bookmarks.append((p.tabbedDescription(), d)) inlist.append(d) + class MovieBrowserConfiguration(ConfigListScreen, Screen): def __init__(self, session, args=0): self.session = session @@ -348,6 +362,7 @@ def cancelCallback(self, answer): x[1].cancel() self.close(False) + class MovieContextMenuSummary(Screen): def __init__(self, session, parent): Screen.__init__(self, session, parent=parent) @@ -366,8 +381,10 @@ def selectionChanged(self): item = self.parent["menu"].getCurrent() self["selected"].text = item[0][0] + from Screens.ParentalControlSetup import ProtectedScreen + class MovieContextMenu(Screen, ProtectedScreen): # Contract: On OK returns a callable object (e.g. delete) def __init__(self, session, csel, service): @@ -450,6 +467,7 @@ def okbuttonClick(self): def cancelClick(self): self.close(None) + class SelectionEventInfo: def __init__(self): self["Service"] = ServiceEvent() @@ -466,6 +484,7 @@ def updateEventInfo(self): serviceref = self.getCurrent() self["Service"].newService(serviceref) + class MovieSelectionSummary(Screen): # Kludgy component to display current selection on LCD. Should use # parent.Service as source for everything, but that seems to have a @@ -503,6 +522,7 @@ def selectionChanged(self): else: self["name"].text = "" + class MovieSelection(Screen, HelpableScreen, SelectionEventInfo, InfoBarBase, ProtectedScreen): # SUSPEND_PAUSES actually means "please call my pauseService()" ALLOW_SUSPEND = Screen.SUSPEND_PAUSES @@ -1482,6 +1502,7 @@ def showTagsSecond(self): def can_tags(self, item): return self.tags + def do_tags(self): self.showTagsN(None) @@ -2169,5 +2190,6 @@ def createPlaylist(self): if ext not in IMAGE_EXTENSIONS: items.append(item) + playlist = [] diff --git a/lib/python/Screens/Mute.py b/lib/python/Screens/Mute.py index 150ba2b3038..a3417b4eb69 100644 --- a/lib/python/Screens/Mute.py +++ b/lib/python/Screens/Mute.py @@ -1,4 +1,5 @@ from Screen import Screen + class Mute(Screen): pass diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index a0076572168..980a1e56c32 100644 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -18,6 +18,7 @@ from Plugins.Plugin import PluginDescriptor from enigma import eTimer + class NetworkAdapterSelection(Screen, HelpableScreen): def __init__(self, session): Screen.__init__(self, session) @@ -708,7 +709,6 @@ def __init__(self, session, iface): self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.cleanup) - def queryWirelessDevice(self, iface): try: from pythonwifi.iwlibs import Wireless diff --git a/lib/python/Screens/NumericalTextInputHelpDialog.py b/lib/python/Screens/NumericalTextInputHelpDialog.py index 22b37c36c97..db46f340bd6 100644 --- a/lib/python/Screens/NumericalTextInputHelpDialog.py +++ b/lib/python/Screens/NumericalTextInputHelpDialog.py @@ -2,6 +2,7 @@ from Components.Label import Label import enigma + class NumericalTextInputHelpDialog(Screen): def __init__(self, session, textinput): Screen.__init__(self, session) diff --git a/lib/python/Screens/Opkg.py b/lib/python/Screens/Opkg.py index b3141014e59..b5ed574d2bd 100644 --- a/lib/python/Screens/Opkg.py +++ b/lib/python/Screens/Opkg.py @@ -6,6 +6,7 @@ from Screens.MessageBox import MessageBox from enigma import eTimer + class Opkg(Screen): def __init__(self, session, cmdList=[]): Screen.__init__(self, session) diff --git a/lib/python/Screens/PVRState.py b/lib/python/Screens/PVRState.py index 2b34bdbe64a..cd72c8ad0c4 100644 --- a/lib/python/Screens/PVRState.py +++ b/lib/python/Screens/PVRState.py @@ -2,10 +2,12 @@ from Components.Label import Label + class PVRState(Screen): def __init__(self, session): Screen.__init__(self, session) self["state"] = Label(text="") + class TimeshiftState(PVRState): pass diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py index 166c458c57c..9062cbad5a5 100644 --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -8,6 +8,7 @@ from Screens.InputBox import PinInput from Tools.BoundFunction import boundFunction + class ProtectedScreen: def __init__(self): if self.isProtected() and config.ParentalControl.servicepin[0].value: @@ -25,6 +26,7 @@ def pinEntered(self, result): def closeProtectedScreen(self, result=None): self.close(None) + class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/PiPSetup.py b/lib/python/Screens/PiPSetup.py index 952adaa5038..721277c5c4a 100644 --- a/lib/python/Screens/PiPSetup.py +++ b/lib/python/Screens/PiPSetup.py @@ -11,6 +11,7 @@ MIN_W = MAX_X / 8 MIN_H = MAX_Y / 8 + def clip(val, min, max): if min <= val <= max: return val @@ -18,6 +19,7 @@ def clip(val, min, max): return max return min + class PiPSetup(Screen): def __init__(self, session, pip): Screen.__init__(self, session) diff --git a/lib/python/Screens/PictureInPicture.py b/lib/python/Screens/PictureInPicture.py index f2bb6382d7d..a66a839f659 100644 --- a/lib/python/Screens/PictureInPicture.py +++ b/lib/python/Screens/PictureInPicture.py @@ -14,6 +14,7 @@ PipPigModeEnabled = False PipPigModeTimer = eTimer() + def timedStopPipPigMode(): from Screens.InfoBar import InfoBar if InfoBar.instance and InfoBar.instance.session: @@ -24,8 +25,10 @@ def timedStopPipPigMode(): global PipPigModeEnabled PipPigModeEnabled = False + PipPigModeTimer.callback.append(timedStopPipPigMode) + def PipPigMode(value): from Screens.InfoBar import InfoBar if InfoBar.instance and InfoBar.instance.session and hasattr(InfoBar.instance.session, "pip") and config.av.pip_mode.value != "external": @@ -45,11 +48,13 @@ def PipPigMode(value): else: PipPigModeTimer.start(100, True) + class PictureInPictureZapping(Screen): skin = """ """ + class PictureInPicture(Screen): def __init__(self, session): global pip_config_initialized diff --git a/lib/python/Screens/PluginBrowser.py b/lib/python/Screens/PluginBrowser.py index 190c9ed4363..fe3a689d1d9 100644 --- a/lib/python/Screens/PluginBrowser.py +++ b/lib/python/Screens/PluginBrowser.py @@ -28,6 +28,7 @@ config.misc.pluginbrowser = ConfigSubsection() config.misc.pluginbrowser.plugin_order = ConfigText(default="") + class PluginBrowserSummary(Screen): def __init__(self, session, parent): Screen.__init__(self, session, parent=parent) @@ -245,6 +246,7 @@ def openExtensionmanager(self): else: self.session.openWithCallback(self.PluginDownloadBrowserClosed, PluginManager) + class PluginDownloadBrowser(Screen): DOWNLOAD = 0 REMOVE = 1 diff --git a/lib/python/Screens/Rc.py b/lib/python/Screens/Rc.py index eaa66469497..8ef46c6c7a2 100644 --- a/lib/python/Screens/Rc.py +++ b/lib/python/Screens/Rc.py @@ -6,6 +6,7 @@ config.misc.rcused = ConfigInteger(default=1) + class Rc: def __init__(self): self["rc"] = MultiPixmap() diff --git a/lib/python/Screens/RdsDisplay.py b/lib/python/Screens/RdsDisplay.py index 914cd297def..128e4a15594 100644 --- a/lib/python/Screens/RdsDisplay.py +++ b/lib/python/Screens/RdsDisplay.py @@ -8,6 +8,7 @@ from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN from Tools.LoadPixmap import LoadPixmap + class RdsInfoDisplaySummary(Screen): def __init__(self, session, parent): Screen.__init__(self, session, parent=parent) @@ -21,6 +22,7 @@ def onText(self, message): else: self.hide() + class RdsInfoDisplay(Screen): ALLOW_SUSPEND = True @@ -94,6 +96,7 @@ def __serviceStopped(self): for x in self.onRassInteractivePossibilityChanged: x(False) + class RassInteractive(Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/RecordPaths.py b/lib/python/Screens/RecordPaths.py index 106f64e00dd..7b14cf72bf1 100644 --- a/lib/python/Screens/RecordPaths.py +++ b/lib/python/Screens/RecordPaths.py @@ -8,6 +8,7 @@ from Tools.Directories import fileExists from Components.UsageConfig import preferredPath + class RecordPathsSettings(Screen, ConfigListScreen): skin = """ diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 06de8dec832..02c92edd267 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -20,6 +20,7 @@ from time import mktime, localtime, time from datetime import datetime + class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): def createSimpleSetup(self, list, mode): nim = self.nimConfig @@ -224,6 +225,7 @@ def createSetup(self): cableNames = sorted([x[0] for x in nimmanager.getCablesByCountrycode(self.cableCountries.value)]) default = self.nimConfig.cable.scan_provider.value in cableNames and self.nimConfig.cable.scan_provider.value or None self.cableRegions = ConfigSelection(default=default, choices=cableNames) + def updateCableProvider(configEntry): self.nimConfig.cable.scan_provider.value = configEntry.value self.nimConfig.cable.scan_provider.save() @@ -285,6 +287,7 @@ def updateCableProvider(configEntry): terrstrialNames = sorted([x[0] for x in nimmanager.getTerrestrialsByCountrycode(self.terrestrialCountries.value)]) default = self.nimConfig.terrestrial.value in terrstrialNames and self.nimConfig.terrestrial.value or None self.terrestrialRegions = ConfigSelection(default=default, choices=terrstrialNames) + def updateTerrestrialProvider(configEntry): self.nimConfig.terrestrial.value = configEntry.value self.nimConfig.terrestrial.save() @@ -714,6 +717,7 @@ def countrycodeToCountry(self, cc): return self.countrycodes[cc.upper()] return cc + class NimSelection(Screen): def __init__(self, session): Screen.__init__(self, session) @@ -865,6 +869,7 @@ def updateList(self, index=None): if index is not None: self["nimlist"].setIndex(index) + class SelectSatsEntryScreen(Screen): skin = """ @@ -880,6 +885,7 @@ class SelectSatsEntryScreen(Screen): """ + def __init__(self, session, userSatlist=""): Screen.__init__(self, session) self["key_red"] = Button(_("Cancel")) @@ -926,6 +932,7 @@ def sortBy(self): connected_sat = [x[0][1] for x in lst if x[0][3]] if len(connected_sat) > 0: menu.insert(0, (_("Connected satellites"), "3")) + def sortAction(choice): if choice: reverse_flag = False diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 56f243ca07b..c7a78c34108 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -13,6 +13,7 @@ from Screens.MessageBox import MessageBox from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager, eDVBFrontendParametersATSC + def buildTerTransponder(frequency, inversion=2, bandwidth=7000000, fechigh=6, feclow=6, modulation=2, transmission=2, guard=4, @@ -32,6 +33,7 @@ def buildTerTransponder(frequency, parm.plp_id = plp_id return parm + def getInitialTransponderList(tlist, pos, feid=None): list = nimmanager.getTransponders(pos, feid) for x in list: @@ -54,6 +56,7 @@ def getInitialTransponderList(tlist, pos, feid=None): parm.t2mi_pid = x[14] tlist.append(parm) + def getInitialCableTransponderList(tlist, nim): list = nimmanager.getTranspondersCable(nim) for x in list: @@ -67,6 +70,7 @@ def getInitialCableTransponderList(tlist, nim): parm.system = x[6] tlist.append(parm) + def getInitialTerrestrialTransponderList(tlist, region, tsystem=eDVBFrontendParametersTerrestrial.System_DVB_T_T2): list = nimmanager.getTranspondersTerrestrial(region) for x in list: @@ -79,6 +83,7 @@ def getInitialTerrestrialTransponderList(tlist, region, tsystem=eDVBFrontendPara continue tlist.append(parm) + def getInitialATSCTransponderList(tlist, nim): list = nimmanager.getTranspondersATSC(nim) for x in list: @@ -90,6 +95,7 @@ def getInitialATSCTransponderList(tlist, nim): parm.system = x[4] tlist.append(parm) + cable_bands = { "DVBC_BAND_EU_VHF_I": 1 << 0, "DVBC_BAND_EU_MID": 1 << 1, @@ -127,6 +133,7 @@ def getInitialATSCTransponderList(tlist, nim): dual_tuner_list = ('TT3L10', 'BCM3466') vtuner_need_idx_list = ('TURBO2',) + def GetDeviceId(filter, nim_idx): socket_id = device_id = 0 for nim in nimmanager.nim_slots: @@ -144,6 +151,7 @@ def GetDeviceId(filter, nim_idx): socket_id += 1 return device_id + def getVtunerId(filter, nim_idx): idx_count = 1 for slot in nimmanager.nim_slots: @@ -154,6 +162,7 @@ def getVtunerId(filter, nim_idx): idx_count += 1 return "" + class CableTransponderSearchSupport: def tryGetRawFrontend(self, feid): @@ -362,6 +371,7 @@ def GetCommand(nim_idx): tmpstr += "\n\n..." self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO) + class TerrestrialTransponderSearchSupport: def terrestrialTransponderSearchSessionClosed(self, *val): @@ -582,6 +592,7 @@ def terrestrialTransponderSearch(self, freq, bandWidth): print "SCAN CMD : ", cmd self.terrestrial_search_container.execute(cmd) + class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport, TerrestrialTransponderSearchSupport): def __init__(self, session): Screen.__init__(self, session) @@ -1684,6 +1695,7 @@ def doCloseRecursive(self): self.session.nav.playService(self.session.postScanService) self.closeRecursive() + class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport, TerrestrialTransponderSearchSupport): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/Scart.py b/lib/python/Screens/Scart.py index 5e1ec1550e3..898c30ce17c 100644 --- a/lib/python/Screens/Scart.py +++ b/lib/python/Screens/Scart.py @@ -3,6 +3,7 @@ from Components.AVSwitch import AVSwitch from Tools import Notifications + class Scart(Screen): def __init__(self, session, start_visible=True): Screen.__init__(self, session) diff --git a/lib/python/Screens/ScreenSaver.py b/lib/python/Screens/ScreenSaver.py index b9e684c0b0f..58efa83923a 100644 --- a/lib/python/Screens/ScreenSaver.py +++ b/lib/python/Screens/ScreenSaver.py @@ -9,6 +9,7 @@ import random from sys import maxint + class InfoBarScreenSaver: def __init__(self): self.onExecBegin.append(self.__onExecBegin) @@ -59,6 +60,7 @@ def keypressScreenSaver(self, key, flag): self.ScreenSaverTimerStart() eActionMap.getInstance().unbindAction('', self.keypressScreenSaver) + class Screensaver(Screen): def __init__(self, session): diff --git a/lib/python/Screens/ServiceInfo.py b/lib/python/Screens/ServiceInfo.py index 4146616873d..63782111f7e 100644 --- a/lib/python/Screens/ServiceInfo.py +++ b/lib/python/Screens/ServiceInfo.py @@ -18,9 +18,11 @@ TYPE_VALUE_FREQ_FLOAT = 7 TYPE_VALUE_BITRATE = 8 + def to_unsigned(x): return x & 0xFFFFFFFF + def ServiceInfoListEntry(a, b="", valueType=TYPE_TEXT, param=4, altColor=False): print "b:", b if not isinstance(b, str): @@ -53,6 +55,7 @@ def ServiceInfoListEntry(a, b="", valueType=TYPE_TEXT, param=4, altColor=False): res.append((eListboxPythonMultiContent.TYPE_TEXT, xa, ya, wa + wb, ha, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, a, color if altColor is True else None)) # spread horizontally return res + class ServiceInfoList(GUIComponent): def __init__(self, source): GUIComponent.__init__(self) @@ -68,9 +71,11 @@ def __init__(self, source): def postWidgetCreate(self, instance): self.instance.setContent(self.l) + TYPE_SERVICE_INFO = 1 TYPE_TRANSPONDER_INFO = 2 + class ServiceInfo(Screen): def __init__(self, session, serviceref=None): Screen.__init__(self, session) diff --git a/lib/python/Screens/ServiceScan.py b/lib/python/Screens/ServiceScan.py index 5c1a1d17628..143b148781d 100644 --- a/lib/python/Screens/ServiceScan.py +++ b/lib/python/Screens/ServiceScan.py @@ -9,6 +9,7 @@ from Components.config import config from enigma import eServiceReference + class ServiceScanSummary(Screen): skin = """ @@ -30,6 +31,7 @@ def updateProgress(self, value): def updateService(self, name): self["Service"].setText(name) + class ServiceScan(Screen): def ok(self): diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py index 605ed0a26d3..4b2c636dd04 100644 --- a/lib/python/Screens/ServiceStopScreen.py +++ b/lib/python/Screens/ServiceStopScreen.py @@ -1,5 +1,6 @@ from Screens.MessageBox import MessageBox + class ServiceStopScreen: def __init__(self): try: diff --git a/lib/python/Screens/SessionGlobals.py b/lib/python/Screens/SessionGlobals.py index 600b30b3bc1..009ec3440c0 100644 --- a/lib/python/Screens/SessionGlobals.py +++ b/lib/python/Screens/SessionGlobals.py @@ -11,6 +11,7 @@ from Components.Converter.Combine import Combine from Components.Renderer.FrontpanelLed import FrontpanelLed + class SessionGlobals(Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/Setup.py b/lib/python/Screens/Setup.py index 03961ecd6b9..e0c3753da75 100644 --- a/lib/python/Screens/Setup.py +++ b/lib/python/Screens/Setup.py @@ -22,12 +22,14 @@ setupdom = xml.etree.cElementTree.parse(setupfile) setupfile.close() + def getConfigMenuItem(configElement): for item in setupdom.getroot().findall('./setup/item/.'): if item.text == configElement: return _(item.attrib["text"]), eval(configElement) return "", None + class SetupError(Exception): def __init__(self, message): self.msg = message @@ -35,6 +37,7 @@ def __init__(self, message): def __str__(self): return self.msg + class SetupSummary(Screen): def __init__(self, session, parent): @@ -62,6 +65,7 @@ def selectionChanged(self): if hasattr(self.parent, "getCurrentDescription") and "description" in self.parent: self.parent["description"].text = self.parent.getCurrentDescription() + class Setup(ConfigListScreen, Screen): ALLOW_SUSPEND = True @@ -165,6 +169,7 @@ def __onSelectionChanged(self): def run(self): self.keySave() + def getSetupTitle(id): xmldata = setupdom.getroot() for x in xmldata.findall("setup"): diff --git a/lib/python/Screens/SetupFallbacktuner.py b/lib/python/Screens/SetupFallbacktuner.py index 6507eb242d7..252b91a5356 100644 --- a/lib/python/Screens/SetupFallbacktuner.py +++ b/lib/python/Screens/SetupFallbacktuner.py @@ -10,6 +10,7 @@ from enigma import getPeerStreamingBoxes + class SetupFallbacktuner(ConfigListScreen, Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/SkinSelector.py b/lib/python/Screens/SkinSelector.py index 9311bb5a6b2..f0319e8a088 100644 --- a/lib/python/Screens/SkinSelector.py +++ b/lib/python/Screens/SkinSelector.py @@ -231,6 +231,7 @@ def getCurrentName(self): current = current.replace("_", " ") return current + class LcdSkinSelector(SkinSelector): def __init__(self, session, screenTitle=_("Display Skin")): SkinSelector.__init__(self, session, screenTitle=screenTitle) @@ -240,6 +241,7 @@ def __init__(self, session, screenTitle=_("Display Skin")): self.current = currentDisplaySkin self.xmlList = ["skin_display.xml", "skin_display_picon.xml"] + class SkinSelectorSummary(Screen): def __init__(self, session, parent): Screen.__init__(self, session, parent=parent) diff --git a/lib/python/Screens/SleepTimerEdit.py b/lib/python/Screens/SleepTimerEdit.py index f31b1a71edd..5352f69e64d 100644 --- a/lib/python/Screens/SleepTimerEdit.py +++ b/lib/python/Screens/SleepTimerEdit.py @@ -9,6 +9,7 @@ from enigma import eEPGCache from time import time, localtime, mktime + class SleepTimerEdit(ConfigListScreen, Screen): def __init__(self, session): Screen.__init__(self, session) @@ -178,6 +179,7 @@ def currentEventTime(self): return remaining + config.recording.margin_after.value * 60 return remaining + def isNextWakeupTime(standby_timer=False): wakeup_enabled = config.usage.wakeup_enabled.value if wakeup_enabled != "no": @@ -195,6 +197,7 @@ def isNextWakeupTime(standby_timer=False): return wakeup_time + (86400 * wakeup_day) return -1 + def WakeupDayTimeOfWeek(): now = localtime() current_day = int(now.tm_wday) diff --git a/lib/python/Screens/SoftcamSetup.py b/lib/python/Screens/SoftcamSetup.py index 62cb9c90ce3..3df7a84185c 100644 --- a/lib/python/Screens/SoftcamSetup.py +++ b/lib/python/Screens/SoftcamSetup.py @@ -12,6 +12,7 @@ from Tools.camcontrol import CamControl from enigma import eTimer + class SoftcamSetup(Screen, ConfigListScreen): skin = """ @@ -26,6 +27,7 @@ class SoftcamSetup(Screen, ConfigListScreen): """ + def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/SoftwareUpdate.py b/lib/python/Screens/SoftwareUpdate.py index 03c3d6eddd7..672e0ddf006 100644 --- a/lib/python/Screens/SoftwareUpdate.py +++ b/lib/python/Screens/SoftwareUpdate.py @@ -23,6 +23,7 @@ import time import calendar + class UpdatePlugin(Screen, ProtectedScreen): skin = """ diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index 4bc8dfdbb43..587a2a6f392 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -31,6 +31,7 @@ QUIT_UPGRADE_PROGRAM = 42 QUIT_IMAGE_RESTORE = 43 + def isInfoBarInstance(): global infoBarInstance if infoBarInstance is None: @@ -39,6 +40,7 @@ def isInfoBarInstance(): infoBarInstance = InfoBar.instance return infoBarInstance + def checkTimeshiftRunning(): infobar_instance = isInfoBarInstance() return config.usage.check_timeshift.value and infobar_instance and infobar_instance.timeshiftEnabled() and infobar_instance.timeshift_was_activated @@ -200,6 +202,7 @@ def standbyWakeup(self): def createSummary(self): return StandbySummary + class Standby(StandbyScreen): def __init__(self, session, StandbyCounterIncrease=True): if checkTimeshiftRunning(): @@ -222,6 +225,7 @@ def showCheckTimeshiftRunningCallback(self, answer=False): def goStandby(self): Notifications.AddNotification(StandbyScreen, self.StandbyCounterIncrease) + class StandbySummary(Screen): skin = """ @@ -234,6 +238,7 @@ class StandbySummary(Screen): """ + class QuitMainloopScreen(Screen): def __init__(self, session, retvalue=QUIT_SHUTDOWN): self.skin = """ @@ -253,8 +258,10 @@ def __init__(self, session, retvalue=QUIT_SHUTDOWN): }.get(retvalue) self["text"] = Label(text) + inTryQuitMainloop = False + def getReasons(session, retvalue=QUIT_SHUTDOWN): recordings = session.nav.getRecordings() jobs = len(job_manager.getPendingJobs()) @@ -278,6 +285,7 @@ def getReasons(session, retvalue=QUIT_SHUTDOWN): reasons.append(_("A file from media is in use!")) return "\n".join(reasons) + class TryQuitMainloop(MessageBox): def __init__(self, session, retvalue=QUIT_SHUTDOWN, timeout=-1, default_yes=False, check_reasons=True): self.retval = retvalue diff --git a/lib/python/Screens/StartWizard.py b/lib/python/Screens/StartWizard.py index f4cef4d55f7..5db67da39bf 100644 --- a/lib/python/Screens/StartWizard.py +++ b/lib/python/Screens/StartWizard.py @@ -25,6 +25,7 @@ config.misc.do_overscanwizard = ConfigBoolean(default=OverscanWizard and config.skin.primary_skin.value == "PLi-FullNightHD/skin.xml") config.misc.check_developimage = ConfigBoolean(default=True) + class StartWizard(WizardLanguage, Rc): def __init__(self, session, silent=True, showSteps=False, neededTag=None): self.xmlfile = ["startwizard.xml"] @@ -44,6 +45,7 @@ def markDone(self): config.misc.firstrun.save() configfile.save() + def setLanguageFromBackup(backupfile): try: import tarfile @@ -61,12 +63,14 @@ def setLanguageFromBackup(backupfile): except: pass + def checkForAvailableAutoBackup(): for backupfile in ["/media/%s/backup/PLi-AutoBackup.tar.gz" % media for media in os.listdir("/media/") if os.path.isdir(os.path.join("/media/", media))]: if os.path.isfile(backupfile): setLanguageFromBackup(backupfile) return True + class AutoRestoreWizard(MessageBox): def __init__(self, session): MessageBox.__init__(self, session, _("Do you want to autorestore settings?"), type=MessageBox.TYPE_YESNO, timeout=20, default=True, simple=True) @@ -77,6 +81,7 @@ def close(self, value): else: MessageBox.close(self) + def checkForDevelopImage(): if about.getImageTypeString() == 'Openpli develop': return config.misc.check_developimage.value @@ -84,6 +89,7 @@ def checkForDevelopImage(): config.misc.check_developimage.value = True config.misc.check_developimage.save() + class DevelopWizard(MessageBox): def __init__(self, session): MessageBox.__init__(self, session, _("This image is intended for developers and testers.\nNo support will be provided!\nDo you understand this?"), type=MessageBox.TYPE_YESNO, timeout=20, default=False, simple=True) @@ -94,6 +100,7 @@ def close(self, value): config.misc.check_developimage.save() MessageBox.close(self) + class AutoInstallWizard(Screen): skin = """ @@ -105,6 +112,7 @@ class AutoInstallWizard(Screen): """ + def __init__(self, session): Screen.__init__(self, session) self["progress"] = ProgressBar() @@ -184,6 +192,7 @@ def abort(self, key=None, flag=None): os.remove("/etc/.doAutoinstall") self.close(3) + if not os.path.isfile("/etc/installed"): from Components.Console import Console Console().ePopen("opkg list_installed | cut -d ' ' -f 1 > /etc/installed;chmod 444 /etc/installed") diff --git a/lib/python/Screens/StreamingClientsInfo.py b/lib/python/Screens/StreamingClientsInfo.py index 8788c5bca3c..8039ce3b4d1 100644 --- a/lib/python/Screens/StreamingClientsInfo.py +++ b/lib/python/Screens/StreamingClientsInfo.py @@ -13,6 +13,7 @@ except: streamList = [] + class StreamingClientsInfo(Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/SubservicesQuickzap.py b/lib/python/Screens/SubservicesQuickzap.py index ad0382b47a9..f5fc5d1871d 100644 --- a/lib/python/Screens/SubservicesQuickzap.py +++ b/lib/python/Screens/SubservicesQuickzap.py @@ -7,6 +7,7 @@ from enigma import eServiceReference from Components.ServiceEventTracker import InfoBarBase + class SubservicesQuickzap(InfoBarBase, InfoBarShowHide, InfoBarMenu, InfoBarInstantRecord, InfoBarSeek, InfoBarTimeshift, InfoBarTimeshiftState, InfoBarExtensions, InfoBarSubtitleSupport, diff --git a/lib/python/Screens/SubtitleDisplay.py b/lib/python/Screens/SubtitleDisplay.py index 13ece59a57f..945e7024814 100644 --- a/lib/python/Screens/SubtitleDisplay.py +++ b/lib/python/Screens/SubtitleDisplay.py @@ -1,5 +1,6 @@ from Screens.Screen import Screen + class SubtitleDisplay(Screen): pass diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 2b91abbb2e2..3cced076acb 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -11,6 +11,7 @@ from Screens.MessageBox import MessageBox import Screens.Standby + class JobView(InfoBarNotifications, Screen, ConfigListScreen): def __init__(self, session, job, parent=None, cancelable=True, backgroundable=True, afterEventChangeable=True): Screen.__init__(self, session, parent) diff --git a/lib/python/Screens/TextBox.py b/lib/python/Screens/TextBox.py index 10504f84d00..ebec85f3246 100644 --- a/lib/python/Screens/TextBox.py +++ b/lib/python/Screens/TextBox.py @@ -2,6 +2,7 @@ from Components.ActionMap import ActionMap from Components.ScrollLabel import ScrollLabel + class TextBox(Screen): def __init__(self, session, text="", title=None, pigless=False): Screen.__init__(self, session) diff --git a/lib/python/Screens/TimeDateInput.py b/lib/python/Screens/TimeDateInput.py index 653d274ab6c..ae2fb833ad1 100644 --- a/lib/python/Screens/TimeDateInput.py +++ b/lib/python/Screens/TimeDateInput.py @@ -6,6 +6,7 @@ import time import datetime + class TimeDateInput(Screen, ConfigListScreen): def __init__(self, session, config_time=None, config_date=None): Screen.__init__(self, session) diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py index 8dd2267938c..2d6051c656b 100644 --- a/lib/python/Screens/TimerEdit.py +++ b/lib/python/Screens/TimerEdit.py @@ -20,6 +20,7 @@ from ServiceReference import ServiceReference from enigma import eServiceReference, eEPGCache + class TimerEditList(Screen): EMPTY = 0 ENABLE = 1 @@ -344,6 +345,7 @@ def finishedEdit(self, answer): def removeEditTimer(): entry.service_ref, entry.begin, entry.end, entry.external = entry.service_ref_prev, entry.begin_prev, entry.end_prev, entry.external_prev self.removeTimer() + def moveEditTimerError(): entry.external = entry.external_prev self.refill() @@ -404,6 +406,7 @@ def leave(self): def onStateChange(self, entry): self.refill() + class TimerSanityConflict(Screen): def __init__(self, session, timer): Screen.__init__(self, session) @@ -544,6 +547,7 @@ def openExtendedSetup(self): menu = [] if not config.usage.show_timer_conflict_warning.value: menu.append((_("Show warning before set 'Ignore conflict'"), "blue_key_warning")) + def showAction(choice): if choice is not None: if choice[1] == "blue_key_warning": diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index f7c9a3bda53..95b6c6b7f1f 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -24,6 +24,7 @@ from datetime import datetime import urllib + class TimerEntry(Screen, ConfigListScreen): def __init__(self, session, timer): Screen.__init__(self, session) @@ -325,6 +326,7 @@ def keySelect(self): self.openMovieLocationBox() elif len(menu) == 2: text = _("Select action") + def selectAction(choice): if choice: if choice[1] == "timername": @@ -551,6 +553,7 @@ def tagEditFinished(self, ret): self.timerentry_tagsset.setChoices([not ret and _("None") or " ".join(ret)]) self["config"].invalidate(self.tagsSet) + class TimerLog(Screen): def __init__(self, session, timer): Screen.__init__(self, session) diff --git a/lib/python/Screens/TimerSelection.py b/lib/python/Screens/TimerSelection.py index 588b6d81d28..1380f5941a2 100644 --- a/lib/python/Screens/TimerSelection.py +++ b/lib/python/Screens/TimerSelection.py @@ -2,6 +2,7 @@ from Components.TimerList import TimerList from Components.ActionMap import ActionMap + class TimerSelection(Screen): def __init__(self, session, list): Screen.__init__(self, session) diff --git a/lib/python/Screens/UnhandledKey.py b/lib/python/Screens/UnhandledKey.py index 1640f960e09..a38c5d3e98b 100644 --- a/lib/python/Screens/UnhandledKey.py +++ b/lib/python/Screens/UnhandledKey.py @@ -1,6 +1,7 @@ from Screens.Screen import Screen from Components.Pixmap import Pixmap + class UnhandledKey(Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/Volume.py b/lib/python/Screens/Volume.py index fe58304fbdd..096a929dd9b 100644 --- a/lib/python/Screens/Volume.py +++ b/lib/python/Screens/Volume.py @@ -2,6 +2,7 @@ from Components.VolumeBar import VolumeBar from Screens.Screen import Screen + class Volume(Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 5a2a7e2ec25..e4e6f733990 100644 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -14,6 +14,7 @@ from xml.sax import make_parser from xml.sax.handler import ContentHandler + class WizardSummary(Screen): def __init__(self, session, parent): Screen.__init__(self, session, parent) @@ -26,6 +27,7 @@ def setCallback(self): def setText(self, text): self["text"].setText(text) + class Wizard(Screen): instance = None @@ -681,4 +683,5 @@ def getWizards(self): self.wizards[-1][0].isLastWizard = True return [(x[2], x[0]) for x in self.wizards if x[1] == 1] + wizardManager = WizardManager() diff --git a/lib/python/Screens/WizardLanguage.py b/lib/python/Screens/WizardLanguage.py index 351728c337c..75b71fd9ab2 100644 --- a/lib/python/Screens/WizardLanguage.py +++ b/lib/python/Screens/WizardLanguage.py @@ -2,6 +2,7 @@ from Components.Label import Label from LanguageSelection import LanguageWizard + class WizardLanguage(Wizard): def __init__(self, session, showSteps=True, showStepSlider=True, showList=True, showConfig=True): Wizard.__init__(self, session, showSteps, showStepSlider, showList, showConfig) diff --git a/lib/python/ServiceReference.py b/lib/python/ServiceReference.py index d6bd13b4e83..4243cd2692e 100644 --- a/lib/python/ServiceReference.py +++ b/lib/python/ServiceReference.py @@ -1,6 +1,7 @@ from enigma import eServiceReference, eServiceCenter, getBestPlayableServiceReference import NavigationInstance + class ServiceReference(eServiceReference): def __init__(self, ref, reftype=eServiceReference.idInvalid, flags=0, path=''): if reftype != eServiceReference.idInvalid: @@ -37,6 +38,7 @@ def isRecordable(self): ref = self.ref return ref.flags & eServiceReference.isGroup or (ref.type == eServiceReference.idDVB or ref.type == eServiceReference.idDVB + 0x100 or ref.type == 0x2000 or ref.type == 0x1001) + def getPlayingref(ref): playingref = None if NavigationInstance.instance: @@ -45,10 +47,12 @@ def getPlayingref(ref): playingref = eServiceReference() return playingref + def isPlayableForCur(ref): info = eServiceCenter.getInstance().info(ref) return info and info.isPlayable(ref, getPlayingref(ref)) + def resolveAlternate(ref): nref = None if ref.flags & eServiceReference.isGroup: diff --git a/lib/python/StartEnigma.py b/lib/python/StartEnigma.py index 51d20555fb8..46db2818f1e 100644 --- a/lib/python/StartEnigma.py +++ b/lib/python/StartEnigma.py @@ -32,8 +32,12 @@ profile("Bouquets") from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, NoSave config.misc.load_unlinked_userbouquets = ConfigYesNo(default=True) + + def setLoadUnlinkedUserbouquets(configElement): enigma.eDVBDB.getInstance().setLoadUnlinkedUserbouquets(configElement.value) + + config.misc.load_unlinked_userbouquets.addNotifier(setLoadUnlinkedUserbouquets) enigma.eDVBDB.getInstance().reloadBouquets() @@ -65,6 +69,7 @@ def setLoadUnlinkedUserbouquets(configElement): # 0 = RecordTimer, 1 = ZapTimer, 2 = Plugins, 3 = WakeupTimer config.misc.epgcache_filename = ConfigText(default="/hdd/epg.dat", fixed_size=False) + def setEPGCachePath(configElement): if os.path.isdir(configElement.value) or os.path.islink(configElement.value): configElement.value = os.path.join(configElement.value, "epg.dat") @@ -82,8 +87,11 @@ def setEPGCachePath(configElement): #config.misc.standbyCounter.addNotifier(standbyCountChanged, initial_call = False) #################################################### + def useTransponderTimeChanged(configElement): enigma.eDVBLocalTimeHandler.getInstance().setUseDVBTime(configElement.value) + + config.misc.useTransponderTime.addNotifier(useTransponderTimeChanged) profile("Twisted") @@ -99,6 +107,7 @@ def runReactor(): reactor.run(installSignalHandlers=False) except ImportError: print "[StartEnigma] Twisted not available" + def runReactor(): enigma.runMainloop() @@ -117,6 +126,7 @@ def runReactor(): profile("misc") had = dict() + def dump(dir, p=""): if isinstance(dir, dict): for (entry, val) in dir.items(): @@ -135,6 +145,7 @@ def dump(dir, p=""): # display + profile("LOAD:ScreenGlobals") from Screens.Globals import Globals from Screens.SessionGlobals import SessionGlobals @@ -168,6 +179,7 @@ def dump(dir, p=""): # Session.doClose: # * destroy screen + class Session: def __init__(self, desktop=None, summary_desktop=None, navigation=None): self.desktop = desktop @@ -334,11 +346,13 @@ def popSummary(self): if self.summary: self.summary.show() + profile("Standby,PowerKey") import Screens.Standby from Screens.Menu import MainMenu, mdom from GlobalActions import globalActionMap + class PowerKey: """ PowerKey stuff - handles the powerkey press and powerkey release actions""" @@ -394,9 +408,11 @@ def standby(self): else: return 0 + profile("Scart") from Screens.Scart import Scart + class AutoScartControl: def __init__(self, session): self.force = False @@ -420,12 +436,14 @@ def VCRSbChanged(self, value): else: self.scartDialog.switchToTV() + profile("Load:CI") from Screens.Ci import CiHandler profile("Load:VolumeControl") from Components.VolumeControl import VolumeControl + def runScreenTest(): config.misc.startCounter.value += 1 config.misc.startCounter.save() @@ -530,6 +548,7 @@ def runNextScreen(session, screensToRun, *result): return 0 + profile("Init:skin") import skin skin.loadSkinData(enigma.getDesktop(0)) diff --git a/lib/python/Tools/ASCIItranslit.py b/lib/python/Tools/ASCIItranslit.py index 1b611368aec..f75bf6b0407 100644 --- a/lib/python/Tools/ASCIItranslit.py +++ b/lib/python/Tools/ASCIItranslit.py @@ -255,6 +255,7 @@ 0x0259: "_", 0x20AC: "EUR"} + def legacyEncode(string): string2 = "" for z, char in enumerate(string.decode("utf-8")): diff --git a/lib/python/Tools/Alternatives.py b/lib/python/Tools/Alternatives.py index 1e1328ec8c6..ef105ff8b8a 100644 --- a/lib/python/Tools/Alternatives.py +++ b/lib/python/Tools/Alternatives.py @@ -3,16 +3,19 @@ from ServiceReference import isPlayableForCur from Tools.CIHelper import cihelper + def getAlternativeChannels(service): alternativeServices = eServiceCenter.getInstance().list(eServiceReference(service)) return alternativeServices and alternativeServices.getContent("S", True) + def CompareWithAlternatives(serviceA, serviceB): return serviceA and serviceB and ( serviceA == serviceB or serviceA.startswith('1:134:') and serviceB in getAlternativeChannels(serviceA) or serviceB.startswith('1:134:') and serviceA in getAlternativeChannels(serviceB)) + def GetWithAlternative(service): if service.startswith('1:134:'): channels = getAlternativeChannels(service) @@ -20,6 +23,7 @@ def GetWithAlternative(service): return channels[0] return service + def ResolveCiAlternative(ref, ignore_ref=None, record_mode=False): if ref and isinstance(ref, eServiceReference): if ref.flags & eServiceReference.isGroup: @@ -30,6 +34,7 @@ def ResolveCiAlternative(ref, ignore_ref=None, record_mode=False): for service in serviceList.getContent("R"): if not ignore_ref or service != ignore_ref: refstr = service.toString() + def resolveRecordLiveMode(): if record_mode: is_assignment = cihelper.ServiceIsAssigned(refstr) diff --git a/lib/python/Tools/BoundFunction.py b/lib/python/Tools/BoundFunction.py index 5ce84bd19a8..11441d4cdef 100644 --- a/lib/python/Tools/BoundFunction.py +++ b/lib/python/Tools/BoundFunction.py @@ -3,6 +3,7 @@ def __init__(self, fnc, *args, **kwargs): self.fnc = fnc self.args = args self.kwargs = kwargs + def __call__(self, *args, **kwargs): newkwargs = dict(self.kwargs) newkwargs.update(kwargs) diff --git a/lib/python/Tools/CIHelper.py b/lib/python/Tools/CIHelper.py index bdafd74d3c8..f0ba18e8622 100644 --- a/lib/python/Tools/CIHelper.py +++ b/lib/python/Tools/CIHelper.py @@ -5,6 +5,7 @@ import NavigationInstance import os + class CIHelper: CI_ASSIGNMENT_LIST = None @@ -18,6 +19,7 @@ def parse_ci_assignment(self): NUM_CI = SystemInfo["CommonInterface"] if NUM_CI and NUM_CI > 0: self.CI_ASSIGNMENT_LIST = [] + def getValue(definitions, default): Len = len(definitions) return Len > 0 and definitions[Len - 1].text or default @@ -185,8 +187,10 @@ def isPlayable(self, service): return 0 return 1 + cihelper = CIHelper() + def isPlayable(service): ret = cihelper.isPlayable(service) return ret diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py index ebf9d3a977c..0a7c497b8bb 100644 --- a/lib/python/Tools/Directories.py +++ b/lib/python/Tools/Directories.py @@ -72,6 +72,7 @@ SCOPE_LIBDIR: (eEnv.resolve("${libdir}/"), PATH_DONTCREATE) } + def resolveFilename(scope, base="", path_prefix=None): # You can only use the ~/ if we have a prefix directory. if base.startswith("~/"): @@ -222,6 +223,7 @@ def itemExists(resolveList, base): path = "%s:%s" % (path, suffix) return path + def comparePath(leftPath, rightPath): if leftPath.endswith(os.sep): leftPath = leftPath[:-1] @@ -234,6 +236,7 @@ def comparePath(leftPath, rightPath): return False return True + def bestRecordingLocation(candidates): path = "" biggest = 0 @@ -251,6 +254,7 @@ def bestRecordingLocation(candidates): print "[Directories] Error %d: Couldn't get free space for '%s' (%s)" % (err.errno, candidate[1], err.strerror) return path + def defaultRecordingLocation(candidate=None): if candidate and pathExists(candidate): return candidate @@ -277,6 +281,7 @@ def defaultRecordingLocation(candidate=None): path += "/" # Bad habits die hard, old code relies on this. return path + def createDir(path, makeParents=False): try: if makeParents: @@ -287,6 +292,7 @@ def createDir(path, makeParents=False): except OSError: return 0 + def removeDir(path): try: os.rmdir(path) @@ -294,6 +300,7 @@ def removeDir(path): except OSError: return 0 + def fileExists(f, mode="r"): if mode == "r": acc_mode = os.R_OK @@ -303,9 +310,11 @@ def fileExists(f, mode="r"): acc_mode = os.F_OK return os.access(f, acc_mode) + def fileCheck(f, mode="r"): return fileExists(f, mode) and f + def fileHas(f, content, mode="r"): result = False if fileExists(f, mode): @@ -316,6 +325,7 @@ def fileHas(f, content, mode="r"): result = True return result + def getRecordingFilename(basename, dirname=None): # Filter out non-allowed characters. non_allowed_characters = "/.\\:*?<>|\"" @@ -346,6 +356,8 @@ def getRecordingFilename(basename, dirname=None): # This is clearly a hack: # + + def InitFallbackFiles(): resolveFilename(SCOPE_CONFIG, "userbouquet.favourites.tv") resolveFilename(SCOPE_CONFIG, "bouquets.tv") @@ -355,6 +367,8 @@ def InitFallbackFiles(): # Returns a list of tuples containing pathname and filename matching the given pattern # Example-pattern: match all txt-files: ".*\.txt$" # + + def crawlDirectory(directory, pattern): list = [] if directory: @@ -365,6 +379,7 @@ def crawlDirectory(directory, pattern): list.append((root, file)) return list + def copyfile(src, dst): f1 = None f2 = None @@ -400,6 +415,7 @@ def copyfile(src, dst): print "[Directories] Error %d: Obtaining stats from '%s' to '%s'! (%s)" % (err.errno, src, dst, err.strerror) return status + def copytree(src, dst, symlinks=False): names = os.listdir(src) if os.path.isdir(dst): @@ -437,6 +453,8 @@ def copytree(src, dst, symlinks=False): # Renames files or if source and destination are on different devices moves them in background # input list of (source, destination) # + + def moveFiles(fileList): errorFlag = False movedList = [] @@ -463,6 +481,7 @@ def moveFiles(fileList): print "[Directories] Error %d: Renaming '%s' to '%s'! (%s)" % (err.errno, item[1], item[0], err.strerror) print "[Directories] Failed to undo move:", item + def getSize(path, pattern=".*"): path_size = 0 if os.path.isdir(path): @@ -474,6 +493,7 @@ def getSize(path, pattern=".*"): path_size = os.path.getsize(path) return path_size + def lsof(): lsof = [] for pid in os.listdir("/proc"): @@ -487,10 +507,12 @@ def lsof(): pass return lsof + def getExtension(file): filename, extension = os.path.splitext(file) return extension + def mediafilesInUse(session): from Components.MovieList import KNOWN_EXTENSIONS files = [os.path.basename(x[2]) for x in lsof() if getExtension(x[2]) in KNOWN_EXTENSIONS] @@ -507,5 +529,7 @@ def mediafilesInUse(session): # contain spaces or other special characters. This method adjusts the # filename to be a safe and single entity for passing to a shell. # + + def shellquote(s): return "'%s'" % s.replace("'", "'\\''") diff --git a/lib/python/Tools/Downloader.py b/lib/python/Tools/Downloader.py index 02a91e0792f..281b64dcfd8 100644 --- a/lib/python/Tools/Downloader.py +++ b/lib/python/Tools/Downloader.py @@ -2,6 +2,7 @@ from twisted.internet import reactor, defer from urlparse import urlparse + class HTTPProgressDownloader(client.HTTPDownloader): def __init__(self, url, outfile, headers=None): client.HTTPDownloader.__init__(self, url, outfile, headers=headers, agent="Enigma2 HbbTV/1.1.1 (+PVR+RTSP+DL;OpenPLi;;;)") @@ -38,6 +39,7 @@ def pageEnd(self): self.end_callback() return ret + class downloadWithProgress: def __init__(self, url, outputfile, contextFactory=None, *args, **kwargs): parsed = urlparse(url) diff --git a/lib/python/Tools/FallbackTimer.py b/lib/python/Tools/FallbackTimer.py index 3edc4438c6f..8fb2b1607eb 100644 --- a/lib/python/Tools/FallbackTimer.py +++ b/lib/python/Tools/FallbackTimer.py @@ -6,6 +6,7 @@ import xml from base64 import encodestring + class FallbackTimerList(): def __init__(self, parent, fallbackFunction, fallbackFunctionNOK=None): @@ -150,6 +151,7 @@ def fallback(self, message=None): def fallbackNOK(self, answer=None): self.fallbackFunctionNOK() + class FallbackTimerDirs(FallbackTimerList): def getFallbackTimerList(self): @@ -175,6 +177,7 @@ def getcurrlocation(self, data): else: self.fallbackFunction() + class FallbackTimerClass(TimerObject): def __init__(self, service_ref="", name="", disabled=0, timebegin=0, timeend=0, duration=0, startprepare=0, diff --git a/lib/python/Tools/FuzzyDate.py b/lib/python/Tools/FuzzyDate.py index 5432eba95ac..03dc8f3e504 100644 --- a/lib/python/Tools/FuzzyDate.py +++ b/lib/python/Tools/FuzzyDate.py @@ -31,7 +31,6 @@ def FuzzyTime(t, inPast=False): return (date, timeres) - if __name__ == "__main__": def _(x): return x print "now: %s %s" % FuzzyTime(time()) diff --git a/lib/python/Tools/Geolocation.py b/lib/python/Tools/Geolocation.py index 05fb735bb64..2beb4c8a4b1 100644 --- a/lib/python/Tools/Geolocation.py +++ b/lib/python/Tools/Geolocation.py @@ -42,6 +42,7 @@ config.misc.enableGeolocation = ConfigYesNo(default=True) geolocation = {} + def InitGeolocation(): global geolocation if config.misc.enableGeolocation.value: @@ -73,6 +74,7 @@ def InitGeolocation(): geolocation = {} print "[Geolocation] Warning: Geolocation has been disabled by user configuration!" + def RefreshGeolocation(): global geolocation geolocation = {} diff --git a/lib/python/Tools/GetEcmInfo.py b/lib/python/Tools/GetEcmInfo.py index d758fa0b551..11fbe6a55aa 100644 --- a/lib/python/Tools/GetEcmInfo.py +++ b/lib/python/Tools/GetEcmInfo.py @@ -9,6 +9,7 @@ ecm = '' data = EMPTY_ECM_INFO + class GetEcmInfo: def pollEcmData(self): global data diff --git a/lib/python/Tools/HardwareInfo.py b/lib/python/Tools/HardwareInfo.py index bc6855d8ba2..32ef2f85fe6 100644 --- a/lib/python/Tools/HardwareInfo.py +++ b/lib/python/Tools/HardwareInfo.py @@ -2,6 +2,7 @@ hw_info = None + class HardwareInfo: device_name = _("unavailable") device_brandname = None diff --git a/lib/python/Tools/Hex2strColor.py b/lib/python/Tools/Hex2strColor.py index 91054bae325..9612f1daf90 100644 --- a/lib/python/Tools/Hex2strColor.py +++ b/lib/python/Tools/Hex2strColor.py @@ -6,6 +6,7 @@ # converts to: # 0 1 2 3 4 5 6 7 8 9 : ; < = > ? + def Hex2strColor(rgb): out = "" for i in range(28, -1, -4): diff --git a/lib/python/Tools/KeyBindings.py b/lib/python/Tools/KeyBindings.py index 555cfd72865..727231cbe17 100644 --- a/lib/python/Tools/KeyBindings.py +++ b/lib/python/Tools/KeyBindings.py @@ -338,9 +338,11 @@ KEYIDS["KEY_YELLOW"]: ("YELLOW",) }] + def addKeyBinding(domain, key, context, action, flags): keyBindings.setdefault((context, action), []).append((key, domain, flags)) + def removeKeyBinding(key, context, action, wild=True): if wild and action == "*": for ctx, action in keyBindings.keys(): @@ -357,12 +359,15 @@ def removeKeyBinding(key, context, action, wild=True): # Returns a list of (key, flags) for a specified action. # + + def queryKeyBinding(context, action): if (context, action) in keyBindings: return [(x[0], x[2]) for x in keyBindings[(context, action)]] else: return [] + def getKeyDescription(key): if rc_model.rcIsDefault(): idx = config.misc.rcused.value @@ -377,11 +382,14 @@ def getKeyDescription(key): idx = 2 return keyDescriptions[idx].get(key) + def getKeyBindingKeys(filterfn=lambda key: True): return filter(filterfn, keyBindings) # Remove all entries of domain "domain". # + + def removeKeyBindings(domain): for x in keyBindings: keyBindings[x] = filter(lambda e: e[1] != domain, keyBindings[x]) diff --git a/lib/python/Tools/Multiboot.py b/lib/python/Tools/Multiboot.py index ace07e94726..456f5ddafd6 100644 --- a/lib/python/Tools/Multiboot.py +++ b/lib/python/Tools/Multiboot.py @@ -4,9 +4,11 @@ import glob import tempfile + class tmp: dir = None + def getMultibootStartupDevice(): tmp.dir = tempfile.mkdtemp(prefix="Multiboot") for device in ('/dev/block/by-name/bootoptions', '/dev/mmcblk0p1', '/dev/mmcblk1p1', '/dev/mmcblk0p3', '/dev/mmcblk0p4'): @@ -19,9 +21,11 @@ def getMultibootStartupDevice(): if not os.path.ismount(tmp.dir): os.rmdir(tmp.dir) + def getparam(line, param): return line.replace("userdataroot", "rootuserdata").rsplit('%s=' % param, 1)[1].split(' ', 1)[0] + def getMultibootslots(): bootslots = {} mode12found = False @@ -55,6 +59,7 @@ def getMultibootslots(): print '[Multiboot] Bootslots found:', bootslots return bootslots + def getCurrentImage(): if SystemInfo["canMultiBoot"]: slot = [x[-1] for x in open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read().split() if x.startswith('rootsubdir')] @@ -66,9 +71,11 @@ def getCurrentImage(): if SystemInfo["canMultiBoot"][slot]['device'] == device: return slot + def getCurrentImageMode(): return bool(SystemInfo["canMultiBoot"]) and SystemInfo["canMode12"] and int(open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read().replace('\0', '').split('=')[-1]) + def deleteImage(slot): tmp.dir = tempfile.mkdtemp(prefix="Multiboot") Console().ePopen('mount %s %s' % (SystemInfo["canMultiBoot"][slot]['device'], tmp.dir)) @@ -79,6 +86,7 @@ def deleteImage(slot): if not os.path.ismount(tmp.dir): os.rmdir(tmp.dir) + def restoreImages(): for slot in SystemInfo["canMultiBoot"]: tmp.dir = tempfile.mkdtemp(prefix="Multiboot") @@ -90,6 +98,7 @@ def restoreImages(): if not os.path.ismount(tmp.dir): os.rmdir(tmp.dir) + def getImagelist(): imagelist = {} if SystemInfo["canMultiBoot"]: diff --git a/lib/python/Tools/Notifications.py b/lib/python/Tools/Notifications.py index 542e85c1764..b91680849e9 100644 --- a/lib/python/Tools/Notifications.py +++ b/lib/python/Tools/Notifications.py @@ -7,6 +7,7 @@ # notifications which are currently on screen (and might be closed by similiar notifications) current_notifications = [] + def __AddNotification(fnc, screen, id, *args, **kwargs): if ".MessageBox'>" in `screen`: kwargs["simple"] = True @@ -18,22 +19,27 @@ def __AddNotification(fnc, screen, id, *args, **kwargs): for x in notificationAdded: x() + def AddNotification(screen, *args, **kwargs): AddNotificationWithCallback(None, screen, *args, **kwargs) + def AddNotificationWithCallback(fnc, screen, *args, **kwargs): __AddNotification(fnc, screen, None, *args, **kwargs) + def AddNotificationParentalControl(fnc, screen, *args, **kwargs): RemovePopup("Parental control") __AddNotification(fnc, screen, "Parental control", *args, **kwargs) + def AddNotificationWithID(id, screen, *args, **kwargs): __AddNotification(None, screen, id, *args, **kwargs) # we don't support notifications with callback and ID as this # would require manually calling the callback on cancelled popups. + def RemovePopup(id): # remove similiar notifications print "RemovePopup, id =", id @@ -49,14 +55,17 @@ def RemovePopup(id): print "(found in current notifications)" x[1].close() + from Screens.MessageBox import MessageBox + def AddPopup(text, type, timeout, id=None): if id is not None: RemovePopup(id) print "AddPopup, id =", id AddNotificationWithID(id, MessageBox, text=text, type=type, timeout=timeout, close_on_any_key=True) + def removeCIdialog(): import NavigationInstance if NavigationInstance.instance and NavigationInstance.instance.wasTimerWakeup(): diff --git a/lib/python/Tools/Profile.py b/lib/python/Tools/Profile.py index 667c43e5d84..01f9a649aeb 100644 --- a/lib/python/Tools/Profile.py +++ b/lib/python/Tools/Profile.py @@ -28,6 +28,7 @@ except IOError: print "WARNING: couldn't open profile file!" + def profile(id): now = time.time() - profile_start if profile_file: @@ -44,6 +45,7 @@ def profile(id): except IOError: pass + def profile_final(): global profile_file if profile_file is not None: diff --git a/lib/python/Tools/StbHardware.py b/lib/python/Tools/StbHardware.py index 83f4c9284b0..2c8ff6341de 100644 --- a/lib/python/Tools/StbHardware.py +++ b/lib/python/Tools/StbHardware.py @@ -3,6 +3,7 @@ from struct import pack, unpack from time import time, localtime, gmtime + def getFPVersion(): ret = None try: @@ -18,6 +19,7 @@ def getFPVersion(): print "getFPVersion failed!" return ret + def setFPWakeuptime(wutime): try: open("/proc/stb/fp/wakeup_time", "w").write(str(wutime)) @@ -28,6 +30,7 @@ def setFPWakeuptime(wutime): except IOError: print "setFPWakeupTime failed!" + def setRTCoffset(forsleep=None): if forsleep is None: forsleep = (localtime(time()).tm_hour - gmtime(time()).tm_hour) * 3600 @@ -37,6 +40,7 @@ def setRTCoffset(forsleep=None): except IOError: print "setRTCoffset failed!" + def setRTCtime(wutime): if path.exists("/proc/stb/fp/rtc_offset"): setRTCoffset() @@ -49,6 +53,7 @@ def setRTCtime(wutime): except IOError: print "setRTCtime failed!" + def getFPWakeuptime(): ret = 0 try: @@ -61,8 +66,10 @@ def getFPWakeuptime(): print "getFPWakeupTime failed!" return ret + wasTimerWakeup = None + def getFPWasTimerWakeup(): global wasTimerWakeup if wasTimerWakeup is not None: @@ -81,6 +88,7 @@ def getFPWasTimerWakeup(): clearFPWasTimerWakeup() return wasTimerWakeup + def clearFPWasTimerWakeup(): try: open("/proc/stb/fp/was_timer_wakeup", "w").write('0') diff --git a/lib/python/Tools/TextBoundary.py b/lib/python/Tools/TextBoundary.py index a14d78e9743..e89ccf16264 100644 --- a/lib/python/Tools/TextBoundary.py +++ b/lib/python/Tools/TextBoundary.py @@ -3,5 +3,7 @@ # Calls onto the static function in eLabel. This avoids causing an invalidate # on the parent container which is detrimental to UI performance, # particularly in a complex screen like the graph EPG + + def getTextBoundarySize(instance, font, targetSize, text): return eLabel.calculateTextSize(font, text, targetSize) diff --git a/lib/python/Tools/Transponder.py b/lib/python/Tools/Transponder.py index 11f9b5ccffc..59b068a245d 100644 --- a/lib/python/Tools/Transponder.py +++ b/lib/python/Tools/Transponder.py @@ -2,9 +2,11 @@ from Components.NimManager import nimmanager from Components.config import config + def orbpos(pos): return pos > 3600 and "N/A" or "%d.%d\xc2\xb0%s" % (pos > 1800 and ((3600 - pos) / 10, (3600 - pos) % 10, "W") or (pos / 10, pos % 10, "E")) + def getTunerDescription(nim): try: return nimmanager.getTerrestrialDescription(nim) @@ -17,11 +19,14 @@ def getTunerDescription(nim): print "[Transponder] no description" return "" + def getMHz(frequency): return (frequency + 50000) / 100000 / 10. # Note: newly added region add into ImportChannels to getTerrestrialRegion() # due using for fallback tuner too + + def getChannelNumber(frequency, nim): if nim == "DVB-T": for n in nimmanager.nim_slots: @@ -52,10 +57,12 @@ def getChannelNumber(frequency, nim): return str(int(f - 526) / 7 + 28) + (d < 3 and "-" or d > 4 and "+" or "") return "" + def supportedChannels(nim): descr = getTunerDescription(nim) return "Europe" in descr and "DVB-T" in descr + def channel2frequency(channel, nim): descr = getTunerDescription(nim) if "Europe" in descr and "DVB-T" in descr: @@ -65,6 +72,7 @@ def channel2frequency(channel, nim): return (474000 + 8000 * (channel - 21)) * 1000 return 474000000 + def ConvertToHumanReadable(tp, tunertype=None): ret = {} if tunertype is None: diff --git a/lib/python/Tools/Trashcan.py b/lib/python/Tools/Trashcan.py index 6e9ac4e0b41..1049e189eb7 100644 --- a/lib/python/Tools/Trashcan.py +++ b/lib/python/Tools/Trashcan.py @@ -5,6 +5,7 @@ from Components import Harddisk from twisted.internet import threads + def getTrashFolder(path): # Returns trash folder without symlinks. Path may be file or directory or whatever. mountpoint = Harddisk.findMountPoint(os.path.realpath(path)) @@ -13,6 +14,7 @@ def getTrashFolder(path): mountpoint = movie return os.path.join(mountpoint, ".Trash") + def createTrashFolder(path): # Create and return trash folder for given file or dir trash = getTrashFolder(path) @@ -21,6 +23,7 @@ def createTrashFolder(path): os.mkdir(trash) return trash + def enumTrashFolders(): # Walk through all Trash folders. This may access network # drives and similar, so might block for minutes. @@ -34,6 +37,7 @@ def enumTrashFolders(): if os.path.isdir(result): yield result + class Trashcan: def __init__(self): self.isCleaning = False @@ -92,6 +96,7 @@ def cleanFail(self, failure): print "[Trashcan] ERROR in clean:", failure self.isCleaning = False + def purge(cleanset, ctimeLimit, reserveBytes): # Remove expired items from trash, and attempt to have # reserveBytes of free disk space. @@ -136,6 +141,7 @@ def purge(cleanset, ctimeLimit, reserveBytes): size -= st_size print "[Trashcan] Size after purging:", size, trash + def cleanAll(trash): if not os.path.isdir(trash): print "[Trashcan] No trash.", trash @@ -154,8 +160,10 @@ def cleanAll(trash): except: pass + def init(session): global instance instance.init(session) + instance = Trashcan() diff --git a/lib/python/Tools/XMLTools.py b/lib/python/Tools/XMLTools.py index cd339ad3c8e..9bea88af0fc 100644 --- a/lib/python/Tools/XMLTools.py +++ b/lib/python/Tools/XMLTools.py @@ -1,5 +1,6 @@ import re + def elementsWithTag(el, tag): """filters all elements of childNode with the specified function example: nodes = elementsWithTag(childNodes, lambda x: x == "bla")""" @@ -16,6 +17,7 @@ def elementsWithTag(el, tag): if tag(x.tagName): yield x + def mergeText(nodelist): rc = "" for node in nodelist: @@ -23,6 +25,7 @@ def mergeText(nodelist): rc = rc + node.data return rc + def stringToXML(text): illegal_xml_chars_RE = re.compile(u'[\x00-\x08\x0b\x0c\x0e-\x1F\uD800-\uDFFF\uFFFE\uFFFF]') text = illegal_xml_chars_RE.sub('', text) diff --git a/lib/python/Tools/camcontrol.py b/lib/python/Tools/camcontrol.py index eb58f301db7..5b0a0e7907f 100644 --- a/lib/python/Tools/camcontrol.py +++ b/lib/python/Tools/camcontrol.py @@ -1,9 +1,11 @@ import os import enigma + class CamControl: '''CAM convention is that a softlink named /etc/init.c/softcam.* points to the start/stop script.''' + def __init__(self, name): self.name = name self.link = '/etc/init.d/' + name diff --git a/lib/python/e2reactor.py b/lib/python/e2reactor.py index 1703ebd51f8..00bcf7c4646 100644 --- a/lib/python/e2reactor.py +++ b/lib/python/e2reactor.py @@ -26,6 +26,7 @@ POLL_DISCONNECTED = (select.POLLHUP | select.POLLERR | select.POLLNVAL) + class E2SharedPoll: def __init__(self): self.dict = {} @@ -44,8 +45,10 @@ def poll(self, timeout=None): return None return r + poller = E2SharedPoll() + class PollReactor(posixbase.PosixReactorBase): """A reactor that uses poll(2).""" @@ -67,7 +70,6 @@ def _updateRegistration(self, fd): if fd in selectables: del selectables[fd] - poller.eApp.interruptPoll() def _dictRemove(self, selectable, mdict): @@ -201,10 +203,12 @@ def callLater(self, *args, **kwargs): poller.eApp.interruptPoll() return posixbase.PosixReactorBase.callLater(self, *args, **kwargs) + def install(): """Install the poll() reactor.""" p = PollReactor() main.installReactor(p) + __all__ = ["PollReactor", "install"] diff --git a/lib/python/keyids.py b/lib/python/keyids.py index a05a4e08f5b..e5a3e4d4f42 100644 --- a/lib/python/keyids.py +++ b/lib/python/keyids.py @@ -341,6 +341,7 @@ 530: ("KEY_MOUSE", "KEY_TOUCHPAD_TOGGLE") } + def invertKeyIds(): invKeyIds = {} for key, value in KEYIDS.items(): diff --git a/lib/python/keymapparser.py b/lib/python/keymapparser.py index e877db70ed2..65d427e4bcb 100644 --- a/lib/python/keymapparser.py +++ b/lib/python/keymapparser.py @@ -6,6 +6,7 @@ # these are only informational (for help)... from Tools.KeyBindings import addKeyBinding + class KeymapError(Exception): def __init__(self, message): self.msg = message @@ -13,6 +14,7 @@ def __init__(self, message): def __str__(self): return self.msg + def getKeyId(id): if len(id) == 1: keyid = ord(id) | 0x8000 @@ -104,6 +106,7 @@ def readKeymap(filename): for device in ctrans.findall("device"): parseTrans(filename, p, device.attrib.get("name"), device) + def removeKeymap(filename): p = enigma.eActionMap.getInstance() p.unbindKeyDomain(filename) diff --git a/lib/python/skin.py b/lib/python/skin.py index 76b693fb202..92cbbabdcef 100644 --- a/lib/python/skin.py +++ b/lib/python/skin.py @@ -67,6 +67,8 @@ # SCOPE_CURRENT_LCDSKIN. The full path is NOT saved. # E.g. "MySkin/skin_display.xml" # + + def InitSkins(): global currentPrimarySkin, currentDisplaySkin runCallbacks = False @@ -110,11 +112,15 @@ def InitSkins(): # Temporary entry point for older versions of StartEnigma.py. # + + def loadSkinData(desktop): InitSkins() # Method to load a skin XML file into the skin data structures. # + + def loadSkin(filename, scope=SCOPE_SKIN, desktop=getDesktop(GUI_SKIN_ID), screenID=GUI_SKIN_ID): global windowStyles filename = resolveFilename(scope, filename) @@ -170,6 +176,7 @@ def loadSkin(filename, scope=SCOPE_SKIN, desktop=getDesktop(GUI_SKIN_ID), screen print("[Skin] Error: Unexpected error opening skin file '%s'! (%s)" % (filename, err)) return False + def reloadSkins(): domScreens.clear() colors.clear() @@ -192,10 +199,12 @@ def reloadSkins(): switchPixmap.clear() InitSkins() + def addCallback(callback): if callback not in callbacks: callbacks.append(callback) + def removeCallback(callback): if callback in self.callbacks: callbacks.remove(callback) @@ -230,6 +239,8 @@ def __str__(self): # h : Multiply by current font height. (Only to be used in elements where the font attribute is available, i.e. not "None") # f : Replace with getSkinFactor(). # + + def parseCoordinate(s, e, size=0, font=None): orig = s = s.strip() if s == "center": # For speed as this can be common case. @@ -268,6 +279,7 @@ def parseCoordinate(s, e, size=0, font=None): # print("[Skin] DEBUG: parseCoordinate s='%s', e='%s', size=%s, font='%s', val='%s'." % (s, e, size, font, val)) return val + def getParentSize(object, desktop): if object: parent = object.getParent() @@ -286,6 +298,7 @@ def getParentSize(object, desktop): return desktop.size() # Widget has no parent, use desktop size instead for relative coordinates. return eSize() + def parseValuePair(s, scale, object=None, desktop=None, size=None): x, y = s.split(",") parentsize = eSize() @@ -295,12 +308,15 @@ def parseValuePair(s, scale, object=None, desktop=None, size=None): yval = parseCoordinate(y, parentsize.height(), size and size.height() or 0) return (xval * scale[0][0] / scale[0][1], yval * scale[1][0] / scale[1][1]) + def parsePosition(s, scale, object=None, desktop=None, size=None): return ePoint(*parseValuePair(s, scale, object, desktop, size)) + def parseSize(s, scale, object=None, desktop=None): return eSize(*[max(0, x) for x in parseValuePair(s, scale, object, desktop)]) + def parseFont(s, scale=((1, 1), (1, 1))): if ";" in s: name, size = s.split(";") @@ -329,6 +345,7 @@ def parseFont(s, scale=((1, 1), (1, 1))): size = f[1] if size is None else size return gFont(name, int(size) * scale[0][0] / scale[0][1]) + def parseColor(s): if s[0] != "#": try: @@ -337,6 +354,7 @@ def parseColor(s): raise SkinError("Color '%s' must be #aarrggbb or valid named color" % s) return gRGB(int(s[1:], 0x10)) + def parseParameter(s): """This function is responsible for parsing parameters in the skin, it can parse integers, floats, hex colors, hex integers, named colors, fonts and strings.""" if s[0] == "*": # String. @@ -355,6 +373,7 @@ def parseParameter(s): else: # Integer. return parseScale(s) + def parseScale(s): orig = s try: @@ -368,6 +387,7 @@ def parseScale(s): val = 0 return val + def loadPixmap(path, desktop, width=0, height=0): option = path.find("#") if option != -1: @@ -379,6 +399,7 @@ def loadPixmap(path, desktop, width=0, height=0): raise SkinError("Pixmap file '%s' not found" % path) return pixmap + def collectAttributes(skinAttributes, node, context, skinPath=None, ignore=(), filenames=frozenset(("pixmap", "pointer", "seek_pointer", "backgroundPixmap", "selectionPixmap", "sliderPixmap", "scrollbarSliderPicture", "scrollbarbackgroundPixmap", "scrollbarBackgroundPicture"))): size = None pos = None @@ -668,14 +689,17 @@ def applySingleAttribute(guiObject, desktop, attrib, value, scale=((1, 1), (1, 1 # Is anyone still using applySingleAttribute? AttributeParser(guiObject, desktop, scale).applyOne(attrib, value) + def applyAllAttributes(guiObject, desktop, attributes, scale): AttributeParser(guiObject, desktop, scale).applyAll(attributes) + def reloadWindowStyles(): for screenID in windowStyles: desktop, screenID, domSkin, pathSkin, scope = windowStyles[screenID] loadSingleSkinData(desktop, screenID, domSkin, pathSkin, scope) + def loadSingleSkinData(desktop, screenID, domSkin, pathSkin, scope=SCOPE_CURRENT_SKIN): """Loads skin data like colors, windowstyle etc.""" assert domSkin.tag == "skin", "root element in skin must be 'skin'!" @@ -1020,6 +1044,7 @@ def parse(self, pos, size, font): pos = (self.x + parseCoordinate(pos[0], self.w, size[0], font), self.y + parseCoordinate(pos[1], self.h, size[1], font)) return (SizeTuple(pos), SizeTuple(size)) + def readSkin(screen, skin, names, desktop): if not isinstance(names, list): names = [names] @@ -1253,6 +1278,8 @@ def processPanel(widget, context): # recursively until all referenced widgets are captured. This code only performs # a simple scan of the XML and no skin processing is performed. # + + def findWidgets(name): widgetSet = set() element, path = domScreens.get(name, (None, None)) @@ -1279,6 +1306,8 @@ def findWidgets(name): # default screen resolution of HD (720p). That is the scale factor for a HD # screen will be 1. # + + def getSkinFactor(): skinfactor = getDesktop(GUI_SKIN_ID).size().height() / 720.0 # if skinfactor not in [0.8, 1, 1.5, 3, 6]: @@ -1290,6 +1319,8 @@ def getSkinFactor(): # screen will be skinned by the skin code. A return of None implies that the # code must provide its own skin for the screen to be displayed to the user. # + + def findSkinScreen(names): if not isinstance(names, list): names = [names] @@ -1299,6 +1330,7 @@ def findSkinScreen(names): return name return None + def dump(x, i=0): print(" " * i + str(x)) try: diff --git a/lib/python/timer.py b/lib/python/timer.py index a64bad791e2..9555d9e8654 100644 --- a/lib/python/timer.py +++ b/lib/python/timer.py @@ -3,6 +3,7 @@ from enigma import eTimer import datetime + class TimerEntry: StateWaiting = 0 StatePrepared = 1 @@ -131,6 +132,7 @@ def disable(self): def enable(self): self.disabled = False + class Timer: # the time between "polls". We do this because # we want to account for time jumps etc. diff --git a/po/xml2po-python3.py b/po/xml2po-python3.py index 83bf86db5ef..31e074aa559 100644 --- a/po/xml2po-python3.py +++ b/po/xml2po-python3.py @@ -14,6 +14,7 @@ class LexicalHandler: pass no_comments = True + class parseXML(ContentHandler, LexicalHandler): def __init__(self, attrlist): self.isPointsElement, self.isReboundsElement = 0, 0 @@ -36,6 +37,7 @@ def startElement(self, name, attrs): except KeyError: pass + parser = make_parser() attrlist = set() diff --git a/po/xml2po.py b/po/xml2po.py index b3be68fc6cd..1d3121ee068 100644 --- a/po/xml2po.py +++ b/po/xml2po.py @@ -13,6 +13,7 @@ class LexicalHandler: pass no_comments = True + class parseXML(ContentHandler, LexicalHandler): def __init__(self, attrlist): self.isPointsElement, self.isReboundsElement = 0, 0 @@ -34,6 +35,7 @@ def startElement(self, name, attrs): except KeyError: pass + parser = make_parser() attrlist = set() diff --git a/tests/enigma.py b/tests/enigma.py index 2ae82443841..ded736df85a 100644 --- a/tests/enigma.py +++ b/tests/enigma.py @@ -1,5 +1,6 @@ # fake-enigma + class slot: def __init__(self): self.list = [] @@ -11,6 +12,7 @@ def __call__(self): for x in self.list: x() + timers = set() import time @@ -19,6 +21,7 @@ def __call__(self): ##################### ENIGMA BASE + class eTimer: def __init__(self): self.timeout = slot() @@ -44,6 +47,7 @@ def do(self): self.next_activation += self.msec / 1000.0 self.timeout() + def runIteration(): running_timers = list(timers) assert len(running_timers), "no running timers, so nothing will ever happen!" @@ -64,12 +68,15 @@ def runIteration(): running_timers[0].do() running_timers = running_timers[1:] + stopped = False + def stop(): global stopped stopped = True + def run(duration=1000): stoptimer = eTimer() stoptimer.start(duration * 1000.0) @@ -96,6 +103,7 @@ def run(duration=1000): eListbox = None eSubtitleWidget = None + class eEPGCache: @classmethod def getInstance(self): @@ -109,10 +117,12 @@ def __init__(self): def lookupEventTime(self, ref, query): return None + eEPGCache() getBestPlayableServiceReference = None + class pNavigation: def __init__(self): self.m_event = slot() @@ -133,9 +143,11 @@ def playService(self, service): def __repr__(self): return "pNavigation" + eRCInput = None getPrevAsciiCode = None + class eServiceReference: isDirectory = 1 @@ -158,6 +170,7 @@ def toString(self): def __repr__(self): return self.toString() + class iRecordableService: def __init__(self, ref): self.ref = ref @@ -177,8 +190,10 @@ def stop(self): def __repr__(self): return "iRecordableService(%s)" % repr(self.ref) + quitMainloop = None + class eAVSwitch: @classmethod def getInstance(self): @@ -207,10 +222,12 @@ def setVideomode(self, value): def setInput(self, value): print "[eAVSwitch] wss set to %d" % value + eAVSwitch() eDVBVolumecontrol = None + class eRFmod: @classmethod def getInstance(self): @@ -239,6 +256,7 @@ def setChannel(self, value): def setFinetune(self, value): print "[eRFmod] set finetune to %d" % value + eRFmod() @@ -261,10 +279,12 @@ def setLCDContrast(self, value): def setInverted(self, value): print "[eDBoxLCD] set inverted to %d" % value + eDBoxLCD() Misc_Options = None + class eServiceCenter: @classmethod def getInstance(self): @@ -278,6 +298,7 @@ def __init__(self): def info(self, ref): return None + eServiceCenter() ##################### ENIGMA CHROOT @@ -308,6 +329,7 @@ def info(self, ref): ##################### ENIGMA ACTIONS + class eActionMap: def __init__(self): pass @@ -321,16 +343,19 @@ def init_nav(): import NavigationInstance NavigationInstance.instance = Navigation.Navigation() + def init_record_config(): print "init recording" import Components.RecordingConfig Components.RecordingConfig.InitRecordingConfig() + def init_parental_control(): print "init parental" from Components.ParentalControl import InitParentalControl InitParentalControl() + def init_all(): # this is stuff from StartEnigma.py init_nav() diff --git a/tests/events.py b/tests/events.py index abbd6a7c9b3..87a7c8d1c35 100644 --- a/tests/events.py +++ b/tests/events.py @@ -3,28 +3,34 @@ recorded_events = [] + def event(self, name, args, kwargs): global recorded_events print "*EVENT*", time.time(), self, name, args, kwargs recorded_events.append((time.time(), self, name, args, kwargs)) + def eventfnc(f): name = f.__name__ + def wrapper(self, *args, **kwargs): event(self, name, args, kwargs) return f(self, *args, **kwargs) return wrapper + def get_events(): global recorded_events r = recorded_events recorded_events = [] return r + def start_log(): global base_time base_time = time.time() + def end_log(test_name): global base_time @@ -57,6 +63,7 @@ def end_log(test_name): else: print "no test data to compare with." + def log(fnc, base_time=0, test_name="test", *args, **kwargs): import fake_time fake_time.setTime(base_time) diff --git a/tests/fake_time.py b/tests/fake_time.py index 3c77dedb060..ec35bc7e17e 100644 --- a/tests/fake_time.py +++ b/tests/fake_time.py @@ -3,29 +3,37 @@ real_time = None time_offset = 0 + def setRealtime(): global real_time real_time = time.time + def setIdealtime(): global real_time real_time = lambda: 0 + def setTime(now): global time_offset time_offset = real_time() - now + setIdealtime() setTime(0) + def my_time(): return real_time() - time_offset + time.time = my_time + def my_sleep(sleep): global time_offset time_offset -= sleep print "(faking %f seconds)" % sleep + time.sleep = my_sleep diff --git a/tests/test_timer.py b/tests/test_timer.py index d3de20c7e7a..a5d6abdccc8 100644 --- a/tests/test_timer.py +++ b/tests/test_timer.py @@ -4,6 +4,8 @@ import tests #enigma.reset() + + def test_timer(repeat=0, timer_start=3600, timer_length=1000, sim_length=86400 * 7): import NavigationInstance @@ -21,7 +23,6 @@ def test_timer(repeat=0, timer_start=3600, timer_length=1000, sim_length=86400 * t.processed_timers = [] t.timer_list = [] - # generate a timer to test import xml.etree.cElementTree import RecordTimer @@ -70,6 +71,7 @@ def test_timer(repeat=0, timer_start=3600, timer_length=1000, sim_length=86400 * if t_initial[3:6] != t_repeated[3:6]: raise tests.TestError("repeated timer time of day does not match") + # required stuff for timer (we try to keep this minimal) enigma.init_nav() enigma.init_record_config() diff --git a/tools/genmetaindex.py b/tools/genmetaindex.py index b98954d3f23..ec0194a9b2f 100644 --- a/tools/genmetaindex.py +++ b/tools/genmetaindex.py @@ -31,6 +31,7 @@ root.append(package) + def indent(elem, level=0): i = "\n" + level * "\t" if len(elem): @@ -46,6 +47,7 @@ def indent(elem, level=0): if level and (not elem.tail or not elem.tail.strip()): elem.tail = i + indent(root) ElementTree(root).write(sys.stdout) diff --git a/tools/host_tools/FormatConverter/datasource.py b/tools/host_tools/FormatConverter/datasource.py index f14e14fb693..6b519055b12 100644 --- a/tools/host_tools/FormatConverter/datasource.py +++ b/tools/host_tools/FormatConverter/datasource.py @@ -1,5 +1,6 @@ from input import inputChoices + class datasource: def __init__(self): self.clear() @@ -43,6 +44,7 @@ def addTransponder(self, satpos, transponder): if len(transponder.keys()) >= 6: self.transponderlist[satpos].append(transponder) + class genericdatasource(datasource): def __init__(self): datasource.__init__(self) diff --git a/tools/host_tools/FormatConverter/input.py b/tools/host_tools/FormatConverter/input.py index 5da79d6e30a..893044709fd 100644 --- a/tools/host_tools/FormatConverter/input.py +++ b/tools/host_tools/FormatConverter/input.py @@ -1,9 +1,11 @@ import sys + def inputText(): input = sys.stdin.readline() return input.strip() + def inputChoices(list, backcmd="b", backtext="back"): repeat = True while repeat: diff --git a/tools/host_tools/FormatConverter/lamedb.py b/tools/host_tools/FormatConverter/lamedb.py index f2f3aa743a5..94e85d29ac5 100644 --- a/tools/host_tools/FormatConverter/lamedb.py +++ b/tools/host_tools/FormatConverter/lamedb.py @@ -1,5 +1,6 @@ from datasource import datasource + class lamedb(datasource): def __init__(self, filename="lamedb"): datasource.__init__(self) diff --git a/tools/host_tools/FormatConverter/satxml.py b/tools/host_tools/FormatConverter/satxml.py index d017e79e49d..1d477e6b9c2 100644 --- a/tools/host_tools/FormatConverter/satxml.py +++ b/tools/host_tools/FormatConverter/satxml.py @@ -4,6 +4,7 @@ from xml.dom.minidom import Document from input import inputText + class satxml(datasource): def __init__(self, filename="satellites.xml"): self.filename = filename diff --git a/tools/svg2skin.py b/tools/svg2skin.py index 782840e9fa2..4010b5c0c17 100644 --- a/tools/svg2skin.py +++ b/tools/svg2skin.py @@ -13,12 +13,14 @@ from xml.sax import make_parser from xml.sax.handler import ContentHandler + def getattrs(attrs, *a): res = [] for x in a: res.append(float(attrs[x])) return res + def parsedict(attrs): if not attrs: return [] @@ -29,12 +31,15 @@ def parsedict(attrs): r[key] = val return r + def px(x): return int(float(x[:-2]) + .5) + def contains(box_o, box_i): return box_o[0] <= box_i[0] and box_o[1] <= box_i[1] and box_o[2] >= box_i[2] and box_o[3] >= box_i[3] + class parseXML(ContentHandler): def __init__(self): self.isPointsElement, self.isReboundsElement = 0, 0 @@ -79,6 +84,7 @@ def startElement(self, name, attrs): font = "" print """\t\t""" % (id, x, y, width, height, font) + parser = make_parser() contentHandler = parseXML() parser.setContentHandler(contentHandler)