Пример #1
0
            def createTabs():
                # Tab1
                lyt1 = QVBoxLayout()
                lytOk = QHBoxLayout()
                rbUpdate = QRadioButton('Update', self)
                lytOk.addWidget(rbUpdate)
                rbDownload = QRadioButton('Download(0 selected)', self)
                lytOk.addWidget(rbDownload)
                btnOk = QPushButton('OK', self)
                lytOk.addWidget(btnOk)
                lyt1.addLayout(lytOk)
                lytChecks = QHBoxLayout()
                ckVrt = QCheckBox('Create VRT tiles', self)
                lytChecks.addWidget(ckVrt)
                ckAddTiles = QCheckBox('Add tiles', self)
                lytChecks.addWidget(ckAddTiles)
                lyt1.addLayout(lytChecks)
                tab1 = QWidget()
                tab1.setLayout(lyt1)
                # Tab 2
                lyt2 = QVBoxLayout()
                wgtDir = QgsFileWidget(self)
                lyt2.addWidget(wgtDir)
                btnRemoveFiles = QPushButton('', self)
                lyt2.addWidget(btnRemoveFiles)
                tab2 = QWidget()
                tab2.setLayout(lyt2)
                #
                tabs = QTabWidget(self)
                tabs.addTab(tab1, 'Update/Download')
                tabs.addTab(tab2, 'Download directory')

                return (tabs, rbUpdate, rbDownload, btnOk, ckVrt, ckAddTiles,
                        wgtDir, btnRemoveFiles)
Пример #2
0
    def start_raster_upload(self) -> None:
        """
        Use the API to (asynchronously) upload files to Picterra.

        Default callback for clicking on CTO (default virtual slot for "OK")
        1. Parse file list to obtain array of file paths, size and contents
        2. For each file launch the async API upload and setup callback

        The upload and processing is done in parallel by a set of worker
        threads.
        In case of errors from the API wrapper it shows an error dialog.

        https://qgis.org/pyqgis/3.2/gui/File/QgsFileWidget.html#qgis.gui.QgsFileWidget.filePath
        """
        self.upload_type = 'raster'
        self.ui.label_select.show()
        self.ui.file_selector.show()
        file_paths = QgsFileWidget.splitFilePaths(
            self.ui.file_selector.filePath())
        self.file_num = len(file_paths)
        if self.file_num == 0:
            self.err_box = error_box("Please select at least one file")
            self.err_box.show()
            return
        # Shows progress bar
        self.ui.progress_bar.show()
        self.ui.progress_bar_label.show()
        # Shows spinner
        spn_lbl = self.ui.progress_label
        movie = QMovie(':/plugins/picterra/assets/spinner.gif')
        spn_lbl.setMovie(movie)
        spn_lbl.show()
        movie.start()
        self.ui.label_select.hide()
        self.ui.file_selector.hide()
        self.ui.start_upload_button.setEnabled(False)
        logger.debug("%s files to upload" % str(self.file_num))
        # Loop over files
        for file_path in file_paths:
            # Check whether or not file exists
            info = get_file_info(file_path)
            if not info:
                continue
            # Open image file as binary
            with open(file_path, 'rb') as f:
                content = f.read()
                f.close()
                # Note the name is the one of the file, not the layer
                logger.debug("Uploading %s .." % info["name"])
                # Launch upload thread
                try:
                    self.api.upload_raster(info["name"], info["mime"], content,
                                           info["size"], self._upload_callback)
                except ApiError as e:
                    error = str(e)
                    logger.error(error)
                    self.err_box = error_box(error)
                    self.err_box.show()
                    self._reset()
Пример #3
0
class loadRteDialog(fields_dialog.fieldsDialog):

    #parent must have attribute sections
    def __init__(self, layerBox, parent):
        fields = ['direction']

        super(loadRteDialog, self).__init__(fields=fields,
                                            layerBox=layerBox,
                                            parent=parent)

        self.setTooltips({
            'direction':
            'Field of layer with direction. Values need to be one of NB,EB,SB,WB,CW,AC'
        })

        self.fileWidget = QgsFileWidget(self)
        self.layout().insertRow(0, 'File', self.fileWidget)

        self.buttonBox.rejected.connect(self.hide)

        self.setWindowTitle('load rte')

        self.clearMode = True  # True=insert at row,False=clear and load
        self.buttonBox.accepted.connect(self.load)

    def setclearMode(self, mode):
        self.clearMode = mode

    def show(self, clearMode):
        self.clearMode = clearMode
        super(loadRteDialog, self).show()

    def load(self):

        layer = self.parent().getLayer()

        p = self.fileWidget.filePath()
        if not p:
            iface.messageBar().pushMessage(
                "manual secbuilder:no file selected", duration=4)
            return

        if not self.fieldsSet():
            iface.messageBar().pushMessage(
                "manual secbuilder:direction field not set", duration=4)
            return
        directionField = self.getFields()['direction']

        labelField = self.parent().getLabelField()

        with open(p, 'r') as f:
            self.parent().model.loadRTE(f=f,
                                        layer=layer,
                                        labelField=labelField,
                                        directionField=directionField,
                                        row=self.parent().rowBox.value(),
                                        clear=self.clearMode)

        self.hide()
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(433, 261)
        self.groupBox = QtWidgets.QGroupBox(Dialog)
        self.groupBox.setGeometry(QtCore.QRect(10, 10, 411, 241))
        self.groupBox.setAutoFillBackground(True)
        self.groupBox.setTitle("")
        self.groupBox.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                   | QtCore.Qt.AlignTop)
        self.groupBox.setFlat(False)
        self.groupBox.setCheckable(False)
        self.groupBox.setObjectName("groupBox")
        self.panImage = QgsFileWidget(self.groupBox)
        self.panImage.setGeometry(QtCore.QRect(210, 50, 171, 27))
        self.panImage.setAccessibleName("")
        self.panImage.setObjectName("panImage")
        self.multImage = QgsFileWidget(self.groupBox)
        self.multImage.setEnabled(True)
        self.multImage.setGeometry(QtCore.QRect(210, 100, 171, 27))
        self.multImage.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.multImage.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.multImage.setFileWidgetButtonVisible(True)
        self.multImage.setFullUrl(True)
        self.multImage.setFilter("")
        self.multImage.setDefaultRoot("")
        self.multImage.setObjectName("multImage")
        self.panImageLabel = QtWidgets.QLabel(self.groupBox)
        self.panImageLabel.setGeometry(QtCore.QRect(30, 50, 161, 20))
        self.panImageLabel.setObjectName("panImageLabel")
        self.multImageLabel = QtWidgets.QLabel(self.groupBox)
        self.multImageLabel.setEnabled(True)
        self.multImageLabel.setGeometry(QtCore.QRect(30, 100, 161, 20))
        self.multImageLabel.setAcceptDrops(False)
        self.multImageLabel.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.multImageLabel.setFrameShadow(QtWidgets.QFrame.Plain)
        self.multImageLabel.setLineWidth(1)
        self.multImageLabel.setWordWrap(False)
        self.multImageLabel.setObjectName("multImageLabel")
        self.btnPansharpen = QtWidgets.QPushButton(self.groupBox)
        self.btnPansharpen.setGeometry(QtCore.QRect(230, 160, 91, 31))
        self.btnPansharpen.setTabletTracking(False)
        self.btnPansharpen.setObjectName("btnPansharpen")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
Пример #5
0
    def accept(self):
        """Method invoked when OK button is clicked."""

        paths = self.select_points_action.filePath()
        file_points = QgsFileWidget.splitFilePaths(paths)
        crs_selected = self.mQgsProjectionSelectionWidget.crs()
        crs = crs_selected.authid()
        import_points(file_points, crs)

        self.close()
Пример #6
0
 def accept(self):
     """Method invoked when OK button is clicked."""
     name_operator = self.operator_name.value().upper()
     paths = self.select_pdf_action.filePath()
     file_operator = QgsFileWidget.splitFilePaths(paths)
     QgsMessageLog.logMessage(
         "Ajouter un exploitant: {} avec PDF: {}".format(
             name_operator, ','.join(file_operator)), 'UnderMap', Qgis.Info)
     create_operator(name_operator, file_operator, None)
     self.close()
Пример #7
0
    def accept(self):
        paths = self.select_pdf_action.filePath()
        file_operator = QgsFileWidget.splitFilePaths(paths)
        root_dir = dirname(file_operator[0])
        to_dir = join(root_dir, "PDF DECOUPE")
        """QgsMessageLog.logMessage('UnderMap', "pdf dans: {} avec PDF: {}"
                                 .format(to_dir, ','.join(file_operator)), Qgis.Info)"""
        for item_file in file_operator:

            split_pdf(item_file, to_dir)
        self.close()
Пример #8
0
    def __init__(self, layerBox, parent):
        fields = ['direction']

        super(loadRteDialog, self).__init__(fields=fields,
                                            layerBox=layerBox,
                                            parent=parent)

        self.setTooltips({
            'direction':
            'Field of layer with direction. Values need to be one of NB,EB,SB,WB,CW,AC'
        })

        self.fileWidget = QgsFileWidget(self)
        self.layout().insertRow(0, 'File', self.fileWidget)

        self.buttonBox.rejected.connect(self.hide)

        self.setWindowTitle('load rte')

        self.clearMode = True  # True=insert at row,False=clear and load
        self.buttonBox.accepted.connect(self.load)
Пример #9
0
    def accept(self):
        """Method invoked when OK button is clicked."""

        input_layer = self.layer.currentLayer()
        out = self.result.filePath()
        file_out = QgsFileWidget.splitFilePaths(out)
        count_overlap_action(input_layer, out)
        QgsMessageLog.logMessage(
            "Input layer: {} and Output: {}".format(input_layer.name(),
                                                    file_out), 'Footprint',
            Qgis.Info)
        self.close()
Пример #10
0
    def setupUi(self):

        self.dlg = QDialog()
        self.dlg.setWindowTitle("TOMs Export")
        self.dlg.setWindowModality(Qt.ApplicationModal)

        self.generalLayout = QVBoxLayout()

        layerGroup = QGroupBox("Choose layers to export")

        # add map layer list
        self.layerList = checkableMapLayerList()
        vbox1 = QVBoxLayout()
        vbox1.addWidget(self.layerList)
        layerGroup.setLayout(vbox1)
        self.generalLayout.addWidget(layerGroup)

        # add file chooser
        outputGroup = QGroupBox("Choose output file")
        self.fileNameWidget = QgsFileWidget()
        self.fileNameWidget.setStorageMode(QgsFileWidget.SaveFile)
        self.fileNameWidget.setFilter(
            "Geopackage (*.gpkg);;JPEG (*.jpg *.jpeg);;TIFF (*.tif)")
        self.fileNameWidget.setSelectedFilter("Geopackage (*.gpkg)")
        vbox2 = QVBoxLayout()
        vbox2.addWidget(self.fileNameWidget)
        outputGroup.setLayout(vbox2)
        self.generalLayout.addWidget(outputGroup)

        # add buttons
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.dlg.accept)
        self.buttonBox.rejected.connect(self.dlg.reject)
        self.generalLayout.addWidget(self.buttonBox)

        self.dlg.setLayout(self.generalLayout)
        checkableMapLayerListCtrl(self.layerList)
Пример #11
0
    def _on_raster_selection_changed(self) -> None:
        """
        Executed when the user select one or more files, shows upload CTO.

        Once at least one file is selected when can proceed with the upload.
        """
        # Show CTO, reset progress bar
        self.ui.start_upload_button.setEnabled(True)
        self.ui.progress_bar.setValue(0)
        # create model/view for file list
        file_paths = QgsFileWidget.splitFilePaths(
            self.ui.file_selector.filePath())
        self.model.setStringList(get_file_info(f)["name"] for f in file_paths)
        self.ui.label_filelist.setText(
            "%s (%d):" % (tr("Selected images"), self.model.rowCount()))
Пример #12
0
    def accept(self):

        from qgis.utils import iface
        name_exploitant = iface.activeLayer().name()
        paths = self.select_pdf_action.filePath()
        file_operator = QgsFileWidget.splitFilePaths(paths)
        project_path = get_project_path()
        to_dir = join(project_path, PROJECT_GROUP[2], name_exploitant,
                      OPERATOR_SUB_DIR[0])
        print(file_operator)
        QgsMessageLog.logMessage(
            'UnderMap',
            "Ajout pdf dans: {} avec PDF: {}".format(name_exploitant,
                                                     ','.join(file_operator)),
            Qgis.Info)
        copy_file(file_operator, to_dir, None)
        self.close()
Пример #13
0
    def addContent(self):
        self.show()
        layout = QVBoxLayout()
        self.setLayout(layout)

        layer_input = QgsFileWidget(self)
        resolution_input = QLineEdit(self)

        layout.addWidget(QLabel("Select layer:"))
        layout.addWidget(layer_input)
        layout.addWidget(QLabel("Desired resolution 1:"))
        layout.addWidget(resolution_input)

        resolution_input.setPlaceholderText("Desired resolution")
        resolution_input.setValidator(QIntValidator())

        button = QPushButton('Remove small polygons')
        button.clicked.connect(
            lambda: calculate(resolution_input, layer_input))
        layout.addWidget(button)
Пример #14
0
    def setupUi(self, dlg_form_auth_prompt):
        dlg_form_auth_prompt.setObjectName(_fromUtf8("dlg_form_auth_prompt"))
        dlg_form_auth_prompt.resize(800, 400)
        dlg_form_auth_prompt.setMinimumSize(QtCore.QSize(800, 400))
        dlg_form_auth_prompt.setMaximumSize(QtCore.QSize(800, 400))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/users.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        dlg_form_auth_prompt.setWindowIcon(icon)
        dlg_form_auth_prompt.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        dlg_form_auth_prompt.setModal(False)
        self.verticalLayout = QtGui.QVBoxLayout(dlg_form_auth_prompt)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.grb_connection_ready = QtGui.QGroupBox(dlg_form_auth_prompt)
        self.grb_connection_ready.setMinimumSize(QtCore.QSize(500, 150))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.grb_connection_ready.setFont(font)
        self.grb_connection_ready.setAutoFillBackground(True)
        self.grb_connection_ready.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.grb_connection_ready.setFlat(True)
        self.grb_connection_ready.setObjectName(_fromUtf8("grb_connection_ready"))
        self.gridLayout_2 = QtGui.QGridLayout(self.grb_connection_ready)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.lbl_app_secret = QtGui.QLabel(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lbl_app_secret.sizePolicy().hasHeightForWidth())
        self.lbl_app_secret.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_app_secret.setFont(font)
        self.lbl_app_secret.setAutoFillBackground(True)
        self.lbl_app_secret.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.lbl_app_secret.setScaledContents(True)
        self.lbl_app_secret.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_app_secret.setObjectName(_fromUtf8("lbl_app_secret"))
        self.gridLayout_2.addWidget(self.lbl_app_secret, 3, 1, 1, 1)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem, 3, 4, 1, 1)
        self.ent_app_secret = QtGui.QLineEdit(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.ent_app_secret.sizePolicy().hasHeightForWidth())
        self.ent_app_secret.setSizePolicy(sizePolicy)
        self.ent_app_secret.setMinimumSize(QtCore.QSize(475, 25))
        self.ent_app_secret.setMaximumSize(QtCore.QSize(800, 30))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.ent_app_secret.setFont(font)
        self.ent_app_secret.setFocusPolicy(QtCore.Qt.NoFocus)
        self.ent_app_secret.setAutoFillBackground(True)
        self.ent_app_secret.setText(_fromUtf8(""))
        self.ent_app_secret.setMaxLength(64)
        self.ent_app_secret.setEchoMode(QtGui.QLineEdit.PasswordEchoOnEdit)
        self.ent_app_secret.setReadOnly(True)
        self.ent_app_secret.setPlaceholderText(_fromUtf8("*******************************************"))
        self.ent_app_secret.setObjectName(_fromUtf8("ent_app_secret"))
        self.gridLayout_2.addWidget(self.ent_app_secret, 3, 3, 1, 1)
        self.chb_isogeo_editor = QtGui.QCheckBox(self.grb_connection_ready)
        self.chb_isogeo_editor.setMinimumSize(QtCore.QSize(300, 20))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.chb_isogeo_editor.setFont(font)
        self.chb_isogeo_editor.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.chb_isogeo_editor.setAutoFillBackground(True)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/authentication/user.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.chb_isogeo_editor.setIcon(icon1)
        self.chb_isogeo_editor.setTristate(False)
        self.chb_isogeo_editor.setObjectName(_fromUtf8("chb_isogeo_editor"))
        self.gridLayout_2.addWidget(self.chb_isogeo_editor, 5, 3, 1, 1)
        self.ent_app_id = QtGui.QLineEdit(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.ent_app_id.sizePolicy().hasHeightForWidth())
        self.ent_app_id.setSizePolicy(sizePolicy)
        self.ent_app_id.setMinimumSize(QtCore.QSize(475, 25))
        self.ent_app_id.setMaximumSize(QtCore.QSize(800, 30))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.ent_app_id.setFont(font)
        self.ent_app_id.setToolTip(_fromUtf8(""))
        self.ent_app_id.setAutoFillBackground(True)
        self.ent_app_id.setText(_fromUtf8(""))
        self.ent_app_id.setMaxLength(100)
        self.ent_app_id.setFrame(True)
        self.ent_app_id.setReadOnly(True)
        self.ent_app_id.setCursorMoveStyle(QtCore.Qt.LogicalMoveStyle)
        self.ent_app_id.setObjectName(_fromUtf8("ent_app_id"))
        self.gridLayout_2.addWidget(self.ent_app_id, 2, 3, 1, 1)
        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem1, 0, 4, 1, 1)
        self.btn_ok_cancel = QtGui.QDialogButtonBox(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.btn_ok_cancel.sizePolicy().hasHeightForWidth())
        self.btn_ok_cancel.setSizePolicy(sizePolicy)
        self.btn_ok_cancel.setMinimumSize(QtCore.QSize(30, 30))
        self.btn_ok_cancel.setMaximumSize(QtCore.QSize(16777215, 100))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_ok_cancel.setFont(font)
        self.btn_ok_cancel.setAutoFillBackground(True)
        self.btn_ok_cancel.setOrientation(QtCore.Qt.Horizontal)
        self.btn_ok_cancel.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
        self.btn_ok_cancel.setCenterButtons(True)
        self.btn_ok_cancel.setObjectName(_fromUtf8("btn_ok_cancel"))
        self.gridLayout_2.addWidget(self.btn_ok_cancel, 6, 0, 1, 8)
        self.lbl_app_id = QtGui.QLabel(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lbl_app_id.sizePolicy().hasHeightForWidth())
        self.lbl_app_id.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_app_id.setFont(font)
        self.lbl_app_id.setAutoFillBackground(True)
        self.lbl_app_id.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.lbl_app_id.setScaledContents(True)
        self.lbl_app_id.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_app_id.setObjectName(_fromUtf8("lbl_app_id"))
        self.gridLayout_2.addWidget(self.lbl_app_id, 2, 1, 1, 1)
        self.btn_check_auth = QtGui.QPushButton(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btn_check_auth.sizePolicy().hasHeightForWidth())
        self.btn_check_auth.setSizePolicy(sizePolicy)
        self.btn_check_auth.setMinimumSize(QtCore.QSize(0, 50))
        self.btn_check_auth.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_check_auth.setFont(font)
        self.btn_check_auth.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/authentication/sign-in.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btn_check_auth.setIcon(icon2)
        self.btn_check_auth.setDefault(True)
        self.btn_check_auth.setObjectName(_fromUtf8("btn_check_auth"))
        self.gridLayout_2.addWidget(self.btn_check_auth, 2, 5, 2, 1)
        self.lbl_browse_credentials = QtGui.QLabel(self.grb_connection_ready)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_browse_credentials.setFont(font)
        self.lbl_browse_credentials.setAutoFillBackground(True)
        self.lbl_browse_credentials.setScaledContents(True)
        self.lbl_browse_credentials.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_browse_credentials.setObjectName(_fromUtf8("lbl_browse_credentials"))
        self.gridLayout_2.addWidget(self.lbl_browse_credentials, 0, 1, 1, 1)
        self.btn_browse_credentials = QgsFileWidget(self.grb_connection_ready)
        self.btn_browse_credentials.setEnabled(True)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btn_browse_credentials.sizePolicy().hasHeightForWidth())
        self.btn_browse_credentials.setSizePolicy(sizePolicy)
        self.btn_browse_credentials.setMinimumSize(QtCore.QSize(475, 30))
        self.btn_browse_credentials.setMaximumSize(QtCore.QSize(800, 30))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_browse_credentials.setFont(font)
        self.btn_browse_credentials.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.btn_browse_credentials.setAcceptDrops(False)
        self.btn_browse_credentials.setFileWidgetButtonVisible(True)
        self.btn_browse_credentials.setUseLink(False)
        self.btn_browse_credentials.setFullUrl(False)
        self.btn_browse_credentials.setFilter(_fromUtf8("*.json;*.ini"))
        self.btn_browse_credentials.setDefaultRoot(_fromUtf8(""))
        self.btn_browse_credentials.setObjectName(_fromUtf8("btn_browse_credentials"))
        self.gridLayout_2.addWidget(self.btn_browse_credentials, 0, 3, 1, 1)
        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem2, 2, 4, 1, 1)
        spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout_2.addItem(spacerItem3, 1, 3, 1, 1)
        self.lbl_api_url = QtGui.QLabel(self.grb_connection_ready)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_api_url.setFont(font)
        self.lbl_api_url.setAutoFillBackground(True)
        self.lbl_api_url.setScaledContents(True)
        self.lbl_api_url.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_api_url.setObjectName(_fromUtf8("lbl_api_url"))
        self.gridLayout_2.addWidget(self.lbl_api_url, 4, 1, 1, 1)
        self.lbl_api_url_value = QtGui.QLabel(self.grb_connection_ready)
        font = QtGui.QFont()
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        font.setKerning(True)
        self.lbl_api_url_value.setFont(font)
        self.lbl_api_url_value.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
        self.lbl_api_url_value.setAutoFillBackground(True)
        self.lbl_api_url_value.setFrameShape(QtGui.QFrame.NoFrame)
        self.lbl_api_url_value.setText(_fromUtf8("https://v1.api.isogeo.com/"))
        self.lbl_api_url_value.setOpenExternalLinks(True)
        self.lbl_api_url_value.setObjectName(_fromUtf8("lbl_api_url_value"))
        self.gridLayout_2.addWidget(self.lbl_api_url_value, 4, 3, 1, 1)
        self.verticalLayout.addWidget(self.grb_connection_ready)
        self.grb_need_account = QtGui.QGroupBox(dlg_form_auth_prompt)
        self.grb_need_account.setMinimumSize(QtCore.QSize(200, 150))
        self.grb_need_account.setMaximumSize(QtCore.QSize(16777215, 200))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.grb_need_account.setFont(font)
        self.grb_need_account.setAutoFillBackground(True)
        self.grb_need_account.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.grb_need_account.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.grb_need_account.setFlat(True)
        self.grb_need_account.setObjectName(_fromUtf8("grb_need_account"))
        self.gridLayout = QtGui.QGridLayout(self.grb_need_account)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.btn_account_new = QtGui.QPushButton(self.grb_need_account)
        self.btn_account_new.setMinimumSize(QtCore.QSize(200, 30))
        self.btn_account_new.setMaximumSize(QtCore.QSize(700, 50))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_account_new.setFont(font)
        self.btn_account_new.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.btn_account_new.setAutoFillBackground(True)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/authentication/send-o.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btn_account_new.setIcon(icon3)
        self.btn_account_new.setDefault(True)
        self.btn_account_new.setObjectName(_fromUtf8("btn_account_new"))
        self.gridLayout.addWidget(self.btn_account_new, 1, 0, 1, 1)
        self.lbl_access_conditions = QtGui.QLabel(self.grb_need_account)
        self.lbl_access_conditions.setMaximumSize(QtCore.QSize(700, 16777215))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_access_conditions.setFont(font)
        self.lbl_access_conditions.setTextFormat(QtCore.Qt.RichText)
        self.lbl_access_conditions.setObjectName(_fromUtf8("lbl_access_conditions"))
        self.gridLayout.addWidget(self.lbl_access_conditions, 0, 0, 1, 1)
        self.verticalLayout.addWidget(self.grb_need_account)

        self.retranslateUi(dlg_form_auth_prompt)
        QtCore.QObject.connect(self.btn_ok_cancel, QtCore.SIGNAL(_fromUtf8("accepted()")), dlg_form_auth_prompt.accept)
        QtCore.QObject.connect(self.btn_ok_cancel, QtCore.SIGNAL(_fromUtf8("rejected()")), dlg_form_auth_prompt.reject)
        QtCore.QMetaObject.connectSlotsByName(dlg_form_auth_prompt)
Пример #15
0
class Ui_dlg_form_auth_prompt(object):
    def setupUi(self, dlg_form_auth_prompt):
        dlg_form_auth_prompt.setObjectName(_fromUtf8("dlg_form_auth_prompt"))
        dlg_form_auth_prompt.resize(800, 400)
        dlg_form_auth_prompt.setMinimumSize(QtCore.QSize(800, 400))
        dlg_form_auth_prompt.setMaximumSize(QtCore.QSize(800, 400))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/users.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        dlg_form_auth_prompt.setWindowIcon(icon)
        dlg_form_auth_prompt.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        dlg_form_auth_prompt.setModal(False)
        self.verticalLayout = QtGui.QVBoxLayout(dlg_form_auth_prompt)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.grb_connection_ready = QtGui.QGroupBox(dlg_form_auth_prompt)
        self.grb_connection_ready.setMinimumSize(QtCore.QSize(500, 150))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.grb_connection_ready.setFont(font)
        self.grb_connection_ready.setAutoFillBackground(True)
        self.grb_connection_ready.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.grb_connection_ready.setFlat(True)
        self.grb_connection_ready.setObjectName(_fromUtf8("grb_connection_ready"))
        self.gridLayout_2 = QtGui.QGridLayout(self.grb_connection_ready)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.lbl_app_secret = QtGui.QLabel(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lbl_app_secret.sizePolicy().hasHeightForWidth())
        self.lbl_app_secret.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_app_secret.setFont(font)
        self.lbl_app_secret.setAutoFillBackground(True)
        self.lbl_app_secret.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.lbl_app_secret.setScaledContents(True)
        self.lbl_app_secret.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_app_secret.setObjectName(_fromUtf8("lbl_app_secret"))
        self.gridLayout_2.addWidget(self.lbl_app_secret, 3, 1, 1, 1)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem, 3, 4, 1, 1)
        self.ent_app_secret = QtGui.QLineEdit(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.ent_app_secret.sizePolicy().hasHeightForWidth())
        self.ent_app_secret.setSizePolicy(sizePolicy)
        self.ent_app_secret.setMinimumSize(QtCore.QSize(475, 25))
        self.ent_app_secret.setMaximumSize(QtCore.QSize(800, 30))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.ent_app_secret.setFont(font)
        self.ent_app_secret.setFocusPolicy(QtCore.Qt.NoFocus)
        self.ent_app_secret.setAutoFillBackground(True)
        self.ent_app_secret.setText(_fromUtf8(""))
        self.ent_app_secret.setMaxLength(64)
        self.ent_app_secret.setEchoMode(QtGui.QLineEdit.PasswordEchoOnEdit)
        self.ent_app_secret.setReadOnly(True)
        self.ent_app_secret.setPlaceholderText(_fromUtf8("*******************************************"))
        self.ent_app_secret.setObjectName(_fromUtf8("ent_app_secret"))
        self.gridLayout_2.addWidget(self.ent_app_secret, 3, 3, 1, 1)
        self.chb_isogeo_editor = QtGui.QCheckBox(self.grb_connection_ready)
        self.chb_isogeo_editor.setMinimumSize(QtCore.QSize(300, 20))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.chb_isogeo_editor.setFont(font)
        self.chb_isogeo_editor.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.chb_isogeo_editor.setAutoFillBackground(True)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/authentication/user.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.chb_isogeo_editor.setIcon(icon1)
        self.chb_isogeo_editor.setTristate(False)
        self.chb_isogeo_editor.setObjectName(_fromUtf8("chb_isogeo_editor"))
        self.gridLayout_2.addWidget(self.chb_isogeo_editor, 5, 3, 1, 1)
        self.ent_app_id = QtGui.QLineEdit(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.ent_app_id.sizePolicy().hasHeightForWidth())
        self.ent_app_id.setSizePolicy(sizePolicy)
        self.ent_app_id.setMinimumSize(QtCore.QSize(475, 25))
        self.ent_app_id.setMaximumSize(QtCore.QSize(800, 30))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.ent_app_id.setFont(font)
        self.ent_app_id.setToolTip(_fromUtf8(""))
        self.ent_app_id.setAutoFillBackground(True)
        self.ent_app_id.setText(_fromUtf8(""))
        self.ent_app_id.setMaxLength(100)
        self.ent_app_id.setFrame(True)
        self.ent_app_id.setReadOnly(True)
        self.ent_app_id.setCursorMoveStyle(QtCore.Qt.LogicalMoveStyle)
        self.ent_app_id.setObjectName(_fromUtf8("ent_app_id"))
        self.gridLayout_2.addWidget(self.ent_app_id, 2, 3, 1, 1)
        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem1, 0, 4, 1, 1)
        self.btn_ok_cancel = QtGui.QDialogButtonBox(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.btn_ok_cancel.sizePolicy().hasHeightForWidth())
        self.btn_ok_cancel.setSizePolicy(sizePolicy)
        self.btn_ok_cancel.setMinimumSize(QtCore.QSize(30, 30))
        self.btn_ok_cancel.setMaximumSize(QtCore.QSize(16777215, 100))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_ok_cancel.setFont(font)
        self.btn_ok_cancel.setAutoFillBackground(True)
        self.btn_ok_cancel.setOrientation(QtCore.Qt.Horizontal)
        self.btn_ok_cancel.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
        self.btn_ok_cancel.setCenterButtons(True)
        self.btn_ok_cancel.setObjectName(_fromUtf8("btn_ok_cancel"))
        self.gridLayout_2.addWidget(self.btn_ok_cancel, 6, 0, 1, 8)
        self.lbl_app_id = QtGui.QLabel(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lbl_app_id.sizePolicy().hasHeightForWidth())
        self.lbl_app_id.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_app_id.setFont(font)
        self.lbl_app_id.setAutoFillBackground(True)
        self.lbl_app_id.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.lbl_app_id.setScaledContents(True)
        self.lbl_app_id.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_app_id.setObjectName(_fromUtf8("lbl_app_id"))
        self.gridLayout_2.addWidget(self.lbl_app_id, 2, 1, 1, 1)
        self.btn_check_auth = QtGui.QPushButton(self.grb_connection_ready)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btn_check_auth.sizePolicy().hasHeightForWidth())
        self.btn_check_auth.setSizePolicy(sizePolicy)
        self.btn_check_auth.setMinimumSize(QtCore.QSize(0, 50))
        self.btn_check_auth.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_check_auth.setFont(font)
        self.btn_check_auth.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/authentication/sign-in.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btn_check_auth.setIcon(icon2)
        self.btn_check_auth.setDefault(True)
        self.btn_check_auth.setObjectName(_fromUtf8("btn_check_auth"))
        self.gridLayout_2.addWidget(self.btn_check_auth, 2, 5, 2, 1)
        self.lbl_browse_credentials = QtGui.QLabel(self.grb_connection_ready)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_browse_credentials.setFont(font)
        self.lbl_browse_credentials.setAutoFillBackground(True)
        self.lbl_browse_credentials.setScaledContents(True)
        self.lbl_browse_credentials.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_browse_credentials.setObjectName(_fromUtf8("lbl_browse_credentials"))
        self.gridLayout_2.addWidget(self.lbl_browse_credentials, 0, 1, 1, 1)
        self.btn_browse_credentials = QgsFileWidget(self.grb_connection_ready)
        self.btn_browse_credentials.setEnabled(True)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btn_browse_credentials.sizePolicy().hasHeightForWidth())
        self.btn_browse_credentials.setSizePolicy(sizePolicy)
        self.btn_browse_credentials.setMinimumSize(QtCore.QSize(475, 30))
        self.btn_browse_credentials.setMaximumSize(QtCore.QSize(800, 30))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_browse_credentials.setFont(font)
        self.btn_browse_credentials.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.btn_browse_credentials.setAcceptDrops(False)
        self.btn_browse_credentials.setFileWidgetButtonVisible(True)
        self.btn_browse_credentials.setUseLink(False)
        self.btn_browse_credentials.setFullUrl(False)
        self.btn_browse_credentials.setFilter(_fromUtf8("*.json;*.ini"))
        self.btn_browse_credentials.setDefaultRoot(_fromUtf8(""))
        self.btn_browse_credentials.setObjectName(_fromUtf8("btn_browse_credentials"))
        self.gridLayout_2.addWidget(self.btn_browse_credentials, 0, 3, 1, 1)
        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem2, 2, 4, 1, 1)
        spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout_2.addItem(spacerItem3, 1, 3, 1, 1)
        self.lbl_api_url = QtGui.QLabel(self.grb_connection_ready)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_api_url.setFont(font)
        self.lbl_api_url.setAutoFillBackground(True)
        self.lbl_api_url.setScaledContents(True)
        self.lbl_api_url.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_api_url.setObjectName(_fromUtf8("lbl_api_url"))
        self.gridLayout_2.addWidget(self.lbl_api_url, 4, 1, 1, 1)
        self.lbl_api_url_value = QtGui.QLabel(self.grb_connection_ready)
        font = QtGui.QFont()
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        font.setKerning(True)
        self.lbl_api_url_value.setFont(font)
        self.lbl_api_url_value.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
        self.lbl_api_url_value.setAutoFillBackground(True)
        self.lbl_api_url_value.setFrameShape(QtGui.QFrame.NoFrame)
        self.lbl_api_url_value.setText(_fromUtf8("https://v1.api.isogeo.com/"))
        self.lbl_api_url_value.setOpenExternalLinks(True)
        self.lbl_api_url_value.setObjectName(_fromUtf8("lbl_api_url_value"))
        self.gridLayout_2.addWidget(self.lbl_api_url_value, 4, 3, 1, 1)
        self.verticalLayout.addWidget(self.grb_connection_ready)
        self.grb_need_account = QtGui.QGroupBox(dlg_form_auth_prompt)
        self.grb_need_account.setMinimumSize(QtCore.QSize(200, 150))
        self.grb_need_account.setMaximumSize(QtCore.QSize(16777215, 200))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.grb_need_account.setFont(font)
        self.grb_need_account.setAutoFillBackground(True)
        self.grb_need_account.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.grb_need_account.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.grb_need_account.setFlat(True)
        self.grb_need_account.setObjectName(_fromUtf8("grb_need_account"))
        self.gridLayout = QtGui.QGridLayout(self.grb_need_account)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.btn_account_new = QtGui.QPushButton(self.grb_need_account)
        self.btn_account_new.setMinimumSize(QtCore.QSize(200, 30))
        self.btn_account_new.setMaximumSize(QtCore.QSize(700, 50))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.btn_account_new.setFont(font)
        self.btn_account_new.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.btn_account_new.setAutoFillBackground(True)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/Isogeo/resources/authentication/send-o.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btn_account_new.setIcon(icon3)
        self.btn_account_new.setDefault(True)
        self.btn_account_new.setObjectName(_fromUtf8("btn_account_new"))
        self.gridLayout.addWidget(self.btn_account_new, 1, 0, 1, 1)
        self.lbl_access_conditions = QtGui.QLabel(self.grb_need_account)
        self.lbl_access_conditions.setMaximumSize(QtCore.QSize(700, 16777215))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.lbl_access_conditions.setFont(font)
        self.lbl_access_conditions.setTextFormat(QtCore.Qt.RichText)
        self.lbl_access_conditions.setObjectName(_fromUtf8("lbl_access_conditions"))
        self.gridLayout.addWidget(self.lbl_access_conditions, 0, 0, 1, 1)
        self.verticalLayout.addWidget(self.grb_need_account)

        self.retranslateUi(dlg_form_auth_prompt)
        QtCore.QObject.connect(self.btn_ok_cancel, QtCore.SIGNAL(_fromUtf8("accepted()")), dlg_form_auth_prompt.accept)
        QtCore.QObject.connect(self.btn_ok_cancel, QtCore.SIGNAL(_fromUtf8("rejected()")), dlg_form_auth_prompt.reject)
        QtCore.QMetaObject.connectSlotsByName(dlg_form_auth_prompt)

    def retranslateUi(self, dlg_form_auth_prompt):
        dlg_form_auth_prompt.setWindowTitle(_translate("dlg_form_auth_prompt", "Isogeo authentication settings", None))
        self.grb_connection_ready.setTitle(_translate("dlg_form_auth_prompt", "I already have Isogeo ID and SECRET for this application", None))
        self.lbl_app_secret.setText(_translate("dlg_form_auth_prompt", "Application SECRET:", None))
        self.chb_isogeo_editor.setToolTip(_translate("dlg_form_auth_prompt", "I\'ve got the power hey yeah heh!", None))
        self.chb_isogeo_editor.setText(_translate("dlg_form_auth_prompt", "I\'ve got edition rights on app.isogeo.com", None))
        self.ent_app_id.setPlaceholderText(_translate("dlg_form_auth_prompt", "plugin-qgis-org-a1b23c4d5f6g7h8i9j10kl11mn13op14", None))
        self.lbl_app_id.setText(_translate("dlg_form_auth_prompt", "Application ID:", None))
        self.btn_check_auth.setToolTip(_translate("dlg_form_auth_prompt", "Check access validity", None))
        self.btn_check_auth.setText(_translate("dlg_form_auth_prompt", "Check", None))
        self.lbl_browse_credentials.setText(_translate("dlg_form_auth_prompt", "From a file:", None))
        self.btn_browse_credentials.setToolTip(_translate("dlg_form_auth_prompt", "Pick your credentials file", None))
        self.btn_browse_credentials.setDialogTitle(_translate("dlg_form_auth_prompt", "Locate the Isogeo API credentials file", None))
        self.lbl_api_url.setToolTip(_translate("dlg_form_auth_prompt", "Only for information, the Isogeo API base URL", None))
        self.lbl_api_url.setText(_translate("dlg_form_auth_prompt", "API location:", None))
        self.grb_need_account.setTitle(_translate("dlg_form_auth_prompt", "Don\'t have an account yet ?", None))
        self.btn_account_new.setText(_translate("dlg_form_auth_prompt", "Request plugin access", None))
        self.lbl_access_conditions.setText(_translate("dlg_form_auth_prompt", "<!DOCTYPE html>\n"
"<html>\n"
"<body>\n"
"\n"
"<ul>\n"
"    <li>Completely free to access generic Open Data</li>\n"
"    <li>Completely free to work with 20 of your geographic data and services (Isogeo account required)</li>\n"
"    <li>Ask for our annual plans to work with your whole geographic data and services !</li>\n"
"</ul> \n"
"\n"
"</body>\n"
"</html>\n"
"", None))
Пример #16
0
class Ui_DockWidget(object):
    def setupUi(self, DockWidget):
        DockWidget.setObjectName(_fromUtf8("DockWidget"))
        DockWidget.resize(397, 827)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(150)
        sizePolicy.setHeightForWidth(
            DockWidget.sizePolicy().hasHeightForWidth())
        DockWidget.setSizePolicy(sizePolicy)
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.tableCoordFeu = QtGui.QTableWidget(self.dockWidgetContents)
        self.tableCoordFeu.setGeometry(QtCore.QRect(12, 310, 241, 181))
        self.tableCoordFeu.setRowCount(5)
        self.tableCoordFeu.setColumnCount(2)
        self.tableCoordFeu.setObjectName(_fromUtf8("tableCoordFeu"))
        self.btSynchronize = QtGui.QPushButton(self.dockWidgetContents)
        self.btSynchronize.setGeometry(QtCore.QRect(270, 310, 101, 51))
        self.btSynchronize.setObjectName(_fromUtf8("btSynchronize"))
        self.btViderFichier = QtGui.QPushButton(self.dockWidgetContents)
        self.btViderFichier.setGeometry(QtCore.QRect(270, 370, 101, 23))
        self.btViderFichier.setObjectName(_fromUtf8("btViderFichier"))
        self.label_6 = QtGui.QLabel(self.dockWidgetContents)
        self.label_6.setGeometry(QtCore.QRect(10, 280, 191, 16))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setItalic(True)
        self.label_6.setFont(font)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.btFermer = QtGui.QPushButton(self.dockWidgetContents)
        self.btFermer.setGeometry(QtCore.QRect(20, 770, 111, 25))
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/close.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btFermer.setIcon(icon)
        self.btFermer.setIconSize(QtCore.QSize(18, 18))
        self.btFermer.setObjectName(_fromUtf8("btFermer"))
        self.btControler = QtGui.QPushButton(self.dockWidgetContents)
        self.btControler.setGeometry(QtCore.QRect(130, 770, 111, 25))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/controle.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btControler.setIcon(icon1)
        self.btControler.setIconSize(QtCore.QSize(18, 18))
        self.btControler.setObjectName(_fromUtf8("btControler"))
        self.btCheck = QtGui.QPushButton(self.dockWidgetContents)
        self.btCheck.setEnabled(False)
        self.btCheck.setGeometry(QtCore.QRect(240, 770, 111, 25))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/valider.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btCheck.setIcon(icon2)
        self.btCheck.setIconSize(QtCore.QSize(18, 18))
        self.btCheck.setObjectName(_fromUtf8("btCheck"))
        self.label_grille = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_grille.setGeometry(QtCore.QRect(10, 9, 371, 131))
        self.label_grille.setObjectName(_fromUtf8("label_grille"))
        self.label_importer = QtGui.QLabel(self.label_grille)
        self.label_importer.setGeometry(QtCore.QRect(25, 30, 61, 16))
        self.label_importer.setObjectName(_fromUtf8("label_importer"))
        self.fileImportGrille = QgsFileWidget(self.label_grille)
        self.fileImportGrille.setGeometry(QtCore.QRect(90, 21, 271, 27))
        self.fileImportGrille.setObjectName(_fromUtf8("fileImportGrille"))
        self.label_cell_encours = QtGui.QLabel(self.label_grille)
        self.label_cell_encours.setGeometry(QtCore.QRect(128, 61, 101, 20))
        self.label_cell_encours.setObjectName(_fromUtf8("label_cell_encours"))
        self.currentId = QtGui.QLineEdit(self.label_grille)
        self.currentId.setGeometry(QtCore.QRect(230, 61, 61, 21))
        self.currentId.setObjectName(_fromUtf8("currentId"))
        self.btGo = QtGui.QPushButton(self.label_grille)
        self.btGo.setGeometry(QtCore.QRect(290, 61, 75, 23))
        self.btGo.setObjectName(_fromUtf8("btGo"))
        self.btSuiv = QtGui.QPushButton(self.label_grille)
        self.btSuiv.setGeometry(QtCore.QRect(250, 96, 111, 23))
        self.btSuiv.setObjectName(_fromUtf8("btSuiv"))
        self.btPrec = QtGui.QPushButton(self.label_grille)
        self.btPrec.setGeometry(QtCore.QRect(140, 96, 111, 23))
        self.btPrec.setObjectName(_fromUtf8("btPrec"))
        self.btZoomGrille = QtGui.QPushButton(self.label_grille)
        self.btZoomGrille.setGeometry(QtCore.QRect(40, 96, 101, 23))
        self.btZoomGrille.setObjectName(_fromUtf8("btZoomGrille"))
        self.label_fichier = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_fichier.setGeometry(QtCore.QRect(10, 150, 371, 121))
        self.label_fichier.setObjectName(_fromUtf8("label_fichier"))
        self.label_2 = QtGui.QLabel(self.label_fichier)
        self.label_2.setGeometry(QtCore.QRect(34, 32, 71, 20))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.label_7 = QtGui.QLabel(self.label_fichier)
        self.label_7.setGeometry(QtCore.QRect(18, 62, 91, 20))
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.fileControleCSV = QtGui.QLineEdit(self.label_fichier)
        self.fileControleCSV.setEnabled(False)
        self.fileControleCSV.setGeometry(QtCore.QRect(110, 63, 251, 20))
        self.fileControleCSV.setObjectName(_fromUtf8("fileControleCSV"))
        self.fileValidationCSV = QtGui.QLineEdit(self.label_fichier)
        self.fileValidationCSV.setEnabled(False)
        self.fileValidationCSV.setGeometry(QtCore.QRect(110, 90, 251, 20))
        self.fileValidationCSV.setObjectName(_fromUtf8("fileValidationCSV"))
        self.label_16 = QtGui.QLabel(self.label_fichier)
        self.label_16.setGeometry(QtCore.QRect(10, 91, 91, 20))
        self.label_16.setObjectName(_fromUtf8("label_16"))
        self.fileOuvrirInventaireCSV = QgsFileWidget(self.label_fichier)
        self.fileOuvrirInventaireCSV.setGeometry(QtCore.QRect(
            111, 25, 251, 27))
        self.fileOuvrirInventaireCSV.setObjectName(
            _fromUtf8("fileOuvrirInventaireCSV"))
        self.label_qualite = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_qualite.setGeometry(QtCore.QRect(10, 510, 361, 241))
        self.label_qualite.setObjectName(_fromUtf8("label_qualite"))
        self.txtNbCell = QtGui.QLineEdit(self.label_qualite)
        self.txtNbCell.setGeometry(QtCore.QRect(200, 30, 150, 20))
        self.txtNbCell.setObjectName(_fromUtf8("txtNbCell"))
        self.label_4 = QtGui.QLabel(self.label_qualite)
        self.label_4.setGeometry(QtCore.QRect(40, 30, 151, 20))
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.txtNbAcquis = QtGui.QLineEdit(self.label_qualite)
        self.txtNbAcquis.setGeometry(QtCore.QRect(200, 50, 150, 20))
        self.txtNbAcquis.setObjectName(_fromUtf8("txtNbAcquis"))
        self.label_5 = QtGui.QLabel(self.label_qualite)
        self.label_5.setGeometry(QtCore.QRect(20, 50, 181, 20))
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.txtNbValidation = QtGui.QLineEdit(self.label_qualite)
        self.txtNbValidation.setGeometry(QtCore.QRect(200, 70, 150, 20))
        self.txtNbValidation.setObjectName(_fromUtf8("txtNbValidation"))
        self.label_14 = QtGui.QLabel(self.label_qualite)
        self.label_14.setGeometry(QtCore.QRect(20, 71, 181, 20))
        self.label_14.setObjectName(_fromUtf8("label_14"))
        self.label_8 = QtGui.QLabel(self.label_qualite)
        self.label_8.setGeometry(QtCore.QRect(120, 100, 71, 16))
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.txtCompletion = QtGui.QLineEdit(self.label_qualite)
        self.txtCompletion.setGeometry(QtCore.QRect(200, 100, 150, 20))
        self.txtCompletion.setObjectName(_fromUtf8("txtCompletion"))
        self.txtMissing = QtGui.QLineEdit(self.label_qualite)
        self.txtMissing.setGeometry(QtCore.QRect(200, 120, 150, 20))
        self.txtMissing.setObjectName(_fromUtf8("txtMissing"))
        self.label_9 = QtGui.QLabel(self.label_qualite)
        self.label_9.setGeometry(QtCore.QRect(10, 120, 191, 20))
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.txtError = QtGui.QLineEdit(self.label_qualite)
        self.txtError.setGeometry(QtCore.QRect(200, 140, 150, 20))
        self.txtError.setObjectName(_fromUtf8("txtError"))
        self.label_10 = QtGui.QLabel(self.label_qualite)
        self.label_10.setGeometry(QtCore.QRect(59, 140, 131, 20))
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.txtRMSE = QtGui.QLineEdit(self.label_qualite)
        self.txtRMSE.setGeometry(QtCore.QRect(200, 160, 150, 20))
        self.txtRMSE.setObjectName(_fromUtf8("txtRMSE"))
        self.label_11 = QtGui.QLabel(self.label_qualite)
        self.label_11.setGeometry(QtCore.QRect(38, 160, 161, 16))
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.txtSBE = QtGui.QLineEdit(self.label_qualite)
        self.txtSBE.setGeometry(QtCore.QRect(200, 190, 150, 20))
        self.txtSBE.setObjectName(_fromUtf8("txtSBE"))
        self.label_12 = QtGui.QLabel(self.label_qualite)
        self.label_12.setGeometry(QtCore.QRect(130, 190, 61, 20))
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.txtSBN = QtGui.QLineEdit(self.label_qualite)
        self.txtSBN.setGeometry(QtCore.QRect(200, 210, 150, 20))
        self.txtSBN.setObjectName(_fromUtf8("txtSBN"))
        self.label_13 = QtGui.QLabel(self.label_qualite)
        self.label_13.setGeometry(QtCore.QRect(130, 210, 61, 20))
        self.label_13.setObjectName(_fromUtf8("label_13"))
        DockWidget.setWidget(self.dockWidgetContents)

        self.retranslateUi(DockWidget)
        QtCore.QMetaObject.connectSlotsByName(DockWidget)

    def retranslateUi(self, DockWidget):
        DockWidget.setWindowTitle(
            _translate("DockWidget", "PoussePousseEditData", None))
        self.btSynchronize.setText(
            _translate("DockWidget", "Synchroniser \n"
                       " le fichier \n"
                       " et le layer", None))
        self.btViderFichier.setText(
            _translate("DockWidget", "! Vider fichier", None))
        self.label_6.setText(
            _translate("DockWidget", "Vue sur le fichier en cours de saisie:",
                       None))
        self.btFermer.setToolTip(
            _translate("DockWidget", "Fermer le plugin", None))
        self.btFermer.setText(_translate("DockWidget", "Fermer", None))
        self.btControler.setToolTip(
            _translate("DockWidget", "Saisir les points de contrôle", None))
        self.btControler.setText(_translate("DockWidget", "Contrôler", None))
        self.btCheck.setToolTip(_translate("DockWidget", "Valider", None))
        self.btCheck.setText(_translate("DockWidget", "Valider", None))
        self.label_grille.setTitle(_translate("DockWidget", "Grille", None))
        self.label_importer.setText(_translate("DockWidget", "Importer:",
                                               None))
        self.label_cell_encours.setText(
            _translate("DockWidget", "Cellule en cours :", None))
        self.btGo.setText(_translate("DockWidget", "Go", None))
        self.btSuiv.setText(_translate("DockWidget", ">>", None))
        self.btPrec.setText(_translate("DockWidget", "<<", None))
        self.btZoomGrille.setText(_translate("DockWidget", "Zoom Grille",
                                             None))
        self.label_fichier.setTitle(_translate("DockWidget", "Fichier", None))
        self.label_2.setText(_translate("DockWidget", "Saisie CSV:", None))
        self.label_7.setText(_translate("DockWidget", "Contrôle CSV:", None))
        self.label_16.setText(_translate("DockWidget", "Validation CSV:",
                                         None))
        self.label_qualite.setTitle(_translate("DockWidget", "Qualité", None))
        self.label_4.setText(
            _translate("DockWidget", "Nombre de cellules tirées:", None))
        self.label_5.setText(
            _translate("DockWidget", "Taille échantillon d\'acquisition:",
                       None))
        self.label_14.setText(
            _translate("DockWidget", "Taille échantillon de contrôle:", None))
        self.label_8.setText(_translate("DockWidget", "Complétion:", None))
        self.label_9.setText(
            _translate("DockWidget", "Nb théorique de pts manquants:", None))
        self.label_10.setText(
            _translate("DockWidget", "Moyenne des erreurs: ", None))
        self.label_11.setText(
            _translate("DockWidget", "Écart quadratique moyen:", None))
        self.label_12.setText(_translate("DockWidget", "biais en X:", None))
        self.label_13.setText(_translate("DockWidget", "biais en Y:", None))
Пример #17
0
class QvFormNovaMapificacio(QvFormBaseMapificacio):
    def __init__(self, llegenda, amplada=500, mapificacio=None, simple=True):
        super().__init__(llegenda, amplada)

        self.fCSV = mapificacio
        self.simple = simple
        self.taulaMostra = None

        self.setWindowTitle('Afegir capa amb mapa simbòlic')

        self.layout = QVBoxLayout()
        self.layout.setSpacing(14)
        self.setLayout(self.layout)

        if self.fCSV is None:
            self.arxiu = QgsFileWidget()
            self.arxiu.setStorageMode(QgsFileWidget.GetFile)
            self.arxiu.setDialogTitle('Selecciona fitxer de dades…')
            self.arxiu.setDefaultRoot(RUTA_LOCAL)
            self.arxiu.setFilter('Arxius CSV (*.csv)')
            self.arxiu.setSelectedFilter('Arxius CSV (*.csv)')
            self.arxiu.lineEdit().setReadOnly(True)
            self.arxiu.fileChanged.connect(self.arxiuSeleccionat)

        self.zona = QComboBox(self)
        self.zona.setEditable(False)
        self.zona.addItem('Selecciona zona…')
        self.zona.currentIndexChanged.connect(self.canviaZona)

        self.mapa = QComboBox(self)
        self.mapa.setEditable(False)
        self.mapa.setIconSize(QSize(126, 126))
        self.mapa.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        self.mapa.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self.mapa.addItem(QIcon(os.path.join(imatgesDir, 'Àrees.PNG')), 'Àrees')
        self.mapa.addItem(QIcon(os.path.join(imatgesDir, 'Cercles.PNG')), 'Cercles')

        self.capa = QLineEdit(self)
        self.capa.setMaxLength(40)

        self.tipus = QComboBox(self)
        self.tipus.setEditable(False)
        self.tipus.addItem('Selecciona tipus…')
        self.tipus.addItems(mv.MAP_AGREGACIO.keys())
        self.tipus.currentIndexChanged.connect(self.canviaTipus)

        self.distribucio = QComboBox(self)
        self.distribucio.setEditable(False)
        self.distribucio.addItem(next(iter(mv.MAP_DISTRIBUCIO.keys())))

        self.calcul = QvComboBoxCamps(self)
        self.filtre = QvComboBoxCamps(self, multiple=True)

        self.color = QComboBox(self)
        self.color.setEditable(False)
        self.comboColors(self.color)

        self.metode = QComboBox(self)
        self.metode.setEditable(False)
        self.metode.addItems(mv.MAP_METODES.keys())

        self.intervals = QSpinBox(self)
        self.intervals.setMinimum(2)
        self.intervals.setMaximum(mv.MAP_MAX_CATEGORIES)
        self.intervals.setSingleStep(1)
        self.intervals.setValue(4)
        self.intervals.setSuffix("  (depèn del mètode)")
        # self.intervals.valueChanged.connect(self.deselectValue)

        self.bTaula = QPushButton('Veure arxiu')
        self.bTaula.setEnabled(False)
        self.bTaula.clicked.connect(self.veureArxiu)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.accepted.connect(self.accept)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        self.buttons.rejected.connect(self.cancel)
        self.buttons.addButton(self.bTaula, QDialogButtonBox.ResetRole)

        self.gDades = QGroupBox('Agregació de dades')
        self.lDades = QFormLayout()
        self.lDades.setSpacing(14)
        self.gDades.setLayout(self.lDades)

        if self.fCSV is None:
            self.lDades.addRow('Arxiu de dades:', self.arxiu)
        self.lDades.addRow('Zona:', self.zona)
        self.lDades.addRow("Tipus d'agregació:", self.tipus)
        self.lDades.addRow('Camp de càlcul:', self.calcul)
        if self.simple:
            self.filtre.setVisible(False)
            self.distribucio.setVisible(False)
        else:
            self.lDades.addRow('Filtre:', self.filtre)
            self.lDades.addRow('Distribució:', self.distribucio)

        self.gMapa = QGroupBox('Definició del mapa simbòlic')
        self.lMapa = QFormLayout()
        self.lMapa.setSpacing(14)
        self.gMapa.setLayout(self.lMapa)

        self.lMapa.addRow('Nom de capa:', self.capa)
        self.lMapa.addRow('Tipus de mapa:', self.mapa)

        self.gSimb = QGroupBox('Simbologia del mapa')
        self.lSimb = QFormLayout()
        self.lSimb.setSpacing(14)
        self.gSimb.setLayout(self.lSimb)

        self.lSimb.addRow('Color base:', self.color)
        self.lSimb.addRow('Mètode classificació:', self.metode)
        self.lSimb.addRow("Nombre d'intervals:", self.intervals)

        self.layout.addWidget(self.gDades)
        self.layout.addWidget(self.gMapa)
        if self.simple:
            self.gSimb.setVisible(False)
        else:
            self.layout.addWidget(self.gSimb)
        self.layout.addWidget(self.buttons)

        self.adjustSize()

        self.nouArxiu()

    def exec(self):
        # La mapificación solo funciona si está instalado el módulo pandas
        if PANDAS_ENABLED:
            return super().exec()
        else:
            self.msgError(PANDAS_ERROR)
            return QDialog.Rejected

    @pyqtSlot()
    def veureArxiu(self):
        if self.taulaMostra is not None:
            self.taulaMostra.show()
            self.taulaMostra.activateWindow()

    def campsDB(self, nom):
        res = []
        if nom != '':
            fich = RUTA_DADES + mv.MAP_ZONES_DB
            if os.path.isfile(fich):
                conn = sqlite3.connect('file:' + fich + '?mode=ro', uri=True)
                conn.row_factory = sqlite3.Row
                c = conn.cursor()
                c.execute('select * from ' + nom)   # nom.split('.')[0])
                row = c.fetchone()
                # res = [i[0].upper() for i in c.description]
                res = [i.upper() for i in row.keys()]
                conn.close()
        return res

    def soloPrimerItem(self, combo):
        combo.setCurrentIndex(0)
        ultimo = combo.count() - 1
        for n in range(ultimo, 0, -1):
            combo.removeItem(n)

    @pyqtSlot()
    def canviaZona(self):
        self.distribucio.setCurrentIndex(0)
        self.soloPrimerItem(self.distribucio)
        if self.zona.currentIndex() > 0:
            z = self.zona.currentText()
            campsZona = self.campsDB(mv.MAP_ZONES[z][1])
            # Carga combo con distribuciones si el campo correspondiente está en la BBDD
            for dist, campo in mv.MAP_DISTRIBUCIO.items():
                if campo != '' and campo in campsZona:
                    self.distribucio.addItem(dist)

    @pyqtSlot()
    def canviaTipus(self):
        if self.tipus.currentText() == 'Recompte':
            self.calcul.setCurrentIndex(-1)
            self.calcul.setEnabled(False)
        else:
            self.calcul.setEnabled(True)

    def borrarArxiu(self):
        if self.taulaMostra is not None:
            self.taulaMostra.hide()
            self.taulaMostra = None
        self.bTaula.setEnabled(False)
        self.tipus.setCurrentIndex(0)
        self.soloPrimerItem(self.zona)
        self.calcul.clear()
        self.filtre.clear()

    def nouArxiu(self):
        if self.fCSV is None:
            return

        # Carga combo con zonas si el campo correspondiente está en el fichero CSV
        num = 0
        for zona, val in mv.MAP_ZONES.items():
            if val[1] != '' and self.fCSV.prefixe + QvSqlite.getAlias(val[0]) in self.fCSV.camps:
                self.zona.addItem(zona)
                num = num + 1

        # Comprobar si la extensión del mapa está limitada
        if num > 0:
            extensio = self.fCSV.testExtensioArxiu(mv.MAP_EXTENSIO)
            if extensio:  # Mapa limitado
                self.comboDelete(self.zona, mv.MAP_TRUE_EXTENSIO)
            else:  # Mapa completo
                self.comboDelete(self.zona, mv.MAP_FALSE_EXTENSIO)

        # Ajustar combo de zonas
        if num == 0:
            self.msgInfo("El fitxer " + self.fCSV.fZones + " no té cap camp de zona")
            if hasattr(self, 'arxiu'):
                self.arxiu.lineEdit().clear()
                self.arxiu.setFocus()
            return
        if num == 1:
            self.zona.setCurrentIndex(1)
            self.capa.setFocus()
        else:
            self.zona.setFocus()

        self.taulaMostra = QvEditorCsv(self.fCSV.fZones, [], 'utf-8', self.fCSV.separador, self)
        self.taulaMostra.setWindowTitle("Vista prèvia d'arxiu geocodificat")
        self.taulaMostra.setReadOnly(True)

        self.bTaula.setEnabled(True)
        self.calcul.setItems(self.fCSV.camps, primer='')
        self.filtre.setItems(self.fCSV.camps)

    @pyqtSlot(str)
    def arxiuSeleccionat(self, nom):
        if nom == '':
            return
        self.borrarArxiu()
        self.fCSV = QvMapificacio(nom)
        self.nouArxiu()

    def validaSortida(self, nom):
        fSalida = self.fCSV.nomArxiuSortida(self.fCSV.netejaString(nom, True))
        return self.msgSobreescriure(fSalida)

    def valida(self):
        ok = False
        if hasattr(self, 'arxiu') and self.arxiu.filePath() == '':
            self.msgInfo("S'ha de seleccionar un arxiu de dades")
            self.arxiu.setFocus()
        elif self.zona.currentIndex() <= 0:
            self.msgInfo("S'ha de seleccionar una zona")
            self.zona.setFocus()
        elif self.capa.text().strip() == '':
            self.msgInfo("S'ha de introduir un nom de capa")
            self.capa.setFocus()
        elif self.tipus.currentIndex() <= 0:
            self.msgInfo("S'ha de seleccionar un tipus d'agregació")
            self.tipus.setFocus()
        elif self.calcul.currentText().strip() == '' and self.tipus.currentText() != 'Recompte':
            self.msgInfo("S'ha de introduir un cálcul per fer l'agregació")
            self.calcul.setFocus()
        elif self.fCSV is None:
            return self.msgInfo("No hi ha cap fitxer seleccionat")
        elif not self.validaSortida(self.capa.text().strip()):
            self.capa.setFocus()
        else:
            ok = True
        return ok

    def setRenderParams(self):
        self.renderParams = QvMapRendererParams(self.mapa.currentText())
        if self.simple:
            self.renderParams.colorBase = mv.MAP_COLORS[self.renderParams.colorBase]
        else:
            self.renderParams.colorBase = mv.MAP_COLORS[self.color.currentText()]
        if self.renderParams.colorContorn is None or self.renderParams.colorContorn == 'Base':
            self.renderParams.colorContorn = self.renderParams.colorBase
        else:
            self.renderParams.colorContorn = mv.MAP_CONTORNS[self.renderParams.colorContorn]
        if self.tipus.currentText().startswith('Recompte') and \
           self.distribucio.currentText() == "Total":
            self.renderParams.numDecimals = 0
        else:
            self.renderParams.numDecimals = 2
        if self.renderParams.tipusMapa == 'Àrees':
            self.renderParams.modeCategories = mv.MAP_METODES[self.metode.currentText()]
            self.renderParams.numCategories = self.intervals.value()
        if self.renderParams.tipusMapa == 'Cercles':
            zona = self.zona.currentText()
            if zona == 'Districte':
                self.renderParams.increase = 8
            elif zona == 'Barri':
                self.renderParams.increase = 4
            elif zona == 'Àrea estadística bàsica':
                self.renderParams.increase = 3
            elif zona == 'Secció censal':
                self.renderParams.increase = 2
            else:
                self.renderParams.increase = 1

    def procesa(self):
        if self.taulaMostra is not None:
            self.taulaMostra.hide()
        self.setRenderParams()
        ok = self.fCSV.agregacio(self.llegenda, self.capa.text().strip(),
                                 self.zona.currentText(), self.tipus.currentText(),
                                 self.renderParams,
                                 campAgregat=self.calcul.currentText().strip(),
                                 simple=self.simple,
                                 filtre=self.filtre.currentText().strip(),
                                 tipusDistribucio=self.distribucio.currentText(),
                                 form=self)
        if ok:
            return ''
        else:
            return self.fCSV.msgError
Пример #18
0
    def __init__(self, llegenda, amplada=500, mapificacio=None, simple=True):
        super().__init__(llegenda, amplada)

        self.fCSV = mapificacio
        self.simple = simple
        self.taulaMostra = None

        self.setWindowTitle('Afegir capa amb mapa simbòlic')

        self.layout = QVBoxLayout()
        self.layout.setSpacing(14)
        self.setLayout(self.layout)

        if self.fCSV is None:
            self.arxiu = QgsFileWidget()
            self.arxiu.setStorageMode(QgsFileWidget.GetFile)
            self.arxiu.setDialogTitle('Selecciona fitxer de dades…')
            self.arxiu.setDefaultRoot(RUTA_LOCAL)
            self.arxiu.setFilter('Arxius CSV (*.csv)')
            self.arxiu.setSelectedFilter('Arxius CSV (*.csv)')
            self.arxiu.lineEdit().setReadOnly(True)
            self.arxiu.fileChanged.connect(self.arxiuSeleccionat)

        self.zona = QComboBox(self)
        self.zona.setEditable(False)
        self.zona.addItem('Selecciona zona…')
        self.zona.currentIndexChanged.connect(self.canviaZona)

        self.mapa = QComboBox(self)
        self.mapa.setEditable(False)
        self.mapa.setIconSize(QSize(126, 126))
        self.mapa.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        self.mapa.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self.mapa.addItem(QIcon(os.path.join(imatgesDir, 'Àrees.PNG')), 'Àrees')
        self.mapa.addItem(QIcon(os.path.join(imatgesDir, 'Cercles.PNG')), 'Cercles')

        self.capa = QLineEdit(self)
        self.capa.setMaxLength(40)

        self.tipus = QComboBox(self)
        self.tipus.setEditable(False)
        self.tipus.addItem('Selecciona tipus…')
        self.tipus.addItems(mv.MAP_AGREGACIO.keys())
        self.tipus.currentIndexChanged.connect(self.canviaTipus)

        self.distribucio = QComboBox(self)
        self.distribucio.setEditable(False)
        self.distribucio.addItem(next(iter(mv.MAP_DISTRIBUCIO.keys())))

        self.calcul = QvComboBoxCamps(self)
        self.filtre = QvComboBoxCamps(self, multiple=True)

        self.color = QComboBox(self)
        self.color.setEditable(False)
        self.comboColors(self.color)

        self.metode = QComboBox(self)
        self.metode.setEditable(False)
        self.metode.addItems(mv.MAP_METODES.keys())

        self.intervals = QSpinBox(self)
        self.intervals.setMinimum(2)
        self.intervals.setMaximum(mv.MAP_MAX_CATEGORIES)
        self.intervals.setSingleStep(1)
        self.intervals.setValue(4)
        self.intervals.setSuffix("  (depèn del mètode)")
        # self.intervals.valueChanged.connect(self.deselectValue)

        self.bTaula = QPushButton('Veure arxiu')
        self.bTaula.setEnabled(False)
        self.bTaula.clicked.connect(self.veureArxiu)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.accepted.connect(self.accept)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        self.buttons.rejected.connect(self.cancel)
        self.buttons.addButton(self.bTaula, QDialogButtonBox.ResetRole)

        self.gDades = QGroupBox('Agregació de dades')
        self.lDades = QFormLayout()
        self.lDades.setSpacing(14)
        self.gDades.setLayout(self.lDades)

        if self.fCSV is None:
            self.lDades.addRow('Arxiu de dades:', self.arxiu)
        self.lDades.addRow('Zona:', self.zona)
        self.lDades.addRow("Tipus d'agregació:", self.tipus)
        self.lDades.addRow('Camp de càlcul:', self.calcul)
        if self.simple:
            self.filtre.setVisible(False)
            self.distribucio.setVisible(False)
        else:
            self.lDades.addRow('Filtre:', self.filtre)
            self.lDades.addRow('Distribució:', self.distribucio)

        self.gMapa = QGroupBox('Definició del mapa simbòlic')
        self.lMapa = QFormLayout()
        self.lMapa.setSpacing(14)
        self.gMapa.setLayout(self.lMapa)

        self.lMapa.addRow('Nom de capa:', self.capa)
        self.lMapa.addRow('Tipus de mapa:', self.mapa)

        self.gSimb = QGroupBox('Simbologia del mapa')
        self.lSimb = QFormLayout()
        self.lSimb.setSpacing(14)
        self.gSimb.setLayout(self.lSimb)

        self.lSimb.addRow('Color base:', self.color)
        self.lSimb.addRow('Mètode classificació:', self.metode)
        self.lSimb.addRow("Nombre d'intervals:", self.intervals)

        self.layout.addWidget(self.gDades)
        self.layout.addWidget(self.gMapa)
        if self.simple:
            self.gSimb.setVisible(False)
        else:
            self.layout.addWidget(self.gSimb)
        self.layout.addWidget(self.buttons)

        self.adjustSize()

        self.nouArxiu()
Пример #19
0
    def setupUi(self, ui_query):
        ui_query.setObjectName("ui_query")
        ui_query.resize(603, 871)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(ui_query)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.scrollArea = QtWidgets.QScrollArea(ui_query)
        self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 585, 853))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_9.setObjectName("horizontalLayout_9")
        self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label.setObjectName("label")
        self.horizontalLayout_9.addWidget(self.label)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_9.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
        self.buttonBox.setSizePolicy(sizePolicy)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Reset)
        self.buttonBox.setCenterButtons(True)
        self.buttonBox.setObjectName("buttonBox")
        self.horizontalLayout_9.addWidget(self.buttonBox)
        self.verticalLayout.addLayout(self.horizontalLayout_9)
        self.textEdit_query = QtWidgets.QTextEdit(self.scrollAreaWidgetContents)
        self.textEdit_query.setAcceptRichText(False)
        self.textEdit_query.setObjectName("textEdit_query")
        self.verticalLayout.addWidget(self.textEdit_query)
        self.advanced = QgsCollapsibleGroupBox(self.scrollAreaWidgetContents)
        self.advanced.setChecked(False)
        self.advanced.setObjectName("advanced")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.advanced)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.formLayout_4 = QtWidgets.QFormLayout()
        self.formLayout_4.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
        self.formLayout_4.setObjectName("formLayout_4")
        self.label_2 = QtWidgets.QLabel(self.advanced)
        self.label_2.setText("{{geocodeArea:}}")
        self.label_2.setObjectName("label_2")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_2)
        self.lineEdit_nominatim = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_nominatim.setObjectName("lineEdit_nominatim")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.lineEdit_nominatim)
        self.label_5 = QtWidgets.QLabel(self.advanced)
        self.label_5.setObjectName("label_5")
        self.formLayout_4.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_5)
        self.radioButton_extentMapCanvas = QtWidgets.QRadioButton(self.advanced)
        self.radioButton_extentMapCanvas.setChecked(True)
        self.radioButton_extentMapCanvas.setObjectName("radioButton_extentMapCanvas")
        self.formLayout_4.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.radioButton_extentMapCanvas)
        self.label_3 = QtWidgets.QLabel(self.advanced)
        self.label_3.setObjectName("label_3")
        self.formLayout_4.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_3)
        self.label_7 = QtWidgets.QLabel(self.advanced)
        self.label_7.setText("")
        self.label_7.setObjectName("label_7")
        self.formLayout_4.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.label_7)
        self.label_10 = QtWidgets.QLabel(self.advanced)
        self.label_10.setText("Points")
        self.label_10.setObjectName("label_10")
        self.formLayout_4.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_10)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.checkBox_points = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_points.setText("")
        self.checkBox_points.setChecked(True)
        self.checkBox_points.setObjectName("checkBox_points")
        self.horizontalLayout_4.addWidget(self.checkBox_points)
        self.lineEdit_csv_points = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_csv_points.setInputMask("")
        self.lineEdit_csv_points.setText("")
        self.lineEdit_csv_points.setPlaceholderText("col1,col2,col3")
        self.lineEdit_csv_points.setObjectName("lineEdit_csv_points")
        self.horizontalLayout_4.addWidget(self.lineEdit_csv_points)
        self.formLayout_4.setLayout(5, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_4)
        self.label_11 = QtWidgets.QLabel(self.advanced)
        self.label_11.setText("Lines")
        self.label_11.setObjectName("label_11")
        self.formLayout_4.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.label_11)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.checkBox_lines = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_lines.setText("")
        self.checkBox_lines.setChecked(True)
        self.checkBox_lines.setObjectName("checkBox_lines")
        self.horizontalLayout_6.addWidget(self.checkBox_lines)
        self.lineEdit_csv_lines = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_csv_lines.setObjectName("lineEdit_csv_lines")
        self.horizontalLayout_6.addWidget(self.lineEdit_csv_lines)
        self.formLayout_4.setLayout(6, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_6)
        self.label_14 = QtWidgets.QLabel(self.advanced)
        self.label_14.setText("Multilinestrings")
        self.label_14.setObjectName("label_14")
        self.formLayout_4.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.label_14)
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.checkBox_multilinestrings = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_multilinestrings.setText("")
        self.checkBox_multilinestrings.setChecked(True)
        self.checkBox_multilinestrings.setObjectName("checkBox_multilinestrings")
        self.horizontalLayout_7.addWidget(self.checkBox_multilinestrings)
        self.lineEdit_csv_multilinestrings = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_csv_multilinestrings.setPlaceholderText("")
        self.lineEdit_csv_multilinestrings.setObjectName("lineEdit_csv_multilinestrings")
        self.horizontalLayout_7.addWidget(self.lineEdit_csv_multilinestrings)
        self.formLayout_4.setLayout(7, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_7)
        self.label_12 = QtWidgets.QLabel(self.advanced)
        self.label_12.setText("Multipolygons")
        self.label_12.setObjectName("label_12")
        self.formLayout_4.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.label_12)
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        self.checkBox_multipolygons = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_multipolygons.setText("")
        self.checkBox_multipolygons.setChecked(True)
        self.checkBox_multipolygons.setObjectName("checkBox_multipolygons")
        self.horizontalLayout_8.addWidget(self.checkBox_multipolygons)
        self.lineEdit_csv_multipolygons = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_csv_multipolygons.setPlaceholderText("")
        self.lineEdit_csv_multipolygons.setObjectName("lineEdit_csv_multipolygons")
        self.horizontalLayout_8.addWidget(self.lineEdit_csv_multipolygons)
        self.formLayout_4.setLayout(8, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_8)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.radioButton_extentLayer = QtWidgets.QRadioButton(self.advanced)
        self.radioButton_extentLayer.setObjectName("radioButton_extentLayer")
        self.horizontalLayout_3.addWidget(self.radioButton_extentLayer)
        self.comboBox_extentLayer = QgsMapLayerComboBox(self.advanced)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.comboBox_extentLayer.sizePolicy().hasHeightForWidth())
        self.comboBox_extentLayer.setSizePolicy(sizePolicy)
        self.comboBox_extentLayer.setObjectName("comboBox_extentLayer")
        self.horizontalLayout_3.addWidget(self.comboBox_extentLayer)
        self.formLayout_4.setLayout(3, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_3)
        self.verticalLayout_2.addLayout(self.formLayout_4)
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_4 = QtWidgets.QLabel(self.advanced)
        self.label_4.setObjectName("label_4")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_4)
        self.output_directory = QgsFileWidget(self.advanced)
        self.output_directory.setObjectName("output_directory")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.output_directory)
        self.label_6 = QtWidgets.QLabel(self.advanced)
        self.label_6.setObjectName("label_6")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_6)
        self.lineEdit_filePrefix = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_filePrefix.setObjectName("lineEdit_filePrefix")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lineEdit_filePrefix)
        self.verticalLayout_2.addLayout(self.formLayout_2)
        self.verticalLayout.addWidget(self.advanced)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.pushButton_generateQuery = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_generateQuery.setObjectName("pushButton_generateQuery")
        self.horizontalLayout_2.addWidget(self.pushButton_generateQuery)
        self.pushButton_runQuery = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_runQuery.setDefault(True)
        self.pushButton_runQuery.setObjectName("pushButton_runQuery")
        self.horizontalLayout_2.addWidget(self.pushButton_runQuery)
        self.pushButton_saveQuery = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_saveQuery.setObjectName("pushButton_saveQuery")
        self.horizontalLayout_2.addWidget(self.pushButton_saveQuery)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.label_progress = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_progress.sizePolicy().hasHeightForWidth())
        self.label_progress.setSizePolicy(sizePolicy)
        self.label_progress.setText("progress text")
        self.label_progress.setObjectName("label_progress")
        self.verticalLayout.addWidget(self.label_progress)
        self.progressBar_execution = QtWidgets.QProgressBar(self.scrollAreaWidgetContents)
        self.progressBar_execution.setProperty("value", 0)
        self.progressBar_execution.setObjectName("progressBar_execution")
        self.verticalLayout.addWidget(self.progressBar_execution)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.pushButton_overpassTurbo = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_overpassTurbo.setText("Overpass Turbo")
        self.pushButton_overpassTurbo.setObjectName("pushButton_overpassTurbo")
        self.horizontalLayout_5.addWidget(self.pushButton_overpassTurbo)
        self.pushButton_documentation = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_documentation.setObjectName("pushButton_documentation")
        self.horizontalLayout_5.addWidget(self.pushButton_documentation)
        self.verticalLayout.addLayout(self.horizontalLayout_5)
        spacerItem1 = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem1)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout_3.addWidget(self.scrollArea)

        self.retranslateUi(ui_query)
        self.checkBox_points.toggled['bool'].connect(self.lineEdit_csv_points.setEnabled)
        self.checkBox_lines.toggled['bool'].connect(self.lineEdit_csv_lines.setEnabled)
        self.checkBox_multilinestrings.toggled['bool'].connect(self.lineEdit_csv_multilinestrings.setEnabled)
        self.checkBox_multipolygons.toggled['bool'].connect(self.lineEdit_csv_multipolygons.setEnabled)
        QtCore.QMetaObject.connectSlotsByName(ui_query)
Пример #20
0
    def __init__(self, parent=None):  # pylint: disable=too-many-statements
        super().__init__(parent)

        self.setWindowTitle(self.tr('Redistrict Plugin | Settings'))
        layout = QVBoxLayout()
        self.auth_label = QLabel(self.tr('Authentication configuration'))
        layout.addWidget(self.auth_label)
        self.auth_value = QgsAuthConfigSelect()
        layout.addWidget(self.auth_value)
        auth_id = get_auth_config_id()
        if auth_id:
            self.auth_value.setConfigId(auth_id)

        layout.addWidget(QLabel(self.tr('API base URL')))
        self.base_url_edit = QLineEdit()
        self.base_url_edit.setText(QgsSettings().value('redistrict/base_url', '', str, QgsSettings.Plugins))
        layout.addWidget(self.base_url_edit)

        h_layout = QHBoxLayout()
        h_layout.addWidget(QLabel(self.tr('Check for completed requests every')))
        self.check_every_spin = QSpinBox()
        self.check_every_spin.setMinimum(10)
        self.check_every_spin.setMaximum(600)
        self.check_every_spin.setSuffix(' ' + self.tr('s'))
        self.check_every_spin.setValue(QgsSettings().value('redistrict/check_every', '30', int, QgsSettings.Plugins))

        h_layout.addWidget(self.check_every_spin)
        layout.addLayout(h_layout)

        self.use_mock_checkbox = QCheckBox(self.tr('Use mock Statistics NZ API'))
        self.use_mock_checkbox.setChecked(get_use_mock_api())
        layout.addWidget(self.use_mock_checkbox)

        self.test_button = QPushButton(self.tr('Test API connection'))
        self.test_button.clicked.connect(self.test_api)
        layout.addWidget(self.test_button)

        self.use_overlays_checkbox = QCheckBox(self.tr('Show updated populations during interactive redistricting'))
        self.use_overlays_checkbox.setChecked(
            QgsSettings().value('redistrict/show_overlays', False, bool, QgsSettings.Plugins))
        layout.addWidget(self.use_overlays_checkbox)

        self.use_sound_group_box = QGroupBox(self.tr('Use audio feedback'))
        self.use_sound_group_box.setCheckable(True)
        self.use_sound_group_box.setChecked(
            QgsSettings().value('redistrict/use_audio_feedback', False, bool, QgsSettings.Plugins))

        sound_layout = QGridLayout()
        sound_layout.addWidget(QLabel(self.tr('When meshblock redistricted')), 0, 0)
        self.on_redistrict_file_widget = QgsFileWidget()
        self.on_redistrict_file_widget.setDialogTitle(self.tr('Select Audio File'))
        self.on_redistrict_file_widget.setStorageMode(QgsFileWidget.GetFile)
        self.on_redistrict_file_widget.setFilePath(
            QgsSettings().value('redistrict/on_redistrict', '', str, QgsSettings.Plugins))
        self.on_redistrict_file_widget.setFilter(self.tr('Wave files (*.wav *.WAV)'))
        sound_layout.addWidget(self.on_redistrict_file_widget, 0, 1)
        self.play_on_redistrict_sound_button = QPushButton(self.tr('Test'))
        self.play_on_redistrict_sound_button.clicked.connect(self.play_on_redistrict_sound)
        sound_layout.addWidget(self.play_on_redistrict_sound_button, 0, 2)

        self.use_sound_group_box.setLayout(sound_layout)
        layout.addWidget(self.use_sound_group_box)

        button_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        layout.addWidget(button_box)
        button_box.rejected.connect(self.reject)
        button_box.accepted.connect(self.accept)

        self.setLayout(layout)
Пример #21
0
    def setupUi(self, ui_quick_query):
        ui_quick_query.setObjectName("ui_quick_query")
        ui_quick_query.resize(644, 805)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(ui_quick_query)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.scrollArea = QtWidgets.QScrollArea(ui_quick_query)
        self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 626, 787))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.pushButton_mapFeatures = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_mapFeatures.setObjectName("pushButton_mapFeatures")
        self.horizontalLayout_4.addWidget(self.pushButton_mapFeatures)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
        self.buttonBox.setSizePolicy(sizePolicy)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Reset)
        self.buttonBox.setObjectName("buttonBox")
        self.horizontalLayout_4.addWidget(self.buttonBox)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
        self.comboBox_key = QtWidgets.QComboBox(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.comboBox_key.sizePolicy().hasHeightForWidth())
        self.comboBox_key.setSizePolicy(sizePolicy)
        self.comboBox_key.setEditable(True)
        self.comboBox_key.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
        self.comboBox_key.setObjectName("comboBox_key")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.comboBox_key)
        self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2)
        self.comboBox_value = QtWidgets.QComboBox(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.comboBox_value.sizePolicy().hasHeightForWidth())
        self.comboBox_value.setSizePolicy(sizePolicy)
        self.comboBox_value.setEditable(True)
        self.comboBox_value.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
        self.comboBox_value.setObjectName("comboBox_value")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.comboBox_value)
        self.cb_query_type = QtWidgets.QComboBox(self.scrollAreaWidgetContents)
        self.cb_query_type.setObjectName("cb_query_type")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.cb_query_type)
        self.stacked_query_type = QtWidgets.QStackedWidget(self.scrollAreaWidgetContents)
        self.stacked_query_type.setLineWidth(0)
        self.stacked_query_type.setObjectName("stacked_query_type")
        self.nominatim = QtWidgets.QWidget()
        self.nominatim.setObjectName("nominatim")
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.nominatim)
        self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_6.setSpacing(0)
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.lineEdit_nominatim = QtWidgets.QLineEdit(self.nominatim)
        self.lineEdit_nominatim.setObjectName("lineEdit_nominatim")
        self.horizontalLayout_6.addWidget(self.lineEdit_nominatim)
        self.spinBox_distance_point = QtWidgets.QSpinBox(self.nominatim)
        self.spinBox_distance_point.setPrefix("")
        self.spinBox_distance_point.setMinimum(1)
        self.spinBox_distance_point.setMaximum(999999999)
        self.spinBox_distance_point.setSingleStep(100)
        self.spinBox_distance_point.setProperty("value", 1000)
        self.spinBox_distance_point.setObjectName("spinBox_distance_point")
        self.horizontalLayout_6.addWidget(self.spinBox_distance_point)
        self.stacked_query_type.addWidget(self.nominatim)
        self.layerExtent = QtWidgets.QWidget()
        self.layerExtent.setObjectName("layerExtent")
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout(self.layerExtent)
        self.horizontalLayout_7.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_7.setSpacing(0)
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.comboBox_extentLayer = QgsMapLayerComboBox(self.layerExtent)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.comboBox_extentLayer.sizePolicy().hasHeightForWidth())
        self.comboBox_extentLayer.setSizePolicy(sizePolicy)
        self.comboBox_extentLayer.setObjectName("comboBox_extentLayer")
        self.horizontalLayout_7.addWidget(self.comboBox_extentLayer)
        self.stacked_query_type.addWidget(self.layerExtent)
        self.nothingDisplayed = QtWidgets.QWidget()
        self.nothingDisplayed.setObjectName("nothingDisplayed")
        self.stacked_query_type.addWidget(self.nothingDisplayed)
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.stacked_query_type)
        self.verticalLayout.addLayout(self.formLayout)
        self.advanced = QgsCollapsibleGroupBox(self.scrollAreaWidgetContents)
        self.advanced.setChecked(False)
        self.advanced.setObjectName("advanced")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.advanced)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.formLayout_3 = QtWidgets.QFormLayout()
        self.formLayout_3.setObjectName("formLayout_3")
        self.label_7 = QtWidgets.QLabel(self.advanced)
        self.label_7.setText("Node")
        self.label_7.setObjectName("label_7")
        self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_7)
        self.checkBox_node = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_node.setText("")
        self.checkBox_node.setChecked(True)
        self.checkBox_node.setObjectName("checkBox_node")
        self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.checkBox_node)
        self.label_8 = QtWidgets.QLabel(self.advanced)
        self.label_8.setText("Way")
        self.label_8.setObjectName("label_8")
        self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_8)
        self.checkBox_way = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_way.setText("")
        self.checkBox_way.setChecked(True)
        self.checkBox_way.setObjectName("checkBox_way")
        self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.checkBox_way)
        self.label_9 = QtWidgets.QLabel(self.advanced)
        self.label_9.setText("Relation")
        self.label_9.setObjectName("label_9")
        self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_9)
        self.checkBox_relation = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_relation.setText("")
        self.checkBox_relation.setChecked(True)
        self.checkBox_relation.setObjectName("checkBox_relation")
        self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.checkBox_relation)
        self.horizontalLayout_3.addLayout(self.formLayout_3)
        self.formLayout_4 = QtWidgets.QFormLayout()
        self.formLayout_4.setObjectName("formLayout_4")
        self.label_10 = QtWidgets.QLabel(self.advanced)
        self.label_10.setText("Points")
        self.label_10.setObjectName("label_10")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_10)
        self.checkBox_points = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_points.setText("")
        self.checkBox_points.setChecked(True)
        self.checkBox_points.setObjectName("checkBox_points")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.checkBox_points)
        self.checkBox_lines = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_lines.setText("")
        self.checkBox_lines.setChecked(True)
        self.checkBox_lines.setObjectName("checkBox_lines")
        self.formLayout_4.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.checkBox_lines)
        self.label_11 = QtWidgets.QLabel(self.advanced)
        self.label_11.setText("Lines")
        self.label_11.setObjectName("label_11")
        self.formLayout_4.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_11)
        self.label_12 = QtWidgets.QLabel(self.advanced)
        self.label_12.setText("Multipolygons")
        self.label_12.setObjectName("label_12")
        self.formLayout_4.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_12)
        self.checkBox_multipolygons = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_multipolygons.setText("")
        self.checkBox_multipolygons.setChecked(True)
        self.checkBox_multipolygons.setObjectName("checkBox_multipolygons")
        self.formLayout_4.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.checkBox_multipolygons)
        self.label_14 = QtWidgets.QLabel(self.advanced)
        self.label_14.setText("Multilinestrings")
        self.label_14.setObjectName("label_14")
        self.formLayout_4.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_14)
        self.checkBox_multilinestrings = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_multilinestrings.setText("")
        self.checkBox_multilinestrings.setChecked(True)
        self.checkBox_multilinestrings.setObjectName("checkBox_multilinestrings")
        self.formLayout_4.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.checkBox_multilinestrings)
        self.horizontalLayout_3.addLayout(self.formLayout_4)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_5 = QtWidgets.QLabel(self.advanced)
        self.label_5.setObjectName("label_5")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_5)
        self.spinBox_timeout = QtWidgets.QSpinBox(self.advanced)
        self.spinBox_timeout.setButtonSymbols(QtWidgets.QAbstractSpinBox.UpDownArrows)
        self.spinBox_timeout.setMinimum(25)
        self.spinBox_timeout.setMaximum(2000)
        self.spinBox_timeout.setSingleStep(25)
        self.spinBox_timeout.setObjectName("spinBox_timeout")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.spinBox_timeout)
        self.label_4 = QtWidgets.QLabel(self.advanced)
        self.label_4.setObjectName("label_4")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_4)
        self.output_directory = QgsFileWidget(self.advanced)
        self.output_directory.setObjectName("output_directory")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.output_directory)
        self.label_6 = QtWidgets.QLabel(self.advanced)
        self.label_6.setObjectName("label_6")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_6)
        self.lineEdit_filePrefix = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_filePrefix.setObjectName("lineEdit_filePrefix")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.lineEdit_filePrefix)
        self.verticalLayout_2.addLayout(self.formLayout_2)
        self.verticalLayout.addWidget(self.advanced)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.pushButton_showQuery = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_showQuery.setObjectName("pushButton_showQuery")
        self.horizontalLayout_2.addWidget(self.pushButton_showQuery)
        self.pushButton_runQuery = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_runQuery.setDefault(True)
        self.pushButton_runQuery.setObjectName("pushButton_runQuery")
        self.horizontalLayout_2.addWidget(self.pushButton_runQuery)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.label_progress = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_progress.sizePolicy().hasHeightForWidth())
        self.label_progress.setSizePolicy(sizePolicy)
        self.label_progress.setText("progress text")
        self.label_progress.setObjectName("label_progress")
        self.verticalLayout.addWidget(self.label_progress)
        self.progressBar_execution = QtWidgets.QProgressBar(self.scrollAreaWidgetContents)
        self.progressBar_execution.setProperty("value", 0)
        self.progressBar_execution.setObjectName("progressBar_execution")
        self.verticalLayout.addWidget(self.progressBar_execution)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem1)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout_3.addWidget(self.scrollArea)

        self.retranslateUi(ui_quick_query)
        self.stacked_query_type.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(ui_quick_query)
Пример #22
0
class TOMsExport:
    """QGIS Plugin Implementation."""
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'TOMsExport_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&TOMsExport')

        # Check if plugin was started the first time in current QGIS session
        # Must be set in initGui() to survive plugin reloads
        self.first_start = None

        self.closeTOMs = False

    def tr(self, message):
        """Get the translation for a string using Qt translation API.
        """
        return QCoreApplication.translate('TOMsExport', message)

    def add_action(self,
                   icon_path,
                   text,
                   callback,
                   enabled_flag=True,
                   add_to_menu=True,
                   add_to_toolbar=True,
                   status_tip=None,
                   whats_this=None,
                   parent=None):

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            # Adds plugin icon to Plugins toolbar
            self.iface.addToolBarIcon(action)

        if add_to_menu:
            self.iface.addPluginToMenu(self.menu, action)

        self.actions.append(action)

        return action

    def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""

        icon_path = ':/plugins/TOMsExport/icon.png'
        self.add_action(icon_path,
                        text=self.tr(u'TOMs Export'),
                        callback=self.run,
                        parent=self.iface.mainWindow())

        # will be set False in run()
        self.first_start = True

    def unload(self):
        """Removes the plugin menu item and icon from QGIS GUI."""
        for action in self.actions:
            self.iface.removePluginMenu(self.tr(u'&TOMsExport'), action)
            self.iface.removeToolBarIcon(action)

    def run(self):
        """Run method that performs all the real work"""

        # Create the dialog with elements (after translation) and keep reference
        # Only create GUI ONCE in callback, so that it will only load when the plugin is started

        self.TOMsConfigFileObject = TOMsConfigFile()
        self.TOMsConfigFileObject.TOMsConfigFileNotFound.connect(
            self.setCloseTOMsFlag)
        self.TOMsConfigFileObject.initialiseTOMsConfigFile()

        utils = TOMsExportUtils(self.iface, self.TOMsConfigFileObject)

        if self.first_start == True:
            self.first_start = False

        self.tableNames = TOMsLayers(self.iface)
        #self.tableNames = setupTableNames(self.iface)
        self.tableNames.TOMsLayersNotFound.connect(self.setCloseTOMsFlag)
        #self.TOMsExportLayerList = self.tableNames.getLayers()
        #requiredFields = self.tableNames.getRequiredFields()

        self.tableNames.TOMsLayersNotFound.connect(self.setCloseTOMsFlag)
        self.tableNames.getLayers(self.TOMsConfigFileObject)

        if self.closeTOMs:
            QMessageBox.information(self.iface.mainWindow(), "ERROR",
                                    ("Unable to start TOMs ..."))
            return

        #self.TOMsExportLayerList = utils.getTOMsExportLayerList()  # not required as list comes from dialog
        # TODO: Check that export layers are present ...

        self.setupUi()

        # show the dialog
        self.dlg.show()
        # Run the dialog event loop
        result = self.dlg.exec_()
        # See if OK was pressed
        # TODO: Make sure that there is a valid file location

        if result:

            # Open geopackage

            canvas = self.iface.mapCanvas()
            layer = canvas.currentLayer()

            fileName = self.fileNameWidget.filePath()
            # QMessageBox.information(self.iface.mainWindow(), "Message", ("Filename is ..." + str(fileName)))
            TOMsMessageLog.logMessage("Filename is ..." + str(fileName),
                                      level=Qgis.Info)

            # Get list of all the layers that are required within the Geopackage

            layerItemsList = self.layerList.getSelectedLayers()
            for currLayerItem in layerItemsList:
                TOMsMessageLog.logMessage("Processing {} ...".format(
                    currLayerItem.text()),
                                          level=Qgis.Warning)

                currLayer = QgsProject.instance().mapLayersByName(
                    currLayerItem.text())[0]

                outputLayersList = utils.processLayer(currLayer)
                if outputLayersList:
                    #status = utils.saveOutputLayers(outputlayersList, fileName)
                    for newLayerName, newLayer in outputLayersList:
                        utils.saveLayerToGpkg(newLayer, fileName)

                        newLayerA = QgsVectorLayer(
                            fileName + "|layername=" + newLayerName,
                            newLayerName, "ogr")
                        QgsProject.instance().addMapLayer(newLayerA)

            TOMsMessageLog.logMessage("******** FINISHED EXPORT ********",
                                      level=Qgis.Warning)

            #self.dlg.close()

    def setupUi(self):

        self.dlg = QDialog()
        self.dlg.setWindowTitle("TOMs Export")
        self.dlg.setWindowModality(Qt.ApplicationModal)

        self.generalLayout = QVBoxLayout()

        layerGroup = QGroupBox("Choose layers to export")

        # add map layer list
        self.layerList = checkableMapLayerList()
        vbox1 = QVBoxLayout()
        vbox1.addWidget(self.layerList)
        layerGroup.setLayout(vbox1)
        self.generalLayout.addWidget(layerGroup)

        # add file chooser
        outputGroup = QGroupBox("Choose output file")
        self.fileNameWidget = QgsFileWidget()
        self.fileNameWidget.setStorageMode(QgsFileWidget.SaveFile)
        self.fileNameWidget.setFilter(
            "Geopackage (*.gpkg);;JPEG (*.jpg *.jpeg);;TIFF (*.tif)")
        self.fileNameWidget.setSelectedFilter("Geopackage (*.gpkg)")
        vbox2 = QVBoxLayout()
        vbox2.addWidget(self.fileNameWidget)
        outputGroup.setLayout(vbox2)
        self.generalLayout.addWidget(outputGroup)

        # add buttons
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.dlg.accept)
        self.buttonBox.rejected.connect(self.dlg.reject)
        self.generalLayout.addWidget(self.buttonBox)

        self.dlg.setLayout(self.generalLayout)
        checkableMapLayerListCtrl(self.layerList)

    def setCloseTOMsFlag(self):
        self.closeTOMs = True
Пример #23
0
class Ui_ui_quick_query(object):
    def setupUi(self, ui_quick_query):
        ui_quick_query.setObjectName("ui_quick_query")
        ui_quick_query.resize(644, 805)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(ui_quick_query)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.scrollArea = QtWidgets.QScrollArea(ui_quick_query)
        self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 626, 787))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.verticalLayout = QtWidgets.QVBoxLayout(
            self.scrollAreaWidgetContents)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.pushButton_mapFeatures = QtWidgets.QPushButton(
            self.scrollAreaWidgetContents)
        self.pushButton_mapFeatures.setObjectName("pushButton_mapFeatures")
        self.horizontalLayout_4.addWidget(self.pushButton_mapFeatures)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.buttonBox.sizePolicy().hasHeightForWidth())
        self.buttonBox.setSizePolicy(sizePolicy)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Reset)
        self.buttonBox.setObjectName("buttonBox")
        self.horizontalLayout_4.addWidget(self.buttonBox)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.comboBox_key = QtWidgets.QComboBox(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.comboBox_key.sizePolicy().hasHeightForWidth())
        self.comboBox_key.setSizePolicy(sizePolicy)
        self.comboBox_key.setEditable(True)
        self.comboBox_key.setSizeAdjustPolicy(
            QtWidgets.QComboBox.AdjustToContents)
        self.comboBox_key.setObjectName("comboBox_key")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.comboBox_key)
        self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)
        self.comboBox_value = QtWidgets.QComboBox(
            self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.comboBox_value.sizePolicy().hasHeightForWidth())
        self.comboBox_value.setSizePolicy(sizePolicy)
        self.comboBox_value.setEditable(True)
        self.comboBox_value.setSizeAdjustPolicy(
            QtWidgets.QComboBox.AdjustToContents)
        self.comboBox_value.setObjectName("comboBox_value")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.comboBox_value)
        self.radioButton_place = QtWidgets.QRadioButton(
            self.scrollAreaWidgetContents)
        self.radioButton_place.setText("")
        self.radioButton_place.setChecked(True)
        self.radioButton_place.setObjectName("radioButton_place")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                  self.radioButton_place)
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        self.comboBox_in_around = QtWidgets.QComboBox(
            self.scrollAreaWidgetContents)
        self.comboBox_in_around.setObjectName("comboBox_in_around")
        self.horizontalLayout_8.addWidget(self.comboBox_in_around)
        self.lineEdit_nominatim = QtWidgets.QLineEdit(
            self.scrollAreaWidgetContents)
        self.lineEdit_nominatim.setText("")
        self.lineEdit_nominatim.setObjectName("lineEdit_nominatim")
        self.horizontalLayout_8.addWidget(self.lineEdit_nominatim)
        self.spinBox_distance_point = QtWidgets.QSpinBox(
            self.scrollAreaWidgetContents)
        self.spinBox_distance_point.setMinimum(1)
        self.spinBox_distance_point.setMaximum(999999999)
        self.spinBox_distance_point.setSingleStep(100)
        self.spinBox_distance_point.setProperty("value", 1000)
        self.spinBox_distance_point.setObjectName("spinBox_distance_point")
        self.horizontalLayout_8.addWidget(self.spinBox_distance_point)
        self.label_distance_point = QtWidgets.QLabel(
            self.scrollAreaWidgetContents)
        self.label_distance_point.setText("m")
        self.label_distance_point.setObjectName("label_distance_point")
        self.horizontalLayout_8.addWidget(self.label_distance_point)
        self.formLayout.setLayout(2, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout_8)
        self.radioButton_extentMapCanvas = QtWidgets.QRadioButton(
            self.scrollAreaWidgetContents)
        self.radioButton_extentMapCanvas.setText("")
        self.radioButton_extentMapCanvas.setObjectName(
            "radioButton_extentMapCanvas")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole,
                                  self.radioButton_extentMapCanvas)
        self.label_13 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_13.setObjectName("label_13")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole,
                                  self.label_13)
        self.radioButton_extentLayer = QtWidgets.QRadioButton(
            self.scrollAreaWidgetContents)
        self.radioButton_extentLayer.setText("")
        self.radioButton_extentLayer.setObjectName("radioButton_extentLayer")
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole,
                                  self.radioButton_extentLayer)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.label_15 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_15.setObjectName("label_15")
        self.horizontalLayout_5.addWidget(self.label_15)
        self.comboBox_extentLayer = QgsMapLayerComboBox(
            self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.comboBox_extentLayer.sizePolicy().hasHeightForWidth())
        self.comboBox_extentLayer.setSizePolicy(sizePolicy)
        self.comboBox_extentLayer.setObjectName("comboBox_extentLayer")
        self.horizontalLayout_5.addWidget(self.comboBox_extentLayer)
        self.formLayout.setLayout(5, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout_5)
        self.verticalLayout.addLayout(self.formLayout)
        self.advanced = QgsCollapsibleGroupBox(self.scrollAreaWidgetContents)
        self.advanced.setChecked(False)
        self.advanced.setObjectName("advanced")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.advanced)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.formLayout_3 = QtWidgets.QFormLayout()
        self.formLayout_3.setObjectName("formLayout_3")
        self.label_7 = QtWidgets.QLabel(self.advanced)
        self.label_7.setText("Node")
        self.label_7.setObjectName("label_7")
        self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_7)
        self.checkBox_node = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_node.setText("")
        self.checkBox_node.setChecked(True)
        self.checkBox_node.setObjectName("checkBox_node")
        self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.checkBox_node)
        self.label_8 = QtWidgets.QLabel(self.advanced)
        self.label_8.setText("Way")
        self.label_8.setObjectName("label_8")
        self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                    self.label_8)
        self.checkBox_way = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_way.setText("")
        self.checkBox_way.setChecked(True)
        self.checkBox_way.setObjectName("checkBox_way")
        self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                    self.checkBox_way)
        self.label_9 = QtWidgets.QLabel(self.advanced)
        self.label_9.setText("Relation")
        self.label_9.setObjectName("label_9")
        self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                    self.label_9)
        self.checkBox_relation = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_relation.setText("")
        self.checkBox_relation.setChecked(True)
        self.checkBox_relation.setObjectName("checkBox_relation")
        self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.FieldRole,
                                    self.checkBox_relation)
        self.horizontalLayout_3.addLayout(self.formLayout_3)
        self.formLayout_4 = QtWidgets.QFormLayout()
        self.formLayout_4.setObjectName("formLayout_4")
        self.label_10 = QtWidgets.QLabel(self.advanced)
        self.label_10.setText("Points")
        self.label_10.setObjectName("label_10")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_10)
        self.checkBox_points = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_points.setText("")
        self.checkBox_points.setChecked(True)
        self.checkBox_points.setObjectName("checkBox_points")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.checkBox_points)
        self.checkBox_lines = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_lines.setText("")
        self.checkBox_lines.setChecked(True)
        self.checkBox_lines.setObjectName("checkBox_lines")
        self.formLayout_4.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                    self.checkBox_lines)
        self.label_11 = QtWidgets.QLabel(self.advanced)
        self.label_11.setText("Lines")
        self.label_11.setObjectName("label_11")
        self.formLayout_4.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                    self.label_11)
        self.label_12 = QtWidgets.QLabel(self.advanced)
        self.label_12.setText("Multipolygons")
        self.label_12.setObjectName("label_12")
        self.formLayout_4.setWidget(3, QtWidgets.QFormLayout.LabelRole,
                                    self.label_12)
        self.checkBox_multipolygons = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_multipolygons.setText("")
        self.checkBox_multipolygons.setChecked(True)
        self.checkBox_multipolygons.setObjectName("checkBox_multipolygons")
        self.formLayout_4.setWidget(3, QtWidgets.QFormLayout.FieldRole,
                                    self.checkBox_multipolygons)
        self.label_14 = QtWidgets.QLabel(self.advanced)
        self.label_14.setText("Multilinestrings")
        self.label_14.setObjectName("label_14")
        self.formLayout_4.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                    self.label_14)
        self.checkBox_multilinestrings = QtWidgets.QCheckBox(self.advanced)
        self.checkBox_multilinestrings.setText("")
        self.checkBox_multilinestrings.setChecked(True)
        self.checkBox_multilinestrings.setObjectName(
            "checkBox_multilinestrings")
        self.formLayout_4.setWidget(2, QtWidgets.QFormLayout.FieldRole,
                                    self.checkBox_multilinestrings)
        self.horizontalLayout_3.addLayout(self.formLayout_4)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_5 = QtWidgets.QLabel(self.advanced)
        self.label_5.setObjectName("label_5")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_5)
        self.spinBox_timeout = QtWidgets.QSpinBox(self.advanced)
        self.spinBox_timeout.setButtonSymbols(
            QtWidgets.QAbstractSpinBox.UpDownArrows)
        self.spinBox_timeout.setMinimum(25)
        self.spinBox_timeout.setMaximum(2000)
        self.spinBox_timeout.setSingleStep(25)
        self.spinBox_timeout.setObjectName("spinBox_timeout")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.spinBox_timeout)
        self.label_4 = QtWidgets.QLabel(self.advanced)
        self.label_4.setObjectName("label_4")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                    self.label_4)
        self.output_directory = QgsFileWidget(self.advanced)
        self.output_directory.setObjectName("output_directory")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                    self.output_directory)
        self.label_6 = QtWidgets.QLabel(self.advanced)
        self.label_6.setObjectName("label_6")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                    self.label_6)
        self.lineEdit_filePrefix = QtWidgets.QLineEdit(self.advanced)
        self.lineEdit_filePrefix.setObjectName("lineEdit_filePrefix")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole,
                                    self.lineEdit_filePrefix)
        self.verticalLayout_2.addLayout(self.formLayout_2)
        self.verticalLayout.addWidget(self.advanced)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.pushButton_showQuery = QtWidgets.QPushButton(
            self.scrollAreaWidgetContents)
        self.pushButton_showQuery.setObjectName("pushButton_showQuery")
        self.horizontalLayout_2.addWidget(self.pushButton_showQuery)
        self.pushButton_runQuery = QtWidgets.QPushButton(
            self.scrollAreaWidgetContents)
        self.pushButton_runQuery.setDefault(True)
        self.pushButton_runQuery.setObjectName("pushButton_runQuery")
        self.horizontalLayout_2.addWidget(self.pushButton_runQuery)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.label_progress = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_progress.sizePolicy().hasHeightForWidth())
        self.label_progress.setSizePolicy(sizePolicy)
        self.label_progress.setText("progress text")
        self.label_progress.setObjectName("label_progress")
        self.verticalLayout.addWidget(self.label_progress)
        self.progressBar_execution = QtWidgets.QProgressBar(
            self.scrollAreaWidgetContents)
        self.progressBar_execution.setProperty("value", 0)
        self.progressBar_execution.setObjectName("progressBar_execution")
        self.verticalLayout.addWidget(self.progressBar_execution)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem1)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout_3.addWidget(self.scrollArea)

        self.retranslateUi(ui_quick_query)
        QtCore.QMetaObject.connectSlotsByName(ui_quick_query)

    def retranslateUi(self, ui_quick_query):
        _translate = QtCore.QCoreApplication.translate
        ui_quick_query.setWindowTitle(
            _translate("ui_quick_query", "QuickOSM - Quick query"))
        self.pushButton_mapFeatures.setText(
            _translate("ui_quick_query", "Help with key/value"))
        self.label.setText(_translate("ui_quick_query", "Key"))
        self.label_2.setText(_translate("ui_quick_query", "Value"))
        self.comboBox_in_around.setToolTip(
            _translate(
                "ui_quick_query",
                "\"In\" will search the first multipolygon relation, however \"Around\" will get the first OSM node."
            ))
        self.lineEdit_nominatim.setPlaceholderText(
            _translate("ui_quick_query", "A village, a town, ..."))
        self.label_13.setText(
            _translate("ui_quick_query", "Extent of the map canvas"))
        self.label_15.setText(_translate("ui_quick_query",
                                         "Extent of a layer"))
        self.advanced.setTitle(_translate("ui_quick_query", "Advanced"))
        self.label_5.setText(_translate("ui_quick_query", "Timeout"))
        self.label_4.setText(_translate("ui_quick_query", "Directory"))
        self.label_6.setText(_translate("ui_quick_query", "File prefix"))
        self.pushButton_showQuery.setText(
            _translate("ui_quick_query", "Show query"))
        self.pushButton_runQuery.setText(
            _translate("ui_quick_query", "Run query"))
Пример #24
0
    def setupUi(self, ui_osm_file):
        ui_osm_file.setObjectName("ui_osm_file")
        ui_osm_file.resize(589, 408)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(ui_osm_file)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.scrollArea = QtWidgets.QScrollArea(ui_osm_file)
        self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 571, 390))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
        self.osm_file = QgsFileWidget(self.scrollAreaWidgetContents)
        self.osm_file.setObjectName("osm_file")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.osm_file)
        self.label_3 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_3.setText("Points")
        self.label_3.setObjectName("label_3")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_3)
        self.checkBox_points = QtWidgets.QCheckBox(self.scrollAreaWidgetContents)
        self.checkBox_points.setText("")
        self.checkBox_points.setChecked(True)
        self.checkBox_points.setObjectName("checkBox_points")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.checkBox_points)
        self.label_4 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_4.setText("Lines")
        self.label_4.setObjectName("label_4")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_4)
        self.checkBox_lines = QtWidgets.QCheckBox(self.scrollAreaWidgetContents)
        self.checkBox_lines.setText("")
        self.checkBox_lines.setChecked(True)
        self.checkBox_lines.setObjectName("checkBox_lines")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.checkBox_lines)
        self.label_5 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_5.setText("Multilinestrings")
        self.label_5.setObjectName("label_5")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_5)
        self.checkBox_multilinestrings = QtWidgets.QCheckBox(self.scrollAreaWidgetContents)
        self.checkBox_multilinestrings.setText("")
        self.checkBox_multilinestrings.setChecked(True)
        self.checkBox_multilinestrings.setObjectName("checkBox_multilinestrings")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.checkBox_multilinestrings)
        self.label_6 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_6.setText("Multipolygons")
        self.label_6.setObjectName("label_6")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_6)
        self.checkBox_multipolygons = QtWidgets.QCheckBox(self.scrollAreaWidgetContents)
        self.checkBox_multipolygons.setText("")
        self.checkBox_multipolygons.setChecked(True)
        self.checkBox_multipolygons.setObjectName("checkBox_multipolygons")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.checkBox_multipolygons)
        self.radioButton_allTags = QtWidgets.QRadioButton(self.scrollAreaWidgetContents)
        self.radioButton_allTags.setChecked(True)
        self.radioButton_allTags.setObjectName("radioButton_allTags")
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.radioButton_allTags)
        self.groupBox_file = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
        self.groupBox_file.setTitle("")
        self.groupBox_file.setObjectName("groupBox_file")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_file)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_2 = QtWidgets.QLabel(self.groupBox_file)
        self.label_2.setObjectName("label_2")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_2)
        self.output_directory = QgsFileWidget(self.groupBox_file)
        self.output_directory.setObjectName("output_directory")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.output_directory)
        self.label_7 = QtWidgets.QLabel(self.groupBox_file)
        self.label_7.setObjectName("label_7")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_7)
        self.lineEdit_filePrefix = QtWidgets.QLineEdit(self.groupBox_file)
        self.lineEdit_filePrefix.setObjectName("lineEdit_filePrefix")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lineEdit_filePrefix)
        self.verticalLayout_2.addLayout(self.formLayout_2)
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.groupBox_file)
        self.radioButton_osmConf = QtWidgets.QRadioButton(self.scrollAreaWidgetContents)
        self.radioButton_osmConf.setChecked(False)
        self.radioButton_osmConf.setObjectName("radioButton_osmConf")
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.radioButton_osmConf)
        self.osm_conf = QgsFileWidget(self.scrollAreaWidgetContents)
        self.osm_conf.setObjectName("osm_conf")
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.osm_conf)
        self.verticalLayout.addLayout(self.formLayout)
        self.pushButton_runQuery = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
        self.pushButton_runQuery.setObjectName("pushButton_runQuery")
        self.verticalLayout.addWidget(self.pushButton_runQuery)
        self.label_progress = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_progress.setText("text progress")
        self.label_progress.setObjectName("label_progress")
        self.verticalLayout.addWidget(self.label_progress)
        self.progressBar_execution = QtWidgets.QProgressBar(self.scrollAreaWidgetContents)
        self.progressBar_execution.setProperty("value", 0)
        self.progressBar_execution.setObjectName("progressBar_execution")
        self.verticalLayout.addWidget(self.progressBar_execution)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout_3.addWidget(self.scrollArea)

        self.retranslateUi(ui_osm_file)
        self.radioButton_allTags.toggled['bool'].connect(self.groupBox_file.setEnabled)
        self.radioButton_osmConf.toggled['bool'].connect(self.osm_conf.setEnabled)
        QtCore.QMetaObject.connectSlotsByName(ui_osm_file)
Пример #25
0
    def setupUi(self, DockWidget):
        DockWidget.setObjectName(_fromUtf8("DockWidget"))
        DockWidget.resize(397, 827)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(150)
        sizePolicy.setHeightForWidth(
            DockWidget.sizePolicy().hasHeightForWidth())
        DockWidget.setSizePolicy(sizePolicy)
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.tableCoordFeu = QtGui.QTableWidget(self.dockWidgetContents)
        self.tableCoordFeu.setGeometry(QtCore.QRect(12, 310, 241, 181))
        self.tableCoordFeu.setRowCount(5)
        self.tableCoordFeu.setColumnCount(2)
        self.tableCoordFeu.setObjectName(_fromUtf8("tableCoordFeu"))
        self.btSynchronize = QtGui.QPushButton(self.dockWidgetContents)
        self.btSynchronize.setGeometry(QtCore.QRect(270, 310, 101, 51))
        self.btSynchronize.setObjectName(_fromUtf8("btSynchronize"))
        self.btViderFichier = QtGui.QPushButton(self.dockWidgetContents)
        self.btViderFichier.setGeometry(QtCore.QRect(270, 370, 101, 23))
        self.btViderFichier.setObjectName(_fromUtf8("btViderFichier"))
        self.label_6 = QtGui.QLabel(self.dockWidgetContents)
        self.label_6.setGeometry(QtCore.QRect(10, 280, 191, 16))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setItalic(True)
        self.label_6.setFont(font)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.btFermer = QtGui.QPushButton(self.dockWidgetContents)
        self.btFermer.setGeometry(QtCore.QRect(20, 770, 111, 25))
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/close.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btFermer.setIcon(icon)
        self.btFermer.setIconSize(QtCore.QSize(18, 18))
        self.btFermer.setObjectName(_fromUtf8("btFermer"))
        self.btControler = QtGui.QPushButton(self.dockWidgetContents)
        self.btControler.setGeometry(QtCore.QRect(130, 770, 111, 25))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/controle.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btControler.setIcon(icon1)
        self.btControler.setIconSize(QtCore.QSize(18, 18))
        self.btControler.setObjectName(_fromUtf8("btControler"))
        self.btCheck = QtGui.QPushButton(self.dockWidgetContents)
        self.btCheck.setEnabled(False)
        self.btCheck.setGeometry(QtCore.QRect(240, 770, 111, 25))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/valider.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btCheck.setIcon(icon2)
        self.btCheck.setIconSize(QtCore.QSize(18, 18))
        self.btCheck.setObjectName(_fromUtf8("btCheck"))
        self.label_grille = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_grille.setGeometry(QtCore.QRect(10, 9, 371, 131))
        self.label_grille.setObjectName(_fromUtf8("label_grille"))
        self.label_importer = QtGui.QLabel(self.label_grille)
        self.label_importer.setGeometry(QtCore.QRect(25, 30, 61, 16))
        self.label_importer.setObjectName(_fromUtf8("label_importer"))
        self.fileImportGrille = QgsFileWidget(self.label_grille)
        self.fileImportGrille.setGeometry(QtCore.QRect(90, 21, 271, 27))
        self.fileImportGrille.setObjectName(_fromUtf8("fileImportGrille"))
        self.label_cell_encours = QtGui.QLabel(self.label_grille)
        self.label_cell_encours.setGeometry(QtCore.QRect(128, 61, 101, 20))
        self.label_cell_encours.setObjectName(_fromUtf8("label_cell_encours"))
        self.currentId = QtGui.QLineEdit(self.label_grille)
        self.currentId.setGeometry(QtCore.QRect(230, 61, 61, 21))
        self.currentId.setObjectName(_fromUtf8("currentId"))
        self.btGo = QtGui.QPushButton(self.label_grille)
        self.btGo.setGeometry(QtCore.QRect(290, 61, 75, 23))
        self.btGo.setObjectName(_fromUtf8("btGo"))
        self.btSuiv = QtGui.QPushButton(self.label_grille)
        self.btSuiv.setGeometry(QtCore.QRect(250, 96, 111, 23))
        self.btSuiv.setObjectName(_fromUtf8("btSuiv"))
        self.btPrec = QtGui.QPushButton(self.label_grille)
        self.btPrec.setGeometry(QtCore.QRect(140, 96, 111, 23))
        self.btPrec.setObjectName(_fromUtf8("btPrec"))
        self.btZoomGrille = QtGui.QPushButton(self.label_grille)
        self.btZoomGrille.setGeometry(QtCore.QRect(40, 96, 101, 23))
        self.btZoomGrille.setObjectName(_fromUtf8("btZoomGrille"))
        self.label_fichier = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_fichier.setGeometry(QtCore.QRect(10, 150, 371, 121))
        self.label_fichier.setObjectName(_fromUtf8("label_fichier"))
        self.label_2 = QtGui.QLabel(self.label_fichier)
        self.label_2.setGeometry(QtCore.QRect(34, 32, 71, 20))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.label_7 = QtGui.QLabel(self.label_fichier)
        self.label_7.setGeometry(QtCore.QRect(18, 62, 91, 20))
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.fileControleCSV = QtGui.QLineEdit(self.label_fichier)
        self.fileControleCSV.setEnabled(False)
        self.fileControleCSV.setGeometry(QtCore.QRect(110, 63, 251, 20))
        self.fileControleCSV.setObjectName(_fromUtf8("fileControleCSV"))
        self.fileValidationCSV = QtGui.QLineEdit(self.label_fichier)
        self.fileValidationCSV.setEnabled(False)
        self.fileValidationCSV.setGeometry(QtCore.QRect(110, 90, 251, 20))
        self.fileValidationCSV.setObjectName(_fromUtf8("fileValidationCSV"))
        self.label_16 = QtGui.QLabel(self.label_fichier)
        self.label_16.setGeometry(QtCore.QRect(10, 91, 91, 20))
        self.label_16.setObjectName(_fromUtf8("label_16"))
        self.fileOuvrirInventaireCSV = QgsFileWidget(self.label_fichier)
        self.fileOuvrirInventaireCSV.setGeometry(QtCore.QRect(
            111, 25, 251, 27))
        self.fileOuvrirInventaireCSV.setObjectName(
            _fromUtf8("fileOuvrirInventaireCSV"))
        self.label_qualite = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_qualite.setGeometry(QtCore.QRect(10, 510, 361, 241))
        self.label_qualite.setObjectName(_fromUtf8("label_qualite"))
        self.txtNbCell = QtGui.QLineEdit(self.label_qualite)
        self.txtNbCell.setGeometry(QtCore.QRect(200, 30, 150, 20))
        self.txtNbCell.setObjectName(_fromUtf8("txtNbCell"))
        self.label_4 = QtGui.QLabel(self.label_qualite)
        self.label_4.setGeometry(QtCore.QRect(40, 30, 151, 20))
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.txtNbAcquis = QtGui.QLineEdit(self.label_qualite)
        self.txtNbAcquis.setGeometry(QtCore.QRect(200, 50, 150, 20))
        self.txtNbAcquis.setObjectName(_fromUtf8("txtNbAcquis"))
        self.label_5 = QtGui.QLabel(self.label_qualite)
        self.label_5.setGeometry(QtCore.QRect(20, 50, 181, 20))
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.txtNbValidation = QtGui.QLineEdit(self.label_qualite)
        self.txtNbValidation.setGeometry(QtCore.QRect(200, 70, 150, 20))
        self.txtNbValidation.setObjectName(_fromUtf8("txtNbValidation"))
        self.label_14 = QtGui.QLabel(self.label_qualite)
        self.label_14.setGeometry(QtCore.QRect(20, 71, 181, 20))
        self.label_14.setObjectName(_fromUtf8("label_14"))
        self.label_8 = QtGui.QLabel(self.label_qualite)
        self.label_8.setGeometry(QtCore.QRect(120, 100, 71, 16))
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.txtCompletion = QtGui.QLineEdit(self.label_qualite)
        self.txtCompletion.setGeometry(QtCore.QRect(200, 100, 150, 20))
        self.txtCompletion.setObjectName(_fromUtf8("txtCompletion"))
        self.txtMissing = QtGui.QLineEdit(self.label_qualite)
        self.txtMissing.setGeometry(QtCore.QRect(200, 120, 150, 20))
        self.txtMissing.setObjectName(_fromUtf8("txtMissing"))
        self.label_9 = QtGui.QLabel(self.label_qualite)
        self.label_9.setGeometry(QtCore.QRect(10, 120, 191, 20))
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.txtError = QtGui.QLineEdit(self.label_qualite)
        self.txtError.setGeometry(QtCore.QRect(200, 140, 150, 20))
        self.txtError.setObjectName(_fromUtf8("txtError"))
        self.label_10 = QtGui.QLabel(self.label_qualite)
        self.label_10.setGeometry(QtCore.QRect(59, 140, 131, 20))
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.txtRMSE = QtGui.QLineEdit(self.label_qualite)
        self.txtRMSE.setGeometry(QtCore.QRect(200, 160, 150, 20))
        self.txtRMSE.setObjectName(_fromUtf8("txtRMSE"))
        self.label_11 = QtGui.QLabel(self.label_qualite)
        self.label_11.setGeometry(QtCore.QRect(38, 160, 161, 16))
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.txtSBE = QtGui.QLineEdit(self.label_qualite)
        self.txtSBE.setGeometry(QtCore.QRect(200, 190, 150, 20))
        self.txtSBE.setObjectName(_fromUtf8("txtSBE"))
        self.label_12 = QtGui.QLabel(self.label_qualite)
        self.label_12.setGeometry(QtCore.QRect(130, 190, 61, 20))
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.txtSBN = QtGui.QLineEdit(self.label_qualite)
        self.txtSBN.setGeometry(QtCore.QRect(200, 210, 150, 20))
        self.txtSBN.setObjectName(_fromUtf8("txtSBN"))
        self.label_13 = QtGui.QLabel(self.label_qualite)
        self.label_13.setGeometry(QtCore.QRect(130, 210, 61, 20))
        self.label_13.setObjectName(_fromUtf8("label_13"))
        DockWidget.setWidget(self.dockWidgetContents)

        self.retranslateUi(DockWidget)
        QtCore.QMetaObject.connectSlotsByName(DockWidget)
Пример #26
0
    def setupUi(self, ui_osm_file):
        ui_osm_file.setObjectName("ui_osm_file")
        ui_osm_file.resize(589, 408)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(ui_osm_file)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.scrollArea = QtWidgets.QScrollArea(ui_osm_file)
        self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 571, 390))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.verticalLayout = QtWidgets.QVBoxLayout(
            self.scrollAreaWidgetContents)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.ExpandingFieldsGrow)
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.osm_file = QgsFileWidget(self.scrollAreaWidgetContents)
        self.osm_file.setObjectName("osm_file")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.osm_file)
        self.label_3 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_3.setText("Points")
        self.label_3.setObjectName("label_3")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label_3)
        self.checkBox_points = QtWidgets.QCheckBox(
            self.scrollAreaWidgetContents)
        self.checkBox_points.setText("")
        self.checkBox_points.setChecked(True)
        self.checkBox_points.setObjectName("checkBox_points")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.checkBox_points)
        self.label_4 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_4.setText("Lines")
        self.label_4.setObjectName("label_4")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                  self.label_4)
        self.checkBox_lines = QtWidgets.QCheckBox(
            self.scrollAreaWidgetContents)
        self.checkBox_lines.setText("")
        self.checkBox_lines.setChecked(True)
        self.checkBox_lines.setObjectName("checkBox_lines")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole,
                                  self.checkBox_lines)
        self.label_5 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_5.setText("Multilinestrings")
        self.label_5.setObjectName("label_5")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole,
                                  self.label_5)
        self.checkBox_multilinestrings = QtWidgets.QCheckBox(
            self.scrollAreaWidgetContents)
        self.checkBox_multilinestrings.setText("")
        self.checkBox_multilinestrings.setChecked(True)
        self.checkBox_multilinestrings.setObjectName(
            "checkBox_multilinestrings")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole,
                                  self.checkBox_multilinestrings)
        self.label_6 = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_6.setText("Multipolygons")
        self.label_6.setObjectName("label_6")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole,
                                  self.label_6)
        self.checkBox_multipolygons = QtWidgets.QCheckBox(
            self.scrollAreaWidgetContents)
        self.checkBox_multipolygons.setText("")
        self.checkBox_multipolygons.setChecked(True)
        self.checkBox_multipolygons.setObjectName("checkBox_multipolygons")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole,
                                  self.checkBox_multipolygons)
        self.radioButton_allTags = QtWidgets.QRadioButton(
            self.scrollAreaWidgetContents)
        self.radioButton_allTags.setChecked(True)
        self.radioButton_allTags.setObjectName("radioButton_allTags")
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole,
                                  self.radioButton_allTags)
        self.groupBox_file = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
        self.groupBox_file.setTitle("")
        self.groupBox_file.setObjectName("groupBox_file")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_file)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_2 = QtWidgets.QLabel(self.groupBox_file)
        self.label_2.setObjectName("label_2")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_2)
        self.output_directory = QgsFileWidget(self.groupBox_file)
        self.output_directory.setObjectName("output_directory")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.output_directory)
        self.label_7 = QtWidgets.QLabel(self.groupBox_file)
        self.label_7.setObjectName("label_7")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                    self.label_7)
        self.lineEdit_filePrefix = QtWidgets.QLineEdit(self.groupBox_file)
        self.lineEdit_filePrefix.setObjectName("lineEdit_filePrefix")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                    self.lineEdit_filePrefix)
        self.verticalLayout_2.addLayout(self.formLayout_2)
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole,
                                  self.groupBox_file)
        self.radioButton_osmConf = QtWidgets.QRadioButton(
            self.scrollAreaWidgetContents)
        self.radioButton_osmConf.setChecked(False)
        self.radioButton_osmConf.setObjectName("radioButton_osmConf")
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole,
                                  self.radioButton_osmConf)
        self.osm_conf = QgsFileWidget(self.scrollAreaWidgetContents)
        self.osm_conf.setObjectName("osm_conf")
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole,
                                  self.osm_conf)
        self.verticalLayout.addLayout(self.formLayout)
        self.pushButton_runQuery = QtWidgets.QPushButton(
            self.scrollAreaWidgetContents)
        self.pushButton_runQuery.setObjectName("pushButton_runQuery")
        self.verticalLayout.addWidget(self.pushButton_runQuery)
        self.label_progress = QtWidgets.QLabel(self.scrollAreaWidgetContents)
        self.label_progress.setText("text progress")
        self.label_progress.setObjectName("label_progress")
        self.verticalLayout.addWidget(self.label_progress)
        self.progressBar_execution = QtWidgets.QProgressBar(
            self.scrollAreaWidgetContents)
        self.progressBar_execution.setProperty("value", 0)
        self.progressBar_execution.setObjectName("progressBar_execution")
        self.verticalLayout.addWidget(self.progressBar_execution)
        spacerItem = QtWidgets.QSpacerItem(20, 40,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout_3.addWidget(self.scrollArea)

        self.retranslateUi(ui_osm_file)
        self.radioButton_allTags.toggled['bool'].connect(
            self.groupBox_file.setEnabled)
        self.radioButton_osmConf.toggled['bool'].connect(
            self.osm_conf.setEnabled)
        QtCore.QMetaObject.connectSlotsByName(ui_osm_file)
Пример #27
0
class DistrictSettingsDialog(QDialog):
    """
    A dialog used for plugin settings
    """

    def __init__(self, parent=None):  # pylint: disable=too-many-statements
        super().__init__(parent)

        self.setWindowTitle(self.tr('Redistrict Plugin | Settings'))
        layout = QVBoxLayout()
        self.auth_label = QLabel(self.tr('Authentication configuration'))
        layout.addWidget(self.auth_label)
        self.auth_value = QgsAuthConfigSelect()
        layout.addWidget(self.auth_value)
        auth_id = get_auth_config_id()
        if auth_id:
            self.auth_value.setConfigId(auth_id)

        layout.addWidget(QLabel(self.tr('API base URL')))
        self.base_url_edit = QLineEdit()
        self.base_url_edit.setText(QgsSettings().value('redistrict/base_url', '', str, QgsSettings.Plugins))
        layout.addWidget(self.base_url_edit)

        h_layout = QHBoxLayout()
        h_layout.addWidget(QLabel(self.tr('Check for completed requests every')))
        self.check_every_spin = QSpinBox()
        self.check_every_spin.setMinimum(10)
        self.check_every_spin.setMaximum(600)
        self.check_every_spin.setSuffix(' ' + self.tr('s'))
        self.check_every_spin.setValue(QgsSettings().value('redistrict/check_every', '30', int, QgsSettings.Plugins))

        h_layout.addWidget(self.check_every_spin)
        layout.addLayout(h_layout)

        self.use_mock_checkbox = QCheckBox(self.tr('Use mock Statistics NZ API'))
        self.use_mock_checkbox.setChecked(get_use_mock_api())
        layout.addWidget(self.use_mock_checkbox)

        self.test_button = QPushButton(self.tr('Test API connection'))
        self.test_button.clicked.connect(self.test_api)
        layout.addWidget(self.test_button)

        self.use_overlays_checkbox = QCheckBox(self.tr('Show updated populations during interactive redistricting'))
        self.use_overlays_checkbox.setChecked(
            QgsSettings().value('redistrict/show_overlays', False, bool, QgsSettings.Plugins))
        layout.addWidget(self.use_overlays_checkbox)

        self.use_sound_group_box = QGroupBox(self.tr('Use audio feedback'))
        self.use_sound_group_box.setCheckable(True)
        self.use_sound_group_box.setChecked(
            QgsSettings().value('redistrict/use_audio_feedback', False, bool, QgsSettings.Plugins))

        sound_layout = QGridLayout()
        sound_layout.addWidget(QLabel(self.tr('When meshblock redistricted')), 0, 0)
        self.on_redistrict_file_widget = QgsFileWidget()
        self.on_redistrict_file_widget.setDialogTitle(self.tr('Select Audio File'))
        self.on_redistrict_file_widget.setStorageMode(QgsFileWidget.GetFile)
        self.on_redistrict_file_widget.setFilePath(
            QgsSettings().value('redistrict/on_redistrict', '', str, QgsSettings.Plugins))
        self.on_redistrict_file_widget.setFilter(self.tr('Wave files (*.wav *.WAV)'))
        sound_layout.addWidget(self.on_redistrict_file_widget, 0, 1)
        self.play_on_redistrict_sound_button = QPushButton(self.tr('Test'))
        self.play_on_redistrict_sound_button.clicked.connect(self.play_on_redistrict_sound)
        sound_layout.addWidget(self.play_on_redistrict_sound_button, 0, 2)

        self.use_sound_group_box.setLayout(sound_layout)
        layout.addWidget(self.use_sound_group_box)

        button_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        layout.addWidget(button_box)
        button_box.rejected.connect(self.reject)
        button_box.accepted.connect(self.accept)

        self.setLayout(layout)

    def accept(self):  # pylint: disable=missing-docstring
        super().accept()
        QgsSettings().setValue('redistrict/auth_config_id', self.auth_value.configId(), QgsSettings.Plugins)
        QgsSettings().setValue('redistrict/use_mock_api', self.use_mock_checkbox.isChecked(), QgsSettings.Plugins)
        QgsSettings().setValue('redistrict/base_url', self.base_url_edit.text(), QgsSettings.Plugins)
        QgsSettings().setValue('redistrict/check_every', self.check_every_spin.value(), QgsSettings.Plugins)
        QgsSettings().setValue('redistrict/show_overlays', self.use_overlays_checkbox.isChecked(), QgsSettings.Plugins)
        QgsSettings().setValue('redistrict/use_audio_feedback', self.use_sound_group_box.isChecked(),
                               QgsSettings.Plugins)
        QgsSettings().setValue('redistrict/on_redistrict', self.on_redistrict_file_widget.filePath(),
                               QgsSettings.Plugins)

    def test_api(self):
        """
        Tests the API connection (real or mock!)
        """
        connector = get_api_connector(use_mock=self.use_mock_checkbox.isChecked(),
                                      authcfg=self.auth_value.configId(),
                                      base_url=self.base_url_edit.text())
        if connector.check():
            QMessageBox.information(self, self.tr('Test API Connection'),
                                    self.tr('API responded OK!'), QMessageBox.Ok)
        else:
            QMessageBox.critical(self, self.tr('Test API Connection'),
                                 self.tr('Could not connect to API!'), QMessageBox.Ok)

    def play_on_redistrict_sound(self):
        """
        Plays the 'on redistrict' sound
        """
        try:
            playsound(self.on_redistrict_file_widget.filePath(), block=False)
        except FileNotFoundError:
            pass
Пример #28
0
# coding: utf-8
from PyQt4.QtGui import QDialog
from qgis.gui import QgsFileWidget

new_dialog = QDialog()
new_dialog.resize(165, 40)
file_widget = QgsFileWidget(new_dialog)

new_dialog.show()
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(433, 261)
        self.groupBox = QtWidgets.QGroupBox(Dialog)
        self.groupBox.setGeometry(QtCore.QRect(10, 10, 411, 241))
        self.groupBox.setAutoFillBackground(True)
        self.groupBox.setTitle("")
        self.groupBox.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                   | QtCore.Qt.AlignTop)
        self.groupBox.setFlat(False)
        self.groupBox.setCheckable(False)
        self.groupBox.setObjectName("groupBox")
        self.panImage = QgsFileWidget(self.groupBox)
        self.panImage.setGeometry(QtCore.QRect(210, 50, 171, 27))
        self.panImage.setAccessibleName("")
        self.panImage.setObjectName("panImage")
        self.multImage = QgsFileWidget(self.groupBox)
        self.multImage.setEnabled(True)
        self.multImage.setGeometry(QtCore.QRect(210, 100, 171, 27))
        self.multImage.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.multImage.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.multImage.setFileWidgetButtonVisible(True)
        self.multImage.setFullUrl(True)
        self.multImage.setFilter("")
        self.multImage.setDefaultRoot("")
        self.multImage.setObjectName("multImage")
        self.panImageLabel = QtWidgets.QLabel(self.groupBox)
        self.panImageLabel.setGeometry(QtCore.QRect(30, 50, 161, 20))
        self.panImageLabel.setObjectName("panImageLabel")
        self.multImageLabel = QtWidgets.QLabel(self.groupBox)
        self.multImageLabel.setEnabled(True)
        self.multImageLabel.setGeometry(QtCore.QRect(30, 100, 161, 20))
        self.multImageLabel.setAcceptDrops(False)
        self.multImageLabel.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.multImageLabel.setFrameShadow(QtWidgets.QFrame.Plain)
        self.multImageLabel.setLineWidth(1)
        self.multImageLabel.setWordWrap(False)
        self.multImageLabel.setObjectName("multImageLabel")
        self.btnPansharpen = QtWidgets.QPushButton(self.groupBox)
        self.btnPansharpen.setGeometry(QtCore.QRect(230, 160, 91, 31))
        self.btnPansharpen.setTabletTracking(False)
        self.btnPansharpen.setObjectName("btnPansharpen")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Qgis Pansharpen Plugin"))
        self.panImage.setDialogTitle(_translate("Dialog", "arquivo"))
        self.multImage.setDialogTitle(_translate("Dialog", "arquivo"))
        self.panImageLabel.setText(
            _translate("Dialog", "Panchromatic Image (.tiff)"))
        self.multImageLabel.setText(
            _translate("Dialog", "Multispectral Image (.tiff)"))
        self.btnPansharpen.setText(_translate("Dialog", "Pansharpen"))

    def panImageFile(self):
        return self.panImage.filePath()

    def multImageFile(self):
        return self.multImage.filePath()

    def GdalClass(self):
        return gdalClass.GdalClass()

    def onClick(self):
        print('botão funcionou')
        print(self.panImageFile())
        print(self.multImageFile())
        self.GdalClass().testando()
        nameOutput = os.path.basename(
            self.panImageFile()) + '-' + os.path.basename(
                self.multImageFile()) + '.tiff'
        output = os.path.join(os.path.dirname(self.panImageFile()), nameOutput)
        print(output)
        self.GdalClass().pansharpening(self.panImageFile(),
                                       self.multImageFile(), output)