示例#1
0
 def setEditor(self,editorObject):
     self.editorObject = editorObject
     self.setWindowTitle("Editing "+editorObject.name)
     visualization.setPlugin(editorObject)
     if editorObject.description==None:
         self.description.setText("")
     else:
         self.description.setText(editorObject.description)
     self.instructions.setText(editorObject.instructions())
示例#2
0
 def finish(self):
     visualization.setPlugin(None)
     res = self.editorObject.value
     self.topBoxLayout.removeWidget(self.extraDialog)
     self.extraDialog.setParent(None)
     self.extraDialog = QFrame()
     self.extraDialog.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum))
     self.topBoxLayout.addWidget(self.extraDialog)
     self.editorObject = None
     return res
示例#3
0
    def run(editorObject):
        """
        Args:
            editorObject (VisualEditorBase): some subclass of VisualEditorBase

        Returns:
            (tuple): A pair (res,value) containing: 

                * res (bool):True / False if OK / Cancel was pressed, respectively, 
                * value: the return value of the editor object

        """
        assert isinstance(editorObject,VisualEditorBase),"Must provide a VisualEditorBase instance to vis.editors.run()"
        global _vis_id, _my_dialog_res

        old_vis_window = visualization.getWindow()
        if _vis_id == None:
            _vis_id = visualization.createWindow("Resource Editor")
        else:
            visualization.setWindow(_vis_id)
        visualization.setPlugin(editorObject)
        def makefunc(gl_backend):
            assert gl_backend is not None
            res = _EditDialog(gl_backend)
            res.setEditor(editorObject)
            visualization._checkWindowCurrent(editorObject.world)
            return res
        visualization.customUI(makefunc)
        visualization.dialog()
        res,retVal = _my_dialog_res,editorObject.value
        assert res is not None,"vis.editors.run(): There may be something wrong with the vis module not catching the customUI, or terminating from a prior dialog?"

        if _doexit:
            visualization.kill()
            print "Exiting program."
            exit(0)

        visualization.setPlugin(None)
        visualization.customUI(None)
        visualization.setWindow(old_vis_window)

        print "vis.editors.run(): Result",res,"return value",retVal
        return res,retVal
示例#4
0
 def finish(self):
     visualization.setPlugin(None)
     res = self.editorObject.value
     self.editorObject = None
     return res