- if self.desktop != None:
- self.currentWindow = wnd = eWindow(self.desktop)
- wnd.setTitle("Screen from python!")
- wnd.move(ePoint(300, 100))
- wnd.resize(eSize(300, 300))
-
- gui = GUIOutputDevice()
- gui.parent = wnd
- gui.create(self.currentDialog)
-
- applyGUIskin(self.currentDialog, None, screen.__class__.__name__)
-
- wnd.show()
- else:
- self.currentWindow = None
+ 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
+ dlg = self.create(screen, arguments)
+
+ # 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()
+
+ def open(self, screen, *arguments):
+ self.pushCurrent()
+ self.currentDialog = self.instantiateDialog(screen, *arguments)
+ self.currentDialog.isTmp = True
+ self.execBegin()