forked from CEN-RA/Plugin_QGIS
Supprimer issues.py
This commit is contained in:
parent
f29df89ba0
commit
bace581f5c
89
issues.py
89
issues.py
@ -1,89 +0,0 @@
|
|||||||
import os
|
|
||||||
plugin_dir = os.path.dirname(__file__)
|
|
||||||
end_find = plugin_dir.rfind('\\')+1
|
|
||||||
|
|
||||||
NAME = plugin_dir[end_find:]
|
|
||||||
#print(NAME)
|
|
||||||
|
|
||||||
from qgis.gui import *
|
|
||||||
|
|
||||||
from qgis.core import (
|
|
||||||
NULL,
|
|
||||||
QgsApplication,
|
|
||||||
QgsDataSourceUri,
|
|
||||||
QgsProject,
|
|
||||||
QgsProviderConnectionException,
|
|
||||||
QgsProviderRegistry,
|
|
||||||
QgsRasterLayer,
|
|
||||||
QgsSettings,
|
|
||||||
QgsVectorLayer,
|
|
||||||
QgsGeometry,
|
|
||||||
)
|
|
||||||
from qgis.PyQt.QtWidgets import (
|
|
||||||
QDialog,
|
|
||||||
QAction,
|
|
||||||
QDockWidget,
|
|
||||||
QFileDialog,
|
|
||||||
QInputDialog,
|
|
||||||
QMenu,
|
|
||||||
QToolButton,
|
|
||||||
QTableWidget,
|
|
||||||
QTableWidgetItem,
|
|
||||||
)
|
|
||||||
from qgis.utils import iface
|
|
||||||
|
|
||||||
|
|
||||||
from .tools.resources import (
|
|
||||||
load_ui,
|
|
||||||
resources_path,
|
|
||||||
send_issues,
|
|
||||||
)
|
|
||||||
|
|
||||||
EDITOR_CLASS = load_ui('CenRa_IssuesSend.ui')
|
|
||||||
|
|
||||||
class CenRa_Issues(QDialog, EDITOR_CLASS):
|
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
_ = parent
|
|
||||||
super().__init__()
|
|
||||||
self.setupUi(self)
|
|
||||||
self.settings = QgsSettings()
|
|
||||||
|
|
||||||
#place connect here
|
|
||||||
self.annuler_button.clicked.connect(self.close)
|
|
||||||
self.ok_button.clicked.connect(self.run_sendissues)
|
|
||||||
|
|
||||||
def run_sendissues(self):
|
|
||||||
text_titre = self.titre_line.text()
|
|
||||||
text_message = self.messages_plain.toPlainText()
|
|
||||||
statu_bug = self.check_bug.isChecked()
|
|
||||||
statu_aide = self.check_aide.isChecked()
|
|
||||||
statu_question = self.check_question.isChecked()
|
|
||||||
statu_amelioration = self.check_amelioration.isChecked()
|
|
||||||
statu_autre = self.check_autre.isChecked()
|
|
||||||
|
|
||||||
statu = []
|
|
||||||
if statu_bug == True : statu = statu + [1]
|
|
||||||
if statu_aide == True : statu = statu + [3]
|
|
||||||
if statu_question == True : statu = statu + [5]
|
|
||||||
if statu_amelioration == True : statu = statu + [2]
|
|
||||||
if statu_autre == True : statu = statu + [6]
|
|
||||||
|
|
||||||
if len(statu) >= 1:
|
|
||||||
import qgis
|
|
||||||
url = qgis.utils.pluginMetadata(NAME,'tracker')
|
|
||||||
print(text_message)
|
|
||||||
send_info = send_issues(url,text_titre,text_message,statu)
|
|
||||||
code = send_info.status_code
|
|
||||||
print(code)
|
|
||||||
else:
|
|
||||||
code = 423
|
|
||||||
if code == 201:
|
|
||||||
iface.messageBar().pushMessage("Envoyer :", "Votre messages à bien été envoyer.", level=Qgis.Success, duration=20)
|
|
||||||
self.close()
|
|
||||||
elif code == 422:
|
|
||||||
iface.messageBar().pushMessage("Erreur :", "Erreur dans le contenu du messages.", level=Qgis.Critical, duration=20)
|
|
||||||
elif code == 423:
|
|
||||||
iface.messageBar().pushMessage("Erreur :", "Pas de sujet sélectionné.", level=Qgis.Critical, duration=20)
|
|
||||||
elif code == 404:
|
|
||||||
iface.messageBar().pushMessage("Missing :", "Le serveur de messagerie est injoignable.", level=Qgis.Warning, duration=20)
|
|
||||||
Loading…
x
Reference in New Issue
Block a user