+ del self.currentDialog.callback
+
+ self.popCurrent()
+ if callback is not None:
+ callback(*retval)
+
+ 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.currentDialog.callback = None # would cause re-entrancy problems.
+ self.execBegin()
+
+ def openWithCallback(self, callback, screen, *arguments):
+ self.open(screen, *arguments)
+ self.currentDialog.callback = callback
+
+ def open(self, screen, *arguments):
+ self.pushCurrent()
+ self.currentDialog = self.instantiateDialog(screen, *arguments)
+ self.currentDialog.isTmp = True
+ self.currentDialog.callback = None
+ self.execBegin()