forked from CEN-RA/Plugin_QGIS
fix bug entre q4 et les logo/icon
This commit is contained in:
parent
2765093f1d
commit
8a1e7e6d70
@ -22,21 +22,16 @@ import csv
|
||||
|
||||
from .forms.about_form import AboutDialog
|
||||
|
||||
# import psycopg2
|
||||
# import psycopg2.extras
|
||||
# import base64
|
||||
import socket
|
||||
import os
|
||||
|
||||
from .tools.resources import maj_verif, pyperclip
|
||||
from .tools.resources import maj_verif, pyperclip, resources_path
|
||||
pyperclip()
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except ValueError:
|
||||
print('Pas de fichier PythonSQL')
|
||||
|
||||
# import sys
|
||||
|
||||
|
||||
class SICEN(object):
|
||||
|
||||
@ -73,43 +68,43 @@ class SICEN(object):
|
||||
self.toolBar.setObjectName("SICEN")
|
||||
|
||||
# Create action that will start plugin configuration
|
||||
self.action = QAction(
|
||||
QIcon(":/plugins/sicen/sicen.png"),
|
||||
self.action_open = QAction(
|
||||
QIcon(resources_path("icon", "sicen.png")),
|
||||
u"Ouverture des données SICEN", self.iface.mainWindow())
|
||||
self.action.setEnabled(False)
|
||||
self.action_open.setEnabled(False)
|
||||
if os.access('N:/', os.R_OK):
|
||||
self.action.setEnabled(True)
|
||||
self.action_open.setEnabled(True)
|
||||
# connect the action to the run method
|
||||
self.action.triggered.connect(self.ouverture)
|
||||
self.action_open.triggered.connect(self.ouverture)
|
||||
|
||||
# Add toolbar button and menu item
|
||||
self.toolBar.addAction(self.action)
|
||||
self.iface.addPluginToMenu(u"SICEN", self.action)
|
||||
self.toolBar.addAction(self.action_open)
|
||||
self.iface.addPluginToMenu(u"SICEN", self.action_open)
|
||||
|
||||
# Create action that will start plugin configuration
|
||||
self.action = QAction(
|
||||
QIcon(":/plugins/sicen/sicen_export.png"),
|
||||
self.action_export = QAction(
|
||||
QIcon(resources_path("icon", "sicen_export.png")),
|
||||
u"Export liste d'espèces", self.iface.mainWindow())
|
||||
self.action.setEnabled(False)
|
||||
self.action_export.setEnabled(False)
|
||||
IPAddr = socket.gethostbyname(socket.gethostname())
|
||||
if IPAddr[0:11] == "100.100.100":
|
||||
self.action.setEnabled(True)
|
||||
self.action_export.setEnabled(True)
|
||||
elif IPAddr[0:9] == "192.168.0":
|
||||
self.action.setEnabled(True)
|
||||
self.action_export.setEnabled(True)
|
||||
elif IPAddr[0:9] == "192.168.1":
|
||||
self.action.setEnabled(True)
|
||||
self.action_export.setEnabled(True)
|
||||
# connect the action to the run method
|
||||
self.action.triggered.connect(self.export)
|
||||
self.action_export.triggered.connect(self.export)
|
||||
|
||||
# Add toolbar button and menu item
|
||||
self.toolBar.addAction(self.action)
|
||||
self.iface.addPluginToMenu(u"SICEN", self.action)
|
||||
self.toolBar.addAction(self.action_export)
|
||||
self.iface.addPluginToMenu(u"SICEN", self.action_export)
|
||||
|
||||
self.menu = QMenu()
|
||||
self.menu.setTitle(QCoreApplication.translate("SICEN", "&SICEN"))
|
||||
|
||||
self.sicen_ouverture = QAction(QIcon(":/plugins/SICEN/sicen.png"), QCoreApplication.translate("SICEN", u"Ouverture des données SICEN"), self.iface.mainWindow())
|
||||
self.sicen_export = QAction(QIcon(":/plugins/SICEN/sicen_export.png"), QCoreApplication.translate("SICEN", u"Export liste d'espèces"), self.iface.mainWindow())
|
||||
self.sicen_ouverture = QAction(QIcon(resources_path("icon", "sicen.png")), QCoreApplication.translate("SICEN", u"Ouverture des données SICEN"), self.iface.mainWindow())
|
||||
self.sicen_export = QAction(QIcon(resources_path("icon", "sicen_export.png")), QCoreApplication.translate("SICEN", u"Export liste d'espèces"), self.iface.mainWindow())
|
||||
|
||||
self.menu.addActions([self.sicen_ouverture, self.sicen_export])
|
||||
|
||||
@ -127,8 +122,10 @@ class SICEN(object):
|
||||
|
||||
def unload(self):
|
||||
# Remove the plugin menu item and icon
|
||||
self.iface.removePluginMenu(u"&SICEN", self.action)
|
||||
self.iface.removeToolBarIcon(self.action)
|
||||
self.iface.removePluginMenu(u"&SICEN", self.action_open)
|
||||
self.iface.removeToolBarIcon(self.action_open)
|
||||
self.iface.removePluginMenu(u"&SICEN", self.action_export)
|
||||
self.iface.removeToolBarIcon(self.action_export)
|
||||
|
||||
# run method that performs all the real work
|
||||
def ouverture(self):
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@ -90,7 +90,7 @@ def resources_path(*args):
|
||||
:return: Absolute path to the resources folder.
|
||||
:rtype: str
|
||||
"""
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_COPIE\\tools")))
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_SICEN\\tools")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user