PEP8: Fix whitespace
[openblackhole/openblackhole-enigma2.git] / lib / python / Plugins / Extensions / SocketMMI / SocketMMI.py
1 from Screens.Ci import MMIDialog
2 import socketmmi
3
4 class SocketMMIMessageHandler:
5         def __init__(self):
6                 self.session = None
7                 self.dlgs = { }
8                 socketmmi.getSocketStateChangedCallbackList().append(self.socketStateChanged)
9
10         def setSession(self, session):
11                 self.session = session
12
13         def connected(self):
14                 return socketmmi.getState(0)
15
16         def getName(self):
17                 return socketmmi.getName(0)
18
19         def startMMI(self):
20                 slot = 0
21                 self.dlgs[slot] = self.session.openWithCallback(self.dlgClosed, MMIDialog, slot, 2, socketmmi, _("wait for mmi..."))
22
23         def socketStateChanged(self, slot):
24                 if slot in self.dlgs:
25                         self.dlgs[slot].ciStateChanged()
26                 elif socketmmi.availableMMI(slot) == 1:
27                         if self.session:
28                                 self.dlgs[slot] = self.session.openWithCallback(self.dlgClosed, MMIDialog, slot, 3, socketmmi, _("wait for mmi..."))
29
30         def dlgClosed(self, slot):
31                 if slot in self.dlgs:
32                         del self.dlgs[slot]