premier commit/push
This commit is contained in:
@@ -31,7 +31,7 @@ else:
|
||||
if os_user == 'STAGE':
|
||||
os_user='stage'
|
||||
if os_user == 'Administrateur':
|
||||
os_user = 'admin'
|
||||
os_user = 'stage'
|
||||
|
||||
schemaname_distinct="""SELECT DISTINCT schemaname from pg_catalog.pg_tables
|
||||
WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier'
|
||||
|
||||
@@ -89,7 +89,7 @@ def resources_path(*args):
|
||||
:return: Absolute path to the resources folder.
|
||||
:rtype: str
|
||||
"""
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\resources")))
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\tools")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
@@ -108,7 +108,7 @@ def load_ui(*args):
|
||||
return ui_class
|
||||
|
||||
def login_base(take=None):
|
||||
from CenRa_Metabase.resources.PythonSQL import host,port,dbname,password,os_user
|
||||
from .tools.PythonSQL import host,port,dbname,password,os_user
|
||||
first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
|
||||
first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
|
||||
@@ -117,6 +117,7 @@ def login_base(take=None):
|
||||
user = res_ident[1]
|
||||
|
||||
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
|
||||
|
||||
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
first_conn.close()
|
||||
|
||||
@@ -138,24 +139,45 @@ def send_issues(url,titre,body,labels):
|
||||
|
||||
|
||||
payload = {'title': titre, 'body': body, 'labels': labels}
|
||||
|
||||
r = requests.post(url, data=json.dumps(payload), headers=headers)
|
||||
print(r.text)
|
||||
try:
|
||||
urllib.request.urlopen('https://google.com')
|
||||
binar = True
|
||||
except:
|
||||
binar = False
|
||||
r = ''
|
||||
if binar:
|
||||
r = requests.post(url, data=json.dumps(payload), headers=headers)
|
||||
return r
|
||||
|
||||
def maj_verif(NAME):
|
||||
import qgis
|
||||
import urllib
|
||||
import urllib.request
|
||||
iface = qgis.utils.iface
|
||||
from qgis.core import Qgis
|
||||
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
URL = url+'/raw/branch/main/plugins.xml'
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',plugin_num)+9
|
||||
version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
|
||||
try:
|
||||
urllib.request.urlopen('https://google.com')
|
||||
binar = True
|
||||
except:
|
||||
binar = False
|
||||
if binar:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',plugin_num)+9
|
||||
version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
|
||||
if version_plugin != version:
|
||||
iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
|
||||
if version_plugin == version:
|
||||
iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
|
||||
def devlog(NAME):
|
||||
import qgis
|
||||
devmaj = '<head><style>* {margin:0; padding:0; }</style></head>'
|
||||
devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
|
||||
return devmaj
|
||||
Reference in New Issue
Block a user