minimally improved LCD support
authorFelix Domke <tmbinc@elitedvb.net>
Thu, 2 Mar 2006 02:14:10 +0000 (02:14 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Thu, 2 Mar 2006 02:14:10 +0000 (02:14 +0000)
21 files changed:
lib/gui/epixmap.cpp
lib/gui/ewidget.h
lib/gui/ewindow.cpp
lib/gui/ewindow.h
lib/python/Components/Clock.py
lib/python/Components/GUIComponent.py
lib/python/Components/GUISkin.py
lib/python/Components/MenuList.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/EventView.py
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/LanguageSelection.py
lib/python/Screens/Makefile.am
lib/python/Screens/Menu.py
lib/python/Screens/PluginBrowser.py
lib/python/Screens/Screen.py
lib/python/Screens/__init__.py
main/enigma.cpp
mytest.py
skin.py

index 70ea9d6a7b099c950fd21ec49950ad139d4506ed..4e15b4eb5ba85c956b149348c0596be040381ced 100644 (file)
@@ -29,8 +29,8 @@ void ePixmap::setPixmapFromFile(const char *filename)
                return;
        }
        
-               // TODO
-       getDesktop()->makeCompatiblePixmap(*m_pixmap);
+               // TODO: This only works for desktop 0
+       getDesktop(0)->makeCompatiblePixmap(*m_pixmap);
        event(evtChangedPixmap);
 }
 
index 6739f25e35ed28dbd34db83d13106782c58ef855..3ddfdc263cc02a565c84f7598eb42f5371067c88 100644 (file)
@@ -113,6 +113,6 @@ public:
        void setFocus(eWidget *focus);
 };
 
-extern eWidgetDesktop *getDesktop();
+extern eWidgetDesktop *getDesktop(int which);
 
 #endif
index f8984729913c3cfc52365ac334e24240a74390bf..112b82d74bb7cf84710cb5157d5ab836b6f25152 100644 (file)
@@ -9,6 +9,7 @@
 eWindow::eWindow(eWidgetDesktop *desktop, int z): eWidget(0)
 {
        m_flags = 0;
+       m_desktop = desktop;
                /* ask style manager for current style */
        ePtr<eWindowStyleManager> mgr;
        eWindowStyleManager::getInstance(mgr);
@@ -34,7 +35,7 @@ eWindow::eWindow(eWidgetDesktop *desktop, int z): eWidget(0)
 
 eWindow::~eWindow()
 {
-       getDesktop()->removeRootWidget(this);
+       m_desktop->removeRootWidget(this);
        m_child->destruct();
 }
 
index d36d912401a5e85e739426c3c2d227a2f0e29fb0..bb7f771cc57a72b2e921c69c44a3248afb51c954 100644 (file)
@@ -32,6 +32,7 @@ private:
        std::string m_title;
        eWidget *m_child;
        int m_flags;
+       eWidgetDesktop *m_desktop;
 };
 
 #endif
index e2d9d5f5605862a9dfbf6434e90e285bc4e85b50..982d1c4a6f11fb951784213b2659d9248a888be3 100644 (file)
@@ -20,7 +20,12 @@ class Clock(HTMLComponent, GUIComponent, VariableText):
                
                self.clockTimer = eTimer()
                self.clockTimer.timeout.get().append(self.doClock)
+
+       def onShow(self):               
                self.clockTimer.start(1000)
+       
+       def onHide(self):
+               self.clockTimer.stop()
 
 # "funktionalitaet"    
        def doClock(self):
@@ -39,4 +44,3 @@ class Clock(HTMLComponent, GUIComponent, VariableText):
 # ...und als HTML:
        def produceHTML(self):
                return self.getText()
-               
index 1476ba8393b02f0f6ae2da89916df7cff74acb96..493df681482f4fd96c3acb4c625d2770dbbc511d 100644 (file)
@@ -18,6 +18,12 @@ class GUIComponent:
        def execEnd(self):
                pass
        
+       def onShow(self):
+               pass
+
+       def onHide(self):
+               pass
+       
        # this works only with normal widgets - if you don't have self.instance, override this.
        def applySkin(self, desktop):
                if self.state == self.HIDDEN:
index f97dd8bd9809dbf6f02034be68f0da1d2a193782..3aa9c851bde96f8bbfe969fefa610caa9d89d2f6 100644 (file)
@@ -6,7 +6,7 @@ class GUISkin:
 
        def __init__(self):
                self.onLayoutFinish = [ ]
-               pass
+               self.summaries = [ ]
 
        def createGUIScreen(self, parent, desktop):
                for (name, val) in self.items():
@@ -32,3 +32,19 @@ class GUISkin:
 
        def close(self):
                self.deleteGUIScreen()
+
+       def createSummary(self):
+               return None
+
+       def addSummary(self, summary):
+               self.summaries.append(summary)
+
+       def removeSummary(self, summary):
+               self.summaries.remove(summary)
+
+       def setTitle(self, title):
+               self.instance.setTitle(title)
+               self.title = title
+               
+               for x in self.summaries:
+                       x.setTitle(title)
index 03e6be6dcce65026bb74392a4ae920941be73df1..4089809569330faf089f47bc6eedb06ee9f35638 100644 (file)
@@ -9,6 +9,7 @@ class MenuList(HTMLComponent, GUIComponent):
                self.list = list
                self.l = eListboxPythonStringContent()
                self.l.setList(self.list)
+               self.onSelectionChanged = [ ]
        
        def getCurrent(self):
                return self.l.getCurrentSelection()
@@ -16,9 +17,12 @@ class MenuList(HTMLComponent, GUIComponent):
        def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
+               self.instance.selectionChanged.get().append(self.selectionChanged)
        
        def GUIdelete(self):
                self.instance.setContent(None)
                self.instance = None
 
-
+       def selectionChanged(self):
+               for f in self.onSelectionChanged:
+                       f()
index c7c1b968edaa87d72207f6071fdf9116d5fbe4b0..40868e870ad3f93f155943bef82f91890a7648fe 100644 (file)
@@ -272,7 +272,7 @@ class ChannelSelectionEdit:
                        new_title += ' ' + _("[bouquet edit]")
                else:
                        new_title += ' ' + _("[favourite edit]")
-               self.instance.setTitle(new_title)
+               self.setTitle(new_title)
                self.bouquet_mark_edit = True
                self.__marked = self.servicelist.getRootServices()
                for x in self.__marked:
@@ -300,7 +300,7 @@ class ChannelSelectionEdit:
                self.clearMarks()
                self.bouquet_mark_edit = False
                self.mutableList = None
-               self.instance.setTitle(self.saved_title)
+               self.setTitle(self.saved_title)
                self.saved_title = None
                self.servicePath = self.savedPath[:]
                del self.savedPath
@@ -346,7 +346,7 @@ class ChannelSelectionEdit:
                        self.pathChangedDisabled = False # re-enable path change
                        self.mutableList.flushChanges() # FIXME add check if changes was made
                        self.mutableList = None
-                       self.instance.setTitle(self.saved_title)
+                       self.setTitle(self.saved_title)
                        self.saved_title = None
                        if self.getRoot() == self.bouquet_root:
                                self.bouquetNumOffsetCache = { }
@@ -358,7 +358,7 @@ class ChannelSelectionEdit:
                        new_title = self.saved_title
                        pos = self.saved_title.find(')')
                        new_title = self.saved_title[:pos+1] + ' ' + _("[move mode]") + self.saved_title[pos+1:]
-                       self.instance.setTitle(new_title);
+                       self.setTitle(new_title);
 
        def handleEditCancel(self):
                if self.movemode: #movemode active?
@@ -487,7 +487,7 @@ class ChannelSelectionBase(Screen):
                if pos != -1:
                        title = title[:pos]
                title += " (TV)"
-               self.instance.setTitle(title)
+               self.setTitle(title)
 
        def setRadioMode(self):
                self.mode = MODE_RADIO
@@ -498,7 +498,7 @@ class ChannelSelectionBase(Screen):
                if pos != -1:
                        title = title[:pos]
                title += " (Radio)"
-               self.instance.setTitle(title)
+               self.setTitle(title)
 
        def setRoot(self, root, justSet=False):
                path = root.getPath()
@@ -559,7 +559,7 @@ class ChannelSelectionBase(Screen):
                                                titleStr += '/'
                                        nameStr = self.getServiceName(end_ref)
                                        titleStr += nameStr
-                               self.instance.setTitle(titleStr)
+                               self.setTitle(titleStr)
 
        def moveUp(self):
                self.servicelist.moveUp()
@@ -1043,7 +1043,7 @@ class SimpleChannelSelection(ChannelSelectionBase):
                        })
 
        def __onExecCallback(self):
-               self.session.currentDialog.instance.setTitle(self.title)
+               self.setTitle(self.title)
                self.setModeTv()
 
        def channelSelected(self): # just return selected service
index 01695dfbb517c1c18797f8c5e7b884edfe2954c2..ef3786c5e5604d814eeb22d7f847eacc1905da1b 100644 (file)
@@ -82,7 +82,7 @@ class EventViewBase:
                        if len(text) > 0:
                                text = text + '\n\n'
                        text = text + ext
-               self.session.currentDialog.instance.setTitle(event.getEventName())
+               self.setTitle(event.getEventName())
                self["epg_description"].setText(text)
                self["datetime"].setText(event.getBeginTimeString())
                self["duration"].setText(_("%d min")%(event.getDuration()/60))
index cfc35294f3506a7b08d79bd45ac86694cd86e41c..d60725f235f47b118363f2e21d0771152bc3d4a3 100644 (file)
@@ -16,7 +16,8 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \
        InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarSeek, InfoBarInstantRecord, \
        InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
        InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift,  \
-       InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView
+       InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
+       InfoBarSummarySupport
 
 from Screens.HelpMenu import HelpableScreen, HelpMenu
 
@@ -24,11 +25,12 @@ from enigma import *
 
 import time
 
-class InfoBar(Screen, InfoBarShowHide, InfoBarPowerKey,
+class InfoBar(InfoBarShowHide, InfoBarPowerKey,
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG,
        InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, 
        HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
-       InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek):
+       InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
+       InfoBarSummarySupport, Screen):
 
        def __init__(self, session):
                Screen.__init__(self, session)
@@ -44,7 +46,7 @@ class InfoBar(Screen, InfoBarShowHide, InfoBarPowerKey,
                                InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \
                                InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
                                InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
-                               InfoBarTuner, InfoBarTimeshift, InfoBarSeek:
+                               InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport:
                        x.__init__(self)
 
                self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")]))
@@ -66,7 +68,8 @@ class InfoBar(Screen, InfoBarShowHide, InfoBarPowerKey,
 class MoviePlayer(Screen, InfoBarShowHide, InfoBarPowerKey, \
                InfoBarMenu, \
                InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
-               InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView):
+               InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
+               InfoBarSummarySupport):
                
        def __init__(self, session, service):
                Screen.__init__(self, session)
@@ -79,7 +82,8 @@ class MoviePlayer(Screen, InfoBarShowHide, InfoBarPowerKey, \
                for x in HelpableScreen, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, \
                                InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
                                InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
-                               InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport:
+                               InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
+                               InfoBarSummarySupport:
                        x.__init__(self)
 
                self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
index 954e9d1fcb2e59fe4cd523af58a6a897d22ed632..d0619628b15ca9687274b4ea72e10777a3bb8172 100644 (file)
@@ -11,6 +11,7 @@ from Components.Pixmap import Pixmap, PixmapConditional
 from Components.BlinkingPixmap import BlinkingPixmapConditional
 from Components.ServiceName import ServiceName
 from Components.EventInfo import EventInfo, EventInfoProgress
+from Components.Clock import Clock
 
 from ServiceReference import ServiceReference
 from EpgSelection import EPGSelection
@@ -748,7 +749,7 @@ class InfoBarSeek:
                if self.seekstate == self.SEEK_STATE_PAUSE:
                        seekable = self.getSeek()
                        if seekable is not None:
-                               seekable.seekRelative(-1, 2)
+                               seekable.seekRelative(-1, 3)
 
        def fwdTimerFire(self):
                print "Display seek fwd"
@@ -1349,3 +1350,22 @@ class InfoBarCueSheetSupport:
                        print "upload failed, no cuesheet interface"
                        return
                self.cut_list = cue.getCutList()
+
+class InfoBarSummary(Screen):
+       skin = """
+       <screen position="0,0" size="132,64">
+               <widget name="Clock" position="50,46" size="82,18" font="Regular;19" />
+               <widget name="CurrentService" position="0,4" size="132,42" font="Regular;19" />
+       </screen>"""
+
+       def __init__(self, session, parent):
+               Screen.__init__(self, session)
+               self["CurrentService"] = ServiceName(self.session.nav)
+               self["Clock"] = Clock()
+
+class InfoBarSummarySupport:
+       def __init__(self):
+               pass
+       
+       def createSummary(self):
+               return InfoBarSummary
index f59c7987697f1f26c32fa4291b6dc5f226cd0f05..6b18121ff81f725e29a9d252a82b6ffc0545582e 100644 (file)
@@ -37,7 +37,7 @@ class LanguageSelection(Screen):
                language.activateLanguage(self["list"].l.getCurrentSelectionIndex())
                config.osd.language.value = self["list"].l.getCurrentSelectionIndex()
                config.osd.language.save()
-               self.session.currentDialog.instance.setTitle(_("Language selection"))
+               self.setTitle(_("Language selection"))
 
        def updateList(self):
                self.list = []
index 47586fe0761b1178b61bc08d28ebc271ebed52eb..d917eb39aa065de9723670b98bb540fb4ffec4ae 100644 (file)
@@ -9,5 +9,4 @@ install_PYTHON = \
        AudioSelection.py InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \
        Dish.py SubserviceSelection.py LanguageSelection.py StartWizard.py \
        TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \
-       Console.py InputBox.py ChoiceBox.py
-
+       Console.py InputBox.py ChoiceBox.py SimpleSummary.py
index bba3628239c381f5f64c6bfe539533e8950ed549..2a7055cf9dca633fa961876917c32437d835a64e 100644 (file)
@@ -6,6 +6,7 @@ from Components.Button import Button
 from Components.Label import Label
 from Components.ProgressBar import ProgressBar
 from Components.config import configfile
+from Components.Clock import Clock
 
 from Tools.Directories import resolveFilename, SCOPE_SKIN
 
@@ -73,7 +74,24 @@ class MenuUpdater:
                return self.updatedMenuItems[id]
        
 menuupdater = MenuUpdater()
-               
+
+class MenuSummary(Screen):
+       skin = """
+       <screen position="0,0" size="132,64">
+               <widget name="Clock" position="50,46" size="82,18" font="Regular;19" />
+               <widget name="MenuTitle" position="0,4" size="132,21" font="Regular;19" />
+               <widget name="MenuEntry" position="0,25" size="132,21" font="Regular;19" />
+       </screen>"""
+
+       def __init__(self, session, parent):
+               Screen.__init__(self, session)
+               self["MenuTitle"] = Label(parent.menu_title)
+               self["MenuEntry"] = Label("")
+               self["Clock"] = Clock()
+
+       def setCurrentEntry(self, entry):
+               self["MenuEntry"].setText(entry)
+
 class Menu(Screen):
        def okbuttonClick(self):
                print "okbuttonClick"
@@ -82,7 +100,7 @@ class Menu(Screen):
 
        def execText(self, text):
                exec text
-               
+
        def runScreen(self, arg):
                # arg[0] is the module (as string)
                # arg[1] is Screen inside this module 
@@ -185,6 +203,7 @@ class Menu(Screen):
 
 
                self["menu"] = MenuList(list)   
+               self["menu"].onSelectionChanged.append(self.selectionChanged)
                                                        
                self["actions"] = ActionMap(["OkCancelActions", "MenuActions"], 
                        {
@@ -197,6 +216,7 @@ class Menu(Screen):
                if a == "":                                                                                                             #if empty use name
                        a = _(getValbyAttr(parent, "text"))
                self["title"] = Header(a)
+               self.menu_title = a
 
        def closeNonRecursive(self):
                self.close(False)
@@ -204,6 +224,14 @@ class Menu(Screen):
        def closeRecursive(self):
                self.close(True)
 
+       def createSummary(self):
+               return MenuSummary
+
+       def selectionChanged(self):
+               entry = self["menu"].getCurrent()[0]
+               for x in self.summaries:
+                       x.setCurrentEntry(entry)
+
 class MainMenu(Menu):
        #add file load functions for the xml-file
        
index 41b3f32eda0c2c2703885050385fe93a631a494a..46661ca143b5e857b6d140953dc61fcbe5f06fc4 100644 (file)
@@ -110,9 +110,9 @@ class PluginDownloadBrowser(Screen):
 
        def setTitle(self):
                if self.type == self.DOWNLOAD:
-                       self.session.currentDialog.instance.setTitle(_("Downloadable new plugins"))
+                       self.setTitle(_("Downloadable new plugins"))
                elif self.type == self.REMOVE:
-                       self.session.currentDialog.instance.setTitle(_("Remove plugins"))
+                       self.setTitle(_("Remove plugins"))
 
        def startRun(self):
                self["list"].instance.hide()
index a8d0b0481f9efedad6432b1852f2da15a6e925a3..8398dadd0fb17169c3828173d4bd29691452725c 100644 (file)
@@ -29,15 +29,15 @@ class Screen(dict, HTMLSkin, GUISkin):
                self.active_components = [ ]
                for x in self.onExecBegin:
                        x()
-                       if self.session.currentDialog != self:
+                       if self.session.current_dialog != self:
                                return
 
-#              assert self.session == None, "a screen can only exec one per time"
+#              assert self.session == None, "a screen can only exec once per time"
 #              self.session = session
 
                for (name, val) in self.items():
                        val.execBegin()
-                       if self.session.currentDialog != self:
+                       if self.session.current_dialog != self:
                                return
                        self.active_components.append(val)
 
@@ -57,6 +57,7 @@ class Screen(dict, HTMLSkin, GUISkin):
        
        # never call this directly - it will be called from the session!
        def doClose(self):
+               self.hide()
                for x in self.onClose:
                        x()
                
@@ -84,6 +85,9 @@ class Screen(dict, HTMLSkin, GUISkin):
                self.instance.show()
                for x in self.onShow:
                        x()
+               for (name, val) in self.items():
+                       if isinstance(val, GUIComponent):
+                               val.onShow()
 
        def hide(self):
                if not self.shown:
@@ -92,3 +96,6 @@ class Screen(dict, HTMLSkin, GUISkin):
                self.instance.hide()
                for x in self.onHide:
                        x()
+               for (name, val) in self.items():
+                       if isinstance(val, GUIComponent):
+                               val.onHide()
index 82e4d833416ad54e67fb85deea9c04b393281a0e..c25426f4d24fd5bf79f99c78c03d856810a69934 100644 (file)
@@ -5,4 +5,4 @@ __all__ = ["ChannelSelection", "ClockDisplay", "ConfigMenu",
        "Satconfig", "Scanconfig", "Ci.py", "Volume.py", "Mute.py",
        "EpgSelection", "EventView", "Standby", "ServiceInfo",
        "AudioSelection", "SubserviceSelection", "InfoBarGenerics", "HelpMenu", "Wizard",
-       "PVRState", "Console", "InputBox", "ChoiceBox" ]
+       "PVRState", "Console", "InputBox", "ChoiceBox", "SimpleSummary" ]
index 3102c20a514f069404d6ef6096cc5305c85f933d..1260a10407c98eec482a724b81a09078dac38b2a 100644 (file)
@@ -135,8 +135,6 @@ public:
 
 /************************************************/
 
-eLabel *lcd_label, *lcd_clock;
-
 int exit_code;
 
 int main(int argc, char **argv)
@@ -209,48 +207,21 @@ int main(int argc, char **argv)
        dsk.setRedrawTask(main);
        dsk_lcd.setRedrawTask(main);
 
-       eWindow *lcd_win = new eWindow(&dsk_lcd);
-       
-       lcd_win->setFlag(eWindow::wfNoBorder);
-       
-       lcd_win->move(ePoint(0, 0));
-       lcd_win->resize(eSize(132, 64));
-       
-       lcd_label = new eLabel(lcd_win);
-       lcd_label->move(ePoint(0, 4));
-       lcd_label->resize(eSize(132, 42));
-       ePtr<gFont> font = new gFont("Regular", 19);
-       //ePtr<gFont> font = new gFont("Regular", 16);
-       lcd_label->setFont(font);
-
-       lcd_clock = new eLabel(lcd_win);
-       lcd_clock->move(ePoint(50, 46));
-       lcd_clock->resize(eSize(132, 18));
-       ePtr<gFont> clkfont = new gFont("Regular", 16);
-       lcd_clock->setFont(clkfont);
-
-       //lcd_label->setText("bla bla bla, this lcd\nSUCKS!");
-       //lcd_clock->setText("88:88:88");
-
-       lcd_win->show();
-       
        eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
        
        printf("executing main\n");
 
        python.execute("mytest", "__main__");
        
-       lcd_win->hide();
-       
        dsk.paint();
        dsk_lcd.paint();
 
        return exit_code;
 }
 
-eWidgetDesktop *getDesktop()
+eWidgetDesktop *getDesktop(int which)
 {
-       return wdsk;
+       return which ? lcddsk : wdsk;
 }
 
 eApplication *getApplication()
@@ -271,10 +242,8 @@ void quitMainloop(int exitCode)
 
 void setLCD(const char *string)
 {
-       lcd_label->setText(string);
 }
 
 void setLCDClock(const char *string)
 {
-       lcd_clock->setText(string);
 }
index 70c45a01d241a39c459a36f197cde3dbfb775a15..4ac9ed631e3905fd81507d835a14b8a86217d7c4 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -6,6 +6,7 @@ from Components.Language import language
 
 import traceback
 import Screens.InfoBar
+from Screens.SimpleSummary import SimpleSummary
 
 import sys
 import time
@@ -81,44 +82,58 @@ class GUIOutputDevice(OutputDevice):
                comp.createGUIScreen(self.parent, desktop)
 
 class Session:
-       def __init__(self):
-               self.desktop = None
-               self.delayTimer = eTimer()
-               self.delayTimer.timeout.get().append(self.processDelay)
+       def __init__(self, desktop = None, summary_desktop = None, navigation = None):
+               self.desktop = desktop
+               self.summary_desktop = summary_desktop
+               self.nav = navigation
+               self.delay_timer = eTimer()
+               self.delay_timer.timeout.get().append(self.processDelay)
                
-               self.currentDialog = None
+               self.current_dialog = None
                
-               self.dialogStack = [ ]
+               self.dialog_stack = [ ]
+               self.summary_stack = [ ]
+               self.summary = None
        
        def processDelay(self):
                self.execEnd()
                
-               callback = self.currentDialog.callback
+               callback = self.current_dialog.callback
 
-               retval = self.currentDialog.returnValue
+               retval = self.current_dialog.returnValue
 
-               if self.currentDialog.isTmp:
-                       self.currentDialog.doClose()
-#                      dump(self.currentDialog)
-                       del self.currentDialog
+               if self.current_dialog.isTmp:
+                       self.current_dialog.doClose()
+#                      dump(self.current_dialog)
+                       del self.current_dialog
                else:
-                       del self.currentDialog.callback
+                       del self.current_dialog.callback
                
                self.popCurrent()
                if callback is not None:
                        callback(*retval)
 
        def execBegin(self):
-               c = self.currentDialog
+               c = self.current_dialog
+               
+               self.pushSummary()
+
+               summary = c.createSummary() or SimpleSummary
+               self.summary = self.instantiateSummaryDialog(summary, c)
+               self.summary.show()
+
+               c.addSummary(self.summary)
                c.execBegin()
 
                # when execBegin opened a new dialog, don't bother showing the old one.
-               if c == self.currentDialog:
+               if c == self.current_dialog:
                        c.show()
                
        def execEnd(self):
-               self.currentDialog.execEnd()
-               self.currentDialog.hide()
+               self.current_dialog.execEnd()
+               self.current_dialog.hide()
+               self.current_dialog.removeSummary(self.summary)
+               self.popSummary()
        
        def create(self, screen, arguments, **kwargs):
                # creates an instance of 'screen' (which is a class)
@@ -129,9 +144,14 @@ class Session:
                        print errstr
                        traceback.print_exc(file=sys.stdout)
                        quitMainloop(5)
-                       
        
        def instantiateDialog(self, screen, *arguments, **kwargs):
+               return self.doInstantiateDialog(screen, arguments, kwargs, self.desktop)
+       
+       def instantiateSummaryDialog(self, screen, *arguments, **kwargs):
+               return self.doInstantiateDialog(screen, arguments, kwargs, self.summary_desktop)
+       
+       def doInstantiateDialog(self, screen, arguments, kwargs, desktop):
                # create dialog
                
                try:
@@ -147,41 +167,45 @@ class Session:
                        return
 
                # read skin data
-               readSkin(dlg, None, dlg.skinName, self.desktop)
+               readSkin(dlg, None, dlg.skinName, desktop)
 
                # create GUI view of this dialog
-               assert self.desktop != None
+               assert desktop is not None
                
                z = 0
+               title = ""
                for (key, value) in dlg.skinAttributes:
                        if key == "zPosition":
                                z = int(value)
-
-               dlg.instance = eWindow(self.desktop, z)
-               applyAllAttributes(dlg.instance, self.desktop, dlg.skinAttributes)
+                       elif key == "title":
+                               title = value
+               
+               dlg.instance = eWindow(desktop, z)
+               dlg.title = title
+               applyAllAttributes(dlg.instance, desktop, dlg.skinAttributes)
                gui = GUIOutputDevice()
                gui.parent = dlg.instance
-               gui.create(dlg, self.desktop)
+               gui.create(dlg, desktop)
                
                return dlg
         
        def pushCurrent(self):
-               if self.currentDialog:
-                       self.dialogStack.append(self.currentDialog)
+               if self.current_dialog:
+                       self.dialog_stack.append(self.current_dialog)
                        self.execEnd()
        
        def popCurrent(self):
-               if len(self.dialogStack):
-                       self.currentDialog = self.dialogStack.pop()
+               if len(self.dialog_stack):
+                       self.current_dialog = self.dialog_stack.pop()
                        self.execBegin()
                else:
-                       self.currentDialog = None
+                       self.current_dialog = None
 
        def execDialog(self, dialog):
                self.pushCurrent()
-               self.currentDialog = dialog
-               self.currentDialog.isTmp = False
-               self.currentDialog.callback = None # would cause re-entrancy problems.
+               self.current_dialog = dialog
+               self.current_dialog.isTmp = False
+               self.current_dialog.callback = None # would cause re-entrancy problems.
                self.execBegin()
 
        def openWithCallback(self, callback, screen, *arguments, **kwargs):
@@ -190,7 +214,7 @@ class Session:
 
        def open(self, screen, *arguments, **kwargs):
                self.pushCurrent()
-               dlg = self.currentDialog = self.instantiateDialog(screen, *arguments, **kwargs)
+               dlg = self.current_dialog = self.instantiateDialog(screen, *arguments, **kwargs)
                dlg.isTmp = True
                dlg.callback = None
                self.execBegin()
@@ -200,8 +224,21 @@ class Session:
                print "code " + str(code)
 
        def close(self, *retval):
-               self.currentDialog.returnValue = retval
-               self.delayTimer.start(0, 1)
+               self.current_dialog.returnValue = retval
+               self.delay_timer.start(0, 1)
+
+       def pushSummary(self):
+               if self.summary is not None:
+                       self.summary.hide()
+               self.summary_stack.append(self.summary)
+               self.summary = None
+
+       def popSummary(self):
+               if self.summary is not None:
+                       self.summary.doClose()
+               self.summary = self.summary_stack.pop()
+               if self.summary is not None:
+                       self.summary.show()
 
 from Screens.Volume import Volume
 from Screens.Mute import Mute
@@ -266,10 +303,7 @@ class VolumeControl:
                        self.muteDialog.hide()
 
 def runScreenTest():
-       session = Session()
-       session.desktop = getDesktop()
-       
-       session.nav = Navigation()
+       session = Session(desktop = getDesktop(0), summary_desktop = getDesktop(1), navigation = Navigation())
        
        screensToRun = [ ]
        
@@ -318,7 +352,7 @@ def runScreenTest():
 import keymapparser
 keymapparser.readKeymap()
 import skin
-skin.loadSkin(getDesktop())
+skin.loadSkin(getDesktop(0))
 
 import Components.InputDevice
 Components.InputDevice.InitInputDevices()
diff --git a/skin.py b/skin.py
index 5f27acca4d8b179ddd6cd55aa23457dbdc29aa8e..3497cc115f12d517a4c68857ea06c14e5f25bd72 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -210,12 +210,12 @@ def readSkin(screen, skin, name, desktop):
                        myscreen = x
        del skin
        
-       if myscreen is None:
-               # try embedded skin
-               if "parsedSkin" in screen.__dict__:
-                       myscreen = screen.parsedSkin
-               elif "skin" in screen.__dict__:
-                       myscreen = screen.parsedSkin = xml.dom.minidom.parseString(screen.skin).childNodes[0]
+       # try embedded skin
+       myscreen = myscreen or getattr(screen, "parsedSkin", None)
+       
+       # try uncompiled embedded skin
+       if myscreen is None and getattr(screen, "skin", None):
+               myscreen = screen.parsedSkin = xml.dom.minidom.parseString(screen.skin).childNodes[0]
        
        assert myscreen is not None, "no skin for screen '" + name + "' found!"