| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- # -*- coding: utf-8 -*-
- """
- /***************************************************************************
- MnCheck
- A QGIS plugin
- Contrôle des données FTTH format MN
- Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
- -------------------
- begin : 2018-12-07
- git sha : $Format:%H$
- copyright : (C) 2018 by Manche Numérique 2019
- email : olivier.massot@manchenumerique.fr
- ***************************************************************************/
- /***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
- """
- import logging
- from PyQt5.QtGui import QIcon
- from PyQt5.QtWidgets import QAction
- from core import logconf
- from core.constants import MAIN
- from ui.dlg_main import DlgMain
- __VERSION__ = "0.1.0"
- logger = logging.getLogger("mncheck")
- logconf.start("mncheck", logging.DEBUG)
- class MnCheck:
- def __init__(self, iface):
- self.iface = iface
- self.plugin_dir = MAIN
- self.dlg = DlgMain()
- self.actions = []
- self.menu = '&MnCheck'
- self.toolbar = self.iface.addToolBar('MnCheck')
- self.toolbar.setObjectName('MnCheck')
- 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:
- self.toolbar.addAction(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 = MAIN / 'icon.png'
- self.add_action(icon_path, text='MnCheck', callback=self.run, parent=self.iface.mainWindow())
- def unload(self):
- """Removes the plugin menu item and icon from QGIS GUI."""
- for action in self.actions:
- self.iface.removePluginMenu('&MnCheck', action)
- self.iface.removeToolBarIcon(action)
- del self.toolbar
- def run(self):
- """Run method that performs all the real work"""
- self.dlg.show()
- result = self.dlg.exec_()
- if result:
- pass
|