def getProjectLayerForGeoGigLayer(repoUrl, layername):
    tracking = getTrackingInfoForGeogigLayer(repoUrl, layername)
    if tracking:
        layers = getAllLayers()
        for layer in layers:
            if formatSource(layer) == tracking.source:
                return layer
def getProjectLayerForGeoGigLayer(repoUrl, layername):
    tracking = getTrackingInfoForGeogigLayer(repoUrl, layername)
    if tracking:
        layers = vectorLayers()
        for layer in layers:
            if formatSource(layer) == tracking.source:
                return layer
def removeTrackedLayer(layer):
    global tracked
    source = formatSource(layer)
    for i, obj in enumerate(tracked):
        if obj.source == source:
            del tracked[i]
            saveTracked()
            return
def removeTrackedLayer(layer):
    global tracked
    source = formatSource(layer)
    for i, obj in enumerate(tracked):
        if obj.source == source:
            del tracked[i]
            saveTracked()
            return
def addTrackedLayer(source, repoFolder):
    global tracked
    source = formatSource(source)
    layer = TrackedLayer(source, repoFolder)
    if layer not in tracked:
        for lay in tracked:
            if lay.source == source:
                tracked.remove(lay)
        tracked.append(layer)
        saveTracked()
def addTrackedLayer(source, repoFolder):
    global tracked
    source = formatSource(source)
    layer = TrackedLayer(source, repoFolder)
    if layer not in tracked:
        for lay in tracked:
            if lay.source == source:
                tracked.remove(lay)
        tracked.append(layer)
        saveTracked()
Exemple #7
0
 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)
Exemple #8
0
    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 getTrackingInfo(layer):
    source = formatSource(layer)
    for obj in tracked:
        if obj.source == source:
            return obj
    return None
def getTrackingInfo(layer):
    source = formatSource(layer)
    for obj in tracked:
        if obj.source == source:
            return obj
    return None