Explorar el Código

opravy chyb: editace metadat, reference na neexistujíci vrstvu

Honza hace 5 años
padre
commit
fdc1a82781
Se han modificado 2 ficheros con 15 adiciones y 7 borrados
  1. 15 7
      Atlas.py
  2. BIN
      __pycache__/Atlas.cpython-37.pyc

+ 15 - 7
Atlas.py

@@ -845,6 +845,7 @@ class Atlas:
             self.dlg.treeWidget.addTopLevelItem(item)
     def checkIfMapExist(self, name):
         url = "http://layman.lesprojekt.cz/rest/"+self.laymanUsername+"/maps/"+str(name)+"/file"
+        print(url)
         r = requests.get(url)
         print(r.content)
         if (r.status_code == 404):
@@ -1700,7 +1701,8 @@ class Atlas:
             if (operation == "add"):                
                 msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete přidat do kompozice "+str(successful)+" vrstev?") 
             if (operation == "mod"): 
-                msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete opravdu provést změny v této kompozici?") 
+                msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Do you want save changes?") 
+                
                 self.dlg.close()
                 self.afterCloseEditMapDialog()
                 print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
@@ -1710,12 +1712,17 @@ class Atlas:
                 self.dlg.show()
             if (operation == "del"):
                 msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete smazat vybranou vrstvu?")
-            msgbox.addButton(QMessageBox.Yes)
-            msgbox.addButton(QMessageBox.No)
-            msgbox.setDefaultButton(QMessageBox.No)
-            reply = msgbox.exec()
+          
+            try: # jedná se o mod pokud je except
+                msgbox.addButton(QMessageBox.Yes)
+                msgbox.addButton(QMessageBox.No)
+                msgbox.setDefaultButton(QMessageBox.No)
+                reply = msgbox.exec()
+            except:
+                pass
+                
             if (reply == QMessageBox.Yes):
-                response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader, verify=False)
+                response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader)
                 print(response.content)
                 data = response.content
                 self.dlg.progressBar.hide() 
@@ -1857,6 +1864,7 @@ class Atlas:
             return False
    
     def removeUnacceptableChars(self, input):
+        input = input.lower()
         input = input.replace("ř","r")
         input = input.replace("š","s")
         input = input.replace("ž","z")
@@ -1872,7 +1880,7 @@ class Atlas:
         input = input.replace("ě","e")
         input = input.replace("ť","t")
         input = re.sub(r'[?|$|.|!]',r'',input)
-        input = input.lower()
+        
        # iface.messageBar().pushWidget(iface.messageBar().createMessage("Layman:", "Diacritics in name of layer was replaced."), Qgis.Success, duration=3)
         return input
 

BIN
__pycache__/Atlas.cpython-37.pyc