def _removeLayer(self): user, email = config.getUserInfo() if user is None: return self.repo.removetree(self.layer, user, email, self.branch) config.iface.messageBar().pushMessage("Layer correctly removed from repository", level = QgsMessageBar.INFO, duration = 5) layer = getProjectLayerForGeoGigLayer(self.repo.url, self.layer) if layer: branches = self.repo.branches() layerInRepo = False for branch in branches: layers = self.repo.trees(branch) if self.layer in layers: layerInRepo = True break if not layerInRepo: setAsNonRepoLayer(layer) tracking = getTrackingInfoForGeogigLayer(self.repo.url, self.layer) if tracking: removeTrackedLayer(tracking.source) #TODO remove triggers from layer repoWatcher.repoChanged.emit(self.repo)
def delete(self): ret = QMessageBox.warning(config.iface.mainWindow(), "Remove repository", "Are you sure you want to remove this repository and all the data in it?", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes); if ret == QMessageBox.No: return tracked = getTrackedPathsForRepo(self.repo) self.repo.delete() removeRepo(self.repo) removeTrackedForRepo(self.repo) layers = vectorLayers() for layer in layers: if formatSource(layer) in tracked: setAsNonRepoLayer(layer) self.tree.takeTopLevelItem(self.tree.indexOfTopLevelItem(self)) repoWatcher.repoChanged.emit(self.repo)
def deleteCurrentElement(self): if len(self.repoTree.selectedItems()) == 0: return item = self.repoTree.selectedItems()[0] if isinstance(item, RepoItem): ret = QMessageBox.warning( config.iface.mainWindow(), "Remove repository", "Are you sure you want to remove this repository and all the data in it?", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) if ret == QMessageBox.No: return tracked = getTrackedPathsForRepo(item.repo) item.repo.delete() removeRepo(item.repo) removeTrackedForRepo(item.repo) layers = getVectorLayers() for layer in layers: if formatSource(layer) in tracked: setAsNonRepoLayer(layer) parent = item.parent() parent.removeChild(item) self.updateCurrentRepo(None) elif isinstance(item, GroupItem): self._removeRepoEndpoint(item) elif isinstance(item, BranchItem): ret = QMessageBox.question( self, 'Delete branch', 'Are you sure you want to delete this branch?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if ret == QMessageBox.No: return item.repo.deletebranch(item.branch) repoWatcher.repoChanged.emit(item.repo) elif isinstance(item, LayerItem): ret = QMessageBox.question( self, 'Delete layer', 'Are you sure you want to delete this layer from the selected branch?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if ret == QMessageBox.No: return execute(lambda: self._removeLayer(item))
def trackLayer(layer): if isRepoLayer(layer): setAsRepoLayer(layer) else: setAsNonRepoLayer(layer)
def trackLayer(layer): if isRepoLayer(layer): setAsRepoLayer(layer) else: setAsNonRepoLayer(layer)