b884d537ebb77563db1d5c50db846a369f6d7907
[openblackhole/openblackhole-enigma2.git] / lib / python / Components / Renderer / Pig.py
1 ##
2 ## P(icture)i(n)g(raphics) renderer
3 ##
4 from Renderer import Renderer
5 from enigma import eVideoWidget, eSize, eRect, ePoint, getDesktop
6 from Screens.PictureInPicture import PipPigMode
7 from Components.config import config
8
9 class Pig(Renderer):
10         def __init__(self):
11                 Renderer.__init__(self)
12                 self.Position = self.Size = None
13
14         GUI_WIDGET = eVideoWidget
15
16         def postWidgetCreate(self, instance):
17                 desk = getDesktop(0)
18                 instance.setDecoder(0)
19                 instance.setFBSize(desk.size())
20
21         def applySkin(self, desktop, parent):
22                 ret = Renderer.applySkin(self, desktop, parent)
23                 if ret:
24                         self.Position = self.instance.position()
25                         self.Size = self.instance.size()
26                 return ret
27
28         def onShow(self):
29                 if self.instance:
30                         if self.Size:
31                                 self.instance.resize(self.Size)
32                         if self.Position:
33                                 self.instance.move(self.Position)
34                         config.skin.hide_pip_when_pig.value and PipPigMode(True)
35
36         def onHide(self):
37                 if self.instance:
38                         self.preWidgetRemove(self.instance)
39                         config.skin.hide_pip_when_pig.value and PipPigMode(False)