From 6c2d3fc303542b7f77f4350974acf781a1b91c30 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Thu, 2 Mar 2006 02:14:10 +0000 Subject: [PATCH] minimally improved LCD support --- lib/gui/epixmap.cpp | 4 +- lib/gui/ewidget.h | 2 +- lib/gui/ewindow.cpp | 3 +- lib/gui/ewindow.h | 1 + lib/python/Components/Clock.py | 6 +- lib/python/Components/GUIComponent.py | 6 ++ lib/python/Components/GUISkin.py | 18 +++- lib/python/Components/MenuList.py | 6 +- lib/python/Screens/ChannelSelection.py | 16 ++-- lib/python/Screens/EventView.py | 2 +- lib/python/Screens/InfoBar.py | 16 ++-- lib/python/Screens/InfoBarGenerics.py | 22 ++++- lib/python/Screens/LanguageSelection.py | 2 +- lib/python/Screens/Makefile.am | 3 +- lib/python/Screens/Menu.py | 32 ++++++- lib/python/Screens/PluginBrowser.py | 4 +- lib/python/Screens/Screen.py | 13 ++- lib/python/Screens/__init__.py | 2 +- main/enigma.cpp | 35 +------- mytest.py | 114 +++++++++++++++--------- skin.py | 12 +-- 21 files changed, 206 insertions(+), 113 deletions(-) diff --git a/lib/gui/epixmap.cpp b/lib/gui/epixmap.cpp index 70ea9d6a..4e15b4eb 100644 --- a/lib/gui/epixmap.cpp +++ b/lib/gui/epixmap.cpp @@ -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); } diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h index 6739f25e..3ddfdc26 100644 --- a/lib/gui/ewidget.h +++ b/lib/gui/ewidget.h @@ -113,6 +113,6 @@ public: void setFocus(eWidget *focus); }; -extern eWidgetDesktop *getDesktop(); +extern eWidgetDesktop *getDesktop(int which); #endif diff --git a/lib/gui/ewindow.cpp b/lib/gui/ewindow.cpp index f8984729..112b82d7 100644 --- a/lib/gui/ewindow.cpp +++ b/lib/gui/ewindow.cpp @@ -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 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(); } diff --git a/lib/gui/ewindow.h b/lib/gui/ewindow.h index d36d9124..bb7f771c 100644 --- a/lib/gui/ewindow.h +++ b/lib/gui/ewindow.h @@ -32,6 +32,7 @@ private: std::string m_title; eWidget *m_child; int m_flags; + eWidgetDesktop *m_desktop; }; #endif diff --git a/lib/python/Components/Clock.py b/lib/python/Components/Clock.py index e2d9d5f5..982d1c4a 100644 --- a/lib/python/Components/Clock.py +++ b/lib/python/Components/Clock.py @@ -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() - diff --git a/lib/python/Components/GUIComponent.py b/lib/python/Components/GUIComponent.py index 1476ba83..493df681 100644 --- a/lib/python/Components/GUIComponent.py +++ b/lib/python/Components/GUIComponent.py @@ -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: diff --git a/lib/python/Components/GUISkin.py b/lib/python/Components/GUISkin.py index f97dd8bd..3aa9c851 100644 --- a/lib/python/Components/GUISkin.py +++ b/lib/python/Components/GUISkin.py @@ -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) diff --git a/lib/python/Components/MenuList.py b/lib/python/Components/MenuList.py index 03e6be6d..40898095 100644 --- a/lib/python/Components/MenuList.py +++ b/lib/python/Components/MenuList.py @@ -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() diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index c7c1b968..40868e87 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -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 diff --git a/lib/python/Screens/EventView.py b/lib/python/Screens/EventView.py index 01695dfb..ef3786c5 100644 --- a/lib/python/Screens/EventView.py +++ b/lib/python/Screens/EventView.py @@ -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)) diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index cfc35294..d60725f2 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -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) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 954e9d1f..d0619628 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -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 = """ + + + + """ + + 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 diff --git a/lib/python/Screens/LanguageSelection.py b/lib/python/Screens/LanguageSelection.py index f59c7987..6b18121f 100644 --- a/lib/python/Screens/LanguageSelection.py +++ b/lib/python/Screens/LanguageSelection.py @@ -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 = [] diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index 47586fe0..d917eb39 100644 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -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 diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py index bba36282..2a7055cf 100644 --- a/lib/python/Screens/Menu.py +++ b/lib/python/Screens/Menu.py @@ -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 = """ + + + + + """ + + 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 diff --git a/lib/python/Screens/PluginBrowser.py b/lib/python/Screens/PluginBrowser.py index 41b3f32e..46661ca1 100644 --- a/lib/python/Screens/PluginBrowser.py +++ b/lib/python/Screens/PluginBrowser.py @@ -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() diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py index a8d0b048..8398dadd 100644 --- a/lib/python/Screens/Screen.py +++ b/lib/python/Screens/Screen.py @@ -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() diff --git a/lib/python/Screens/__init__.py b/lib/python/Screens/__init__.py index 82e4d833..c25426f4 100644 --- a/lib/python/Screens/__init__.py +++ b/lib/python/Screens/__init__.py @@ -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" ] diff --git a/main/enigma.cpp b/main/enigma.cpp index 3102c20a..1260a104 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -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 font = new gFont("Regular", 19); - //ePtr 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 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); } diff --git a/mytest.py b/mytest.py index 70c45a01..4ac9ed63 100644 --- 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 5f27acca..3497cc11 100644 --- 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!" -- 2.30.2