def init_appearance(self): """Initialize the Trace Appearance table.""" tbl = self.table_appearance # Creating and connecting point pen buttons self.point_pen_color = ColorButton() self.point_pen_size = pqg.SpinBox( step=.1, dec=True, minStep=.1, bounds=(0, None)) self.point_pen_color.sigColorChanging.connect(self.set_point_pen) self.point_pen_size.sigValueChanging.connect(self.set_point_pen) tbl.setCellWidget(0, 0, self.point_pen_color) tbl.setCellWidget(0, 1, self.point_pen_size) # Creating and connecting point outline buttons self.point_outline_color = ColorButton() self.point_outline_size = pqg.SpinBox( step=.1, dec=True, minStep=.01, bounds=(0, 1)) self.point_outline_color.sigColorChanging.connect(self.set_point_outline) self.point_outline_size.sigValueChanging.connect(self.set_point_outline) tbl.setCellWidget(1, 0, self.point_outline_color) tbl.setCellWidget(1, 1, self.point_outline_size) # Creating and connecting point style buttons self.point_shape = QtGui.QComboBox() self.point_shape.addItems( ["Circle", "Square", "Triangle", "Diamond", 'Plus']) self.point_shape.activated.connect(self.set_point_shape) self.px_mode = QtGui.QCheckBox("px mode") self.px_mode.setChecked(True) self.px_mode.stateChanged.connect(self.toggle_px_mode) tbl.setCellWidget(2, 0, self.point_shape) tbl.setCellWidget(2, 1, self.px_mode) # Creating and connecting curve pen buttons self.curve_pen_color = ColorButton() self.curve_pen_size = pqg.SpinBox( step=.1, dec=True, minStep=.1, bounds=(0, None)) self.curve_pen_color.sigColorChanging.connect(self.set_curve_pen) self.curve_pen_size.sigValueChanging.connect(self.set_curve_pen) tbl.setCellWidget(3, 0, self.curve_pen_color) tbl.setCellWidget(3, 1, self.curve_pen_size) # Creating and connecting curve shadow buttons self.curve_shadow_color = ColorButton() self.curve_shadow_size = pqg.SpinBox( step=.1, dec=True, minStep=.1, bounds=(0, 1)) self.curve_shadow_color.sigColorChanging.connect(self.set_curve_shadow) self.curve_shadow_size.sigValueChanging.connect(self.set_curve_shadow) tbl.setCellWidget(4, 0, self.curve_shadow_color) tbl.setCellWidget(4, 1, self.curve_shadow_size) # Creating and connecting fill buttons self.curve_fill_color = ColorButton() self.curve_fill_level = pqg.SpinBox(step=.1, dec=True, minStep=.1) self.curve_fill_color.sigColorChanging.connect(self.set_curve_fill) self.curve_fill_level.sigValueChanging.connect(self.set_curve_fill) tbl.setCellWidget(5, 0, self.curve_fill_color) tbl.setCellWidget(5, 1, self.curve_fill_level)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(1213, 744) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout_6 = QtGui.QVBoxLayout(Form) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.splitter_side_bar = QtGui.QSplitter(Form) self.splitter_side_bar.setOrientation(QtCore.Qt.Horizontal) self.splitter_side_bar.setObjectName(_fromUtf8("splitter_side_bar")) self.layoutWidget = QtGui.QWidget(self.splitter_side_bar) self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) self.verticalLayout.setMargin(0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.tree_data = QtGui.QTreeWidget(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.tree_data.sizePolicy().hasHeightForWidth()) self.tree_data.setSizePolicy(sizePolicy) self.tree_data.setColumnCount(2) self.tree_data.setObjectName(_fromUtf8("tree_data")) self.verticalLayout.addWidget(self.tree_data) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_17 = QtGui.QLabel(self.layoutWidget) self.label_17.setMaximumSize(QtCore.QSize(60, 25)) font = QtGui.QFont() font.setPointSize(13) font.setItalic(False) font.setUnderline(False) font.setStrikeOut(False) self.label_17.setFont(font) self.label_17.setTextFormat(QtCore.Qt.RichText) self.label_17.setScaledContents(True) self.label_17.setObjectName(_fromUtf8("label_17")) self.horizontalLayout_3.addWidget(self.label_17) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.verticalLayout.addLayout(self.horizontalLayout_3) self.table_images = QtGui.QTableWidget(self.layoutWidget) self.table_images.setObjectName(_fromUtf8("table_images")) self.table_images.setColumnCount(3) self.table_images.setRowCount(0) item = QtGui.QTableWidgetItem() self.table_images.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.table_images.setHorizontalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.table_images.setHorizontalHeaderItem(2, item) self.verticalLayout.addWidget(self.table_images) self.btn_newImage = QtGui.QPushButton(self.layoutWidget) self.btn_newImage.setMaximumSize(QtCore.QSize(16777215, 25)) self.btn_newImage.setObjectName(_fromUtf8("btn_newImage")) self.verticalLayout.addWidget(self.btn_newImage) self.horizontalLayout_13 = QtGui.QHBoxLayout() self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) self.label_18 = QtGui.QLabel(self.layoutWidget) self.label_18.setMaximumSize(QtCore.QSize(100, 25)) font = QtGui.QFont() font.setPointSize(13) font.setItalic(False) font.setUnderline(False) font.setStrikeOut(False) self.label_18.setFont(font) self.label_18.setTextFormat(QtCore.Qt.RichText) self.label_18.setScaledContents(True) self.label_18.setObjectName(_fromUtf8("label_18")) self.horizontalLayout_13.addWidget(self.label_18) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem1) self.verticalLayout.addLayout(self.horizontalLayout_13) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.label_13 = QtGui.QLabel(self.layoutWidget) self.label_13.setMaximumSize(QtCore.QSize(25, 30)) self.label_13.setObjectName(_fromUtf8("label_13")) self.horizontalLayout_9.addWidget(self.label_13) self.combo_select_source = QtGui.QComboBox(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.combo_select_source.sizePolicy().hasHeightForWidth()) self.combo_select_source.setSizePolicy(sizePolicy) self.combo_select_source.setMaximumSize(QtCore.QSize(150, 20)) self.combo_select_source.setObjectName(_fromUtf8("combo_select_source")) self.horizontalLayout_9.addWidget(self.combo_select_source) self.label_14 = QtGui.QLabel(self.layoutWidget) self.label_14.setMaximumSize(QtCore.QSize(20, 30)) self.label_14.setObjectName(_fromUtf8("label_14")) self.horizontalLayout_9.addWidget(self.label_14) self.combo_select_val = QtGui.QComboBox(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.combo_select_val.sizePolicy().hasHeightForWidth()) self.combo_select_val.setSizePolicy(sizePolicy) self.combo_select_val.setMaximumSize(QtCore.QSize(150, 20)) self.combo_select_val.setObjectName(_fromUtf8("combo_select_val")) self.horizontalLayout_9.addWidget(self.combo_select_val) spacerItem2 = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_9) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.label_5 = QtGui.QLabel(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) self.label_5.setSizePolicy(sizePolicy) self.label_5.setMaximumSize(QtCore.QSize(10, 20)) self.label_5.setAlignment(QtCore.Qt.AlignCenter) self.label_5.setObjectName(_fromUtf8("label_5")) self.gridLayout.addWidget(self.label_5, 0, 0, 1, 1) self.label_10 = QtGui.QLabel(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth()) self.label_10.setSizePolicy(sizePolicy) self.label_10.setMaximumSize(QtCore.QSize(10, 20)) self.label_10.setAlignment(QtCore.Qt.AlignCenter) self.label_10.setObjectName(_fromUtf8("label_10")) self.gridLayout.addWidget(self.label_10, 1, 0, 1, 1) self.label_11 = QtGui.QLabel(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_11.sizePolicy().hasHeightForWidth()) self.label_11.setSizePolicy(sizePolicy) self.label_11.setMaximumSize(QtCore.QSize(10, 20)) self.label_11.setAlignment(QtCore.Qt.AlignCenter) self.label_11.setObjectName(_fromUtf8("label_11")) self.gridLayout.addWidget(self.label_11, 0, 2, 1, 1) self.label_12 = QtGui.QLabel(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_12.sizePolicy().hasHeightForWidth()) self.label_12.setSizePolicy(sizePolicy) self.label_12.setMaximumSize(QtCore.QSize(10, 20)) self.label_12.setAlignment(QtCore.Qt.AlignCenter) self.label_12.setObjectName(_fromUtf8("label_12")) self.gridLayout.addWidget(self.label_12, 1, 2, 1, 1) self.combo_x = QtGui.QComboBox(self.layoutWidget) self.combo_x.setObjectName(_fromUtf8("combo_x")) self.gridLayout.addWidget(self.combo_x, 0, 1, 1, 1) self.combo_y = QtGui.QComboBox(self.layoutWidget) self.combo_y.setObjectName(_fromUtf8("combo_y")) self.gridLayout.addWidget(self.combo_y, 1, 1, 1, 1) self.combo_t = QtGui.QComboBox(self.layoutWidget) self.combo_t.setObjectName(_fromUtf8("combo_t")) self.gridLayout.addWidget(self.combo_t, 0, 3, 1, 1) self.combo_c = QtGui.QComboBox(self.layoutWidget) self.combo_c.setObjectName(_fromUtf8("combo_c")) self.gridLayout.addWidget(self.combo_c, 1, 3, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.table_slice = QtGui.QTableWidget(self.layoutWidget) self.table_slice.setObjectName(_fromUtf8("table_slice")) self.table_slice.setColumnCount(3) self.table_slice.setRowCount(0) item = QtGui.QTableWidgetItem() self.table_slice.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.table_slice.setHorizontalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.table_slice.setHorizontalHeaderItem(2, item) self.verticalLayout.addWidget(self.table_slice) self.horizontalLayout_14 = QtGui.QHBoxLayout() self.horizontalLayout_14.setObjectName(_fromUtf8("horizontalLayout_14")) self.label_19 = QtGui.QLabel(self.layoutWidget) self.label_19.setMaximumSize(QtCore.QSize(100, 25)) font = QtGui.QFont() font.setPointSize(13) font.setItalic(False) font.setUnderline(False) font.setStrikeOut(False) self.label_19.setFont(font) self.label_19.setTextFormat(QtCore.Qt.RichText) self.label_19.setScaledContents(True) self.label_19.setObjectName(_fromUtf8("label_19")) self.horizontalLayout_14.addWidget(self.label_19) self.checkBox_isocurve = QtGui.QCheckBox(self.layoutWidget) self.checkBox_isocurve.setText(_fromUtf8("")) self.checkBox_isocurve.setObjectName(_fromUtf8("checkBox_isocurve")) self.horizontalLayout_14.addWidget(self.checkBox_isocurve) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem3) self.verticalLayout.addLayout(self.horizontalLayout_14) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.label_15 = QtGui.QLabel(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_15.sizePolicy().hasHeightForWidth()) self.label_15.setSizePolicy(sizePolicy) self.label_15.setObjectName(_fromUtf8("label_15")) self.horizontalLayout_5.addWidget(self.label_15) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem4) self.label_16 = QtGui.QLabel(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_16.sizePolicy().hasHeightForWidth()) self.label_16.setSizePolicy(sizePolicy) self.label_16.setObjectName(_fromUtf8("label_16")) self.horizontalLayout_5.addWidget(self.label_16) self.spin_width = SpinBox(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_width.sizePolicy().hasHeightForWidth()) self.spin_width.setSizePolicy(sizePolicy) self.spin_width.setMaximumSize(QtCore.QSize(50, 15)) self.spin_width.setObjectName(_fromUtf8("spin_width")) self.horizontalLayout_5.addWidget(self.spin_width) self.verticalLayout.addLayout(self.horizontalLayout_5) self.gradient_isocurve = GradientWidget(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.gradient_isocurve.sizePolicy().hasHeightForWidth()) self.gradient_isocurve.setSizePolicy(sizePolicy) self.gradient_isocurve.setMaximumSize(QtCore.QSize(16777215, 40)) self.gradient_isocurve.setObjectName(_fromUtf8("gradient_isocurve")) self.verticalLayout.addWidget(self.gradient_isocurve) self.table_isocurve = QtGui.QTableWidget(self.layoutWidget) self.table_isocurve.setObjectName(_fromUtf8("table_isocurve")) self.table_isocurve.setColumnCount(4) self.table_isocurve.setRowCount(0) item = QtGui.QTableWidgetItem() self.table_isocurve.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.table_isocurve.setHorizontalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.table_isocurve.setHorizontalHeaderItem(2, item) item = QtGui.QTableWidgetItem() self.table_isocurve.setHorizontalHeaderItem(3, item) self.verticalLayout.addWidget(self.table_isocurve) self.btn_new_isocurve = QtGui.QPushButton(self.layoutWidget) self.btn_new_isocurve.setMaximumSize(QtCore.QSize(16777215, 25)) self.btn_new_isocurve.setObjectName(_fromUtf8("btn_new_isocurve")) self.verticalLayout.addWidget(self.btn_new_isocurve) self.splitter = QtGui.QSplitter(self.splitter_side_bar) self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter.setObjectName(_fromUtf8("splitter")) self.plot = ImageView(self.splitter) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.plot.sizePolicy().hasHeightForWidth()) self.plot.setSizePolicy(sizePolicy) self.plot.setSizeIncrement(QtCore.QSize(0, 0)) self.plot.setObjectName(_fromUtf8("plot")) self.layoutWidget1 = QtGui.QWidget(self.splitter) self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget1) self.horizontalLayout_2.setMargin(0) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.spin_x_min = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_x_min.sizePolicy().hasHeightForWidth()) self.spin_x_min.setSizePolicy(sizePolicy) self.spin_x_min.setMinimumSize(QtCore.QSize(0, 0)) self.spin_x_min.setMaximumSize(QtCore.QSize(80, 15)) self.spin_x_min.setBaseSize(QtCore.QSize(0, 0)) self.spin_x_min.setObjectName(_fromUtf8("spin_x_min")) self.horizontalLayout.addWidget(self.spin_x_min) self.spin_x_max = SpinBox(self.layoutWidget1) self.spin_x_max.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_x_max.sizePolicy().hasHeightForWidth()) self.spin_x_max.setSizePolicy(sizePolicy) self.spin_x_max.setMinimumSize(QtCore.QSize(0, 0)) self.spin_x_max.setMaximumSize(QtCore.QSize(80, 15)) self.spin_x_max.setBaseSize(QtCore.QSize(0, 0)) self.spin_x_max.setObjectName(_fromUtf8("spin_x_max")) self.horizontalLayout.addWidget(self.spin_x_max) self.spin_y_min = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_y_min.sizePolicy().hasHeightForWidth()) self.spin_y_min.setSizePolicy(sizePolicy) self.spin_y_min.setMinimumSize(QtCore.QSize(0, 0)) self.spin_y_min.setMaximumSize(QtCore.QSize(80, 15)) self.spin_y_min.setBaseSize(QtCore.QSize(0, 0)) self.spin_y_min.setObjectName(_fromUtf8("spin_y_min")) self.horizontalLayout.addWidget(self.spin_y_min) self.spin_y_max = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_y_max.sizePolicy().hasHeightForWidth()) self.spin_y_max.setSizePolicy(sizePolicy) self.spin_y_max.setMinimumSize(QtCore.QSize(0, 0)) self.spin_y_max.setMaximumSize(QtCore.QSize(80, 15)) self.spin_y_max.setBaseSize(QtCore.QSize(0, 0)) self.spin_y_max.setObjectName(_fromUtf8("spin_y_max")) self.horizontalLayout.addWidget(self.spin_y_max) self.spin_t = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_t.sizePolicy().hasHeightForWidth()) self.spin_t.setSizePolicy(sizePolicy) self.spin_t.setMaximumSize(QtCore.QSize(80, 15)) self.spin_t.setObjectName(_fromUtf8("spin_t")) self.horizontalLayout.addWidget(self.spin_t) self.spin_lvl_min = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_lvl_min.sizePolicy().hasHeightForWidth()) self.spin_lvl_min.setSizePolicy(sizePolicy) self.spin_lvl_min.setMaximumSize(QtCore.QSize(80, 15)) self.spin_lvl_min.setObjectName(_fromUtf8("spin_lvl_min")) self.horizontalLayout.addWidget(self.spin_lvl_min) self.spin_lvl_max = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_lvl_max.sizePolicy().hasHeightForWidth()) self.spin_lvl_max.setSizePolicy(sizePolicy) self.spin_lvl_max.setMaximumSize(QtCore.QSize(80, 15)) self.spin_lvl_max.setObjectName(_fromUtf8("spin_lvl_max")) self.horizontalLayout.addWidget(self.spin_lvl_max) self.verticalLayout_5.addLayout(self.horizontalLayout) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint) self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.label_3 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) self.label_3.setSizePolicy(sizePolicy) self.label_3.setMinimumSize(QtCore.QSize(0, 0)) self.label_3.setMaximumSize(QtCore.QSize(40, 15)) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName(_fromUtf8("label_3")) self.horizontalLayout_4.addWidget(self.label_3) self.label_4 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) self.label_4.setSizePolicy(sizePolicy) self.label_4.setMinimumSize(QtCore.QSize(0, 0)) self.label_4.setMaximumSize(QtCore.QSize(40, 15)) self.label_4.setAlignment(QtCore.Qt.AlignCenter) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_4.addWidget(self.label_4) self.label = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setMinimumSize(QtCore.QSize(0, 0)) self.label.setMaximumSize(QtCore.QSize(40, 15)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout_4.addWidget(self.label) self.label_2 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(0, 0)) self.label_2.setMaximumSize(QtCore.QSize(40, 15)) self.label_2.setScaledContents(False) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_4.addWidget(self.label_2) self.label_7 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth()) self.label_7.setSizePolicy(sizePolicy) self.label_7.setMinimumSize(QtCore.QSize(0, 0)) self.label_7.setMaximumSize(QtCore.QSize(40, 15)) self.label_7.setAlignment(QtCore.Qt.AlignCenter) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout_4.addWidget(self.label_7) self.label_8 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth()) self.label_8.setSizePolicy(sizePolicy) self.label_8.setMinimumSize(QtCore.QSize(0, 0)) self.label_8.setMaximumSize(QtCore.QSize(40, 15)) self.label_8.setAlignment(QtCore.Qt.AlignCenter) self.label_8.setObjectName(_fromUtf8("label_8")) self.horizontalLayout_4.addWidget(self.label_8) self.label_9 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth()) self.label_9.setSizePolicy(sizePolicy) self.label_9.setMinimumSize(QtCore.QSize(0, 0)) self.label_9.setMaximumSize(QtCore.QSize(40, 15)) self.label_9.setAlignment(QtCore.Qt.AlignCenter) self.label_9.setObjectName(_fromUtf8("label_9")) self.horizontalLayout_4.addWidget(self.label_9) self.verticalLayout_5.addLayout(self.horizontalLayout_4) self.horizontalLayout_2.addLayout(self.verticalLayout_5) self.checkBox_lockRatio = QtGui.QCheckBox(self.layoutWidget1) self.checkBox_lockRatio.setMaximumSize(QtCore.QSize(80, 15)) self.checkBox_lockRatio.setObjectName(_fromUtf8("checkBox_lockRatio")) self.horizontalLayout_2.addWidget(self.checkBox_lockRatio) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.btn_autoRange = QtGui.QPushButton(self.layoutWidget1) self.btn_autoRange.setMaximumSize(QtCore.QSize(100, 20)) self.btn_autoRange.setCheckable(True) self.btn_autoRange.setChecked(True) self.btn_autoRange.setObjectName(_fromUtf8("btn_autoRange")) self.verticalLayout_3.addWidget(self.btn_autoRange) self.btn_autoLvl = QtGui.QPushButton(self.layoutWidget1) self.btn_autoLvl.setMaximumSize(QtCore.QSize(100, 20)) self.btn_autoLvl.setCheckable(True) self.btn_autoLvl.setChecked(True) self.btn_autoLvl.setObjectName(_fromUtf8("btn_autoLvl")) self.verticalLayout_3.addWidget(self.btn_autoLvl) self.horizontalLayout_2.addLayout(self.verticalLayout_3) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.btnColor_background = ColorButton(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.btnColor_background.sizePolicy().hasHeightForWidth()) self.btnColor_background.setSizePolicy(sizePolicy) self.btnColor_background.setMaximumSize(QtCore.QSize(75, 25)) self.btnColor_background.setObjectName(_fromUtf8("btnColor_background")) self.verticalLayout_4.addWidget(self.btnColor_background) self.label_6 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth()) self.label_6.setSizePolicy(sizePolicy) self.label_6.setMaximumSize(QtCore.QSize(100, 15)) self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName(_fromUtf8("label_6")) self.verticalLayout_4.addWidget(self.label_6) self.horizontalLayout_2.addLayout(self.verticalLayout_4) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.btnColor_grid = ColorButton(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.btnColor_grid.sizePolicy().hasHeightForWidth()) self.btnColor_grid.setSizePolicy(sizePolicy) self.btnColor_grid.setMaximumSize(QtCore.QSize(75, 25)) self.btnColor_grid.setObjectName(_fromUtf8("btnColor_grid")) self.verticalLayout_2.addWidget(self.btnColor_grid) self.checkBox_showGrid = QtGui.QCheckBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.checkBox_showGrid.sizePolicy().hasHeightForWidth()) self.checkBox_showGrid.setSizePolicy(sizePolicy) self.checkBox_showGrid.setMaximumSize(QtCore.QSize(80, 15)) self.checkBox_showGrid.setObjectName(_fromUtf8("checkBox_showGrid")) self.verticalLayout_2.addWidget(self.checkBox_showGrid) self.horizontalLayout_2.addLayout(self.verticalLayout_2) self.verticalLayout_8 = QtGui.QVBoxLayout() self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.checkBox_x_slice = QtGui.QCheckBox(self.layoutWidget1) self.checkBox_x_slice.setMaximumSize(QtCore.QSize(80, 15)) self.checkBox_x_slice.setObjectName(_fromUtf8("checkBox_x_slice")) self.verticalLayout_8.addWidget(self.checkBox_x_slice) self.checkBox_y_slice = QtGui.QCheckBox(self.layoutWidget1) self.checkBox_y_slice.setMaximumSize(QtCore.QSize(80, 15)) self.checkBox_y_slice.setObjectName(_fromUtf8("checkBox_y_slice")) self.verticalLayout_8.addWidget(self.checkBox_y_slice) self.horizontalLayout_2.addLayout(self.verticalLayout_8) self.verticalLayout_6.addWidget(self.splitter_side_bar) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(1316, 888) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout_7 = QtGui.QVBoxLayout(Form) self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) self.splitter_side_bar = QtGui.QSplitter(Form) self.splitter_side_bar.setOrientation(QtCore.Qt.Horizontal) self.splitter_side_bar.setObjectName(_fromUtf8("splitter_side_bar")) self.layoutWidget = QtGui.QWidget(self.splitter_side_bar) self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) self.verticalLayout.setMargin(0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.splitter_4 = QtGui.QSplitter(self.layoutWidget) self.splitter_4.setOrientation(QtCore.Qt.Vertical) self.splitter_4.setObjectName(_fromUtf8("splitter_4")) self.tree_data = QtGui.QTreeWidget(self.splitter_4) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.tree_data.sizePolicy().hasHeightForWidth()) self.tree_data.setSizePolicy(sizePolicy) self.tree_data.setColumnCount(2) self.tree_data.setObjectName(_fromUtf8("tree_data")) self.verticalLayout.addWidget(self.splitter_4) self.horizontalLayout_12 = QtGui.QHBoxLayout() self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12")) self.label_17 = QtGui.QLabel(self.layoutWidget) self.label_17.setMaximumSize(QtCore.QSize(60, 25)) font = QtGui.QFont() font.setPointSize(13) font.setItalic(False) font.setUnderline(False) font.setStrikeOut(False) self.label_17.setFont(font) self.label_17.setTextFormat(QtCore.Qt.RichText) self.label_17.setScaledContents(True) self.label_17.setObjectName(_fromUtf8("label_17")) self.horizontalLayout_12.addWidget(self.label_17) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem) self.verticalLayout.addLayout(self.horizontalLayout_12) self.table_traces = QtGui.QTableWidget(self.layoutWidget) self.table_traces.setObjectName(_fromUtf8("table_traces")) self.table_traces.setColumnCount(5) self.table_traces.setRowCount(0) item = QtGui.QTableWidgetItem() self.table_traces.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.table_traces.setHorizontalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.table_traces.setHorizontalHeaderItem(2, item) item = QtGui.QTableWidgetItem() self.table_traces.setHorizontalHeaderItem(3, item) item = QtGui.QTableWidgetItem() self.table_traces.setHorizontalHeaderItem(4, item) self.verticalLayout.addWidget(self.table_traces) self.btn_newTrace = QtGui.QPushButton(self.layoutWidget) self.btn_newTrace.setObjectName(_fromUtf8("btn_newTrace")) self.verticalLayout.addWidget(self.btn_newTrace) self.horizontalLayout_13 = QtGui.QHBoxLayout() self.horizontalLayout_13.setObjectName(_fromUtf8("horizontalLayout_13")) self.label_18 = QtGui.QLabel(self.layoutWidget) self.label_18.setMaximumSize(QtCore.QSize(100, 25)) font = QtGui.QFont() font.setPointSize(13) font.setItalic(False) font.setUnderline(False) font.setStrikeOut(False) self.label_18.setFont(font) self.label_18.setTextFormat(QtCore.Qt.RichText) self.label_18.setScaledContents(True) self.label_18.setObjectName(_fromUtf8("label_18")) self.horizontalLayout_13.addWidget(self.label_18) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem1) self.verticalLayout.addLayout(self.horizontalLayout_13) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.label_13 = QtGui.QLabel(self.layoutWidget) self.label_13.setMaximumSize(QtCore.QSize(25, 30)) self.label_13.setObjectName(_fromUtf8("label_13")) self.horizontalLayout_9.addWidget(self.label_13) self.combo_selectSource = QtGui.QComboBox(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.combo_selectSource.sizePolicy().hasHeightForWidth()) self.combo_selectSource.setSizePolicy(sizePolicy) self.combo_selectSource.setMaximumSize(QtCore.QSize(150, 20)) self.combo_selectSource.setObjectName(_fromUtf8("combo_selectSource")) self.horizontalLayout_9.addWidget(self.combo_selectSource) self.label_14 = QtGui.QLabel(self.layoutWidget) self.label_14.setMaximumSize(QtCore.QSize(20, 30)) self.label_14.setObjectName(_fromUtf8("label_14")) self.horizontalLayout_9.addWidget(self.label_14) self.combo_select_val = QtGui.QComboBox(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.combo_select_val.sizePolicy().hasHeightForWidth()) self.combo_select_val.setSizePolicy(sizePolicy) self.combo_select_val.setMaximumSize(QtCore.QSize(150, 20)) self.combo_select_val.setObjectName(_fromUtf8("combo_select_val")) self.horizontalLayout_9.addWidget(self.combo_select_val) self.label_15 = QtGui.QLabel(self.layoutWidget) self.label_15.setMaximumSize(QtCore.QSize(15, 30)) self.label_15.setObjectName(_fromUtf8("label_15")) self.horizontalLayout_9.addWidget(self.label_15) self.combo_select_arg = QtGui.QComboBox(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.combo_select_arg.sizePolicy().hasHeightForWidth()) self.combo_select_arg.setSizePolicy(sizePolicy) self.combo_select_arg.setMaximumSize(QtCore.QSize(150, 20)) self.combo_select_arg.setObjectName(_fromUtf8("combo_select_arg")) self.horizontalLayout_9.addWidget(self.combo_select_arg) spacerItem2 = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_9) self.table_slice = QtGui.QTableWidget(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.table_slice.sizePolicy().hasHeightForWidth()) self.table_slice.setSizePolicy(sizePolicy) self.table_slice.setObjectName(_fromUtf8("table_slice")) self.table_slice.setColumnCount(3) self.table_slice.setRowCount(0) item = QtGui.QTableWidgetItem() self.table_slice.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.table_slice.setHorizontalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.table_slice.setHorizontalHeaderItem(2, item) self.verticalLayout.addWidget(self.table_slice) self.horizontalLayout_11 = QtGui.QHBoxLayout() self.horizontalLayout_11.setObjectName(_fromUtf8("horizontalLayout_11")) self.label_16 = QtGui.QLabel(self.layoutWidget) self.label_16.setMaximumSize(QtCore.QSize(150, 25)) font = QtGui.QFont() font.setPointSize(13) font.setItalic(False) font.setUnderline(False) font.setStrikeOut(False) self.label_16.setFont(font) self.label_16.setTextFormat(QtCore.Qt.RichText) self.label_16.setScaledContents(True) self.label_16.setObjectName(_fromUtf8("label_16")) self.horizontalLayout_11.addWidget(self.label_16) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem3) self.verticalLayout.addLayout(self.horizontalLayout_11) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10")) self.checkBox_points = QtGui.QCheckBox(self.layoutWidget) self.checkBox_points.setMaximumSize(QtCore.QSize(16777215, 20)) self.checkBox_points.setObjectName(_fromUtf8("checkBox_points")) self.horizontalLayout_10.addWidget(self.checkBox_points) self.checkBox_curve = QtGui.QCheckBox(self.layoutWidget) self.checkBox_curve.setMaximumSize(QtCore.QSize(16777215, 20)) self.checkBox_curve.setObjectName(_fromUtf8("checkBox_curve")) self.horizontalLayout_10.addWidget(self.checkBox_curve) self.checkBox_fill = QtGui.QCheckBox(self.layoutWidget) self.checkBox_fill.setMaximumSize(QtCore.QSize(16777215, 20)) self.checkBox_fill.setObjectName(_fromUtf8("checkBox_fill")) self.horizontalLayout_10.addWidget(self.checkBox_fill) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem4) self.verticalLayout.addLayout(self.horizontalLayout_10) self.table_appearance = QtGui.QTableWidget(self.layoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.table_appearance.sizePolicy().hasHeightForWidth()) self.table_appearance.setSizePolicy(sizePolicy) self.table_appearance.setShowGrid(True) self.table_appearance.setCornerButtonEnabled(True) self.table_appearance.setObjectName(_fromUtf8("table_appearance")) self.table_appearance.setColumnCount(2) self.table_appearance.setRowCount(6) item = QtGui.QTableWidgetItem() self.table_appearance.setVerticalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.table_appearance.setVerticalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.table_appearance.setVerticalHeaderItem(2, item) item = QtGui.QTableWidgetItem() self.table_appearance.setVerticalHeaderItem(3, item) item = QtGui.QTableWidgetItem() self.table_appearance.setVerticalHeaderItem(4, item) item = QtGui.QTableWidgetItem() self.table_appearance.setVerticalHeaderItem(5, item) item = QtGui.QTableWidgetItem() self.table_appearance.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.table_appearance.setHorizontalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.table_appearance.setItem(0, 0, item) item = QtGui.QTableWidgetItem() self.table_appearance.setItem(2, 0, item) self.table_appearance.horizontalHeader().setVisible(False) self.verticalLayout.addWidget(self.table_appearance) self.splitter = QtGui.QSplitter(self.splitter_side_bar) self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter.setObjectName(_fromUtf8("splitter")) self.plot = PlotWidget(self.splitter) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.plot.sizePolicy().hasHeightForWidth()) self.plot.setSizePolicy(sizePolicy) self.plot.setSizeIncrement(QtCore.QSize(0, 0)) self.plot.setObjectName(_fromUtf8("plot")) self.layoutWidget1 = QtGui.QWidget(self.splitter) self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget1) self.horizontalLayout_2.setMargin(0) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem5) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.spin_x_min = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_x_min.sizePolicy().hasHeightForWidth()) self.spin_x_min.setSizePolicy(sizePolicy) self.spin_x_min.setMinimumSize(QtCore.QSize(0, 0)) self.spin_x_min.setMaximumSize(QtCore.QSize(80, 15)) self.spin_x_min.setBaseSize(QtCore.QSize(30, 15)) self.spin_x_min.setObjectName(_fromUtf8("spin_x_min")) self.horizontalLayout.addWidget(self.spin_x_min) self.spin_x_max = SpinBox(self.layoutWidget1) self.spin_x_max.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_x_max.sizePolicy().hasHeightForWidth()) self.spin_x_max.setSizePolicy(sizePolicy) self.spin_x_max.setMinimumSize(QtCore.QSize(0, 0)) self.spin_x_max.setMaximumSize(QtCore.QSize(80, 15)) self.spin_x_max.setBaseSize(QtCore.QSize(30, 15)) self.spin_x_max.setObjectName(_fromUtf8("spin_x_max")) self.horizontalLayout.addWidget(self.spin_x_max) self.spin_y_min = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_y_min.sizePolicy().hasHeightForWidth()) self.spin_y_min.setSizePolicy(sizePolicy) self.spin_y_min.setMinimumSize(QtCore.QSize(0, 0)) self.spin_y_min.setMaximumSize(QtCore.QSize(80, 15)) self.spin_y_min.setBaseSize(QtCore.QSize(30, 15)) self.spin_y_min.setObjectName(_fromUtf8("spin_y_min")) self.horizontalLayout.addWidget(self.spin_y_min) self.spin_y_max = SpinBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.spin_y_max.sizePolicy().hasHeightForWidth()) self.spin_y_max.setSizePolicy(sizePolicy) self.spin_y_max.setMinimumSize(QtCore.QSize(0, 0)) self.spin_y_max.setMaximumSize(QtCore.QSize(80, 15)) self.spin_y_max.setBaseSize(QtCore.QSize(30, 15)) self.spin_y_max.setObjectName(_fromUtf8("spin_y_max")) self.horizontalLayout.addWidget(self.spin_y_max) self.verticalLayout_5.addLayout(self.horizontalLayout) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.label_3 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) self.label_3.setSizePolicy(sizePolicy) self.label_3.setMinimumSize(QtCore.QSize(5, 10)) self.label_3.setMaximumSize(QtCore.QSize(40, 15)) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName(_fromUtf8("label_3")) self.horizontalLayout_4.addWidget(self.label_3) self.label_4 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) self.label_4.setSizePolicy(sizePolicy) self.label_4.setMinimumSize(QtCore.QSize(5, 10)) self.label_4.setMaximumSize(QtCore.QSize(40, 15)) self.label_4.setAlignment(QtCore.Qt.AlignCenter) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_4.addWidget(self.label_4) self.label = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setMinimumSize(QtCore.QSize(5, 10)) self.label.setMaximumSize(QtCore.QSize(40, 15)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout_4.addWidget(self.label) self.label_2 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(5, 10)) self.label_2.setMaximumSize(QtCore.QSize(40, 15)) self.label_2.setScaledContents(False) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout_4.addWidget(self.label_2) self.verticalLayout_5.addLayout(self.horizontalLayout_4) self.horizontalLayout_2.addLayout(self.verticalLayout_5) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.btn_autoScaleX = QtGui.QPushButton(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.btn_autoScaleX.sizePolicy().hasHeightForWidth()) self.btn_autoScaleX.setSizePolicy(sizePolicy) self.btn_autoScaleX.setMaximumSize(QtCore.QSize(75, 25)) self.btn_autoScaleX.setCheckable(True) self.btn_autoScaleX.setChecked(True) self.btn_autoScaleX.setObjectName(_fromUtf8("btn_autoScaleX")) self.verticalLayout_3.addWidget(self.btn_autoScaleX) self.btn_autoScaleY = QtGui.QPushButton(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.btn_autoScaleY.sizePolicy().hasHeightForWidth()) self.btn_autoScaleY.setSizePolicy(sizePolicy) self.btn_autoScaleY.setMaximumSize(QtCore.QSize(75, 25)) self.btn_autoScaleY.setCheckable(True) self.btn_autoScaleY.setChecked(True) self.btn_autoScaleY.setObjectName(_fromUtf8("btn_autoScaleY")) self.verticalLayout_3.addWidget(self.btn_autoScaleY) self.horizontalLayout_2.addLayout(self.verticalLayout_3) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.btnColor_background = ColorButton(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.btnColor_background.sizePolicy().hasHeightForWidth()) self.btnColor_background.setSizePolicy(sizePolicy) self.btnColor_background.setMaximumSize(QtCore.QSize(75, 20)) self.btnColor_background.setObjectName(_fromUtf8("btnColor_background")) self.verticalLayout_4.addWidget(self.btnColor_background) self.label_6 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth()) self.label_6.setSizePolicy(sizePolicy) self.label_6.setMaximumSize(QtCore.QSize(100, 15)) self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName(_fromUtf8("label_6")) self.verticalLayout_4.addWidget(self.label_6) self.horizontalLayout_2.addLayout(self.verticalLayout_4) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.btnColor_grid = ColorButton(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.btnColor_grid.sizePolicy().hasHeightForWidth()) self.btnColor_grid.setSizePolicy(sizePolicy) self.btnColor_grid.setMaximumSize(QtCore.QSize(75, 20)) self.btnColor_grid.setObjectName(_fromUtf8("btnColor_grid")) self.verticalLayout_2.addWidget(self.btnColor_grid) self.label_5 = QtGui.QLabel(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) self.label_5.setSizePolicy(sizePolicy) self.label_5.setMaximumSize(QtCore.QSize(75, 15)) self.label_5.setAlignment(QtCore.Qt.AlignCenter) self.label_5.setObjectName(_fromUtf8("label_5")) self.verticalLayout_2.addWidget(self.label_5) self.horizontalLayout_2.addLayout(self.verticalLayout_2) self.verticalLayout_8 = QtGui.QVBoxLayout() self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.checkBox_logX = QtGui.QCheckBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.checkBox_logX.sizePolicy().hasHeightForWidth()) self.checkBox_logX.setSizePolicy(sizePolicy) self.checkBox_logX.setMaximumSize(QtCore.QSize(16777215, 15)) self.checkBox_logX.setObjectName(_fromUtf8("checkBox_logX")) self.verticalLayout_8.addWidget(self.checkBox_logX) self.checkBox_logY = QtGui.QCheckBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.checkBox_logY.sizePolicy().hasHeightForWidth()) self.checkBox_logY.setSizePolicy(sizePolicy) self.checkBox_logY.setMaximumSize(QtCore.QSize(16777215, 15)) self.checkBox_logY.setObjectName(_fromUtf8("checkBox_logY")) self.verticalLayout_8.addWidget(self.checkBox_logY) self.horizontalLayout_2.addLayout(self.verticalLayout_8) self.verticalLayout_6 = QtGui.QVBoxLayout() self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.checkBox_showGrid = QtGui.QCheckBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.checkBox_showGrid.sizePolicy().hasHeightForWidth()) self.checkBox_showGrid.setSizePolicy(sizePolicy) self.checkBox_showGrid.setMaximumSize(QtCore.QSize(16777215, 15)) self.checkBox_showGrid.setObjectName(_fromUtf8("checkBox_showGrid")) self.verticalLayout_6.addWidget(self.checkBox_showGrid) self.checkBox_showLegend = QtGui.QCheckBox(self.layoutWidget1) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.checkBox_showLegend.sizePolicy().hasHeightForWidth()) self.checkBox_showLegend.setSizePolicy(sizePolicy) self.checkBox_showLegend.setMaximumSize(QtCore.QSize(16777215, 15)) self.checkBox_showLegend.setObjectName(_fromUtf8("checkBox_showLegend")) self.verticalLayout_6.addWidget(self.checkBox_showLegend) self.horizontalLayout_2.addLayout(self.verticalLayout_6) self.checkBox_lockRatio = QtGui.QCheckBox(self.layoutWidget1) self.checkBox_lockRatio.setMaximumSize(QtCore.QSize(16777215, 20)) self.checkBox_lockRatio.setObjectName(_fromUtf8("checkBox_lockRatio")) self.horizontalLayout_2.addWidget(self.checkBox_lockRatio) spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem6) self.verticalLayout_7.addWidget(self.splitter_side_bar) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
class TraceTab(QtGui.QWidget, Ui_Form): """A widget that represents one tab for displaying traces.""" def __init__(self, Graph): """Add SELF to PARENT in GRAPH, which should be a tab page.""" # Initialize the widget and UI. QtGui.QWidget.__init__(self) self.setupUi(self) # Default Fields self.graph = Graph self.backgroundColor = pqg.mkColor(255, 255, 255, 100) self.gridColor = pqg.mkColor(0, 0, 0, 255) self.traces = {} self.dataStreams = Graph.dataStreams self.traceCombos = [] self.legend = None self.name = None self.enableSetRange = True self.enableUpdateBoxes = True self.curTrace = None # Add the grid, and get rid of the autoscale button. self.plot.getPlotItem().showGrid(True, True, 255) self.plot.getPlotItem().hideButtons() # Initializing the spin boxes: self.spin_x_min.setOpts(step=.1, dec=True, minStep=.1) self.spin_x_max.setOpts(step=.1, dec=True, minStep=.1) self.spin_y_min.setOpts(step=.1, dec=True, minStep=.1) self.spin_y_max.setOpts(step=.1, dec=True, minStep=.1) self.plot.getPlotItem().sigRangeChanged.connect(self.updateRangeBoxes) self.spin_x_min.valueChanged.connect(self.setRange) self.spin_x_max.valueChanged.connect(self.setRange) self.spin_y_min.valueChanged.connect(self.setRange) self.spin_y_max.valueChanged.connect(self.setRange) self.updateRangeBoxes() # Setting background color self.plot.getPlotItem().getViewBox().setBackgroundColor( self.backgroundColor) # Connecting buttons. self.btn_autoScaleX.clicked.connect(self.autoScaleX) self.btn_autoScaleY.clicked.connect(self.autoScaleY) # Connecting the check boxes. self.checkBox_showGrid.setChecked(True) self.checkBox_showGrid.clicked.connect(self.showGrid) self.checkBox_showLegend.clicked.connect(self.showLegend) self.checkBox_logX.clicked.connect(self.toggleLogX) self.checkBox_logY.clicked.connect(self.toggleLogY) self.checkBox_lockRatio.clicked.connect(self.lockRatio) # Connecting the color buttons self.btnColor_background.sigColorChanging.connect(self.setBackgroundColor) self.btnColor_grid.sigColorChanging.connect(self.setGridColor) # self.btnColor_background.colorDialog.setParent(self.graph) self.btnColor_background.parent44 = self.graph # Initializing the color buttons self.btnColor_background.setColor(self.backgroundColor) self.btnColor_grid.setColor(self.gridColor) # Connecting the Create New Trace button self.btn_newTrace.clicked.connect(self.newTrace) # Connecting trace data selectors self.combo_selectSource.activated.connect(self.select_source) self.combo_select_val.activated.connect(self.select_val) self.combo_select_arg.activated.connect(self.select_arg) # Connecting checkboxes showPoints = lambda: self.toggle_show_points(self.checkBox_points) self.checkBox_points.clicked.connect(showPoints) showCurve = lambda: self.toggle_show_curve(self.checkBox_curve) self.checkBox_curve.clicked.connect(showCurve) showFill = lambda: self.toggle_show_fill(self.checkBox_fill) self.checkBox_fill.clicked.connect(showFill) self.splitter.setSizes([10000, 1]) self.table_traces.cellClicked.connect(self.cell_clicked) self.table_traces.setSelectionMode(QtGui.QAbstractItemView.NoSelection) self.init_appearance() self.tree_data.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.tree_data.customContextMenuRequested.connect(self.ds_menu) self.table_traces.itemChanged.connect(self.item_changed) def zoom_to_current(self): """Zoom the viewbox to view the current plot.""" xMin, xMax = self.curTrace.dataBounds(0) yMin, yMax = self.curTrace.dataBounds(1) xMin -= (xMax - xMin) / 20.0 xMax += (xMax - xMin) / 20.0 yMin -= (yMax - yMin) / 20.0 yMax += (yMax - yMin) / 20.0 self.spin_x_min.setValue(xMin) self.spin_x_max.setValue(xMax) self.spin_y_min.setValue(yMin) self.spin_y_max.setValue(yMax) def item_changed(self, item): col = item.column() if col == 0: item.trace.setName(item.text()) def paste_plot(self, plot): if isinstance(plot, TraceItem): self.newTrace() self.curTrace.setName(plot.name()) self.curTrace.copy_data(plot) self.sync_buttons() self.curTrace.toggleShowFill(self.checkBox_fill) self.curTrace.toggleShowPoints(self.checkBox_points) self.curTrace.toggleShowCurve(self.checkBox_curve) self.curTrace.update_slice_table(self.table_slice) if isinstance(plot, ImageItem): self.newTrace() self.curTrace.setName(plot.name) self.curTrace.copy_data(plot) self.sync_buttons() self.curTrace.toggleShowFill(self.checkBox_fill) self.curTrace.toggleShowPoints(self.checkBox_points) self.curTrace.toggleShowCurve(self.checkBox_curve) self.curTrace.update_slice_table(self.table_slice) def ds_menu(self, pos): item = self.tree_data.itemAt(pos) if item is None: return try: if item.isClickable: pass except AttributeError: return valName = str(item.text(0)) argIndex = 0 extra = "" ds = item.ds if item.dataType == 'arg': valName = item.valName argName = str(item.text(0)) extra = " vs " + argName argIndex = ds.get_args_to_val(valName).index(argName) globalPos = self.tree_data.mapToGlobal(pos) myMenu = QtGui.QMenu() myMenu.addAction("plot " + valName + extra) selectedItem = myMenu.exec_(globalPos) if selectedItem is None: return if str(selectedItem.text()) == "plot " + valName + extra: self.newTrace() index = self.combo_selectSource.findText(ds.name) self.combo_selectSource.setCurrentIndex(index) self.select_source(index) index = self.combo_select_val.findText(valName) self.combo_select_val.setCurrentIndex(index) self.select_val(index) self.combo_select_arg.setCurrentIndex(argIndex) self.select_arg(argIndex) def init_appearance(self): """Initialize the Trace Appearance table.""" tbl = self.table_appearance # Creating and connecting point pen buttons self.point_pen_color = ColorButton() self.point_pen_size = pqg.SpinBox( step=.1, dec=True, minStep=.1, bounds=(0, None)) self.point_pen_color.sigColorChanging.connect(self.set_point_pen) self.point_pen_size.sigValueChanging.connect(self.set_point_pen) tbl.setCellWidget(0, 0, self.point_pen_color) tbl.setCellWidget(0, 1, self.point_pen_size) # Creating and connecting point outline buttons self.point_outline_color = ColorButton() self.point_outline_size = pqg.SpinBox( step=.1, dec=True, minStep=.01, bounds=(0, 1)) self.point_outline_color.sigColorChanging.connect(self.set_point_outline) self.point_outline_size.sigValueChanging.connect(self.set_point_outline) tbl.setCellWidget(1, 0, self.point_outline_color) tbl.setCellWidget(1, 1, self.point_outline_size) # Creating and connecting point style buttons self.point_shape = QtGui.QComboBox() self.point_shape.addItems( ["Circle", "Square", "Triangle", "Diamond", 'Plus']) self.point_shape.activated.connect(self.set_point_shape) self.px_mode = QtGui.QCheckBox("px mode") self.px_mode.setChecked(True) self.px_mode.stateChanged.connect(self.toggle_px_mode) tbl.setCellWidget(2, 0, self.point_shape) tbl.setCellWidget(2, 1, self.px_mode) # Creating and connecting curve pen buttons self.curve_pen_color = ColorButton() self.curve_pen_size = pqg.SpinBox( step=.1, dec=True, minStep=.1, bounds=(0, None)) self.curve_pen_color.sigColorChanging.connect(self.set_curve_pen) self.curve_pen_size.sigValueChanging.connect(self.set_curve_pen) tbl.setCellWidget(3, 0, self.curve_pen_color) tbl.setCellWidget(3, 1, self.curve_pen_size) # Creating and connecting curve shadow buttons self.curve_shadow_color = ColorButton() self.curve_shadow_size = pqg.SpinBox( step=.1, dec=True, minStep=.1, bounds=(0, 1)) self.curve_shadow_color.sigColorChanging.connect(self.set_curve_shadow) self.curve_shadow_size.sigValueChanging.connect(self.set_curve_shadow) tbl.setCellWidget(4, 0, self.curve_shadow_color) tbl.setCellWidget(4, 1, self.curve_shadow_size) # Creating and connecting fill buttons self.curve_fill_color = ColorButton() self.curve_fill_level = pqg.SpinBox(step=.1, dec=True, minStep=.1) self.curve_fill_color.sigColorChanging.connect(self.set_curve_fill) self.curve_fill_level.sigValueChanging.connect(self.set_curve_fill) tbl.setCellWidget(5, 0, self.curve_fill_color) tbl.setCellWidget(5, 1, self.curve_fill_level) def toggle_show_points(self, checkBox): if self.curTrace is not None: self.curTrace.toggleShowPoints(checkBox) def toggle_show_curve(self, checkBox): if self.curTrace is not None: self.curTrace.toggleShowCurve(checkBox) def toggle_show_fill(self, checkBox): if self.curTrace is not None: self.curTrace.toggleShowFill(checkBox) def set_point_pen(self, *args): if self.curTrace is not None: color = self.point_pen_color.color() size = self.point_pen_size.value() self.curTrace.setPointPen(color, size) def set_point_outline(self, *args): if self.curTrace is not None: color = self.point_outline_color.color() size = self.point_outline_size.value() self.curTrace.setPointOutline(color, size) def set_point_shape(self): if self.curTrace is not None: self.curTrace.setPointShape(self.point_shape) def toggle_px_mode(self): if self.curTrace is not None: self.curTrace.togglePxMode(self.px_mode) def set_curve_pen(self, *args): if self.curTrace is not None: color = self.curve_pen_color.color() size = self.curve_pen_size.value() self.curTrace.setCurvePen(color, size) def set_curve_shadow(self, *args): if self.curTrace is not None: color = self.curve_shadow_color.color() size = self.curve_shadow_size.value() self.curTrace.setCurveShadow(color, size) def set_curve_fill(self, *args): if self.curTrace is not None: color = self.curve_fill_color.color() level = self.curve_fill_level.value() self.curTrace.setFill(color, level) def sync_buttons(self): if self.curTrace is None: return trace = self.curTrace self.combo_select_val.blockSignals(True) self.combo_selectSource.blockSignals(True) self.combo_select_arg.blockSignals(True) self.point_pen_color.blockSignals(True) self.point_pen_size.blockSignals(True) self.point_outline_color.blockSignals(True) self.point_outline_size.blockSignals(True) self.point_shape.blockSignals(True) self.px_mode.blockSignals(True) self.curve_pen_color.blockSignals(True) self.curve_pen_size.blockSignals(True) self.curve_shadow_color.blockSignals(True) self.curve_shadow_size.blockSignals(True) self.curve_fill_color.blockSignals(True) self.curve_fill_level.blockSignals(True) self.checkBox_points.blockSignals(True) self.checkBox_curve.blockSignals(True) self.checkBox_fill.blockSignals(True) if trace.argName is not None: index = self.combo_selectSource.findText(trace.ds.name) self.combo_selectSource.setCurrentIndex(index) self.select_source(index) index = self.combo_select_val.findText(trace.valName) self.combo_select_val.setCurrentIndex(index) self.select_val(index) index = self.combo_select_arg.findText(trace.argName) self.combo_select_arg.setCurrentIndex(index) else: self.combo_selectSource.setCurrentIndex(-1) self.combo_select_val.clear() self.combo_select_arg.clear() pointDict = {'o': 'Circle', 's': 'Square', 't': 'Triangle', 'd': 'Diamond', '+': 'Plus'} index = self.point_shape.findText(pointDict[trace.symbol]) self.point_shape.setCurrentIndex(index) self.point_pen_color.setColor(trace.pointColor) self.point_pen_size.setValue(trace.pointSize) self.point_outline_color.setColor(trace.outlineColor) self.point_outline_size.setValue(trace.outlineSize) self.px_mode.setChecked(trace.pxMode) self.curve_pen_color.setColor(trace.curveColor) self.curve_pen_size.setValue(trace.curveSize) self.curve_shadow_color.setColor(trace.shadowColor) self.curve_shadow_size.setValue(trace.shadowSize) self.curve_fill_color.setColor(trace.fillColor) self.curve_fill_level.setValue(trace.fillLevel) self.checkBox_points.setChecked(trace.showPoints) self.checkBox_curve.setChecked(trace.showCurve) self.checkBox_fill.setChecked(trace.showFill) self.combo_select_val.blockSignals(False) self.combo_selectSource.blockSignals(False) self.combo_select_arg.blockSignals(False) self.point_pen_color.blockSignals(False) self.point_pen_size.blockSignals(False) self.point_outline_color.blockSignals(False) self.point_outline_size.blockSignals(False) self.point_shape.blockSignals(False) self.px_mode.blockSignals(False) self.curve_pen_color.blockSignals(False) self.curve_pen_size.blockSignals(False) self.curve_shadow_color.blockSignals(False) self.curve_shadow_size.blockSignals(False) self.curve_fill_color.blockSignals(False) self.curve_fill_level.blockSignals(False) self.checkBox_points.blockSignals(False) self.checkBox_curve.blockSignals(False) self.checkBox_fill.blockSignals(False) def select_source(self, index): """Change the dataStream that COMBO_SELECT_VAL pulls from and clear COMBO_SELECT_ARG.""" dsName = str(self.combo_selectSource.currentText()) ds = self.dataStreams[dsName] self.combo_select_val.clear() self.combo_select_arg.clear() self.combo_select_val.addItems(ds.vals.keys()) def select_val(self, index): valName = str(self.combo_select_val.currentText()) dsName = str(self.combo_selectSource.currentText()) ds = self.dataStreams[dsName] self.combo_select_arg.clear() self.combo_select_arg.addItems(ds.get_args_to_val(valName)) def select_arg(self, index): argName = str(self.combo_select_arg.currentText()) valName = str(self.combo_select_val.currentText()) dsName = str(self.combo_selectSource.currentText()) ds = self.dataStreams[dsName] if self.curTrace is None: self.newTrace() self.curTrace.set_data_source(ds, valName, argName) self.curTrace.update_slice_table(self.table_slice) self.sync_buttons() def toggleLogX(self): if self.checkBox_logX.isChecked(): self.plot.getPlotItem().setLogMode(x=True) else: self.plot.getPlotItem().setLogMode(x=False) def toggleLogY(self): if self.checkBox_logY.isChecked(): self.plot.getPlotItem().setLogMode(y=True) else: self.plot.getPlotItem().setLogMode(y=False) def deleteTab(self): for key, trace in self.traces.items(): trace.delete() del self.traces del self.graph del self.plot self.destroy() def delete_trace(self, trace): self.traces.pop(trace.name()) index = -1 for row in range(self.table_traces.rowCount()): item = self.table_traces.item(row, 0) if str(item.text()) == trace.name(): index = row if index == -1: raise Exception("Cannot find trace in table.") if self.curTrace == trace: if len(self.traces) == 0: self.curTrace = None elif index == self.table_traces.rowCount()-1: name = str(self.table_traces.item(index-1, 0).text()) trace = self.traces[name] self.change_to_trace(trace) elif index < self.table_traces.rowCount()-1: name = str(self.table_traces.item(index+1, 0).text()) trace = self.traces[name] self.change_to_trace(trace) if self.graph.plotToPaste == trace: self.graph.plotToPaste = None self.table_traces.removeRow(index) def setName(self, newName): self.name = str(newName) def addDataSource(self, ds): self.combo_selectSource.addItem(ds.name) def updateRangeBoxes(self): """ Sets the values of the spin boxes to the current viewable range.""" if self.enableUpdateBoxes: self.enableSetRange = False ((x_min, x_max), (y_min, y_max) ) = self.plot.getPlotItem().viewRange() self.spin_x_min.setValue(float(x_min)) self.spin_x_max.setValue(float(x_max)) self.spin_y_min.setValue(float(y_min)) self.spin_y_max.setValue(float(y_max)) self.enableSetRange = True autoRange = self.plot.getPlotItem().getViewBox().autoRangeEnabled() self.btn_autoScaleX.setChecked(autoRange[0]) self.btn_autoScaleY.setChecked(autoRange[1]) def setRange(self): if self.enableSetRange: self.enableUpdateBoxes = False x_min = self.spin_x_min.value() x_max = self.spin_x_max.value() y_min = self.spin_y_min.value() y_max = self.spin_y_max.value() self.plot.getPlotItem().setRange( xRange=(x_min, x_max), yRange=(y_min, y_max), padding=False) self.enableUpdateBoxes = True self.btn_autoScaleX.setChecked(False) self.btn_autoScaleY.setChecked(False) self.plot.enableAutoRange(enable=False) def autoScaleX(self): """ Auto scales the x axis such that all item are viewable. """ enable = self.btn_autoScaleX.isChecked() XAxis = pqg.ViewBox.XAxis self.plot.enableAutoRange(axis=XAxis, enable=enable) def autoScaleY(self): """ Auto scales the y axis such that all item are viewable. """ enable = self.btn_autoScaleY.isChecked() YAxis = pqg.ViewBox.YAxis self.plot.enableAutoRange(axis=YAxis, enable=enable) def showGrid(self): """ Toggles the grid on or off. """ enable = self.checkBox_showGrid.isChecked() if enable: self.plot.getPlotItem().getAxis('left').setGrid(255) self.plot.getPlotItem().getAxis('bottom').setGrid(255) else: self.plot.getPlotItem().getAxis('left').setGrid(False) self.plot.getPlotItem().getAxis('bottom').setGrid(False) def showLegend(self): if self.checkBox_showLegend.isChecked(): self.legend = pqg.LegendItem() for trace in self.traces.itervalues(): self.legend.addItem(trace, trace.NAME) self.legend.setParentItem(self.plot.getPlotItem()) elif self.legend is not None: vb = self.plot.getPlotItem().getViewBox() vb.removeItem(self.legend) self.legend = None def setBackgroundColor(self): """ Sets the background color to the value of the value of btnColor_background.""" self.backgroundColor = self.btnColor_background.color() self.plot.getPlotItem().getViewBox().setBackgroundColor( self.backgroundColor) def setGridColor(self): """Sets the axis color to the value of btnColor_grid. """ self.axisColor = self.btnColor_grid.color() self.plot.getPlotItem().getAxis('left').setPen(self.axisColor) self.plot.getPlotItem().getAxis('bottom').setPen(self.axisColor) def lockRatio(self): """ Lock the aspect ratio of my view box to be that of my Image.""" if self.checkBox_lockRatio.isChecked(): self.plot.getPlotItem().getViewBox().setAspectLocked(True, 1.0) else: self.plot.getPlotItem().getViewBox().setAspectLocked(False) def cell_clicked(self, row, column): item = self.table_traces.item(row, 0) traceName = str(item.text()) trace = self.traces.get(traceName, None) if trace is None: raise GraphException("Not in known traces") else: self.change_to_trace(trace) def change_to_trace(self, trace): """ Set curTrace to TRACE. Update all the buttons/table_slice and then highlight the proper row in the table_traces.""" # Deselecting the previous curTrace if self.curTrace is not None: index = -1 for row in range(self.table_traces.rowCount()): item = self.table_traces.item(row, 0) if str(item.text()) == self.curTrace.name(): index = row if index != -1: item = self.table_traces.item(index, 0) item.setBackgroundColor(pqg.mkColor(255, 255, 255, 255)) # Selecting the current trace index = -1 for row in range(self.table_traces.rowCount()): item = self.table_traces.item(row, 0) if str(item.text()) == trace.name(): index = row if index != -1: item = self.table_traces.item(index, 0) item.setBackgroundColor(pqg.mkColor(0, 200, 200, 200)) self.curTrace = trace trace.update_slice_table(self.table_slice) self.sync_buttons() def newTrace(self): trace = TraceItem(self) trace.NAME = uniqueName("Trace {}", 0, self.traces) self.traces[trace.NAME] = trace trace.add_to_trace_table(self.table_traces) self.change_to_trace(trace) def rename(self, trace, newName): oldName = trace.name() if newName in self.traces.keys(): return oldName else: self.traces.pop(oldName) self.traces[newName] = trace return newName