Exemple #1
0
 def createWidget(self):
     if self.dialogType == DIALOG_STANDARD:
         if self.param.multiline:
             widget = QPlainTextEdit()
             if self.param.default:
                 widget.setPlainText(self.param.default)
         else:
             widget = StringInputPanel(self.param)
             if self.param.default:
                 widget.setValue(self.param.default)
     elif self.dialogType == DIALOG_BATCH:
         widget = QLineEdit()
         if self.param.default:
             widget.setText(self.param.default)
     else:
         strings = self.dialog.getAvailableValuesOfType(ParameterString, OutputString)
         options = [(self.dialog.resolveValueDescription(s), s) for s in strings]
         if self.param.multiline:
             widget = MultilineTextPanel(options)
             widget.setText(self.param.default or "")
         else:
             widget = QComboBox()
             widget.setEditable(True)
             for desc, val in options:
                 widget.addItem(desc, val)
             widget.setEditText(self.param.default or "")
     return widget
Exemple #2
0
    def __init__(self, parent, alg):
        ParametersPanel.__init__(
            self, parent,
            alg)  ## Création le l'interface Qt pour les paramètres

        ## Add console command
        w = QWidget()  # New Qt Windows

        layout = QVBoxLayout()  # New Qt vertical Layout
        layout.setMargin(0)
        layout.setSpacing(6)

        label = QLabel()  # New Qt label (text)
        label.setText(self.tr("Chloe/Java console call"))
        layout.addWidget(label)  # Add label in layout

        self.text = QPlainTextEdit()  # New Qt champs de text in/out
        self.text.setReadOnly(True)  # Read only
        layout.addWidget(self.text)  # Add in layout

        w.setLayout(layout)  # layout -in-> Windows
        self.layoutMain.addWidget(w)  # windows -in-> Windows system

        self.connectParameterSignals()
        self.parametersHaveChanged()
Exemple #3
0
    def __init__(self, description, parent=None):
        # import pydevd
        # pydevd.settrace('localhost', port=65432, stdoutToServer=True, stderrToServer=True,
        #                 trace_only_current_thread=False, overwrite_prev_trace=True, patch_multiprocessing=True,
        #                 suspend=False)
        super(EditDescription, self).__init__(parent)
        self.description = description

        layout = QVBoxLayout()

        self.textWidget = QPlainTextEdit()
        self.textWidget.setPlainText(self.description)
        layout.addWidget(self.textWidget)

        buttonLayout = QHBoxLayout()
        okButton = QPushButton("Ok")
        okButton.clicked.connect(self.ok)
        cancelButton = QPushButton("Cancel")
        cancelButton.clicked.connect(self.reject)
        buttonLayout.addWidget(okButton)
        buttonLayout.addWidget(cancelButton)
        layout.addLayout(buttonLayout)

        self.setLayout(layout)
        self.resize(650, self.height())
        self.setWindowTitle("Edit dR description")
Exemple #4
0
 def createWidget(self):
     if self.dialogType == DIALOG_STANDARD:
         if self.param.multiline:
             widget = QPlainTextEdit()
             if self.param.default:
                 widget.setPlainText(self.param.default)
         else:
             widget = StringInputPanel(self.param)
             if self.param.default:
                 widget.setValue(self.param.default)
     elif self.dialogType == DIALOG_BATCH:
         widget = QLineEdit()
         if self.param.default:
             widget.setText(self.param.default)
     else:
         # strings, numbers, files and table fields are all allowed input types
         strings = self.dialog.getAvailableValuesOfType([
             ParameterString, ParameterNumber, ParameterFile,
             ParameterTableField, ParameterExpression
         ], OutputString)
         options = [(self.dialog.resolveValueDescription(s), s)
                    for s in strings]
         if self.param.multiline:
             widget = MultilineTextPanel(options)
             widget.setText(self.param.default or "")
         else:
             widget = QComboBox()
             widget.setEditable(True)
             for desc, val in options:
                 widget.addItem(desc, val)
             widget.setEditText(self.param.default or "")
     return widget
    def __init__(self, parent, alg):
        ParametersPanel.__init__(self, parent, alg) ## Création le l'interface Qt pour les paramètres
        
        ## Add console command
        w = QWidget()              # New Qt Windows

        layout = QVBoxLayout()     # New Qt vertical Layout
        layout.setMargin(0)
        layout.setSpacing(6)

        label = QLabel()           # New Qt label (text)
        label.setText(self.tr("Chloe/Java console call"))
        layout.addWidget(label)    # Add label in layout

        self.text = QPlainTextEdit()  # New Qt champs de text in/out
        self.text.setReadOnly(True)   # Read only
        layout.addWidget(self.text)   # Add in layout

        w.setLayout(layout)           # layout -in-> Windows
        self.layoutMain.addWidget(w)  # windows -in-> Windows system

        for output in self.alg.outputs:
            if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
                self.checkBoxes[output.name].setText(self.tr('Open output file after running algorithm'))


        self.connectParameterSignals()
        self.parametersHaveChanged()
    def __init__(self, title, message, errors, username, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(title)

        self.verticalLayout = QVBoxLayout(self)

        self.label = QLabel(message, self)
        self.verticalLayout.addWidget(self.label)

        self.plainTextEdit = QPlainTextEdit(self)
        self.plainTextEdit.setPlainText(errors)
        self.plainTextEdit.setReadOnly(True)
        self.verticalLayout.addWidget(self.plainTextEdit)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Close)
        self.verticalLayout.addWidget(self.buttonBox)
        self.reportButton = self.buttonBox.addButton(self.tr("Report error"), QDialogButtonBox.ActionRole)

        self.reportButton.clicked.connect(self.__reportError)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        self.username = username
        self.metadata = MetaData()
Exemple #7
0
    def __init__(self, parent, alg):
        ParametersPanel.__init__(
            self, parent,
            alg)  ## Création le l'interface Qt pour les paramètres

        ## Add console command
        w = QWidget()  # New Qt Windows

        layout = QVBoxLayout()  # New Qt vertical Layout
        layout.setMargin(0)
        layout.setSpacing(6)

        label = QLabel()  # New Qt label (text)
        label.setText(self.tr("Chloe/Java console call"))
        layout.addWidget(label)  # Add label in layout

        self.text = QPlainTextEdit()  # New Qt champs de text in/out
        self.text.setReadOnly(True)  # Read only
        layout.addWidget(self.text)  # Add in layout

        w.setLayout(layout)  # layout -in-> Windows
        self.layoutMain.addWidget(w)  # windows -in-> Windows system

        self.types_of_metrics = {}

        for output in self.alg.outputs:
            if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
                self.checkBoxes[output.name].setText(
                    self.tr('Open output file after running algorithm'))

        self.connectParameterSignals()
        self.parametersHaveChanged()

        # === Init cbFilter
        cbFilter = self.widgets["METRICS"].cbFilter
        cbFilter.addItems(self.alg.types_of_metrics.keys())

        # === Init listSrc
        value = cbFilter.currentText()
        listSrc = self.widgets["METRICS"].listSrc
        listSrc.clear()
        if self.types_of_metrics:
            if value in self.types_of_metrics.keys():
                listSrc.addItems(self.types_of_metrics[value])

        # === Init listDest
        listDest = self.widgets["METRICS"].listDest
        listDest.clear()

        self.metrics_selected = set()

        lineEdit = self.widgets["METRICS"].lineEdit
        lineEdit.setReadOnly(True)
    def initGui(self):
        self.setWindowTitle('Import to GeoGig')
        verticalLayout = QVBoxLayout()

        if self.repo is None:
            repos = repository.repos
            layerLabel = QLabel('Repository')
            verticalLayout.addWidget(layerLabel)
            self.repoCombo = QComboBox()
            self.repoCombo.addItems(
                ["%s - %s" % (r.group, r.title) for r in repos])
            self.repoCombo.currentIndexChanged.connect(self.updateBranches)
            verticalLayout.addWidget(self.repoCombo)
        if self.layer is None:
            layerLabel = QLabel('Layer')
            verticalLayout.addWidget(layerLabel)
            self.layerCombo = QComboBox()
            layerNames = [
                layer.name() for layer in vectorLayers()
                if layer.source().lower().split("|")[0].split(".")[-1] in
                ["gpkg", "geopkg"] and not isRepoLayer(layer)
            ]
            self.layerCombo.addItems(layerNames)
            verticalLayout.addWidget(self.layerCombo)

        self.branchLabel = QLabel("Branch")
        verticalLayout.addWidget(self.branchLabel)

        self.branchCombo = QComboBox()
        self.branches = self.repo.branches(
        ) if self.repo is not None else repos[0].branches()
        self.branchCombo.addItems(self.branches)
        verticalLayout.addWidget(self.branchCombo)

        messageLabel = QLabel('Message to describe this update')
        verticalLayout.addWidget(messageLabel)

        self.messageBox = QPlainTextEdit()
        verticalLayout.addWidget(self.messageBox)

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Cancel)
        self.importButton = QPushButton("Add layer")
        self.importButton.clicked.connect(self.importClicked)
        self.buttonBox.addButton(self.importButton, QDialogButtonBox.ApplyRole)
        self.buttonBox.rejected.connect(self.cancelPressed)
        verticalLayout.addWidget(self.buttonBox)

        self.setLayout(verticalLayout)

        self.resize(600, 300)

        self.messageBox.setFocus()
Exemple #9
0
 def __init__(self, options, parent=None):
     super(MultilineTextPanel, self).__init__(parent)
     self.options = options
     self.verticalLayout = QVBoxLayout(self)
     self.verticalLayout.setSpacing(2)
     self.verticalLayout.setMargin(0)
     self.combo = QComboBox()
     self.combo.addItem(self.tr('[Use text below]'))
     for option in options:
         self.combo.addItem(option[0], option[1])
     self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.verticalLayout.addWidget(self.combo)
     self.textBox = QPlainTextEdit()
     self.verticalLayout.addWidget(self.textBox)
     self.setLayout(self.verticalLayout)
Exemple #10
0
    def __init__(self, parent, alg):
        ParametersPanel.__init__(self, parent, alg)

        w = QWidget()
        layout = QVBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(6)
        label = QLabel()
        label.setText(self.tr("GDAL/OGR console call"))
        layout.addWidget(label)
        self.text = QPlainTextEdit()
        self.text.setReadOnly(True)
        layout.addWidget(self.text)
        w.setLayout(layout)
        self.layoutMain.addWidget(w)

        self.connectParameterSignals()
        self.parametersHaveChanged()
Exemple #11
0
 def createWidgets(self):
     vlayout = QVBoxLayout()
     vlayout.addWidget(
         QLabel(
             "PST now has all information necessary to start the analysis.")
     )
     vlayout.addStretch(1)
     self._propView = QPlainTextEdit()
     self._propView.setReadOnly(True)
     self._propView.setVisible(False)
     vlayout.addWidget(self._propView, 30)
     hlayout = QHBoxLayout()
     hlayout.addWidget(QLabel("Click 'Start' to start the analysis."), 1)
     self._toggleSettingsButton = QPushButton("Show settings")
     self._toggleSettingsButton.clicked.connect(self.onToggleShowSettings)
     hlayout.addWidget(self._toggleSettingsButton)
     vlayout.addLayout(hlayout)
     self.setLayout(vlayout)
    def __init__(self, parent, alg):
        super().__init__(parent, alg)

        w = QWidget()
        layout = QVBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(6)
        label = QLabel()
        label.setText(self.tr("Chloe Command line"))
        layout.addWidget(label)
        self.text = QPlainTextEdit()
        self.text.setReadOnly(True)
        layout.addWidget(self.text)
        w.setLayout(layout)
        self.layoutMain.addWidget(w)

        self.connectParameterSignals()
        self.parametersHaveChanged()
    def initGui(self):
        self.setObjectName("CommitDialog")
        self.resize(600, 250)
        self.setWindowTitle("Syncronize layer to repository branch")

        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setSpacing(2)
        self.verticalLayout.setMargin(5)

        self.branchLabel = QLabel("Branch")
        self.verticalLayout.addWidget(self.branchLabel)

        self.branchCombo = QComboBox()
        self.branches = []
        branches = self.repo.branches()
        for branch in branches:
            trees = self.repo.trees(branch)
            if self.layername in trees:
                self.branches.append(branch)
        self.branchCombo.addItems(self.branches)
        try:
            idx = self.branches.index("master")
        except:
            idx = 0
        self.branchCombo.setCurrentIndex(idx)
        self.verticalLayout.addWidget(self.branchCombo)

        self.msgLabel = QLabel("Message to describe this update")
        self.verticalLayout.addWidget(self.msgLabel)

        self.text = QPlainTextEdit()
        self.text.setPlainText(self._message)
        self.verticalLayout.addWidget(self.text)

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        self.verticalLayout.addWidget(self.buttonBox)

        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
            bool(self.branches))

        self.setLayout(self.verticalLayout)
        self.buttonBox.accepted.connect(self.okPressed)

        self.text.setFocus()
Exemple #14
0
    def __init__(self, parent, rpt_file_path):
        self.rpt_file_path = rpt_file_path

        QDialog.__init__(self, parent)

        self.setWindowTitle('Log: ' + self.rpt_file_path)

        main_lay = QVBoxLayout(self)

        self.txt_log = QPlainTextEdit(self)
        self.txt_log.setMinimumWidth(500)
        self.txt_log.setMinimumHeight(300)
        main_lay.addWidget(self.txt_log)

        self.btn_close = QPushButton('Close')
        self.btn_close.clicked.connect(self.close_dialog)
        main_lay.addWidget(self.btn_close)

        self.fill_txt()
Exemple #15
0
 def createWidget(self, parent):
     return QPlainTextEdit(parent)
Exemple #16
0
    def getWidgetFromParameter(self, param):
        # TODO Create Parameter widget class that holds the logic
        # for creating a widget that belongs to the parameter.
        if isinstance(param, ParameterRaster):
            layers = dataobjects.getRasterLayers()
            items = []
            if param.optional:
                items.append((self.NOT_SELECTED, None))
            for layer in layers:
                items.append((self.getExtendedLayerName(layer), layer))
            item = InputLayerSelectorPanel(items, param)
        elif isinstance(param, ParameterVector):
            if self.somethingDependsOnThisParameter(param) or self.alg.allowOnlyOpenedLayers:
                item = QComboBox()
                layers = dataobjects.getVectorLayers(param.datatype)
                layers.sort(key=lambda lay: lay.name())
                if param.optional:
                    item.addItem(self.NOT_SELECTED, None)
                for layer in layers:
                    item.addItem(self.getExtendedLayerName(layer), layer)
                item.currentIndexChanged.connect(self.updateDependentFields)
                item.name = param.name
            else:
                layers = dataobjects.getVectorLayers(param.datatype)
                items = []
                if param.optional:
                    items.append((self.NOT_SELECTED, None))
                for layer in layers:
                    items.append((self.getExtendedLayerName(layer), layer))
                # if already set, put first in list
                for i, (name, layer) in enumerate(items):
                    if layer and layer.source() == param.value:
                        items.insert(0, items.pop(i))
                item = InputLayerSelectorPanel(items, param)
        elif isinstance(param, ParameterTable):
            if self.somethingDependsOnThisParameter(param):
                item = QComboBox()
                layers = dataobjects.getTables()
                if param.optional:
                    item.addItem(self.NOT_SELECTED, None)
                for layer in layers:
                    item.addItem(layer.name(), layer)
                item.currentIndexChanged.connect(self.updateDependentFields)
                item.name = param.name
            else:
                layers = dataobjects.getTables()
                items = []
                if param.optional:
                    items.append((self.NOT_SELECTED, None))
                for layer in layers:
                    items.append((layer.name(), layer))
                # if already set, put first in list
                for i, (name, layer) in enumerate(items):
                    if layer and layer.source() == param.value:
                        items.insert(0, items.pop(i))
                item = InputLayerSelectorPanel(items, param)
        elif isinstance(param, ParameterBoolean):
            item = QCheckBox()
            if param.default:
                item.setChecked(True)
            else:
                item.setChecked(False)
        elif isinstance(param, ParameterTableField) or isinstance(param, ParameterTableMultipleField):
            if isinstance(param, ParameterTableMultipleField):
                item = ListMultiSelectWidget()
            else:
                item = QComboBox()
            if param.parent in self.dependentItems:
                items = self.dependentItems[param.parent]
            else:
                items = []
                self.dependentItems[param.parent] = items
            items.append(param)
            parent = self.alg.getParameterFromName(param.parent)
            if isinstance(parent, ParameterVector):
                layers = dataobjects.getVectorLayers(parent.datatype)
            else:
                layers = dataobjects.getTables()
            if len(layers) > 0:
                if param.optional and isinstance(param, ParameterTableField):
                    item.addItem(self.tr('[not set]'))
                item.addItems(self.getFields(layers[0], param.datatype))
        elif isinstance(param, ParameterSelection):
            item = QComboBox()
            item.addItems(param.options)
            if param.default:
                item.setCurrentIndex(param.default)
        elif isinstance(param, ParameterFixedTable):
            item = FixedTablePanel(param)
        elif isinstance(param, ParameterRange):
            item = RangePanel(param)
        elif isinstance(param, ParameterFile):
            item = FileSelectionPanel(param.isFolder, param.ext)
        elif isinstance(param, ParameterMultipleInput):
            if param.datatype == dataobjects.TYPE_FILE:
                item = MultipleInputPanel(datatype=dataobjects.TYPE_FILE)
            else:
                if param.datatype == dataobjects.TYPE_RASTER:
                    options = dataobjects.getRasterLayers(sorting=False)
                elif param.datatype == dataobjects.TYPE_VECTOR_ANY:
                    options = dataobjects.getVectorLayers(sorting=False)
                else:
                    options = dataobjects.getVectorLayers([param.datatype], sorting=False)
                opts = [self.getExtendedLayerName(opt) for opt in options]
                item = MultipleInputPanel(opts)
        elif isinstance(param, ParameterNumber):
            item = NumberInputPanel(param.default, param.min, param.max,
                                    param.isInteger)
        elif isinstance(param, ParameterExtent):
            item = ExtentSelectionPanel(self.parent, self.alg, param.default)
        elif isinstance(param, ParameterPoint):
            item = PointSelectionPanel(self.parent, param.default)
        elif isinstance(param, ParameterCrs):
            item = CrsSelectionPanel(param.default)
        elif isinstance(param, ParameterString):
            if param.multiline:
                verticalLayout = QVBoxLayout()
                verticalLayout.setSizeConstraint(
                    QLayout.SetDefaultConstraint)
                textEdit = QPlainTextEdit()
                if param.default:
                    textEdit.setPlainText(param.default)
                verticalLayout.addWidget(textEdit)
                item = textEdit
            else:
                item = QLineEdit()
                if param.default:
                    item.setText(unicode(param.default))
        elif isinstance(param, ParameterGeometryPredicate):
            item = GeometryPredicateSelectionPanel(param.enabledPredicates)
            if param.left:
                widget = self.valueItems[param.left]
                if isinstance(widget, InputLayerSelectorPanel):
                    widget = widget.cmbText
                widget.currentIndexChanged.connect(item.onLeftLayerChange)
                item.leftLayer = widget.itemData(widget.currentIndex())
            if param.right:
                widget = self.valueItems[param.right]
                if isinstance(widget, InputLayerSelectorPanel):
                    widget = widget.cmbText
                widget.currentIndexChanged.connect(item.onRightLayerChange)
                item.rightLayer = widget.itemData(widget.currentIndex())
            item.updatePredicates()
            if param.default:
                item.setValue(param.default)
        else:
            item = QLineEdit()
            if param.default:
                item.setText(unicode(param.default))

        return item