def onDbSearchPressed(self, row: int):
        """Open database browser to allow user pick a QGIS project file. \
        Trigered when edit button is pressed for a project with type_storage == database.

        :param row: row indice
        :type row: int
        """
        item = self.tableWidget.item(row, 1)

        pgr = QgsProviderGuiRegistry(QgsApplication.pluginPath())
        pl = pgr.providerList()
        if 'postgres' in pgr.providerList():
            psgp = pgr.projectStorageGuiProviders('postgres')
            if len(psgp) > 0:
                uri = psgp[0].showLoadGui()
                try:
                    if uri:
                        file_widget = self.tableWidget.cellWidget(
                            row, self.cols.uri)
                        file_widget.setText(uri)

                        name_widget = self.tableWidget.cellWidget(
                            row, self.cols.name)
                        name = name_widget.text()
                        if not name:
                            try:
                                name = uri.split("project=")[-1]
                                name = name.split(".")[0]
                            except Exception:
                                name = ""

                            name_widget.setText(name)

                except Exception:
                    pass
    def on_exception_but_clicked(self):
        # Local vars for testing value display in debugger
        t01 = QgsApplication.pluginPath()
        t02 = QgsApplication.svgPaths()
        # t03 = QChar('x')
        t04 = QPoint(4, 5)
        t05 = QPointF(4.1, 5.1)
        t06 = QDate()
        t07 = QTime()
        t08 = QDir()
        t09 = QFile()
        t10 = QUrl()

        x01 = 42
        x02 = "fortytwo"

        raise Exception("Exception raised. Check local variables in your debugger.")
Ejemplo n.º 3
0
    def on_exception_but_clicked(self):
        #Local vars for testing value display in debugger
        t01 = QgsApplication.pluginPath()
        t02 = QgsApplication.svgPaths()
        #t03 = QChar('x')
        t04 = QPoint(4, 5)
        t05 = QPointF(4.1, 5.1)
        t06 = QDate()
        t07 = QTime()
        t08 = QDir()
        t09 = QFile()
        t10 = QUrl()

        x01 = 42
        x02 = 'fortytwo'

        raise Exception(
            "Exception raised. Check local variables in your debugger.")