fix bug entre q4 et les logo/icon

This commit is contained in:
Tom LAVEILLE 2026-03-20 11:47:02 +01:00
parent 2765093f1d
commit 8a1e7e6d70
4 changed files with 24 additions and 27 deletions

View File

@ -22,21 +22,16 @@ import csv
from .forms.about_form import AboutDialog from .forms.about_form import AboutDialog
# import psycopg2
# import psycopg2.extras
# import base64
import socket import socket
import os import os
from .tools.resources import maj_verif, pyperclip from .tools.resources import maj_verif, pyperclip, resources_path
pyperclip() pyperclip()
try: try:
from .tools.PythonSQL import login_base from .tools.PythonSQL import login_base
except ValueError: except ValueError:
print('Pas de fichier PythonSQL') print('Pas de fichier PythonSQL')
# import sys
class SICEN(object): class SICEN(object):
@ -73,43 +68,43 @@ class SICEN(object):
self.toolBar.setObjectName("SICEN") self.toolBar.setObjectName("SICEN")
# Create action that will start plugin configuration # Create action that will start plugin configuration
self.action = QAction( self.action_open = QAction(
QIcon(":/plugins/sicen/sicen.png"), QIcon(resources_path("icon", "sicen.png")),
u"Ouverture des données SICEN", self.iface.mainWindow()) 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): if os.access('N:/', os.R_OK):
self.action.setEnabled(True) self.action_open.setEnabled(True)
# connect the action to the run method # 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 # Add toolbar button and menu item
self.toolBar.addAction(self.action) self.toolBar.addAction(self.action_open)
self.iface.addPluginToMenu(u"SICEN", self.action) self.iface.addPluginToMenu(u"SICEN", self.action_open)
# Create action that will start plugin configuration # Create action that will start plugin configuration
self.action = QAction( self.action_export = QAction(
QIcon(":/plugins/sicen/sicen_export.png"), QIcon(resources_path("icon", "sicen_export.png")),
u"Export liste d'espèces", self.iface.mainWindow()) u"Export liste d'espèces", self.iface.mainWindow())
self.action.setEnabled(False) self.action_export.setEnabled(False)
IPAddr = socket.gethostbyname(socket.gethostname()) IPAddr = socket.gethostbyname(socket.gethostname())
if IPAddr[0:11] == "100.100.100": if IPAddr[0:11] == "100.100.100":
self.action.setEnabled(True) self.action_export.setEnabled(True)
elif IPAddr[0:9] == "192.168.0": elif IPAddr[0:9] == "192.168.0":
self.action.setEnabled(True) self.action_export.setEnabled(True)
elif IPAddr[0:9] == "192.168.1": elif IPAddr[0:9] == "192.168.1":
self.action.setEnabled(True) self.action_export.setEnabled(True)
# connect the action to the run method # 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 # Add toolbar button and menu item
self.toolBar.addAction(self.action) self.toolBar.addAction(self.action_export)
self.iface.addPluginToMenu(u"SICEN", self.action) self.iface.addPluginToMenu(u"SICEN", self.action_export)
self.menu = QMenu() self.menu = QMenu()
self.menu.setTitle(QCoreApplication.translate("SICEN", "&SICEN")) 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_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(":/plugins/SICEN/sicen_export.png"), QCoreApplication.translate("SICEN", u"Export liste d'espèces"), 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]) self.menu.addActions([self.sicen_ouverture, self.sicen_export])
@ -127,8 +122,10 @@ class SICEN(object):
def unload(self): def unload(self):
# Remove the plugin menu item and icon # Remove the plugin menu item and icon
self.iface.removePluginMenu(u"&SICEN", self.action) self.iface.removePluginMenu(u"&SICEN", self.action_open)
self.iface.removeToolBarIcon(self.action) 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 # run method that performs all the real work
def ouverture(self): def ouverture(self):

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -90,7 +90,7 @@ def resources_path(*args):
:return: Absolute path to the resources folder. :return: Absolute path to the resources folder.
:rtype: str :rtype: str
""" """
path = abspath(abspath(join(plugin_path(), "CenRa_COPIE\\tools"))) path = abspath(abspath(join(plugin_path(), "CenRa_SICEN\\tools")))
for item in args: for item in args:
path = abspath(join(path, item)) path = abspath(join(path, item))
return path return path