Hi all!
I want to append a third button the messagebox class. I cloned the original Messagebox class and added some additional code (see below), but the buttons are not displayed when the messagebox is shown. Buttons of Messageboxes with usual types like TYPE_YESNO are displayed correctly.
Here is my class:
Python
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.Sources.StaticText import StaticText
from Components.MenuList import MenuList
from enigma import eTimer
class MessageBox(Screen):
TYPE_YESNO = 0
TYPE_INFO = 1
TYPE_WARNING = 2
TYPE_ERROR = 3
TYPE_YESNOCANCEL = 4
def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True):
self.type = type
Screen.__init__(self, session)
[...] same as the original
if type == self.TYPE_YESNOCANCEL:
print "MessageBoxSlim: in __init__"
if default == 1:
self.list = [ (_("yes"), 0), (_("no"), 1), (_("yes"), 2) ]
elif default == 2:
self.list = [ (_("no"), 1), (_("yes"), 0), (_("yes"), 2) ]
else:
self.list = [ (_("yes"), 2), (_("yes"), 0), (_("no"), 1) ]
[...] all the same ...
def initTimeout(self, timeout):
[...] original
def __onShown(self):
[...] original
def startTimer(self):
[...] original
def stopTimer(self):
[...] original
def timerTick(self):
[...] original
def timeoutCallback(self):
[...] original
def cancel(self):
[...] original
def ok(self):
if self.type == self.TYPE_YESNO:
self.close(self["list"].getCurrent()[1] == 0)
elif self.type == self.TYPE_YESNOCANCEL:
self.close(self["list"].getCurrent()[1])
else:
self.close(True)
def alwaysOK(self):
[...] original
def up(self):
[...] original
def down(self):
[...] original
def left(self):
[...] original
def right(self):
[...] original
def move(self, direction):
[...] original
def __repr__(self):
[...] original
Alles anzeigen
Do you have any ideas?
P.S.: I invoke this MessageBox by calling
from Screens.MyCustomMessageBox import MessageBox
[...]
Tools.Notifications.AddNotificationWithCallback(self.retHandler, MessageBox, text, 4, duration, default = False)