|
@@ -318,10 +318,13 @@ class Atlas:
|
|
|
def run_UserInfoDialog(self):
|
|
def run_UserInfoDialog(self):
|
|
|
self.dlg = UserInfoDialog()
|
|
self.dlg = UserInfoDialog()
|
|
|
self.dlg.show()
|
|
self.dlg.show()
|
|
|
|
|
+ self.dlg.pushButton_logout.setStyleSheet("#pushButton_logout {color: #fff !important;text-transform: uppercase; text-decoration: none; background: #72c02c; padding: 20px; border-radius: 50px; display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_logout:hover{background: #66ab27 ;}")
|
|
|
|
|
+ self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
|
|
|
userEndpoint = "http://layman.lesprojekt.cz/rest/current-user"
|
|
userEndpoint = "http://layman.lesprojekt.cz/rest/current-user"
|
|
|
r = requests.get(url = userEndpoint, headers = self.authHeader)
|
|
r = requests.get(url = userEndpoint, headers = self.authHeader)
|
|
|
res = r.text
|
|
res = r.text
|
|
|
res = self.fromByteToJson(r.content)
|
|
res = self.fromByteToJson(r.content)
|
|
|
|
|
+ self.dlg.pushButton_logout.clicked.connect(lambda: self.logout())
|
|
|
print(res['claims'])
|
|
print(res['claims'])
|
|
|
self.dlg.label_layman.setText(res['claims']['preferred_username'])
|
|
self.dlg.label_layman.setText(res['claims']['preferred_username'])
|
|
|
self.dlg.label_agrihub.setText(res['claims']['email'])
|
|
self.dlg.label_agrihub.setText(res['claims']['email'])
|
|
@@ -343,6 +346,10 @@ class Atlas:
|
|
|
self.dlg.lineEdit_units.setText(self.compositeList[x]['units'])
|
|
self.dlg.lineEdit_units.setText(self.compositeList[x]['units'])
|
|
|
self.dlg.lineEdit_scale.setText(str(self.compositeList[x]['scale']))
|
|
self.dlg.lineEdit_scale.setText(str(self.compositeList[x]['scale']))
|
|
|
self.dlg.lineEdit_user.setText(self.compositeList[x]['user']['name'])
|
|
self.dlg.lineEdit_user.setText(self.compositeList[x]['user']['name'])
|
|
|
|
|
+ self.dlg.lineEdit_xmin.setText(self.compositeList[x]['extent'][0])
|
|
|
|
|
+ self.dlg.lineEdit_xmax.setText(self.compositeList[x]['extent'][2])
|
|
|
|
|
+ self.dlg.lineEdit_ymin.setText(self.compositeList[x]['extent'][1])
|
|
|
|
|
+ self.dlg.lineEdit_ymax.setText(self.compositeList[x]['extent'][3])
|
|
|
self.dlg.rejected.connect(lambda: self.afterCloseEditMapDialog())
|
|
self.dlg.rejected.connect(lambda: self.afterCloseEditMapDialog())
|
|
|
self.dlg.pushButton_save.clicked.connect(lambda: self.modifyMap(x))
|
|
self.dlg.pushButton_save.clicked.connect(lambda: self.modifyMap(x))
|
|
|
self.dlg.rejected.connect(lambda: self.afterCloseCompositeDialog())
|
|
self.dlg.rejected.connect(lambda: self.afterCloseCompositeDialog())
|
|
@@ -706,7 +713,20 @@ class Atlas:
|
|
|
return loaded
|
|
return loaded
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ def logout(self):
|
|
|
|
|
+ self.menu_saveLocalFile.setEnabled(False)
|
|
|
|
|
+ self.menu_loadJson.setEnabled(False)
|
|
|
|
|
+ self.menu_ImportLayerDialog.setEnabled(False)
|
|
|
|
|
+ self.menu_AddLayerDialog.setEnabled(False)
|
|
|
|
|
+ self.menu_AddMapDialog.setEnabled(False)
|
|
|
|
|
+ self.menu_ImportLayerDialog.setEnabled(False)
|
|
|
|
|
+ self.menu_ImportMapDialog.setEnabled(False)
|
|
|
|
|
+ self.menu_UserInfoDialog.setEnabled(False)
|
|
|
|
|
+ self.textbox.setText("Layman")
|
|
|
|
|
+ self.dlg.close()
|
|
|
|
|
+ # self.flaskThread.join()
|
|
|
|
|
+ # self.thread1.join() ## ukončujeme vlákno, které se stará o refresh tokenů OAUTH
|
|
|
|
|
+
|
|
|
def enableLoadMapButtons(self, item):
|
|
def enableLoadMapButtons(self, item):
|
|
|
self.dlg.pushButton_mapWFS.setEnabled(True)
|
|
self.dlg.pushButton_mapWFS.setEnabled(True)
|
|
|
def enableButtonImport(self, item, column):
|
|
def enableButtonImport(self, item, column):
|
|
@@ -1096,8 +1116,8 @@ class Atlas:
|
|
|
# disconnects
|
|
# disconnects
|
|
|
self.dockwidget.closingPlugin.disconnect(self.onClosePlugin)
|
|
self.dockwidget.closingPlugin.disconnect(self.onClosePlugin)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ self.flaskThread.terminate() ## killing daemons
|
|
|
|
|
+ self.thread1.terminate()
|
|
|
self.pluginIsActive = False
|
|
self.pluginIsActive = False
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1200,7 +1220,11 @@ class Atlas:
|
|
|
self.compositeList[x]['name'] = name
|
|
self.compositeList[x]['name'] = name
|
|
|
self.compositeList[x]['abstract'] = self.dlg.lineEdit_abstract.text()
|
|
self.compositeList[x]['abstract'] = self.dlg.lineEdit_abstract.text()
|
|
|
self.compositeList[x]['title'] = self.dlg.lineEdit_title.text()
|
|
self.compositeList[x]['title'] = self.dlg.lineEdit_title.text()
|
|
|
-
|
|
|
|
|
|
|
+ self.compositeList[x]['extent'][0] = self.dlg.lineEdit_xmin.text()
|
|
|
|
|
+ self.compositeList[x]['extent'][2] = self.dlg.lineEdit_xmax.text()
|
|
|
|
|
+ self.compositeList[x]['extent'][1] = self.dlg.lineEdit_ymin.text()
|
|
|
|
|
+ self.compositeList[x]['extent'][3] = self.dlg.lineEdit_ymax.text()
|
|
|
|
|
+ print(self.compositeList[x]['extent'])
|
|
|
|
|
|
|
|
print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])
|
|
print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])
|
|
|
oldName = self.dlg.lineEdit_name.text()
|
|
oldName = self.dlg.lineEdit_name.text()
|
|
@@ -1996,10 +2020,18 @@ class Atlas:
|
|
|
root = QgsProject.instance().layerTreeRoot()
|
|
root = QgsProject.instance().layerTreeRoot()
|
|
|
group = root.findGroup(groupName)
|
|
group = root.findGroup(groupName)
|
|
|
if not(group):
|
|
if not(group):
|
|
|
- group = root.addGroup(groupName)
|
|
|
|
|
|
|
+ group = root.addGroup(groupName)
|
|
|
|
|
+ group = self.reorderToTop(groupName)
|
|
|
QgsProject.instance().addMapLayer(layer,False)
|
|
QgsProject.instance().addMapLayer(layer,False)
|
|
|
group.insertChildNode(1,QgsLayerTreeLayer(layer))
|
|
group.insertChildNode(1,QgsLayerTreeLayer(layer))
|
|
|
-
|
|
|
|
|
|
|
+ def reorderToTop(self, name):
|
|
|
|
|
+ root = QgsProject.instance().layerTreeRoot()
|
|
|
|
|
+ for ch in root.children():
|
|
|
|
|
+ if ch.name() == name:
|
|
|
|
|
+ _ch = ch.clone()
|
|
|
|
|
+ root.insertChildNode(0, _ch)
|
|
|
|
|
+ root.removeChildNode(ch)
|
|
|
|
|
+ return _ch
|
|
|
def convertUrlFromHex(self, url):
|
|
def convertUrlFromHex(self, url):
|
|
|
url = url.replace('%3A',':')
|
|
url = url.replace('%3A',':')
|
|
|
url = url.replace('%2F','/')
|
|
url = url.replace('%2F','/')
|
|
@@ -2260,9 +2292,9 @@ class Atlas:
|
|
|
#################
|
|
#################
|
|
|
|
|
|
|
|
print ("##### flask server is starting #####")
|
|
print ("##### flask server is starting #####")
|
|
|
- thread = StartFlaskDaemon()
|
|
|
|
|
- thread.daemon = True
|
|
|
|
|
- thread.start()
|
|
|
|
|
|
|
+ self.flaskThread = StartFlaskDaemon()
|
|
|
|
|
+ self.flaskThread.daemon = True
|
|
|
|
|
+ self.flaskThread.start()
|
|
|
url = 'https://www.'+self.liferayServer+'/o/oauth2/authorize?response_type=code&client_id='+self.client_id+'&redirect_uri=http%3A%2F%2Flocalhost:3000%2Fclient%2Fauthn%2Foauth2-liferay%2Fcallback&code_challenge='+self.code_challenge ##n4bQgYhMfWWaL-qgxVrQFaO_TxsrC4Is0V1sFbDwCgg'
|
|
url = 'https://www.'+self.liferayServer+'/o/oauth2/authorize?response_type=code&client_id='+self.client_id+'&redirect_uri=http%3A%2F%2Flocalhost:3000%2Fclient%2Fauthn%2Foauth2-liferay%2Fcallback&code_challenge='+self.code_challenge ##n4bQgYhMfWWaL-qgxVrQFaO_TxsrC4Is0V1sFbDwCgg'
|
|
|
webbrowser.open(url, new=2)
|
|
webbrowser.open(url, new=2)
|
|
|
|
|
|