コード例 #1
0
 def __init__(self, objeto=None, has_id=True):
     QFormLayout.__init__(self)
     QFormBase.__init__(self, objeto=objeto, has_id=has_id)
     app.count_field = 0
     self.setSpacing(6)
     self.setContentsMargins(10, 10, 10, 10)
コード例 #2
0
ファイル: stretchdialog.py プロジェクト: ubarsc/tuiview
    def __init__(self, parent, stretch, gdaldataset=None):
        QFormLayout.__init__(self)

        # the mode
        self.modeCombo = QComboBox(parent)
        for text, code in MODE_DATA:
            self.modeCombo.addItem(text, code)

        # callback so we can set the state of other items when changed
        self.modeCombo.currentIndexChanged.connect(self.modeChanged)

        self.rampCombo = QComboBox(parent)

        # make sure the pseudocolor has the extra ramps loaded
        try:
            pseudocolor.loadExtraRamps()
        except Exception as e:
            QMessageBox.critical(parent, MESSAGE_TITLE, str(e))

        # populate combo - sort by type
        for (name, display) in pseudocolor.getRampsForDisplay():
            self.rampCombo.addItem(display, name)

        self.modeLayout = QHBoxLayout()
        self.modeLayout.addWidget(self.modeCombo)
        self.modeLayout.addWidget(self.rampCombo)

        self.addRow("Mode", self.modeLayout)

        if gdaldataset is None:
            # we don't have a dateset - is a rule
            # create spin boxes for the bands
            self.createSpinBands(parent)
        else:
            # we have a dataset. create combo
            # boxes with the band names
            self.createComboBands(gdaldataset, parent)

        self.addRow("Bands", self.bandLayout)

        # create the combo for the type of stretch
        self.stretchLayout = QHBoxLayout()
        self.stretchCombo = QComboBox(parent)
        for text, code in STRETCH_DATA:
            self.stretchCombo.addItem(text, code)
        # callback so we can set the state of other items when changed
        self.stretchCombo.currentIndexChanged.connect(self.stretchChanged)

        self.stretchLayout.addWidget(self.stretchCombo)

        # create the spin boxes for the std devs or hist min and max
        self.stretchParam1 = QDoubleSpinBox(parent)
        self.stretchParam1.setDecimals(3)
        self.stretchParam1Stats = QCheckBox(parent)
        self.stretchParam1Stats.setText("Statistics Min")

        self.stretchParam1Stats.stateChanged.connect(self.param1StatsChanged)

        self.stretchParam2 = QDoubleSpinBox(parent)
        self.stretchParam2.setDecimals(3)
        self.stretchParam2Stats = QCheckBox(parent)
        self.stretchParam2Stats.setText("Statistics Max")

        self.stretchParam2Stats.stateChanged.connect(self.param2StatsChanged)

        self.stretchLayout.addWidget(self.stretchParam1)
        self.stretchLayout.addWidget(self.stretchParam1Stats)
        self.stretchLayout.addWidget(self.stretchParam2)
        self.stretchLayout.addWidget(self.stretchParam2Stats)

        self.addRow("Stretch", self.stretchLayout)

        # now for no data, background and NaN
        self.fixedColorLayout = QHBoxLayout()
        self.nodataLabel = QLabel(parent)
        self.nodataLabel.setText("No Data")
        self.fixedColorLayout.addWidget(self.nodataLabel)
        self.fixedColorLayout.setAlignment(self.nodataLabel, Qt.AlignRight)
        self.nodataButton = ColorButton(parent)
        self.fixedColorLayout.addWidget(self.nodataButton)

        self.backgroundLabel = QLabel(parent)
        self.backgroundLabel.setText("Background")
        self.fixedColorLayout.addWidget(self.backgroundLabel)
        self.fixedColorLayout.setAlignment(self.backgroundLabel, Qt.AlignRight)
        self.backgroundButton = ColorButton(parent)
        self.fixedColorLayout.addWidget(self.backgroundButton)

        self.NaNLabel = QLabel(parent)
        self.NaNLabel.setText("NaN")
        self.fixedColorLayout.addWidget(self.NaNLabel)
        self.fixedColorLayout.setAlignment(self.NaNLabel, Qt.AlignRight)
        self.NaNButton = ColorButton(parent)
        self.fixedColorLayout.addWidget(self.NaNButton)

        self.addRow("Fixed Colors", self.fixedColorLayout)

        # set state of GUI for this stretch
        self.updateStretch(stretch)