当前位置: 首页>>代码示例>>Python>>正文


Python PostgisTableSelector.PostgisTableSelector类代码示例

本文整理汇总了Python中processing.gui.PostgisTableSelector.PostgisTableSelector的典型用法代码示例。如果您正苦于以下问题:Python PostgisTableSelector类的具体用法?Python PostgisTableSelector怎么用?Python PostgisTableSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PostgisTableSelector类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: saveToPostGIS

    def saveToPostGIS(self):
        dlg = PostgisTableSelector(self, self.parameter.name().lower())
        dlg.exec_()
        if dlg.connection:
            self.use_temporary = False
            settings = QgsSettings()
            mySettings = '/PostgreSQL/connections/' + dlg.connection
            dbname = settings.value(mySettings + '/database')
            user = settings.value(mySettings + '/username')
            host = settings.value(mySettings + '/host')
            port = settings.value(mySettings + '/port')
            password = settings.value(mySettings + '/password')
            uri = QgsDataSourceUri()
            uri.setConnection(host, str(port), dbname, user, password)
            uri.setDataSource(dlg.schema, dlg.table,
                              "the_geom" if isinstance(self.parameter, QgsProcessingParameterFeatureSink) and self.parameter.hasGeometry() else None)

            connInfo = uri.connectionInfo()
            (success, user, passwd) = QgsCredentials.instance().get(connInfo, None, None)
            if success:
                QgsCredentials.instance().put(connInfo, user, passwd)
            self.leText.setText("postgis:" + uri.uri())

            self.skipOutputChanged.emit(False)
            self.destinationChanged.emit()
开发者ID:lbartoletti,项目名称:QGIS,代码行数:25,代码来源:DestinationSelectionPanel.py

示例2: saveToPostGIS

 def saveToPostGIS(self):
     dlg = PostgisTableSelector(self, self.output.name.lower())
     dlg.exec_()
     if dlg.connection:
         settings = QSettings()
         mySettings = '/PostgreSQL/connections/' + dlg.connection
         dbname = settings.value(mySettings + '/database')
         user = settings.value(mySettings + '/username')
         host = settings.value(mySettings + '/host')
         port = settings.value(mySettings + '/port')
         password = settings.value(mySettings + '/password')
         uri = QgsDataSourceURI()
         uri.setConnection(host, str(port), dbname, user, password)
         uri.setDataSource(dlg.schema, dlg.table, "the_geom")
         connInfo = uri.connectionInfo()
         (success, user, passwd) = QgsCredentials.instance().get(connInfo, None, None)
         if success:
             QgsCredentials.instance().put(connInfo, user, passwd)
         self.leText.setText("postgis:" + uri.uri())
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:19,代码来源:OutputSelectionPanel.py


注:本文中的processing.gui.PostgisTableSelector.PostgisTableSelector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。