Ejemplo n.º 1
0
 def _updateBrokerClose(self):
     broker = self._brokerDlg.getBroker()
     if broker.dirty():
         if not Log.confirm("You have unsaved changes. Close anyway?"):
             return
     self._brokerDlg.dockWidget.setVisible(False)
     self.dockWidget.setFixedHeight(self.height())  # paramterise
     self._brokers.load()
     self.brokerManagerWidget.setCurrentIndex(self.kBrokerListTabId)
Ejemplo n.º 2
0
    def checkBrokerConfig(self):
        if not self._brokers.list():
            raise BrokersNotDefined

        if self.dirty():
            if Log.confirm("You have unsaved changed in your broker configuration. Save now?"):
                self.apply()
            else:
                raise BrokerNotSynced("Unsaved changes")
Ejemplo n.º 3
0
    def _delBroker(self, broker):
        if self._layerManager.brokerInUse(broker.id()):
            Log.alert("A layer is currently using this broker. Please remove this first!")
            return

        if not Log.confirm("Are you sure you want to delete the broker " + broker.name() + "?"):
            return
        broker.deletingBroker.emit()
        self._brokers.delete(broker)
        self._brokers.sync()
        self._buildBrokerTable()
Ejemplo n.º 4
0
    def checkBrokerConfig(self):
        # Nathan - Can be done like this:
        # if not self._brokers.list():
        # (if not will check for the empty list)
        if len(self._brokers.list()) == 0:
            raise BrokersNotDefined

        if self.dirty():
            if Log.confirm("You have unsaved changed in your broker configuration. Save now?"):
                self.apply()
            else:
                raise BrokerNotSynced("Unsaved changes")
    def removeLayer(self, layer, confirm=True):
        lid = layer.id()
        if confirm and Log.confirm("Are you sure you want to remove layer " + layer.name() + "?"):
            try:
                Log.debug("Removing layer")
                # QgsMapLayerRegistry.instance().removeMapLayers(layer.id())
                QgsProject.instance().layerTreeRoot().removeLayer(layer)

                self.delTLayer(lid)
            except Exception as e:
                Log.debug("Layer removed " + str(e))
        elif not confirm:
            QgsProject.instance().layerTreeRoot().removeLayer(layer)

            # QgsMapLayerRegistry.instance().removeMapLayer(layer.id())
            self.delTLayer(lid)

        Log.debug("Layer removed")
Ejemplo n.º 6
0
    def removeLayer(self, layer, confirm=True):
        lid = layer.id()
        if confirm and Log.confirm("Are you sure you want to remove layer " +
                                   layer.name() + "?"):
            try:
                Log.debug("Removing layer")
                # QgsMapLayerRegistry.instance().removeMapLayers(layer.id())
                QgsProject.instance().layerTreeRoot().removeLayer(layer)

                self.delTLayer(lid)
            except Exception as e:
                Log.debug("Layer removed " + str(e))
        elif not confirm:
            QgsProject.instance().layerTreeRoot().removeLayer(layer)

            # QgsMapLayerRegistry.instance().removeMapLayer(layer.id())
            self.delTLayer(lid)

        Log.debug("Layer removed")