Template
forked from CEN-RA/Plugin_QGIS
flake8 copie
This commit is contained in:
+14
-16
@@ -4,27 +4,25 @@ __email__ = "info@3liz.org"
|
||||
|
||||
|
||||
from qgis.core import QgsApplication
|
||||
from qgis.PyQt.QtCore import QCoreApplication, Qt, QTranslator, QUrl
|
||||
from qgis.PyQt.QtCore import QSettings, QUrl
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon
|
||||
from qgis.PyQt.QtWidgets import QAction, QMessageBox
|
||||
from qgis.PyQt.QtWidgets import QAction
|
||||
from qgis.utils import iface
|
||||
import qgis
|
||||
|
||||
|
||||
#include <QSettings>
|
||||
import socket
|
||||
# include <QSettings>
|
||||
import os
|
||||
from .about_form import AboutDialog
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
# plugin_path,
|
||||
pyperclip,
|
||||
resources_path,
|
||||
maj_verif,
|
||||
)
|
||||
pyperclip()
|
||||
from .copie_editor import Copie_Editor
|
||||
from .about_form import AboutDialog
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
class PgCopie:
|
||||
def __init__(self):
|
||||
@@ -36,18 +34,18 @@ class PgCopie:
|
||||
self.dock_action = None
|
||||
self.help_action = None
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\')+1
|
||||
end_find = plugin_dir.rfind('\\') + 1
|
||||
global NAME
|
||||
NAME = plugin_dir[end_find:]
|
||||
maj_verif(NAME)
|
||||
|
||||
# Display About window on first use
|
||||
version = qgis.utils.pluginMetadata('CenRa_COPIE','version')
|
||||
version = qgis.utils.pluginMetadata('CenRa_COPIE', 'version')
|
||||
s = QSettings()
|
||||
versionUse = s.value("copie/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
if str(versionUse) != str(version):
|
||||
s.setValue("copie/version", str(version))
|
||||
print(versionUse,version)
|
||||
print(versionUse, version)
|
||||
self.open_about_dialog()
|
||||
|
||||
def initGui(self):
|
||||
@@ -65,12 +63,12 @@ class PgCopie:
|
||||
if not self.action_editor:
|
||||
self.action_editor = Copie_Editor()
|
||||
|
||||
self.copie_editor = QAction(icon, 'Copie',None)
|
||||
self.copie_editor = QAction(icon, 'Copie', None)
|
||||
self.toolBar.addAction(self.copie_editor)
|
||||
self.copie_editor.triggered.connect(self.open_editor)
|
||||
self.copie_editor.setEnabled(False)
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
if os.access('N:/',os.R_OK):
|
||||
# IPAddr = socket.gethostbyname(socket.gethostname())
|
||||
if os.access('N:/', os.R_OK):
|
||||
self.copie_editor.setEnabled(True)
|
||||
|
||||
def open_about_dialog(self):
|
||||
@@ -79,6 +77,7 @@ class PgCopie:
|
||||
"""
|
||||
dialog = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
@@ -90,8 +89,7 @@ class PgCopie:
|
||||
def unload(self):
|
||||
""" Unload the plugin. """
|
||||
if self.action_editor:
|
||||
iface.removePluginMenu('CenRa_Copie',self.copie_editor)
|
||||
|
||||
iface.removePluginMenu('CenRa_Copie', self.copie_editor)
|
||||
|
||||
if self.provider:
|
||||
QgsApplication.processingRegistry().removeProvider(self.provider)
|
||||
|
||||
Reference in New Issue
Block a user