show used dvb system in tuner info dialog (dvb-s / dvb-s2)
[enigma2.git] / lib / python / Screens / MessageBox.py
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
8
9 class MessageBox(Screen):
10         TYPE_YESNO = 0
11         TYPE_INFO = 1
12         TYPE_WARNING = 2
13         TYPE_ERROR = 3
14         
15         def __init__(self, session, text, type = TYPE_YESNO):
16                 self.type = type
17                 Screen.__init__(self, session)
18                 
19                 self["text"] = Label(text)
20                 
21                 self["ErrorPixmap"] = Pixmap()
22                 self["QuestionPixmap"] = Pixmap()
23                 self["InfoPixmap"] = Pixmap()
24                 
25                 self.list = []
26                 if type != self.TYPE_ERROR:
27                         self["ErrorPixmap"].hide()
28                 if type != self.TYPE_YESNO:
29                         self["QuestionPixmap"].hide()
30                 if type != self.TYPE_INFO:
31                         self["InfoPixmap"].hide()
32                         
33                 if type == self.TYPE_YESNO:
34                         self.list = [ (_("yes"), 0), (_("no"), 1) ]
35
36
37                 self["list"] = MenuList(self.list)
38                 
39                 self["actions"] = ActionMap(["MsgBoxActions"], 
40                         {
41                                 "cancel": self.cancel,
42                                 "ok": self.ok,
43                                 "alwaysOK": self.alwaysOK
44                         })
45                         
46         
47         def cancel(self):
48                 self.close(False)
49         
50         def ok(self):
51                 if self.type == self.TYPE_YESNO:
52                         self.close(self["list"].getCurrent()[1] == 0)
53                 else:
54                         self.close(True)
55
56         def alwaysOK(self):
57                 self.close(True)