def _setup_ui(self): self.plot = QtGui.QTreeWidget() param_header = QtGui.QTreeWidgetItem(self.x_label) self.plot.setHeaderItem(param_header) self.plot.setColumnWidth(0, 150) self.plot.setAlternatingRowColors(True) self.plot.setSortingEnabled(True) self.plot.sortItems(0, QtCore.Qt.AscendingOrder) # patch addItem and removeItem from pyqtgraph PlotItem self.plot.addItem = self.addItem self.plot.removeItem = self.removeItem
def _setup_ui(self): preview_tab = QtGui.QTabWidget() param_vbox = QtGui.QVBoxLayout() param_vbox_widget = QtGui.QWidget() self.plot_widget = [] self.plot = [] vbox_widget = [] vbox = [] for index, plot_widget in enumerate(self.plot_widget_classes): vbox_widget.append(QtGui.QWidget()) vbox.append(QtGui.QVBoxLayout()) color_cycle = self.color_cycle[:1] self.plot_widget.append( plot_widget(self.columns, x_axes=self.x_axes[index], y_axes=self.y_axes[index], x_label=self.x_labels[index], y_label=self.y_labels[index], legend_text=self.legend_text[index], color_cycle=color_cycle)) self.plot.append(self.plot_widget[-1].plot) vbox[-1].addWidget(self.plot_widget[-1]) vbox_widget[-1].setLayout(vbox[-1]) preview_tab.addTab(vbox_widget[-1], self.plot_names[index]) self.preview_param = QtGui.QTreeWidget() param_header = QtGui.QTreeWidgetItem(["Name", "Value"]) self.preview_param.setHeaderItem(param_header) self.preview_param.setColumnWidth(0, 150) self.preview_param.setAlternatingRowColors(True) param_vbox.addWidget(self.preview_param) param_vbox_widget.setLayout(param_vbox) preview_tab.addTab(param_vbox_widget, "Run Parameters") self.layout().addWidget(preview_tab, 0, 3, 4, 1) self.layout().setColumnStretch(3, 2) self.setMinimumSize(900, 500) self.resize(1300, 500) self.setFileMode(QtGui.QFileDialog.ExistingFiles) self.currentChanged.connect(self.update_plot)