+ def create(self, comp, desktop):
+ comp.createGUIScreen(self.parent, desktop)
+
+class Session:
+ def __init__(self):
+ self.desktop = None
+ self.delayTimer = eTimer()
+ self.delayTimer.timeout.get().append(self.processDelay)
+
+ self.currentDialog = None
+
+ self.dialogStack = [ ]
+
+ def processDelay(self):
+ self.execEnd()
+
+ if self.currentDialog.isTmp:
+ self.currentDialog.doClose()
+
+ print sys.getrefcount(self.currentDialog)
+ del self.currentDialog.instance
+# dump(self.currentDialog)
+ del self.currentDialog
+
+ self.popCurrent()
+
+ def execBegin(self):
+ self.currentDialog.execBegin()
+ self.currentDialog.instance.show()
+
+ def execEnd(self):
+ self.currentDialog.execEnd()
+ self.currentDialog.instance.hide()
+
+ def create(self, screen, arguments):
+ # creates an instance of 'screen' (which is a class)
+ return screen(self, *arguments)
+
+ def instantiateDialog(self, screen, *arguments):
+ # create dialog
+
+ try:
+ dlg = self.create(screen, arguments)
+ except:
+ print 'EXCEPTION IN DIALOG INIT CODE, ABORTING:'
+ print '-'*60
+ traceback.print_exc(file=sys.stdout)
+ quitMainloop()
+ print '-'*60
+
+ # read skin data
+ readSkin(dlg, None, dlg.skinName, self.desktop)
+
+ # create GUI view of this dialog
+ assert self.desktop != None
+ dlg.instance = eWindow(self.desktop)
+ applyAllAttributes(dlg.instance, self.desktop, dlg.skinAttributes)
+ gui = GUIOutputDevice()
+ gui.parent = dlg.instance
+ gui.create(dlg, self.desktop)
+
+ return dlg
+
+ def pushCurrent(self):
+ if self.currentDialog:
+ self.dialogStack.append(self.currentDialog)
+ self.execEnd()
+
+ def popCurrent(self):
+ if len(self.dialogStack):
+ self.currentDialog = self.dialogStack.pop()
+ self.execBegin()
+
+ def execDialog(self, dialog):
+ self.pushCurrent()
+ self.currentDialog = dialog
+ self.currentDialog.isTmp = False
+ self.execBegin()