better fix for previous commit
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 3 Apr 2007 18:03:10 +0000 (18:03 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 3 Apr 2007 18:03:10 +0000 (18:03 +0000)
store last entered begin time in multi epg

lib/python/Screens/EpgSelection.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/TimeDateInput.py

index 0483f98..3103bfa 100644 (file)
@@ -1,4 +1,5 @@
 from Screen import Screen
 from Screen import Screen
+from Components.config import config, ConfigClock
 from Components.Button import Button
 from Components.Pixmap import Pixmap
 from Components.Label import Label
 from Components.Button import Button
 from Components.Pixmap import Pixmap
 from Components.Label import Label
@@ -17,6 +18,8 @@ from time import localtime, time
 
 import xml.dom.minidom
 
 
 import xml.dom.minidom
 
+mepg_config_initialized = False
+
 class EPGSelection(Screen):
        def __init__(self, session, service, zapFunc=None, eventid=None, bouquetChangeCB=None):
                Screen.__init__(self, session)
 class EPGSelection(Screen):
        def __init__(self, session, service, zapFunc=None, eventid=None, bouquetChangeCB=None):
                Screen.__init__(self, session)
@@ -90,7 +93,11 @@ class EPGSelection(Screen):
 
        def enterDateTime(self):
                if self.type == EPG_TYPE_MULTI:
 
        def enterDateTime(self):
                if self.type == EPG_TYPE_MULTI:
-                       self.session.openWithCallback(self.onDateTimeInputClosed, TimeDateInput)
+                       global mepg_config_initialized
+                       if not mepg_config_initialized:
+                               config.misc.prev_mepg_time=ConfigClock(default = time())
+                               mepg_config_initialized = True
+                       self.session.openWithCallback(self.onDateTimeInputClosed, TimeDateInput, config.misc.prev_mepg_time )
 
        def onDateTimeInputClosed(self, ret):
                if len(ret) > 1:
 
        def onDateTimeInputClosed(self, ret):
                if len(ret) > 1:
index 0d571fd..f114192 100644 (file)
@@ -83,11 +83,10 @@ class InfoBarShowHide:
                
                self.onShow.append(self.__onShow)
                self.onHide.append(self.__onHide)
                
                self.onShow.append(self.__onShow)
                self.onHide.append(self.__onHide)
+               self.current_begin_time=0
 
        def __eventInfoChanged(self):
 
        def __eventInfoChanged(self):
-               ref = self.session.nav.getCurrentlyPlayingServiceReference()
-               service_type = ref and ref.type
-               if service_type and service_type == eServiceReference.idDVB and not len(ref.getPath()):
+               if self.execing:
                        service = self.session.nav.getCurrentService()
                        old_begin_time = self.current_begin_time
                        info = service and service.info()
                        service = self.session.nav.getCurrentService()
                        old_begin_time = self.current_begin_time
                        info = service and service.info()
@@ -98,11 +97,9 @@ class InfoBarShowHide:
                                        self.doShow()
 
        def __serviceStarted(self):
                                        self.doShow()
 
        def __serviceStarted(self):
-               self.current_begin_time=0
-               if config.usage.show_infobar_on_zap.value:
-                       ref = self.session.nav.getCurrentlyPlayingServiceReference()
-                       ref_type = ref and ref.type
-                       if ref_type and ref_type == eServiceReference.idDVB and not len(ref.getPath()):
+               if self.execing:
+                       self.current_begin_time=0
+                       if config.usage.show_infobar_on_zap.value:
                                self.doShow()
 
        def __onShow(self):
                                self.doShow()
 
        def __onShow(self):
index 6cdc621..c50d819 100644 (file)
@@ -9,15 +9,14 @@ import time
 import datetime
 
 class TimeDateInput(Screen, ConfigListScreen):
 import datetime
 
 class TimeDateInput(Screen, ConfigListScreen):
-       def __init__(self, session):
+       def __init__(self, session, config_time=None, config_date=None):
                Screen.__init__(self, session)
                Screen.__init__(self, session)
-
                self["oktext"] = Label(_("OK"))
                self["canceltext"] = Label(_("Cancel"))
                self["ok"] = Pixmap()
                self["cancel"] = Pixmap()
 
                self["oktext"] = Label(_("OK"))
                self["canceltext"] = Label(_("Cancel"))
                self["ok"] = Pixmap()
                self["cancel"] = Pixmap()
 
-               self.createConfig()
+               self.createConfig(config_date, config_time)
 
                self["actions"] = NumberActionMap(["SetupActions"],
                {
 
                self["actions"] = NumberActionMap(["SetupActions"],
                {
@@ -30,10 +29,18 @@ class TimeDateInput(Screen, ConfigListScreen):
                ConfigListScreen.__init__(self, self.list)
                self.createSetup(self["config"])
 
                ConfigListScreen.__init__(self, self.list)
                self.createSetup(self["config"])
 
-       def createConfig(self):
-               nowtime = time.time()
-               self.timeinput_date = ConfigDateTime(default = nowtime, formatstring = _("%d.%B %Y"), increment = 86400)
-               self.timeinput_time = ConfigClock(default = nowtime)
+       def createConfig(self, conf_date, conf_time):
+               self.save_mask = 0
+               if conf_time:
+                       self.save_mask |= 1
+               else:
+                       conf_time = ConfigClock(default = time.time()),
+               if conf_date:
+                       self.save_mask |= 2
+               else:
+                       conf_date = ConfigDateTime(default = time.time(), formatstring = _("%d.%B %Y"), increment = 86400)
+               self.timeinput_date = conf_date
+               self.timeinput_time = conf_time
 
        def createSetup(self, configlist):
                self.list = []
 
        def createSetup(self, configlist):
                self.list = []
@@ -52,7 +59,15 @@ class TimeDateInput(Screen, ConfigListScreen):
 
        def keyGo(self):
                time = self.getTimestamp(self.timeinput_date.value, self.timeinput_time.value)
 
        def keyGo(self):
                time = self.getTimestamp(self.timeinput_date.value, self.timeinput_time.value)
+               if self.save_mask & 1:
+                       self.timeinput_time.save()
+               if self.save_mask & 2:
+                       self.timeinput_date.save()
                self.close((True, time))
 
        def keyCancel(self):
                self.close((True, time))
 
        def keyCancel(self):
+               if self.save_mask & 1:
+                       self.timeinput_time.cancel()
+               if self.save_mask & 2:
+                       self.timeinput_date.cancel()
                self.close((False,))
                self.close((False,))