From: Chang.H.S Date: Thu, 29 Sep 2011 05:00:00 +0000 (+0900) Subject: OSD3DSetup : Add new Plugin X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=816c83463d467f164eb91d48380b5608b8293337 OSD3DSetup : Add new Plugin --- diff --git a/configure.ac b/configure.ac index 39226dc..90ed9c5 100644 --- a/configure.ac +++ b/configure.ac @@ -215,6 +215,8 @@ lib/python/Plugins/SystemPlugins/Blindscan/Makefile lib/python/Plugins/SystemPlugins/Blindscan/meta/Makefile lib/python/Plugins/SystemPlugins/RemoteControlCode/Makefile lib/python/Plugins/SystemPlugins/RemoteControlCode/meta/Makefile +lib/python/Plugins/SystemPlugins/OSD3DSetup/Makefile +lib/python/Plugins/SystemPlugins/OSD3DSetup/meta/Makefile lib/python/Tools/Makefile lib/service/Makefile lib/components/Makefile diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index c3eda28..d31990d 100755 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -5,7 +5,7 @@ SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder \ DefaultServicesScanner NFIFlash DiseqcTester CommonInterfaceAssignment \ CrashlogAutoSubmit CleanupWizard VideoEnhancement WirelessLan NetworkWizard \ TempFanControl FactoryTest Fancontrol FPGAUpgrade WirelessLanSetup ManualFancontrol \ - Blindscan RemoteControlCode + Blindscan RemoteControlCode OSD3DSetup install_PYTHON = \ __init__.py diff --git a/lib/python/Plugins/SystemPlugins/OSD3DSetup/Makefile.am b/lib/python/Plugins/SystemPlugins/OSD3DSetup/Makefile.am new file mode 100755 index 0000000..60a1406 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/OSD3DSetup/Makefile.am @@ -0,0 +1,7 @@ +installdir = $(pkglibdir)/python/Plugins/SystemPlugins/OSD3DSetup + +SUBDIRS = meta + +install_PYTHON = \ + __init__.py \ + plugin.py diff --git a/lib/python/Plugins/SystemPlugins/OSD3DSetup/__init__.py b/lib/python/Plugins/SystemPlugins/OSD3DSetup/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/lib/python/Plugins/SystemPlugins/OSD3DSetup/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/OSD3DSetup/meta/Makefile.am new file mode 100755 index 0000000..85a9132 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/OSD3DSetup/meta/Makefile.am @@ -0,0 +1,3 @@ +installdir = $(datadir)/meta + +dist_install_DATA = plugin_osd3dsetup.xml diff --git a/lib/python/Plugins/SystemPlugins/OSD3DSetup/meta/plugin_osd3dsetup.xml b/lib/python/Plugins/SystemPlugins/OSD3DSetup/meta/plugin_osd3dsetup.xml new file mode 100755 index 0000000..6a2b58a --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/OSD3DSetup/meta/plugin_osd3dsetup.xml @@ -0,0 +1,16 @@ + + + + + + hschang + OSD3DSetup + enigma2-plugin-systemplugins-osd3dsetup + Adjust 3D settings + Adjust 3D settings + + + + + + diff --git a/lib/python/Plugins/SystemPlugins/OSD3DSetup/plugin.py b/lib/python/Plugins/SystemPlugins/OSD3DSetup/plugin.py new file mode 100755 index 0000000..67ef166 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/OSD3DSetup/plugin.py @@ -0,0 +1,119 @@ +from Screens.Screen import Screen +from Components.ConfigList import ConfigListScreen +from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSelection, ConfigSlider, getConfigListEntry +from Components.Sources.StaticText import StaticText + +modelist = {"off": _("Off"), "auto": _("Auto"), "sidebyside": _("Side by Side"), "topandbottom": _("Top and Bottom")} +setmodelist = {"mode1": _("Mode 1"), "mode2": _("Mode 2")} + +config.plugins.OSD3DSetup = ConfigSubsection() +config.plugins.OSD3DSetup.mode = ConfigSelection(choices = modelist, default = "auto") +config.plugins.OSD3DSetup.znorm = ConfigInteger(default = 0) +config.plugins.OSD3DSetup.setmode = ConfigSelection(choices = setmodelist, default = "mode1") + +class OSD3DSetupScreen(Screen, ConfigListScreen): + skin = """ + + + + + + + """ + + def __init__(self, session): + self.skin = OSD3DSetupScreen.skin + Screen.__init__(self, session) + + from Components.ActionMap import ActionMap + from Components.Button import Button + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + self["actions"] = ActionMap(["SetupActions", "ColorActions"], + { + "ok": self.keyGo, + "save": self.keyGo, + "cancel": self.keyCancel, + "green": self.keyGo, + "red": self.keyCancel, + }, -2) + + self.list = [] + ConfigListScreen.__init__(self, self.list, session = self.session) + + mode = config.plugins.OSD3DSetup.mode.value + znorm = config.plugins.OSD3DSetup.znorm.value + setmode = config.plugins.OSD3DSetup.setmode.value + + self.mode = ConfigSelection(choices = modelist, default = mode) + self.znorm = ConfigSlider(default = znorm + 50, increment = 1, limits = (0, 100)) + self.setmode = ConfigSelection(choices = setmodelist, default = setmode) + self.list.append(getConfigListEntry(_("Setup mode"), self.setmode)) + self.list.append(getConfigListEntry(_("3d mode"), self.mode)) + self.list.append(getConfigListEntry(_("Depth"), self.znorm)) + self["config"].list = self.list + self["config"].l.setList(self.list) + + def keyLeft(self): + ConfigListScreen.keyLeft(self) + self.setPreviewSettings() + + def keyRight(self): + ConfigListScreen.keyRight(self) + self.setPreviewSettings() + + def setPreviewSettings(self): + applySettings(self.mode.value, int(self.znorm.value) - 50, self.setmode.value) + + def keyGo(self): + config.plugins.OSD3DSetup.mode.value = self.mode.value + config.plugins.OSD3DSetup.znorm.value = int(self.znorm.value) - 50 + config.plugins.OSD3DSetup.setmode.value = self.setmode.value + config.plugins.OSD3DSetup.save() + self.close() + + def keyCancel(self): + setConfiguredSettings() + self.close() + +def applySettings(mode, znorm, setmode): + try: + if setmode == "mode1": + file = open("/proc/stb/fb/3dmode", "w") + file.write(mode) + file.close() + file = open("/proc/stb/fb/znorm", "w") + file.write('%d' % znorm) + file.close() + elif setmode == "mode2": + file = open("/proc/stb/fb/primary/3d","w") + if mode == "sidebyside" : + mode = "sbs" + elif mode == "topandbottom": + mode = "tab" + file.write(mode) + file.close() + file = open("/proc/stb/fb/primary/zoffset","w") + file.write('%d' % znorm) + file.close() + except: + return + +def setConfiguredSettings(): + applySettings(config.plugins.OSD3DSetup.mode.value, + int(config.plugins.OSD3DSetup.znorm.value), config.plugins.OSD3DSetup.setmode.value) + +def main(session, **kwargs): + session.open(OSD3DSetupScreen) + +def startup(reason, **kwargs): + setConfiguredSettings() + +def Plugins(**kwargs): + from os import path + if path.exists("/proc/stb/fb/3dmode") or path.exists("/proc/stb/fb/primary/3d"): + from Plugins.Plugin import PluginDescriptor + return [PluginDescriptor(name = "OSD 3D setup", description = _("Adjust 3D settings"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main), + PluginDescriptor(name = "OSD 3D setup", description = "", where = PluginDescriptor.WHERE_SESSIONSTART, fnc = startup)] + return []