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


Python QgsLogger.debug方法代码示例

本文整理汇总了Python中qgis.core.QgsLogger.debug方法的典型用法代码示例。如果您正苦于以下问题:Python QgsLogger.debug方法的具体用法?Python QgsLogger.debug怎么用?Python QgsLogger.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.core.QgsLogger的用法示例。


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

示例1: testLogger

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def testLogger(self):
     (myFileHandle, myFilename) = tempfile.mkstemp()
     try:
         myFile = os.fdopen(myFileHandle, "w")
         myFile.write("QGIS Logger Unit Test\n")
         myFile.close()
         os.environ['QGIS_DEBUG'] = '2'
         os.environ['QGIS_LOG_FILE'] = myFilename
         myLogger = QgsLogger()
         myLogger.debug('This is a debug')
         myLogger.warning('This is a warning')
         myLogger.critical('This is critical')
         #myLogger.fatal('Aaaargh...fatal');  #kills QGIS not testable
         myFile = open(myFilename, 'rt')
         myText = myFile.readlines()
         myFile.close()
         myExpectedText = ['QGIS Logger Unit Test\n',
                           'This is a debug\n',
                           'This is a warning\n',
                           'This is critical\n']
         myMessage = ('Expected:\n---\n%s\n---\nGot:\n---\n%s\n---\n' %
                            (myExpectedText, myText))
         self.assertEquals(myText, myExpectedText, myMessage)
     finally:
         pass
         os.remove(myFilename)
开发者ID:AaronGaim,项目名称:QGIS,代码行数:28,代码来源:test_qgslogger.py

示例2: _setSelectedRecord

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
    def _setSelectedRecord(self, layerId, featureId):
        ''' Set current selected Record and layer
        '''
        QgsLogger.debug("RecordsDisplayWidget._setSelectedRecord: Selected layerId = {} and record id {}".format(layerId, featureId), 3)

        self._selectedLayerId = layerId
        self._selectedFeatureId = int(featureId)
开发者ID:psigcat,项目名称:infoplus,代码行数:9,代码来源:records_display_widget.py

示例3: loadAttachments

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def loadAttachments(self, safetyId=None):
     '''
     Method to a load attachments from missions_attachment table based on idexes
     @param safetyId: select only records related to the safetyId
     @return attachments: list of dict of the retrieved records
     '''
     self.checkConnection()
 
     # create query
     sqlquery = "SELECT * FROM missions_attachment "
     if safetyId != None:
         sqlquery += "WHERE safety_id = '%s' " % safetyId
     sqlquery += "ORDER BY id;"
     
     QgsLogger.debug(self.tr("Recupera gli attachments con la query: %s" % sqlquery), 1 )
     try:
         
         self.cursor.execute(sqlquery)
         columnNames = [descr[0] for descr in self.cursor.description]
         
         attachments = []
         for values in self.cursor:
             attachments.append( dict(zip(columnNames, values)) )
         
         return attachments
         
     except Exception as ex:
         raise(ex)
开发者ID:faunalia,项目名称:rt_geosisma_offline,代码行数:30,代码来源:ArchiveManager.py

示例4: _highlightRecord

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def _highlightRecord(self, layerId, featureId):
     ''' Set current hilighted Record and layer
     '''
     QgsLogger.debug("RecordsDisplayWidget._highlightRecord: on mouse over layerId = {} and record id {}".format(layerId, featureId), 3)
     
     if layerId and featureId:
         self.highlightRecord.emit(layerId, featureId)
开发者ID:psigcat,项目名称:infoplus,代码行数:9,代码来源:records_display_widget.py

示例5: loadRequests

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def loadRequests(self, indexes=None):
     '''
     Method to a load requests from missions_request table based on idexes
     @param indexes: list of index to retrieve. If empty then retrieve all
     @return requests: list of dict of the retrieved records
     '''
     self.checkConnection()
 
     # create query
     sqlquery = "SELECT * FROM missions_request "
     if (indexes != None) and (len(indexes) > 0):
         sqlquery += "WHERE "
         for index in indexes:
             sqlquery += "id='%s' OR " % adapt(index)
         sqlquery = sqlquery[0:-4] + " "
     sqlquery += "ORDER BY id;"
     
     QgsLogger.debug(self.tr("Recupera le request con la query: %s" % sqlquery), 1 )
     try:
         
         self.cursor.execute(sqlquery)
         columnNames = [descr[0] for descr in self.cursor.description]
         
         requests = []
         for values in self.cursor:
             requests.append( dict(zip(columnNames, values)) )
         
         return requests
         
     except Exception as ex:
         raise(ex)
开发者ID:faunalia,项目名称:rt_geosisma_offline,代码行数:33,代码来源:ArchiveManager.py

示例6: updateRequest

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
    def updateRequest(self, team_id, requestDict):
        '''
        Method to a update a request in missions_request table
        @param team_id: team_id code e.g index in DB table of the team... as returned by rest api
        @param requestDict: request dictiionary - keys have to be the same key of Db
        '''
        self.checkConnection()
        
        # preare dictionary to be used for DB
        requestOdered = self.prepareRequestDict(team_id, requestDict)

        # create query
        sqlquery = "UPDATE missions_request SET "
        for k,v in requestOdered.items():
            if k == "id":
                continue
            sqlquery += '%s=%s, ' % (k,adapt(v))
        sqlquery = sqlquery[0:-2] + " "
        sqlquery += "WHERE id=%s" % adapt(requestOdered["id"])
        
        QgsLogger.debug(self.tr("Aggiorna request con la query: %s" % sqlquery), 1 )
        try:
            
            self.cursor.execute(sqlquery)
            
        except Exception as ex:
            raise(ex)
开发者ID:faunalia,项目名称:rt_geosisma_offline,代码行数:29,代码来源:ArchiveManager.py

示例7: loadUnlikedSafeties

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def loadUnlikedSafeties(self):
     '''
     Method to a load safeties without linked Particella
     @return safeties: list of dict of the retrieved records
     '''
     self.checkConnection()
 
     # create query
     sqlquery = "SELECT *,ST_AsText(the_geom) FROM missions_safety WHERE gid_catasto == '' OR gid_catasto == 'None' OR gid_catasto IS NULL "
     sqlquery += "ORDER BY id;"
     
     QgsLogger.debug(self.tr("Recupera le safety non associate a particelle"), 1 )
     try:
         
         self.cursor.execute(sqlquery)
         columnNames = [descr[0] for descr in self.cursor.description]
         # get index of the_geom and ST_AsText(the_geom)
         geomIndex = columnNames.index("the_geom")
         textGeomIndex = columnNames.index("ST_AsText(the_geom)")
         
         # modify column to erase binary the_geom and substitude with renamed ST_AsText(st_geom)
         columnNames[textGeomIndex] = "the_geom" 
         columnNames.pop(geomIndex)
         
         safeties = []
         for values in self.cursor:
             listValues = [v for v in values]
             listValues.pop(geomIndex)
             safeties.append( dict(zip(columnNames, listValues)) )
         
         return safeties
         
     except Exception as ex:
         raise(ex)
开发者ID:faunalia,项目名称:rt_geosisma_offline,代码行数:36,代码来源:ArchiveManager.py

示例8: uploadAttachment

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
    def uploadAttachment(self, safetyRemoteId, attachment):
        
        tempAttachment = attachment.copy()
        # modify attachment values to be as requested by server records
        tempAttachment["safety"] = self.safetyUrl + str(safetyRemoteId) + "/"
        tempAttachment["attached_file"] = os.path.basename(tempAttachment["attached_file"])
        tempAttachment.pop("id")
        tempAttachment.pop("attached_by_id")
        tempAttachment.pop("safety_id")
        
        QgsLogger.debug("uploadAttachment upload of %s" % json.dumps(tempAttachment),2 )

        boundary = "Boundary_.oOo._83uncb3yc7y83yb4ybi93u878278bx7b8789"
        datas = QByteArray()
        # add parameters
        datas += "--" + boundary + "\r\n"
        for name, value in tempAttachment.iteritems():
            if name == "attached_file":
                continue
            datas += 'Content-Disposition: form-data; name="%s"\r\n' % name;
            datas += 'Content-Type: text/plain; charset=utf-8\r\n';
            datas += "\r\n"
            datas += str(value).encode('utf-8')
            datas += "\r\n"
            datas += "--" + boundary + "\r\n"
        
        # add file
        fd = QFile(tempAttachment["attached_file"])
        fd.open(QIODevice.ReadOnly)
        datas += 'Content-Disposition: form-data; name="attached_file"; filename="%s"\r\n' % tempAttachment["attached_file"];
        datas += 'Content-Type: application/octet-stream\r\n';
        datas += "\r\n"
        datas += fd.readAll()
        datas += "\r\n"
        datas += "--" + boundary + "\r\n"
        fd.close()
        
        # build request
        request = QNetworkRequest()
        url = QUrl(self.baseApiUrl + self.attachmentUrl)
        request.setUrl(url)
        request.setRawHeader("Host", url.host())
        request.setRawHeader("Content-type", "multipart/form-data; boundary=%s" % boundary)
        request.setRawHeader("Content-Length", str(datas.size()))
        
        # register response manager
        try:
            self.manager.finished.disconnect()
        except:
            pass
        self.manager.finished.connect(self.replyUploadAttachmentFinished)

        # start upload
#         print "dump request-----------------------------------------------"
#         for headerKey in request.rawHeaderList():
#             print headerKey, request.rawHeader(headerKey)
#         print datas
        self.singleAttachmentUploadFinished = False
        self.manager.post(request, datas)
        QgsLogger.debug("uploadAttachment to url %s with datas %s" % (url.toString(), str(datas)) ,2 )
开发者ID:faunalia,项目名称:rt_geosisma_offline,代码行数:62,代码来源:UploadManager.py

示例9: fab_10kByPoint

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
    def fab_10kByPoint(self, point):
        '''
        Method to a load a record from fab_10k basing on geometry point
        @param point: where to find features
        @return fab_10k: list of dict of the retrieved records
        '''
        self.checkConnection()

        sqlquery = '''
            SELECT
                *
            FROM
                fab_10k 
            WHERE 
                ST_Contains(the_geom, ST_GeometryFromText('POINT(%s %s)', %s));
            ''' % ( point.x(), point.y(), gw.instance().GEODBDEFAULT_SRID )

        QgsLogger.debug(self.tr("Recupera fab_10k con la query: %s" % sqlquery), 1 )
        try:
            
            self.cursor.execute(sqlquery)
            columnNames = [descr[0] for descr in self.cursor.description]
            safeties = []
            for values in self.cursor:
                listValues = [v for v in values]
                safeties.append( dict(zip(columnNames, listValues)) )
            
            return safeties
            
        except Exception as ex:
            raise(ex)
开发者ID:faunalia,项目名称:rt_geosisma_offline,代码行数:33,代码来源:GeoArchiveManager.py

示例10: showRoadClassDistribution

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
    def showRoadClassDistribution(self, currentRoadTypeItem, previousRoadTypeItem):
        ''' Set sunbust UI for each tab category
        '''
        # manage event in case of list clear
        if not currentRoadTypeItem:
            return
        
        # get classes from itemData (UserRole)
        vehicleClasses = currentRoadTypeItem.data(QtCore.Qt.UserRole)
        
        # then load config for each vehicle tab
        # for each tab get it's specific configuration to load in the webview tab
        for tabIndex in range(self.gui.fleetComposition_tabs.count()):
            # get tab name
            tabWidget = self.gui.fleetComposition_tabs.widget(tabIndex)
            vehicleClass = self.gui.fleetComposition_tabs.tabText(tabIndex)
            
            # get confguration for the current vechicle class
            vehicleClassConf = self.getChildrensByName(vehicleClasses, vehicleClass)
            if vehicleClassConf:
                # convert in json string
                jsonString = json.dumps(vehicleClassConf)
                
                # init webview basing on json configuration
                webView = tabWidget.findChildren(QtWebKit.QWebView)[0] # assume only a webview is present in the tab
                print webView.objectName()

                JsCommand = "showJson(%s)" % jsonString
                QgsLogger.debug(self.plugin.tr("Load config with with JS command: %s" % JsCommand), 3)
                
                webView.page().mainFrame().evaluateJavaScript(JsCommand)
开发者ID:enricofer,项目名称:QTraffic,代码行数:33,代码来源:fleet_composition_tab_manager.py

示例11: _displayRecords

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
    def _displayRecords(self):
        ''' after a while show records... this give time that the bridge is available in JS
        '''
        if self._layer.selectedFeatureCount():
            # then prepare selected records in structure usefut for accordion visualization
            featuresDict = self._prepareFeatures_asAccordion()
            
            # prepare js command to execute in the page
            jsonString = json.dumps(featuresDict)
            
            JsCommand = "showRecords('%s', %s)" % (self._layer.id(), jsonString) # <<< jsonString is automatically converted in javascript obj during evaluate
            QgsLogger.debug(self.tr("display records with with JS command: %s" % JsCommand), 3)
            
            # show records
            self.webView.page().mainFrame().evaluateJavaScript(JsCommand)
        
        else:
            QgsLogger.debug(self.tr("No features selected to display for layer: %s" % self._layer.id()), 1)

        # then we can say that the load is completed
        self._ready = True
        
        # Check if we want to remove selection of this layer
        if self.removeSelection:
            self._layer.removeSelection()      
        
        # notify it is ready
        self.ready.emit(self._ready)
开发者ID:psigcat,项目名称:infoplus,代码行数:30,代码来源:records_display_widget.py

示例12: setGuiProjectLoaded

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def setGuiProjectLoaded(self):
     ''' Set GUI if a project has loaded
     '''
     message = "QTraffic: setGuiProjectLoaded by sender {}".format(str(type(self.sender())))
     QgsLogger.debug(message, debuglevel=3)
     
     self.gui.saveAsProject_PButton.setEnabled(True)
开发者ID:QTrafficmodel,项目名称:QTraffic,代码行数:9,代码来源:project_tab_manager.py

示例13: updateTeam

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
    def updateTeam(self, teamDict):
        '''
        Method to a update a team in organization_team table
        @param teamDict: team dictiionary - keys have to be the same key of Db
        '''
        self.checkConnection()
        
        # preare dictionary to be used for DB
        teamOdered = self.prepareTeamDict(teamDict)

        # create query
        sqlquery = "UPDATE organization_team SET "
        for k,v in teamOdered.items():
            if k == "id":
                continue
            sqlquery += '%s=%s, ' % (k,adapt(v))
        sqlquery = sqlquery[0:-2] + " "
        sqlquery += "WHERE id=%s" % adapt(teamOdered["id"])
        
        QgsLogger.debug(self.tr("Aggiorna team con la query: %s" % sqlquery), 1 )
        try:
            
            self.cursor.execute(sqlquery)
            
        except Exception as ex:
            raise(ex)
开发者ID:faunalia,项目名称:rt_geosisma_offline,代码行数:28,代码来源:ArchiveManager.py

示例14: setHilightRecord

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def setHilightRecord(self, layerId=None, featureId=None):
     '''
     slot emitted by JS to communicate the current Layer/featureId have to be highlighted
     '''
     QgsLogger.debug("RecordsDisplayWidgetBridge.setHilightRecord: on mouse over layerId = {} and record id {}".format(layerId, featureId), 3)
     
     if layerId and featureId:
         self.highlightRecord.emit(layerId, featureId)
开发者ID:psigcat,项目名称:infoplus,代码行数:10,代码来源:records_display_widget_bridge.py

示例15: setSelctedRecord

# 需要导入模块: from qgis.core import QgsLogger [as 别名]
# 或者: from qgis.core.QgsLogger import debug [as 别名]
 def setSelctedRecord(self, layerId=None, featureId=None):
     '''
     slot emitted by JS to communicate the current Layer/featureId selected in the interface
     '''
     QgsLogger.debug("RecordsDisplayWidgetBridge.setSelctedRecord: Selected layerId = {} and record id {}".format(layerId, featureId), 3)
     
     if layerId and featureId:
         self.selectedRecord.emit(layerId, featureId)
开发者ID:psigcat,项目名称:infoplus,代码行数:10,代码来源:records_display_widget_bridge.py


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