def initSubWidgets(self): # Add the various tabs to this widget self.bottomAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) bottomAxisUi = Ui_CartesianPlotAxis() bottomAxisUi.setupUi(self.bottomAxis) self.bottomAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.bottomAxis, "Bottom Axis") self.leftAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) leftAxisUi = Ui_CartesianPlotAxis() leftAxisUi.setupUi(self.leftAxis) self.leftAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.leftAxis, "Left Axis") self.topAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) topAxisUi = Ui_CartesianPlotAxis() topAxisUi.setupUi(self.topAxis) self.topAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.topAxis, "Top Axis") self.getChild("tabWidget").setTabEnabled(2, False) self.rightAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) rightAxisUi = Ui_CartesianPlotAxis() rightAxisUi.setupUi(self.rightAxis) self.rightAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.rightAxis, "Right Axis") self.getChild("tabWidget").setTabEnabled(3, False) self.legend = QPlotLegendWidget(self.getChild("tabWidget")) legendUi = Ui_PlotLegend() legendUi.setupUi(self.legend) self.getChild("tabWidget").addTab(self.legend, "Legend")
class QCartesianPlotTypeWidget(QEditFigureSubWidget): def __init__(self, plotOptionsWidget, *args): QEditFigureSubWidget.__init__(self, *args) self._plotOptionsWidget = plotOptionsWidget def initSubWidgets(self): # Add the various tabs to this widget self.bottomAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) bottomAxisUi = Ui_CartesianPlotAxis() bottomAxisUi.setupUi(self.bottomAxis) self.bottomAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.bottomAxis, "Bottom Axis") self.leftAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) leftAxisUi = Ui_CartesianPlotAxis() leftAxisUi.setupUi(self.leftAxis) self.leftAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.leftAxis, "Left Axis") self.topAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) topAxisUi = Ui_CartesianPlotAxis() topAxisUi.setupUi(self.topAxis) self.topAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.topAxis, "Top Axis") self.getChild("tabWidget").setTabEnabled(2, False) self.rightAxis = QCartesianPlotAxisWidget(self.getChild("tabWidget")) rightAxisUi = Ui_CartesianPlotAxis() rightAxisUi.setupUi(self.rightAxis) self.rightAxis.initSubWidgets() self.getChild("tabWidget").addTab(self.rightAxis, "Right Axis") self.getChild("tabWidget").setTabEnabled(3, False) self.legend = QPlotLegendWidget(self.getChild("tabWidget")) legendUi = Ui_PlotLegend() legendUi.setupUi(self.legend) self.getChild("tabWidget").addTab(self.legend, "Legend") # Some axis options will always be linked together (such as the bottom and top scale types), and so # we should link them in the UI so that the user knows that they are the same. def saveUi(self): plotTypeObject = self._plotOptionsWidget.currentPlot().plotTypeObject bottomAxisUiOptions = self.bottomAxis.getCurrentUi() plotTypeObject.set("bottomAxis", bottomAxisUiOptions) leftAxisUiOptions = self.leftAxis.getCurrentUi() plotTypeObject.set("leftAxis", leftAxisUiOptions) topAxisUiOptions = self.topAxis.getCurrentUi() plotTypeObject.set("topAxis", topAxisUiOptions) rightAxisUiOptions = self.rightAxis.getCurrentUi() plotTypeObject.set("rightAxis", rightAxisUiOptions) legendUiOptions = self.legend.getCurrentUi() plotTypeObject.set("legend", legendUiOptions) self.wavePairs.saveOptionsToSelectedWavePairs() def resetUi(self): plotTypeObject = self._plotOptionsWidget.currentPlot().plotTypeObject bottomAxisOptions = plotTypeObject.get("bottomAxis") self.bottomAxis.setCurrentUi(bottomAxisOptions) leftAxisOptions = plotTypeObject.get("leftAxis") self.leftAxis.setCurrentUi(leftAxisOptions) topAxisOptions = plotTypeObject.get("topAxis") self.topAxis.setCurrentUi(topAxisOptions) rightAxisOptions = plotTypeObject.get("rightAxis") self.rightAxis.setCurrentUi(rightAxisOptions) legendOptions = plotTypeObject.get("legend") self.legend.setCurrentUi(legendOptions) self.wavePairs.resetUi() def reload(self): self.bottomAxis.initSubWidgets() self.leftAxis.initSubWidgets() self.topAxis.initSubWidgets() self.rightAxis.initSubWidgets() self.wavePairs.initSubWidgets()