def on_tableScenes_item_change(self, item: QTableWidgetItem):
     r = item.row()
     c = item.column()
     itemData = None if r >= len(self.scenes) and r < 0 else self.scenes[r]
     if itemData is None:
         return
     if not itemData.layer is None:
         try:
             print(itemData.layer.id())
         except RuntimeError as rex:
             itemData.layer = None
     if itemData.layer is None:
         layer = self.createMapLayer(itemData.data)
         if not layer is None:
             itemData.layer = layer
             self.scenes[r] = itemData
             proj = QgsProject.instance()
             proj.addMapLayer(layer)
Esempio n. 2
0
 def on_tableScenes_item_change(self, item: QTableWidgetItem):
     r = item.row()
     c = item.column()
     #QMessageBox.about(self, "NTSOMZ_BBPCatalog", "on_tableScenes_item_change\n"+":".join([str(r), str(c)]))
     itemData = None if r >= len(self.scenes) and r < 0 else self.scenes[r]
     if itemData is None:
         #QMessageBox.about(self, "NTSOMZ_BBPCatalog", "on_tableScenes_item_change\n"+"itemData is None")
         return
     if not itemData.layer is None:
         try:
             print(itemData.layer.id())
         except RuntimeError as rex:
             itemData.layer = None
     if itemData.layer is None:
         layer = self.createMapLayer(itemData.data)
         #QMessageBox.about(self, "NTSOMZ_BBPCatalog", "on_tableScenes_item_change\n"+str(layer))
         if not layer is None:
             itemData.layer = layer
             self.scenes[r] = itemData
             proj = QgsProject.instance()
             proj.addMapLayer(layer)