Skip to content

Commit

Permalink
Wms wmts ponowne dodanie warstw
Browse files Browse the repository at this point in the history
  • Loading branch information
gustawgawrysiak authored and Kamaz25 committed Aug 5, 2021
1 parent a28ea58 commit c8c2f14
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions OrtoTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ def add_to_map(self, name):
CustomMessageBox(
None, tr('Can\'t add layer') + name).button_ok()
else:
CustomMessageBox(
None, tr('Layer already exists ') + name).button_ok()
lyr = QgsProject.instance().mapLayersByName(name)[0]
QgsProject.instance().layerTreeRoot().findLayer(lyr.id()).setItemVisibilityChecked(True)
lyrontree = QgsProject.instance().layerTreeRoot().findLayer(lyr.id())
lyrontree.setItemVisibilityChecked(not lyrontree.isItemVisibilityCheckedRecursive())

def create_menu(self):
layers_names = []
Expand Down Expand Up @@ -150,13 +149,9 @@ def create_menu(self):
self.ortomenu = menu

def ortocheck(self):
lyrs = [layer.name() for layer in QgsProject.instance().mapLayers().values()]
ortos = self.ortomenu
for orto in ortos.actions():
if orto.text() in lyrs:
orto.setChecked(True)
else:
orto.setChecked(False)
checked = [layer.name() for layer in QgsProject.instance().layerTreeRoot().checkedLayers()]
for orto in self.ortomenu.actions():
orto.setChecked(orto.text() in checked)

class OrtoActionService(QObject):
orto_added = pyqtSignal()
Expand Down

0 comments on commit c8c2f14

Please sign in to comment.