+ # when execBegin opened a new dialog, don't bother showing the old one.
+ if c == self.current_dialog:
+ c.show()
+
+ def execEnd(self):
+ 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)
+ try:
+ return screen(self, *arguments, **kwargs)
+ except:
+ errstr = "Screen %s(%s, %s): %s" % (str(screen), str(arguments), str(kwargs), sys.exc_info()[0])
+ 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:
+ dlg = self.create(screen, arguments, **kwargs)
+ except:
+ print 'EXCEPTION IN DIALOG INIT CODE, ABORTING:'
+ print '-'*60
+ traceback.print_exc(file=sys.stdout)
+ quitMainloop(5)
+ print '-'*60
+
+ if dlg is None:
+ return
+
+ # read skin data
+ readSkin(dlg, None, dlg.skinName, desktop)
+
+ # create GUI view of this dialog
+ assert desktop is not None
+
+ z = 0
+ title = ""
+ for (key, value) in dlg.skinAttributes:
+ if key == "zPosition":
+ z = int(value)
+ 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, desktop)
+
+ return dlg
+
+ def pushCurrent(self):
+ if self.current_dialog:
+ self.dialog_stack.append(self.current_dialog)
+ self.execEnd()
+
+ def popCurrent(self):
+ if len(self.dialog_stack):
+ self.current_dialog = self.dialog_stack.pop()
+ self.execBegin()