add setClock
[enigma2.git] / lib / python / Screens / InfoBar.py
index f89eba0fa85746b86366a4f3722e39b59ccf700a..e98ebbaee7c12cf40a74acd4dc8d4c96414c01d0 100644 (file)
@@ -1,12 +1,15 @@
 from Screen import Screen
 from ChannelSelection import ChannelSelection
 from Components.Clock import Clock
 from Screen import Screen
 from ChannelSelection import ChannelSelection
 from Components.Clock import Clock
+from Components.VolumeBar import VolumeBar
 from Components.ActionMap import ActionMap
 from Components.Button import Button
 from Components.ServiceName import ServiceName
 from Components.EventInfo import EventInfo
 from Components.ActionMap import ActionMap
 from Components.Button import Button
 from Components.ServiceName import ServiceName
 from Components.EventInfo import EventInfo
+from Components.ServicePosition import ServicePosition
 
 from Screens.MessageBox import MessageBox
 
 from Screens.MessageBox import MessageBox
+from Screens.MovieSelection import MovieSelection
 
 from enigma import *
 
 
 from enigma import *
 
@@ -16,12 +19,20 @@ import time
 from Menu import MainMenu, mdom
 
 class InfoBar(Screen):
 from Menu import MainMenu, mdom
 
 class InfoBar(Screen):
+       STATE_HIDDEN = 0
+       STATE_HIDING = 1
+       STATE_SHOWING = 2
+       STATE_SHOWN = 3
+       
        def __init__(self, session):
                Screen.__init__(self, session)
 
                #instantiate forever
                self.servicelist = self.session.instantiateDialog(ChannelSelection)
        def __init__(self, session):
                Screen.__init__(self, session)
 
                #instantiate forever
                self.servicelist = self.session.instantiateDialog(ChannelSelection)
+               self.volumeBar = VolumeBar()            
                
                
+               self.state = self.STATE_HIDDEN
+
                self["actions"] = ActionMap( [ "InfobarActions" ], 
                        {
                                "switchChannelUp": self.switchChannelUp,
                self["actions"] = ActionMap( [ "InfobarActions" ], 
                        {
                                "switchChannelUp": self.switchChannelUp,
@@ -29,13 +40,22 @@ class InfoBar(Screen):
                                "mainMenu": self.mainMenu,
                                "zapUp": self.zapUp,
                                "zapDown": self.zapDown,
                                "mainMenu": self.mainMenu,
                                "zapUp": self.zapUp,
                                "zapDown": self.zapDown,
+                               "volumeUp": self.volUp,
+                               "volumeDown": self.volDown,
+                               "volumeMute": self.volMute,
                                "instantRecord": self.instantRecord,
                                "hide": self.hide,
                                "instantRecord": self.instantRecord,
                                "hide": self.hide,
-                               "toggleShow": self.toggleShow
+                               "toggleShow": self.toggleShow,
+                               "showMovies": self.showMovies,
+                               "quit": self.quit
                        })
 #              self["okbutton"] = Button("mainMenu", [self.mainMenu])
                
                self["CurrentTime"] = Clock()
                        })
 #              self["okbutton"] = Button("mainMenu", [self.mainMenu])
                
                self["CurrentTime"] = Clock()
+               # ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
+               # Clock()
+
+               self["Volume"] = self.volumeBar
                
                self["ServiceName"] = ServiceName(self.session.nav)
                
                
                self["ServiceName"] = ServiceName(self.session.nav)
                
@@ -46,6 +66,8 @@ class InfoBar(Screen):
                self["Event_Next_Duration"] = EventInfo(self.session.nav, EventInfo.Next_Duration)
                
                self.recording = None
                self["Event_Next_Duration"] = EventInfo(self.session.nav, EventInfo.Next_Duration)
                
                self.recording = None
+               
+               self.pos = 0
        
        def mainMenu(self):
                print "loading mainmenu XML..."
        
        def mainMenu(self):
                print "loading mainmenu XML..."
@@ -65,10 +87,12 @@ class InfoBar(Screen):
                self.instance.hide()
 
        def toggleShow(self):
                self.instance.hide()
 
        def toggleShow(self):
-               if self.instance.isVisible():
-                       self.instance.hide()
+               if self.state == self.STATE_SHOWN:
+#                      self.instance.hide()
+                       self.startHide()
                else:
                else:
-                       self.instance.show()
+#                      self.instance.show()
+                       self.startShow()
 
        def     zapUp(self):
                self.servicelist.moveUp()
 
        def     zapUp(self):
                self.servicelist.moveUp()
@@ -77,10 +101,33 @@ class InfoBar(Screen):
        def     zapDown(self):
                self.servicelist.moveDown()
                self.servicelist.zap()
        def     zapDown(self):
                self.servicelist.moveDown()
                self.servicelist.zap()
+
+       def     volUp(self):
+               eDVBVolumecontrol.getInstance().volumeUp()
+               self.volumeBar.setValue(eDVBVolumecontrol.getInstance().getVolume())
+
+       def     volDown(self):
+               eDVBVolumecontrol.getInstance().volumeDown()
+               self.volumeBar.setValue(eDVBVolumecontrol.getInstance().getVolume())
+               
+       def startShow(self):
+               self.instance.m_animation.startMoveAnimation(ePoint(0, 600), ePoint(0, 380), 100)
+               self.state = self.STATE_SHOWN
+       
+       def startHide(self):
+               self.instance.m_animation.startMoveAnimation(ePoint(0, 380), ePoint(0, 600), 100)
+               self.state = self.STATE_HIDDEN
+
+       def     volMute(self):
+               eDVBVolumecontrol.getInstance().volumeToggleMute()
+               self.volumeBar.setValue(eDVBVolumecontrol.getInstance().getVolume())
+
+       def     quit(self):
+               quitMainloop()
                
        def instantRecord(self):
                
        def instantRecord(self):
-               self.session.open(MessageBox, "this would be an instant recording! do you really know what you're doing?!")
-               return
+               #self.session.open(MessageBox, "this would be an instant recording! do you really know what you're doing?!")
+               #return
        
                if self.recording != None:
                        print "remove entry"
        
                if self.recording != None:
                        print "remove entry"
@@ -100,4 +147,7 @@ class InfoBar(Screen):
                                                epg = ev
                        # fix me, description. 
                        self.recording = self.session.nav.recordWithTimer(time.time(), time.time() + 30, serviceref, epg, "instant record")
                                                epg = ev
                        # fix me, description. 
                        self.recording = self.session.nav.recordWithTimer(time.time(), time.time() + 30, serviceref, epg, "instant record")
+       
+       def showMovies(self):
+               self.session.open(MovieSelection)