Optimisation pour TT

This commit is contained in:
Tom LAVEILLE 2025-04-09 11:44:05 +02:00
parent bc538524fb
commit c809c12c9f
10 changed files with 30 additions and 86 deletions

View File

@ -4,7 +4,7 @@ import configparser
import shutil
import tempfile
import base64
import socket
import os
import psycopg2
import psycopg2.extras
from os.path import abspath, join, pardir, dirname
@ -109,14 +109,9 @@ def load_ui(*args):
return ui_class
def pyperclip():
IPAddr=socket.gethostbyname(socket.gethostname())
dst = abspath(abspath(join(plugin_path(), "CenRa_AUTOMAP\\tools\\")))
if IPAddr[0:11] == "100.100.100": #4269
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\StyleLayer.py'
if IPAddr[0:9] == "192.168.0": #01
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\StyleLayer.py'
if IPAddr[0:9] == "192.168.1": #0726
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\StyleLayer.py'
dst = dirname(dirname(__file__))+"\\tools\\"
if os.access('N:/',os.R_OK):
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/StyleLayer.py'
try:
shutil.copy(src, dst)
except:

View File

@ -70,11 +70,7 @@ class PgCopie:
self.copie_editor.triggered.connect(self.open_editor)
self.copie_editor.setEnabled(False)
IPAddr=socket.gethostbyname(socket.gethostname())
if IPAddr[0:11] == "100.100.100":
self.copie_editor.setEnabled(True)
elif IPAddr[0:9] == "192.168.0":
self.copie_editor.setEnabled(True)
elif IPAddr[0:9] == "192.168.1":
if os.access('N:/',os.R_OK):
self.copie_editor.setEnabled(True)
def open_about_dialog(self):

View File

@ -6,7 +6,7 @@ import tempfile
import base64
import psycopg2
import psycopg2.extras
import socket
import os
from os.path import abspath, join, pardir, dirname
from qgis.PyQt import uic
@ -109,14 +109,9 @@ def load_ui(*args):
return ui_class
def pyperclip():
IPAddr=socket.gethostbyname(socket.gethostname())
dst = abspath(abspath(join(plugin_path(), "CenRa_COPIE\\tools\\")))
if IPAddr[0:11] == "100.100.100": #4269
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.0": #01
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.1": #0726
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
dst = dirname(dirname(__file__))+"\\tools\\"
if os.access('N:/',os.R_OK):
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
try:
shutil.copy(src, dst)
except:

View File

@ -70,12 +70,7 @@ class PgFlux:
self.toolBar.addAction(self.flux_editor)
self.flux_editor.triggered.connect(self.open_editor)
self.flux_editor.setEnabled(False)
IPAddr=socket.gethostbyname(socket.gethostname())
if IPAddr[0:11] == "100.100.100":
self.flux_editor.setEnabled(True)
elif IPAddr[0:9] == "192.168.0":
self.flux_editor.setEnabled(True)
elif IPAddr[0:9] == "192.168.1":
if os.access('N:/',os.R_OK):
self.flux_editor.setEnabled(True)
def open_about_dialog(self):

View File

@ -2,7 +2,7 @@
import configparser
import shutil
import socket
import os
import tempfile
from os.path import abspath, join, pardir, dirname
@ -78,14 +78,9 @@ def plugin_test_data_path(*args, copy=False):
return path
def pyperclip():
IPAddr=socket.gethostbyname(socket.gethostname())
dst = abspath(abspath(join(plugin_path(), "CenRa_FLUX\\tools\\")))
if IPAddr[0:11] == "100.100.100": #4269
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.0": #01
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.1": #0726
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
dst = dirname(dirname(__file__))+"\\tools\\"
if os.access('N:/',os.R_OK):
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
try:
shutil.copy(src, dst)
except:

View File

@ -3,7 +3,7 @@
import configparser
import shutil
import tempfile
import socket
import os
from os.path import abspath, join, pardir, dirname
from qgis.PyQt.QtWidgets import QApplication
from qgis.PyQt import uic
@ -93,14 +93,9 @@ def resources_path(*args):
return path
def pyperclip():
IPAddr=socket.gethostbyname(socket.gethostname())
dst = abspath(abspath(join(plugin_path(), "CenRa_METABASE\\tools\\")))
if IPAddr[0:11] == "100.100.100": #4269
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.0": #01
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.1": #0726
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
dst = dirname(dirname(__file__))+"\\tools\\"
if os.access('N:/',os.R_OK):
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
try:
shutil.copy(src, dst)
except:

View File

@ -80,11 +80,7 @@ class PgPostgis:
self.postgis_creator.triggered.connect(self.open_creator)
self.postgis_creator.setEnabled(False)
if IPAddr[0:11] == "100.100.100":
self.postgis_creator.setEnabled(True)
elif IPAddr[0:9] == "192.168.0":
self.postgis_creator.setEnabled(True)
elif IPAddr[0:9] == "192.168.1":
if os.access('N:/',os.R_OK):
self.postgis_creator.setEnabled(True)
if not self.action_editor:
@ -95,11 +91,7 @@ class PgPostgis:
self.postgis_editor.triggered.connect(self.open_editor)
self.postgis_editor.setEnabled(False)
if IPAddr[0:11] == "100.100.100":
self.postgis_editor.setEnabled(True)
elif IPAddr[0:9] == "192.168.0":
self.postgis_editor.setEnabled(True)
elif IPAddr[0:9] == "192.168.1":
if os.access('N:/',os.R_OK):
self.postgis_editor.setEnabled(True)
if not self.action_rename:
@ -119,11 +111,7 @@ class PgPostgis:
self.postgis_rename.setVisible(0)
self.postgis_rename.setEnabled(False)
if IPAddr[0:11] == "100.100.100":
self.postgis_rename.setEnabled(True)
elif IPAddr[0:9] == "192.168.0":
self.postgis_rename.setEnabled(True)
elif IPAddr[0:9] == "192.168.1":
if os.access('N:/',os.R_OK):
self.postgis_rename.setEnabled(True)
def open_about_dialog(self):

View File

@ -6,7 +6,7 @@ import tempfile
import base64
import psycopg2
import psycopg2.extras
import socket
import os
from os.path import abspath, join, pardir, dirname
from qgis.core import QgsDataSourceUri
from .SQLRequet import *
@ -110,14 +110,9 @@ def load_ui(*args):
return ui_class
def pyperclip():
IPAddr=socket.gethostbyname(socket.gethostname())
dst = abspath(abspath(join(plugin_path(), "CenRa_POSTGIS\\tools\\")))
if IPAddr[0:11] == "100.100.100": #4269
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.0": #01
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.1": #0726
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
dst = dirname(dirname(__file__))+"\\tools\\"
if os.access('N:/',os.R_OK):
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
try:
shutil.copy(src, dst)
except:

View File

@ -104,12 +104,7 @@ class SICEN(object):
QIcon(":/plugins/sicen/sicen.png"),
u"Ouverture des données SICEN", self.iface.mainWindow())
self.action.setEnabled(False)
IPAddr=socket.gethostbyname(socket.gethostname())
if IPAddr[0:11] == "100.100.100":
self.action.setEnabled(True)
elif IPAddr[0:9] == "192.168.0":
self.action.setEnabled(True)
elif IPAddr[0:9] == "192.168.1":
if os.access('N:/',os.R_OK):
self.action.setEnabled(True)
# connect the action to the run method
self.action.triggered.connect(self.ouverture)

View File

@ -3,7 +3,7 @@
import configparser
import shutil
import tempfile
import socket
import os
import base64
import psycopg2
import psycopg2.extras
@ -109,14 +109,9 @@ def load_ui(*args):
return ui_class
def pyperclip():
IPAddr=socket.gethostbyname(socket.gethostname())
dst = abspath(abspath(join(plugin_path(), "CenRa_SICEN\\tools\\")))
if IPAddr[0:11] == "100.100.100": #4269
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.0": #01
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.1": #0726
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
dst = dirname(dirname(__file__))+"\\tools\\"
if os.access('N:/',os.R_OK):
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
try:
shutil.copy(src, dst)
except: