1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.Label import Label
4 from Components.Button import Button
5 from Components.Pixmap import Pixmap
6 from Components.MenuList import MenuList
7 from enigma import eSize, ePoint
9 class MessageBox(Screen):
15 def __init__(self, session, text, type = TYPE_YESNO):
17 Screen.__init__(self, session)
19 self["text"] = Label(text)
21 self["ErrorPixmap"] = Pixmap()
22 self["QuestionPixmap"] = Pixmap()
25 if type != self.TYPE_ERROR:
26 self.onShown.append(self["ErrorPixmap"].hideWidget)
27 elif type != self.TYPE_YESNO:
28 self.onShown.append(self["QuestionPixmap"].hideWidget)
30 if type == self.TYPE_YESNO:
31 self.list = [ (_("yes"), 0), (_("no"), 1) ]
34 self["list"] = MenuList(self.list)
36 self["actions"] = ActionMap(["MsgBoxActions"],
38 "cancel": self.cancel,
40 "alwaysOK": self.alwaysOK
48 if self.type == self.TYPE_YESNO:
49 self.close(self["list"].getCurrent()[1] == 0)