add extension to swap picture in picture with big picture
[enigma2.git] / lib / python / Screens / PictureInPicture.py
1 from Screens.Screen import Screen
2 from enigma import ePoint, eSize, eServiceCenter
3
4 from Components.VideoWindow import VideoWindow
5
6 class PictureInPicture(Screen):
7         def __init__(self, session):
8                 Screen.__init__(self, session)
9                 
10                 self["video"] = VideoWindow()
11                 self.currentService = None
12
13         def move(self, x, y):
14                 print "moving pip to", str(x) + ":" + str(y)
15                 self.instance.move(ePoint(x, y))
16                 
17         def resize(self, w, h):
18                 print "resizing pip to", str(w) + "x" + str(h)
19                 self.instance.resize(eSize(*(w, h)))
20                 self["video"].instance.resize(eSize(*(w, h)))
21                 
22         def getPosition(self):
23                 return ((self.instance.position().x(), self.instance.position().y()))
24                 
25         def getSize(self):
26                 return (self.instance.size().width(), self.instance.size().height())
27                 
28         def playService(self, service):
29                 self.pipservice = eServiceCenter.getInstance().play(service)
30                 if self.pipservice and not self.pipservice.setTarget(1):
31                         self.pipservice.start()
32                         self.currentService = service
33                         return True
34                 else:
35                         self.pipservice = None
36                         return False
37                 
38         def getCurrentService(self):
39                 return self.currentService
40