Exemplo n.º 1
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.firstStep = FirstStepWidget()
        self.secondStep = SecondStepWidget()
        self.secondAndHalfStep = SecondAndHalfStepWidget()
        self.thirdStep = ThirdStepWidget()
        self.setCentralWidget(self.firstStep)

        self.connect(self.firstStep, QtCore.SIGNAL("nextStep()"),
                     self.showSecondStepAfterFirst)
        self.connect(self.secondStep, QtCore.SIGNAL("previousStep()"),
                     self.showFirstStep)
        self.connect(self.secondStep, QtCore.SIGNAL("nextStep()"),
                     self.showStepAfterSecond)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("previousStep()"),
                     self.showSecondStepAfterSecondAndHalf)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("nextStep()"),
                     self.showThirdStep)
        self.connect(self.thirdStep, QtCore.SIGNAL("previousStep()"),
                     self.showStepBeforeThird)
        self.connect(self.thirdStep, QtCore.SIGNAL("loadDevices()"),
                     self.loadDevices)
Exemplo n.º 2
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.firstStep = FirstStepWidget()
        self.secondStep = SecondStepWidget()
        self.secondAndHalfStep = SecondAndHalfStepWidget()
        self.thirdStep = ThirdStepWidget()
        self.setCentralWidget(self.firstStep)

        self.connect(self.firstStep, QtCore.SIGNAL("nextStep()"), self.showSecondStepAfterFirst)
        self.connect(self.secondStep, QtCore.SIGNAL("previousStep()"), self.showFirstStep)
        self.connect(self.secondStep, QtCore.SIGNAL("nextStep()"), self.showStepAfterSecond)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("previousStep()"), self.showSecondStepAfterSecondAndHalf)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("nextStep()"), self.showThirdStep)
        self.connect(self.thirdStep, QtCore.SIGNAL("previousStep()"), self.showStepBeforeThird)
        self.connect(self.thirdStep, QtCore.SIGNAL("loadDevices()"), self.loadDevices)
Exemplo n.º 3
0
class mainApp(QMainWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.firstStep = FirstStepWidget()
        self.secondStep = SecondStepWidget()
        self.secondAndHalfStep = SecondAndHalfStepWidget()
        self.thirdStep = ThirdStepWidget()
        self.setCentralWidget(self.firstStep)

        self.connect(self.firstStep, QtCore.SIGNAL("nextStep()"), self.showSecondStepAfterFirst)
        self.connect(self.secondStep, QtCore.SIGNAL("previousStep()"), self.showFirstStep)
        self.connect(self.secondStep, QtCore.SIGNAL("nextStep()"), self.showStepAfterSecond)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("previousStep()"), self.showSecondStepAfterSecondAndHalf)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("nextStep()"), self.showThirdStep)
        self.connect(self.thirdStep, QtCore.SIGNAL("previousStep()"), self.showStepBeforeThird)
        self.connect(self.thirdStep, QtCore.SIGNAL("loadDevices()"), self.loadDevices)

    def showSecondStepAfterFirst(self):
        self.firstStep.setParent(None)
        self.updateDefaultParameters()
        self.setCentralWidget(self.secondStep)

    def showFirstStep(self):
        self.secondStep.setParent(None)
        self.setCentralWidget(self.firstStep)

    def updateDefaultParameters(self):
        self.firstStep.saveSettings()

    def showStepAfterSecond(self):
        self.secondStep.setParent(None)
        if SettingsCloud.getParameter("parameterFromDb"):
            self.setCentralWidget(self.thirdStep)
        else:
            self.setCentralWidget(self.secondAndHalfStep)
            linacData = self.secondStep.getLinacData()
            ringData = self.secondStep.getRingData()
            self.secondAndHalfStep.setSectionsData(linacData, ringData)
            self.secondAndHalfStep.createDeviceWidgets()

    def showSecondStepAfterSecondAndHalf(self):
        self.secondAndHalfStep.setParent(None)
        self.setCentralWidget(self.secondStep)

    def showThirdStep(self):
        self.secondAndHalfStep.setParent(None)
        self.setCentralWidget(self.thirdStep)

    def showStepBeforeThird(self):
        self.thirdStep.setParent(None)
        if SettingsCloud.getParameter("parameterFromDb"):
            self.setCentralWidget(self.secondStep)
        else:
            self.setCentralWidget(self.secondAndHalfStep)

    def loadDevices(self):
        svgDrawer = SvgDrawer()
        svgDrawer.loadSvg(self.getBaseSvgPath())

        self.processSectionsData(svgDrawer)

        svgDrawer.drawAll()

        destinationFile = self.thirdStep.getFilePath()
        svgDrawer.saveSvg(destinationFile)

    def getBaseSvgPath(self):
        currentFilePath = path.realpath(__file__)
        currentDirPath = path.dirname(currentFilePath)
        baseSvgPath = currentDirPath + "/../src/blank.svg"
        return baseSvgPath

    def processSectionsData(self, svgDrawer):
        dataProcessor = SectionsDataProcesssor(svgDrawer)
        linacSectionsData = self.secondStep.getLinacData()
        ringSectionsData = self.secondStep.getRingData()
        dataProcessor.processLinacSections(linacSectionsData)
        dataProcessor.processRingSections(ringSectionsData)
        dataProcessor.drawLastSectionIfNecessary()
Exemplo n.º 4
0
class mainApp(QMainWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.firstStep = FirstStepWidget()
        self.secondStep = SecondStepWidget()
        self.secondAndHalfStep = SecondAndHalfStepWidget()
        self.thirdStep = ThirdStepWidget()
        self.setCentralWidget(self.firstStep)

        self.connect(self.firstStep, QtCore.SIGNAL("nextStep()"),
                     self.showSecondStepAfterFirst)
        self.connect(self.secondStep, QtCore.SIGNAL("previousStep()"),
                     self.showFirstStep)
        self.connect(self.secondStep, QtCore.SIGNAL("nextStep()"),
                     self.showStepAfterSecond)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("previousStep()"),
                     self.showSecondStepAfterSecondAndHalf)
        self.connect(self.secondAndHalfStep, QtCore.SIGNAL("nextStep()"),
                     self.showThirdStep)
        self.connect(self.thirdStep, QtCore.SIGNAL("previousStep()"),
                     self.showStepBeforeThird)
        self.connect(self.thirdStep, QtCore.SIGNAL("loadDevices()"),
                     self.loadDevices)

    def showSecondStepAfterFirst(self):
        self.firstStep.setParent(None)
        self.updateDefaultParameters()
        self.setCentralWidget(self.secondStep)

    def showFirstStep(self):
        self.secondStep.setParent(None)
        self.setCentralWidget(self.firstStep)

    def updateDefaultParameters(self):
        self.firstStep.saveSettings()

    def showStepAfterSecond(self):
        self.secondStep.setParent(None)
        if SettingsCloud.getParameter("parameterFromDb"):
            self.setCentralWidget(self.thirdStep)
        else:
            self.setCentralWidget(self.secondAndHalfStep)
            linacData = self.secondStep.getLinacData()
            ringData = self.secondStep.getRingData()
            self.secondAndHalfStep.setSectionsData(linacData, ringData)
            self.secondAndHalfStep.createDeviceWidgets()

    def showSecondStepAfterSecondAndHalf(self):
        self.secondAndHalfStep.setParent(None)
        self.setCentralWidget(self.secondStep)

    def showThirdStep(self):
        self.secondAndHalfStep.setParent(None)
        self.setCentralWidget(self.thirdStep)

    def showStepBeforeThird(self):
        self.thirdStep.setParent(None)
        if SettingsCloud.getParameter("parameterFromDb"):
            self.setCentralWidget(self.secondStep)
        else:
            self.setCentralWidget(self.secondAndHalfStep)

    def loadDevices(self):
        svgDrawer = SvgDrawer()
        svgDrawer.loadSvg(self.getBaseSvgPath())

        self.processSectionsData(svgDrawer)

        svgDrawer.drawAll()

        destinationFile = self.thirdStep.getFilePath()
        svgDrawer.saveSvg(destinationFile)

    def getBaseSvgPath(self):
        currentFilePath = path.realpath(__file__)
        currentDirPath = path.dirname(currentFilePath)
        baseSvgPath = currentDirPath + "/../src/blank.svg"
        return baseSvgPath

    def processSectionsData(self, svgDrawer):
        dataProcessor = SectionsDataProcesssor(svgDrawer)
        linacSectionsData = self.secondStep.getLinacData()
        ringSectionsData = self.secondStep.getRingData()
        dataProcessor.processLinacSections(linacSectionsData)
        dataProcessor.processRingSections(ringSectionsData)
        dataProcessor.drawLastSectionIfNecessary()