From: Stefan Pluecken Date: Thu, 2 Mar 2006 00:53:47 +0000 (+0000) Subject: better resizing X-Git-Tag: 2.6.0~3941 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/4ad28359f1e3090e963e1a8083c34c0940d0514d?ds=sidebyside better resizing --- diff --git a/data/skin.xml b/data/skin.xml index 4367b413..2d920f84 100644 --- a/data/skin.xml +++ b/data/skin.xml @@ -347,7 +347,7 @@ - + # this should be factored out into some helper code, but currently demonstrates applets. from enigma import eSize, ePoint @@ -358,11 +358,14 @@ textsize = self["text"].getSize() # y size still must be fixed in font stuff... textsize = (textsize[0] + 50, textsize[1] + 50) -offset = 60 +count = len(self.list) +if count > 6: + count = 6 +offset = 30 * count wsizex = textsize[0] + 60 wsizey = textsize[1] + offset -if (280 > wsizex): - wsizex = 280 +if (400 > wsizex): + wsizex = 400 wsize = (wsizex, wsizey) @@ -373,7 +376,7 @@ self.instance.resize(eSize(*wsize)) self["text"].instance.resize(eSize(*textsize)) # move list -listsize = (wsizex, 50) +listsize = (wsizex, 30 * len(self.list)) self["list"].instance.move(ePoint(0, textsize[1])) self["list"].instance.resize(eSize(*listsize)) diff --git a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py index d4d24f32..c4e28fea 100644 --- a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py @@ -69,7 +69,7 @@ class Test(Screen): self["text"].number(number) def main(session): - session.openWithCallback(test, ChoiceBox, title="Hallo", list=[(_("yes"), "yes"), (_("no"), "no")]) + session.openWithCallback(test, ChoiceBox, title="Delete everything on this Dreambox?", list=[(_("yes"), "yes"), (_("no"), "no"), (_("perhaps"), "perhaps"), (_("ask me tomorrow"), "ask me tomorrow"), (_("leave me alone with this s§&$!"), "yes")]) def test(returnValue): print "You entered", returnValue diff --git a/lib/python/Screens/ChoiceBox.py b/lib/python/Screens/ChoiceBox.py index 533e78d0..cc6afb1c 100644 --- a/lib/python/Screens/ChoiceBox.py +++ b/lib/python/Screens/ChoiceBox.py @@ -9,11 +9,12 @@ from Components.GUIComponent import * import os class ChoiceBox(Screen): - def __init__(self, session, title = "", **kwargs): + def __init__(self, session, title = "", list = []): Screen.__init__(self, session) self["text"] = Label(title) - self["list"] = MenuList(**kwargs) + self.list = list + self["list"] = MenuList(list) self["actions"] = NumberActionMap(["WizardActions", "InputActions"], {