Пример #1
0
 def createNewElement(self):
     typeName = self.sender().text()
     elementType = self.classDictionary[typeName]
     dialog = genDialog(elementType())
     if dialog.exec_():
         data = [datum[1].text() for datum in dialog.info + dialog.more]
         element = elementType(data)
         undoAction = commandLoadElements(self, [element])
         self.undoStack.push(undoAction)
Пример #2
0
    def editElement(self, name):
        try:
            selectedElement = self.elementDictionary[name]
        except KeyError: # Element name not found
            return

        if selectedElement.isBeamline():
            self.setWorkingBeamline(selectedElement)
            self.callAfterWorkingBeamlineChanges()
        else:
            dialog = genDialog(selectedElement)
            if dialog.exec_():
                data = dialog.info + dialog.more
                newElement = type(selectedElement)([datum[1].text() for datum in data])
                undoAction = commandEditElement(self, selectedElement, newElement)
                self.undoStack.push(undoAction)
                self.elementPreview()
Пример #3
0
    def addBeam(self):
        beamline = self.beamlineType()
        if self.workingBeamlineName:
            beamline.name = self.workingBeamlineName

        for name in self.workingBeamlineElementNames():
            beamline.addElement(self.elementDictionary[name])              

        dialog = genDialog(beamline)
        if dialog.exec_():
            beamline.name = dialog.info[0][1].text()
            if self.workingBeamlineName:
                oldBeam = self.elementDictionary[self.workingBeamlineName]
                undoAction = commandEditElement(self, oldBeam, beamline)
            else:
                undoAction = commandLoadElements(self, [beamline])
            self.setWorkingBeamline()
            self.callAfterWorkingBeamlineChanges()
            self.undoStack.push(undoAction)