예제 #1
0
    def add_row(self):
        """Add a new row to verhang table"""
        self.tableWidgetVerhang.insertRow(self.tableWidgetVerhang.rowCount())
        current_row = self.tableWidgetVerhang.rowCount() - 1

        # from column
        from_spinbox = QtWidgets.QDoubleSpinBox()
        from_spinbox.setMaximum(10000)
        from_spinbox.setSingleStep(50)
        from_spinbox.valueChanged.connect(self.from_spinbox_value_changed)
        self.tableWidgetVerhang.setCellWidget(current_row, 0, from_spinbox)

        # to column
        to_spinbox = QtWidgets.QDoubleSpinBox()
        to_spinbox.setMaximum(100000)
        to_spinbox.setSingleStep(50)
        to_spinbox.valueChanged.connect(self.to_spinbox_value_changed)
        self.tableWidgetVerhang.setCellWidget(current_row, 1, to_spinbox)

        # verhang column
        verhang_spinbox = QtWidgets.QDoubleSpinBox()
        verhang_spinbox.setMaximum(1)
        verhang_spinbox.setDecimals(4)
        verhang_spinbox.setSingleStep(0.001)
        verhang_spinbox.valueChanged.connect(
            self.verhang_spinbox_value_changed)
        self.tableWidgetVerhang.setCellWidget(current_row, 2, verhang_spinbox)

        self.update_verhang_table()
        self.validate_run()
예제 #2
0
    def setupUi(self, spinnnerDialog):
        """Pylint ignore"""
        spinnnerDialog.setObjectName("spinnnerDialog")
        spinnnerDialog.resize(400, 300)
        self.verticalLayout = QtWidgets.QVBoxLayout(spinnnerDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(spinnnerDialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.spinBox = QtWidgets.QSpinBox(spinnnerDialog)
        self.spinBox.setObjectName("spinBox")
        self.verticalLayout.addWidget(self.spinBox)
        self.label_2 = QtWidgets.QLabel(spinnnerDialog)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.doubleSpinBox = QtWidgets.QDoubleSpinBox(spinnnerDialog)
        self.doubleSpinBox.setObjectName("doubleSpinBox")
        self.verticalLayout.addWidget(self.doubleSpinBox)
        self.label_3 = QtWidgets.QLabel(spinnnerDialog)
        self.label_3.setObjectName("label_3")
        self.verticalLayout.addWidget(self.label_3)
        self.mQgsSpinBox = gui.QgsSpinBox(spinnnerDialog)
        self.mQgsSpinBox.setObjectName("mQgsSpinBox")
        self.verticalLayout.addWidget(self.mQgsSpinBox)
        self.button_box = QtWidgets.QDialogButtonBox(spinnnerDialog)
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                           | QtWidgets.QDialogButtonBox.Ok)
        self.button_box.setObjectName("button_box")
        self.verticalLayout.addWidget(self.button_box)

        self.retranslateUi(spinnnerDialog)
        self.button_box.accepted.connect(spinnnerDialog.accept)
        self.button_box.rejected.connect(spinnnerDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(spinnnerDialog)
예제 #3
0
    def setupUi(self, CartogramDialog):
        CartogramDialog.setObjectName("CartogramDialog")
        CartogramDialog.resize(640, 600)
        self.formLayout = QtWidgets.QFormLayout(CartogramDialog)
        self.formLayout.setObjectName("formLayout")
        self.layerComboBoxLabel = QtWidgets.QLabel(CartogramDialog)
        self.layerComboBoxLabel.setObjectName("layerComboBoxLabel")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.layerComboBoxLabel)
        self.layerComboBox = gui.QgsMapLayerComboBox(CartogramDialog)
        self.layerComboBox.setObjectName("layerComboBox")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.layerComboBox)
        self.fieldListViewLabel = QtWidgets.QLabel(CartogramDialog)
        self.fieldListViewLabel.setObjectName("fieldListViewLabel")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.fieldListViewLabel)
        self.fieldListView = QgsFieldListView(CartogramDialog)
        self.fieldListView.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
        self.fieldListView.setObjectName("fieldListView")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.fieldListView)
        self.stopConditionsFrameLabel = QtWidgets.QLabel(CartogramDialog)
        self.stopConditionsFrameLabel.setObjectName("stopConditionsFrameLabel")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.stopConditionsFrameLabel)
        self.stopConditionsFrame = QtWidgets.QFrame(CartogramDialog)
        self.stopConditionsFrame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.stopConditionsFrame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.stopConditionsFrame.setObjectName("stopConditionsFrame")
        self.formLayout_2 = QtWidgets.QFormLayout(self.stopConditionsFrame)
        self.formLayout_2.setObjectName("formLayout_2")
        self.iterationsSpinBoxLabel = QtWidgets.QLabel(self.stopConditionsFrame)
        self.iterationsSpinBoxLabel.setObjectName("iterationsSpinBoxLabel")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.iterationsSpinBoxLabel)
        self.iterationsSpinBox = QtWidgets.QSpinBox(self.stopConditionsFrame)
        self.iterationsSpinBox.setMinimum(1)
        self.iterationsSpinBox.setMaximum(9999)
        self.iterationsSpinBox.setProperty("value", 10)
        self.iterationsSpinBox.setObjectName("iterationsSpinBox")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.iterationsSpinBox)
        self.averageErrorDoubleSpinBoxLabel = QtWidgets.QLabel(self.stopConditionsFrame)
        self.averageErrorDoubleSpinBoxLabel.setObjectName("averageErrorDoubleSpinBoxLabel")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.averageErrorDoubleSpinBoxLabel)
        self.averageErrorDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.stopConditionsFrame)
        self.averageErrorDoubleSpinBox.setSingleStep(0.5)
        self.averageErrorDoubleSpinBox.setProperty("value", 10.0)
        self.averageErrorDoubleSpinBox.setObjectName("averageErrorDoubleSpinBox")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.averageErrorDoubleSpinBox)
        self.conditionsExplanationLabel = QtWidgets.QLabel(self.stopConditionsFrame)
        self.conditionsExplanationLabel.setWordWrap(True)
        self.conditionsExplanationLabel.setObjectName("conditionsExplanationLabel")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.conditionsExplanationLabel)
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.stopConditionsFrame)
        self.buttonBox = QtWidgets.QDialogButtonBox(CartogramDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.buttonBox)

        self.retranslateUi(CartogramDialog)
        self.buttonBox.accepted.connect(CartogramDialog.accept) # type: ignore
        self.buttonBox.rejected.connect(CartogramDialog.reject) # type: ignore
        self.layerComboBox.layerChanged['QgsMapLayer*'].connect(self.fieldListView.setLayer) # type: ignore
        QtCore.QMetaObject.connectSlotsByName(CartogramDialog)
예제 #4
0
 def createEditor(self, parent, option, index):
     editor = QtWidgets.QDoubleSpinBox(parent)
     editor.setMaximum(100000)
     editor.setMinimum(-100000)
     editor.setDecimals(3)
     editor.setSingleStep(0.001)
     editor.setAccelerated(True)
     return editor
    def add_aggregation(self, *args, aggregation: Aggregation = DEFAULT_AGGREGATION):
        """Add a new row to tableWidgetAggregations, always last row"""
        self.tableWidgetAggregations.insertRow(self.tableWidgetAggregations.rowCount())
        current_row = self.tableWidgetAggregations.rowCount() - 1

        # variable column
        variable_combobox = QtWidgets.QComboBox()
        for i, variable in enumerate(AGGREGATION_VARIABLES):
            variable_combobox.addItem(VT_NAMES[variable.var_type] + ': ' + variable.long_name)
            variable_combobox.setItemData(i, variable)
        idx = variable_combobox.findText(aggregation.variable.long_name, Qt.MatchEndsWith)
        variable_combobox.setCurrentIndex(idx)
        variable_combobox.currentTextChanged.connect(self.variable_combobox_text_changed)
        self.tableWidgetAggregations.setCellWidget(current_row, 0, variable_combobox)

        # sign column
        direction_combobox = QtWidgets.QComboBox()
        counter = 0
        for s in AGGREGATION_SIGNS:
            direction_combobox.addItem(s.long_name)
            direction_combobox.setItemData(counter, s)
            counter += 1
        direction_combobox.setCurrentText(aggregation.sign.long_name)
        self.tableWidgetAggregations.setCellWidget(current_row, 1, direction_combobox)
        direction_combobox.currentTextChanged.connect(self.direction_combobox_text_changed)

        # method column
        method_combobox = QtWidgets.QComboBox()
        for i, method in enumerate(AGGREGATION_METHODS):
            method_combobox.addItem(method.long_name)
            method_combobox.setItemData(i, method)
        method_combobox.setCurrentText(aggregation.method.long_name)
        self.tableWidgetAggregations.setCellWidget(current_row, 2, method_combobox)
        method_combobox.currentTextChanged.connect(self.method_combobox_text_changed)

        # threshold column
        threshold_widget = QtWidgets.QDoubleSpinBox()
        threshold_widget.setRange(sys.float_info.min, sys.float_info.max)
        self.tableWidgetAggregations.setCellWidget(current_row, 3, threshold_widget)
        method = method_combobox.itemData(method_combobox.currentIndex())
        self.set_threshold_widget(row=current_row, method=method)
        if aggregation.threshold is not None:
            threshold_widget.setValue(aggregation.threshold)
        threshold_widget.valueChanged.connect(self.threshold_value_changed)

        # units column
        units_combobox = QtWidgets.QComboBox()
        self.tableWidgetAggregations.setCellWidget(current_row, 4, units_combobox)
        self.set_units_widget(row=current_row,
                              variable=variable_combobox.itemData(variable_combobox.currentIndex()),
                              method=method
                              )
        # TODO: dit nu nu lastig te setten obv aggregation, omdat die wel een attribuut multiplier heeft,
        #  maar niet een attribuut units. laat ik nu even voor wat het is
        units_combobox.currentTextChanged.connect(self.units_combobox_text_changed)
        self.update_demanded_aggregations()
        self.set_styling_tab()
        self.validate()
예제 #6
0
    def getUI(self):
        ui = QtWidgets.QWidget()
        self.figure = plt.figure()
        self.mpl_canvas = FigureCanvas(self.figure)
        self.attrsel = QtWidgets.QComboBox()
        self.attrsel.addItems(sorted([m for m in self.data]))
        self.attrsel.currentIndexChanged.connect(self.draw_new_plot)
        self.scale_min = QtWidgets.QLineEdit("0")
        self.scale_min.setMinimumWidth(5)
        self.scale_min.editingFinished.connect(self.draw_new_plot)
        self.scale_max = QtWidgets.QLineEdit("10")
        self.scale_max.setMinimumWidth(5)
        self.scale_max.editingFinished.connect(self.draw_new_plot)
        self.colormap = QtWidgets.QComboBox()
        self.colormap.addItems(sorted(m for m in cm.datad))
        self.colormap.setCurrentIndex(self.colormap.findText("gist_earth"))
        self.colormap.currentIndexChanged.connect(self.draw_new_plot)
        self.marker = QtWidgets.QComboBox()
        self.marker.addItems(['.', ',', 'o', 'v', '^', '<', '>', '1', '2', '3', '4', '8', 's', 'p',
                              'P', '*', 'h', 'H', '+', 'x', 'X', 'D', 'd', '|', '_'])
        self.marker.setCurrentIndex(2)
        self.marker.currentIndexChanged.connect(self.draw_new_plot)
        self.markerSize = QtWidgets.QDoubleSpinBox()
        self.markerSize.setValue(0.5)
        self.markerSize.setRange(0.1, 200)
        self.markerSize.setSingleStep(0.1)
        self.markerSize.valueChanged.connect(self.draw_new_plot)
        self.lineSize = QtWidgets.QDoubleSpinBox()
        self.lineSize.setValue(1)
        self.lineSize.setRange(0.1, 20)
        self.lineSize.setSingleStep(0.1)
        self.lineSize.valueChanged.connect(self.draw_new_plot)
        self.zex = QtWidgets.QDoubleSpinBox()
        self.zex.setValue(1)
        self.zex.setRange(0.1, 50)
        self.zex.setSingleStep(0.1)
        self.zex.setDecimals(1)
        self.zex.valueChanged.connect(self.draw_new_plot)

        self.linecolor = QtWidgets.QPushButton("#FF0000")
        self.linecolor.setStyleSheet('color: #FF0000')
        self.linecolor.clicked.connect(self.colorpicker)

        self.hb = QtWidgets.QHBoxLayout()
        self.hb2 = QtWidgets.QHBoxLayout()

        self.hb.addWidget(QtWidgets.QLabel("Select attribute:"))
        self.hb.addWidget(self.attrsel)
        self.hb.addWidget(QtWidgets.QLabel("Scale from:"))
        self.hb.addWidget(self.scale_min)
        self.hb.addWidget(QtWidgets.QLabel("Scale to:"))
        self.hb.addWidget(self.scale_max)
        self.hb.addStretch()

        self.hb2.addWidget(QtWidgets.QLabel("Colormap:"))
        self.hb2.addWidget(self.colormap)
        self.hb2.addWidget(QtWidgets.QLabel("Marker:"))
        self.hb2.addWidget(self.marker)
        self.hb2.addWidget(QtWidgets.QLabel("Marker size:"))
        self.hb2.addWidget(self.markerSize)
        self.hb2.addWidget(QtWidgets.QLabel("Line color:"))
        self.hb2.addWidget(self.linecolor)
        self.hb2.addWidget(QtWidgets.QLabel("Line width:"))
        self.hb2.addWidget(self.lineSize)
        self.hb2.addWidget(QtWidgets.QLabel("Z exagg.:"))
        self.hb2.addWidget(self.zex)
        self.hb2.addStretch()


        self.vb = QtWidgets.QVBoxLayout()
        self.vb.addWidget(self.mpl_canvas, 1)
        self.vb.addWidget(NavigationToolbar(self.mpl_canvas, ui))
        self.vb.addLayout(self.hb)
        self.vb.addLayout(self.hb2)

        ui.setLayout(self.vb)
        ui.setMinimumSize(500,500)
        return ui
예제 #7
0
파일: QpalsWSM.py 프로젝트: zhixd83/qpals
    def createWidget(self):
        # Form
        boxleft = QtWidgets.QVBoxLayout()
        loadDir = QtWidgets.QPushButton("load")
        newProj = QtWidgets.QPushButton("new")
        newProj.clicked.connect(self.newProject)
        loadDir.clicked.connect(self.loadProject)
        hbox2 = QtWidgets.QHBoxLayout()
        hbox2.addWidget(loadDir)
        hbox2.addWidget(newProj)
        boxleft.addLayout(hbox2)
        self.prjBox = QtWidgets.QGroupBox("Project settings")
        self.prjBox.setEnabled(False)
        formL = QtWidgets.QFormLayout()
        self.prjBox.setLayout(formL)
        self.odmText = QpalsDropTextbox(layerlist=self.layerlist)
        self.odmText.currentTextChanged.connect(self.odmFileChanged)
        formL.addRow("odm", self.odmText)
        self.axisText = QpalsDropTextbox(layerlist=self.layerlist,
                                         filterrex='.*[\.shp]')
        formL.addRow("axis shp", self.axisText)

        self.widthSpin = QtWidgets.QDoubleSpinBox()
        self.widthSpin.setValue(15)
        self.widthSpin.setSingleStep(0.1)
        self.widthSpin.setRange(1, 50)
        self.widthSpin.setSuffix(" m")
        formL.addRow("sec width", self.widthSpin)

        self.depthSpin = QtWidgets.QDoubleSpinBox()
        self.depthSpin.setValue(5)
        self.depthSpin.setSingleStep(0.1)
        self.depthSpin.setRange(1, 50)
        self.depthSpin.setSuffix(" m")
        formL.addRow("sec depth", self.depthSpin)

        self.overlapSpin = QtWidgets.QDoubleSpinBox()
        self.overlapSpin.setValue(0)
        self.overlapSpin.setSingleStep(1)
        self.overlapSpin.setRange(0, 100)
        self.overlapSpin.setSuffix("%")
        formL.addRow("sec overlap", self.overlapSpin)

        self.attrSel = QtWidgets.QComboBox()
        formL.addRow("attribute", self.attrSel)

        # createShd = QtWidgets.QPushButton("create shading")
        # createShd.clicked.connect(self.createShd)
        # formL.addRow(createShd)
        createSec = QtWidgets.QPushButton("save && create sections")
        createSec.clicked.connect(self.createSec)
        formL.addRow(createSec)
        self.progress = QtWidgets.QProgressBar()
        formL.addRow(self.progress)
        boxleft.addWidget(self.prjBox)
        modeBox = QtWidgets.QGroupBox("Mode")
        modeBoxL = QtWidgets.QFormLayout()
        modeBox.setLayout(modeBoxL)
        self.modeGrp = QtWidgets.QButtonGroup()
        for mode in ['linear (1,2,3...)', 'alternating (farthest sampling)']:
            btn = QtWidgets.QRadioButton(mode)
            modeBoxL.addRow(btn)
            self.modeGrp.addButton(btn)
            if mode.startswith('alternating'):
                btn.setChecked(True)

        boxleft.addWidget(modeBox)
        saveBtn = QtWidgets.QPushButton("Save progress")
        saveBtn.clicked.connect(self.saveProgress)
        boxleft.addWidget(saveBtn)

        expGroup = QtWidgets.QGroupBox("Export")
        expGroupLayout = QtWidgets.QFormLayout()
        expGroup.setLayout(expGroupLayout)
        self.expBtn = QtWidgets.QPushButton("Export WSM")
        self.expBtn.clicked.connect(self.exportWSM)
        self.expBtn.setEnabled(False)
        self.expPath = QpalsDropTextbox()
        self.expPath.currentTextChanged.connect(self.exportChanged)
        expGroupLayout.addRow("Output file", self.expPath)
        self.dXSpin = QtWidgets.QDoubleSpinBox()
        self.dYSpin = QtWidgets.QDoubleSpinBox()
        self.dXSpin.valueChanged.connect(self.dXdYChanged)
        self.dYSpin.valueChanged.connect(self.dXdYChanged)
        self.dXSpin.setValue(1)
        self.dYSpin.setValue(1)
        self.dXSpin.setSingleStep(0.1)
        self.dYSpin.setSingleStep(0.1)
        expGroupLayout.addRow("X cell size", self.dXSpin)
        expGroupLayout.addRow("Y cell size", self.dYSpin)
        self.progress2 = QtWidgets.QProgressBar()
        expGroupLayout.addRow(self.progress2)
        expGroupLayout.addRow(self.expBtn)

        boxleft.addWidget(expGroup)

        # center figure
        figure = plt.figure()
        centerbox = QtWidgets.QVBoxLayout()
        self.plotcenter = FigureCanvas(figure)
        self.axcenter = figure.add_subplot(111)
        figure.subplots_adjust(left=0, right=1, top=0.99, bottom=0.01)
        #manager, canvas = figure.canvas.manager, figure.canvas
        #canvas.mpl_disconnect(manager.key_press_handler_id)  # remove default key bindings (ctrl+w = close)
        #cid = self.plotcenter.mpl_connect('key_press_event', self.keyPressed)
        cid2 = self.plotcenter.mpl_connect('button_press_event',
                                           self.mousePressed)
        cid2 = self.plotcenter.mpl_connect('motion_notify_event',
                                           self.mouseMoved)
        cid3 = self.plotcenter.mpl_connect('button_release_event',
                                           self.mouseReleased)
        cid4 = self.plotcenter.mpl_connect('scroll_event', self.mouseScrolled)

        #toolbar = NavigationToolbar(self.plotcenter, self.widget)
        centerbox.addWidget(self.plotcenter)
        #centerbox.addWidget(toolbar)
        centerw = QtWidgets.QWidget()
        centerw.setLayout(centerbox)

        # right figure
        vboxright = QtWidgets.QVBoxLayout()
        data3d = {
            'X': np.array([0]),
            'Y': np.array([0]),
            'Z': np.array([0]),
            self.attrSel.currentText(): np.array([0])
        }
        mins = {self.attrSel.currentText(): 0}
        maxes = {self.attrSel.currentText(): 1}
        self.pltwindow_3d = mpl_plotwindow(self.project, self.iface, data3d,
                                           mins, maxes)
        self.plotright = self.pltwindow_3d.ui

        # Section Grid Buttons
        secGrid = QtWidgets.QGridLayout()
        leftup = QtWidgets.QPushButton("↑")
        self.hleftLbl = QtWidgets.QLabel("h=")
        leftdown = QtWidgets.QPushButton("↓")
        rightup = QtWidgets.QPushButton("↑")
        self.hrightLbl = QtWidgets.QLabel("h=")
        rightdown = QtWidgets.QPushButton("↓")
        symCanvas = QtWidgets.QWidget()
        secGrid.addWidget(leftup, 0, 0)
        secGrid.addWidget(self.hleftLbl, 1, 0)
        secGrid.addWidget(leftdown, 2, 0)
        secGrid.addWidget(rightup, 0, 2)
        secGrid.addWidget(self.hrightLbl, 1, 2)
        secGrid.addWidget(rightdown, 2, 2)
        secGrid.addWidget(symCanvas, 0, 1, 3, 1)

        # Navigation Buttons
        navGrid = QtWidgets.QGridLayout()
        prevBtn = QtWidgets.QPushButton("prev")
        nextBtn = QtWidgets.QPushButton("next")
        prevBtn.clicked.connect(self.prevSec)
        nextBtn.clicked.connect(self.nextSec)
        self.incbox = QtWidgets.QSpinBox()
        self.incbox.setMinimum(1)
        self.currbox = QtWidgets.QSpinBox()
        self.currbox.valueChanged.connect(self.currSecChanged)
        self.skipSeen = QtWidgets.QCheckBox("Skip already seen sections")
        self.skipSeen.setChecked(True)
        pickBtn = QtWidgets.QPushButton("pick")
        pickBtn.clicked.connect(self.activatePickTool)
        self.status = QtWidgets.QLabel("Section 0/0: 0% finished")
        navGrid.addWidget(prevBtn, 0, 0)
        navGrid.addWidget(QtWidgets.QLabel("inc"), 0, 1)
        navGrid.addWidget(self.incbox, 0, 2)
        navGrid.addWidget(nextBtn, 0, 3)
        navGrid.addWidget(self.skipSeen, 1, 0, 1, 4)
        navGrid.addWidget(QtWidgets.QLabel("Current Index:"))
        navGrid.addWidget(self.currbox, 2, 1)
        navGrid.addWidget(pickBtn, 2, 3)
        navGrid.addWidget(self.status, 3, 0, 1, 4)

        vboxright.addWidget(self.plotright, stretch=1)
        vboxright.addWidget(QHLine())
        #vboxright.addLayout(secGrid)
        vboxright.addWidget(QHLine())
        vboxright.addLayout(navGrid)

        boxleftw = QtWidgets.QWidget()
        boxleftw.setLayout(boxleft)
        vboxrightw = QtWidgets.QWidget()
        vboxrightw.setLayout(vboxright)
        self.addWidget(boxleftw)
        self.addWidget(centerw)
        self.addWidget(vboxrightw)
        self.setStretchFactor(0, 1)
        self.setStretchFactor(1, 15)
        self.setStretchFactor(2, 1)
        self.setStyleSheet("QSplitter::handle{background-color: #CCCCCC;}")
        self.setHandleWidth(2)
예제 #8
0
    def getUI(self):
        lay = QtWidgets.QVBoxLayout()
        self.widg.setLayout(lay)
        lay.addWidget(self.canvas.native, stretch=1)
        policy = self.widg.sizePolicy()
        policy.setVerticalStretch(1)
        self.widg.setSizePolicy(policy)
        self.widg.setMinimumSize(500, 500)
        self.widg.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        self.toolbar = QtWidgets.QHBoxLayout()
        self.toolbar2 = QtWidgets.QHBoxLayout()
        lay.addLayout(self.toolbar)
        lay.addLayout(self.toolbar2)
        self.CMbox = QtWidgets.QComboBox()
        self.attrBox = QtWidgets.QComboBox()

        self.toolbar.addWidget(QtWidgets.QLabel("Attribute:"))
        self.toolbar.addWidget(self.attrBox)
        self.toolbar.addWidget(QtWidgets.QLabel("Colormap:"))
        self.toolbar.addWidget(self.CMbox)
        self.toolbar.addWidget(QtWidgets.QLabel("Min:"))
        self.scaleMin = QtWidgets.QLineEdit()
        self.scaleMin.editingFinished.connect(self.draw_new_plot)
        self.toolbar.addWidget(self.scaleMin)
        self.toolbar.addWidget(QtWidgets.QLabel("Max:"))
        self.scaleMax = QtWidgets.QLineEdit()
        self.scaleMax.editingFinished.connect(self.draw_new_plot)
        self.toolbar.addWidget(self.scaleMax)

        self.markerBox = QtWidgets.QComboBox()
        self.toolbar.addWidget(QtWidgets.QLabel("Marker:"))
        self.toolbar.addWidget(self.markerBox)
        self.markerSize = QtWidgets.QSpinBox()
        self.markerSize.setValue(2)
        self.markerSize.valueChanged.connect(self.draw_new_plot)
        self.toolbar.addWidget(QtWidgets.QLabel("Marker size:"))
        self.toolbar.addWidget(self.markerSize)
        self.bgColorBtn = QtWidgets.QPushButton('#FFFFFF')
        self.bgColorBtn.setStyleSheet('color: #FFFFFF')
        self.bgColorBtn.clicked.connect(self.bgColorPick)
        self.lineColorBtn = QtWidgets.QPushButton('#FF0000')
        self.lineColorBtn.setStyleSheet('color: #FF0000')
        self.lineColorBtn.clicked.connect(self.lineColorPick)

        self.toolbar2.addWidget(QtWidgets.QLabel("bg color:"))
        self.toolbar2.addWidget(self.bgColorBtn)

        self.toolbar2.addWidget(QtWidgets.QLabel("line color:"))
        self.toolbar2.addWidget(self.lineColorBtn)


        self.lineWidth = QtWidgets.QSpinBox()
        self.lineWidth.setValue(2)
        self.lineWidth.valueChanged.connect(self.draw_new_plot)
        self.toolbar2.addWidget(QtWidgets.QLabel("line width:"))
        self.toolbar2.addWidget(self.lineWidth)


        self.zex = QtWidgets.QDoubleSpinBox()
        self.zex.setValue(1)
        self.zex.setRange(0.1, 50)
        self.zex.setSingleStep(0.1)
        self.zex.setDecimals(1)
        self.zex.valueChanged.connect(self.draw_new_plot)
        self.toolbar2.addWidget(QtWidgets.QLabel("Z exagg."))
        self.toolbar2.addWidget(self.zex)

        self.toolbar.addStretch()
        self.toolbar2.addStretch()

        return self.widg