Exemplo n.º 1
0
 def addResultSubWindow(self, plotWidget):
     subWindow = QMdiSubWindow(parent=self.getMdiArea())
     subWindow.setAttribute(Qt.WA_DeleteOnClose)
     subWindow.setWidget(plotWidget)
     subWindow.setOption(QMdiSubWindow.RubberBandResize, True)
     self.getMdiArea().addSubWindow(subWindow)
     subWindow.showMaximized()
     subWindow.activateWindow()
     subWindow.show()  # important!
     self.show()
Exemplo n.º 2
0
    def update_plots(self):
        '''
        Create all the plots based on the selection in the list widget 
        self.tableSources
        
        This is rather complicated and should be refactored + broken
        down.
        '''

        # gather information about what to show
        windowTitlesToShow = {}
        #for (dataID, dataItem) in self.experimentalData.items():
        for (entity, dataTuple) in self.data.items():
            dataID = entity.id
            if self.dataModel.does_show_experimental_data_of(
                    dataID) and self.dataModel.does_show_simulation_data_of(
                        dataID):
                windowTitle = "Experimental and simulation values of %s" % dataID
            elif self.dataModel.does_show_experimental_data_of(dataID):
                windowTitle = "Experimental values of %s" % dataID
            elif self.dataModel.does_show_simulation_data_of(dataID):
                windowTitle = "Simulation values of %s" % dataID
            else:
                windowTitle = None

            if windowTitle is not None:
                windowTitlesToShow[windowTitle] = (entity, dataTuple)

        # close previous windows that show information we don't want now
        for existingWindowTitle in self.existingPlotWindows.keys():
            if not windowTitlesToShow.has_key(existingWindowTitle):
                self.existingPlotWindows.pop(existingWindowTitle).close()

        # create missing windows
        #for (dataID, dataItem) in self.experimentalData.items():
        for (windowTitle, (entity, dataTuple)) in windowTitlesToShow.items():

            dataID = entity.id

            if self.existingPlotWindows.has_key(
                    windowTitle
            ):  # dont' create windows that are already there
                continue

            labelExperimental = "Experimental values of %s" % dataID
            labelSimulation = "Simulation values of %s" % dataID

            subWindow = QMdiSubWindow(parent=self.plotWindowsArea)
            subWindow.setAttribute(Qt.WA_DeleteOnClose)
            subWindow.setOption(QMdiSubWindow.RubberBandResize, True)
            self.existingPlotWindows[windowTitle] = subWindow

            #            if self.dataModel.does_show_experimental_data_of(dataID):
            #                if self.simulationData.has_key(dataID):
            #                    experimentalData = {dataID:dataItem}
            #                else:
            #                    experimentalData = None
            #            else:
            #                experimentalData = None
            #
            #            if self.dataModel.does_show_simulation_data_of(dataID):
            #                if self.simulationData.has_key(dataID):
            #                    simulationData = {dataID + "_sim" : self.simulationData[dataID]}
            #                else:
            #                    simulationData = None
            #            else:
            #                simulationData = None

            if self.dataModel.does_show_experimental_data_of(dataID):
                experimentalData = dataTuple[1]
            else:
                experimentalData = None

            if self.dataModel.does_show_simulation_data_of(dataID):
                simulationData = dataTuple[0]
            else:
                simulationData = None

            plotWidget = PlotWidget(
                parent=subWindow,
                experimentalData=experimentalData,
                simulationData=simulationData,
                labelExperimental=labelExperimental,
                labelSimulation=labelSimulation,
                showLegend=self.checkBoxShowLegend.isChecked(),
                logYAxis=self.checkBoxLogYAxis.isChecked())

            subWindow.setWindowTitle(windowTitle)
            subWindow.setWidget(plotWidget)
            subWindow.show()  # important!