<commit_before>'''
Created on 25 sept. 2015

Updated on 11 may 2015

@author: arxit
'''

import os
import json

from qgis.core import *
import qgis.utils
from PyQt4.QtGui import QAction
from PyQt4.QtCore import QCoreApplication
import PagLuxembourg.main

TOPOL_SECTION = "Topol"

class TopologyChecker(object):
    '''
    Main class for the topology checker widget
    '''

    def __init__(self, action):
        '''
        Constructor
        '''
        self.topology_action=action
    
    def run(self):
        '''
        Runs the widget
        '''
        
        project = PagLuxembourg.main.current_project
        
        if not project.isPagProject():
            return
        
        self.topology_action.trigger()
        
        # Zoom to selected onclick button
        wb=PagLuxembourg.main.current_project.getLayer(PagLuxembourg.main.xsd_schema.getTypeFromTableName('PAG.MODIFICATION_PAG'))
        if wb.isValid():
            test=wb.selectedFeatureCount()
            
            canvas = qgis.utils.iface.mapCanvas()
            canvas.zoomToSelected(wb)
            if test==1:
                qgis.utils.iface.messageBar().pushMessage("Sucess", "There is " + str(test) + " selected entity in MODIFICATION PAG layer. You can now check topology")
            else:
                qgis.utils.iface.messageBar().pushMessage("Sucess", "There are " + str(test) + " selected entities in MODIFICATION PAG layer. You can now check topology")
        else :
            qgis.utils.iface.messageBar().pushMessage("Error", "MODIFICATION PAG layer is not correct")<commit_msg>Affichage de messages<commit_after>'''
Created on 25 sept. 2015

Updated on 11 may 2015

@author: arxit
'''

import os
import json

from qgis.core import *
import qgis.utils
from PyQt4.QtGui import QAction
from PyQt4.QtCore import QCoreApplication
import PagLuxembourg.main

TOPOL_SECTION = "Topol"

class TopologyChecker(object):
    '''
    Main class for the topology checker widget
    '''

    def __init__(self, action):
        '''
        Constructor
        '''
        self.topology_action=action
    
    def run(self):
        '''
        Runs the widget
        '''
        
        project = PagLuxembourg.main.current_project
        
        if not project.isPagProject():
            return
        
        self.topology_action.trigger()
        
        # Zoom to selected onclick button
        wb=PagLuxembourg.main.current_project.getLayer(PagLuxembourg.main.xsd_schema.getTypeFromTableName('PAG.MODIFICATION_PAG'))
        if wb.isValid():
            entity_count = wb.selectedFeatureCount()
            canvas = qgis.utils.iface.mapCanvas()
            canvas.zoomToSelected(wb)
            if entity_count==1:
                qgis.utils.iface.messageBar().pushMessage("Sucess", "There is " + str(entity_count) + " selected entity in MODIFICATION PAG layer. You can now check topology")
            else:
                qgis.utils.iface.messageBar().pushMessage("Sucess", "There are " + str(entity_count) + " selected entities in MODIFICATION PAG layer. You can now check topology")
        else :
            qgis.utils.iface.messageBar().pushMessage("Error", "MODIFICATION PAG layer is not correct")
{'fraction_non_alphanumeric': 0.09426356589147286, 'fraction_numerical': 0.009302325581395349, 'mean_word_length': 2.3815513626834384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4599091', 'n_tokens_mistral': 974, 'n_tokens_neox': 947, 'n_words': 228}