Beispiel #1
0
    def toggle(self, state=None):
        ''' this function creates instances of the editor
    this is also the function that a game may use to enable/disable the editor
    '''
        if state is None:
            state = not self.editorGui
        print "I: EditorClass.toggleEditor:", state

        if state:
            # Fourth phase: load one of the two interface layers.
            if self.guiType == "dgui":
                from dgui.pEditorApp import EditorApp
                self.editorGui = EditorApp(self)
                self.editorGui.enable()
            elif self.guiType == "wxgui":
                # wxGui needs to be opened before the editor, as it opens the window later
                from wxgui.pEditorApp import EditorApp
                self.editorGui = EditorApp(self)
        else:
            if self.guiType == "dgui":
                self.editorGui.disable()
                self.editorGui.destroy()
                self.editorGui = None
            elif self.guiType == "wxgui":
                print "E: EditorClass.toggleEditor: wxGui cannot be closed"