[RecordTimer] fix repeat timer issue.
[vuplus_dvbapp] / lib / python / Screens / QuadPiP.py
1 from Screens.Screen import Screen
2 from enigma import ePoint, eSize, eServiceCenter, getBestPlayableServiceReference, eServiceReference
3 from Components.VideoWindow import VideoWindow
4 from Components.config import config, ConfigPosition
5
6 class QuadPiP(Screen):
7         def __init__(self, session, decoderIdx = 1, pos = None):
8                 Screen.__init__(self, session)
9                 self["video"] = VideoWindow(decoderIdx, 720, 576)
10                 self.currentService = None
11                 self.onLayoutFinish.append(self.LayoutFinished)
12                 self.decoderIdx = decoderIdx
13                 self.pos = pos
14                 self.skinName = "PictureInPicture"
15
16         def LayoutFinished(self):
17                 self["video"].instance.setAdjustPosition(False)
18                 self.onLayoutFinish.remove(self.LayoutFinished)
19                 x = self.pos[0]
20                 y = self.pos[1]
21                 w = self.pos[2]
22                 h = self.pos[3]
23
24                 if x != -1 and y != -1 and w != -1 and h != -1:
25                         self.move(x, y)
26                         self.resize(w, h)
27
28         def move(self, x, y):
29                 self.instance.move(ePoint(x, y))
30
31         def resize(self, w, h):
32                 self.instance.resize(eSize(*(w, h)))
33                 self["video"].instance.resize(eSize(*(w, h)))
34
35         def getPosition(self):
36                 return ((self.instance.position().x(), self.instance.position().y()))
37
38         def getSize(self):
39                 return (self.instance.size().width(), self.instance.size().height())
40
41         def playService(self, service, playAudio):
42                 if service and (service.flags & eServiceReference.isGroup):
43                         ref = getBestPlayableServiceReference(service, eServiceReference())
44                 else:
45                         ref = service
46                 if ref:
47                         self.pipservice = eServiceCenter.getInstance().play(ref)
48                         if self.pipservice and not self.pipservice.setTarget(self.decoderIdx):
49                                 self.setQpipMode(True, playAudio)
50                                 self.pipservice.start()
51                                 self.currentService = service
52                                 return True
53                         else:
54                                 self.pipservice = None
55                 return False
56
57         def setQpipMode(self, pipMode, playAudio):
58                 if self.pipservice:
59                         self.pipservice.setQpipMode(pipMode, playAudio)
60
61         def getCurrentService(self):
62                 return self.currentService
63