Commit 1b6c3417 authored by Benjamin Jakimow's avatar Benjamin Jakimow
Browse files
parent 96325348
Pipeline #18165 failed with stage
in 6 seconds
......@@ -33,6 +33,10 @@ import typing
import pathlib
import collections
import uuid
from PyQt5.QtCore import QMimeData, QVariant, QPoint, QByteArray, QFileInfo, QUrl, pyqtSignal, Qt
from PyQt5.QtGui import QColor, QIcon
from PyQt5.QtXml import QDomDocument, QDomElement
from osgeo import osr
from ..speclib import SpectralLibrarySettingsKey
from PyQt5.QtWidgets import *
......@@ -2540,9 +2544,9 @@ class SpectralLibrary(QgsVectorLayer):
progressDialog.setValue(nAdded)
lastTime = datetime.datetime.now()
activeEditCommand = self.isEditCommandActive()
in_active_command = self.isEditCommandActive()
if not activeEditCommand:
if not in_active_command:
self.beginEditCommand('Add profiles')
for i, pSrc in enumerate(profiles):
......@@ -2576,7 +2580,7 @@ class SpectralLibrary(QgsVectorLayer):
# final buffer call
flushBuffer(triggerProgressBar=True)
if activeEditCommand:
if not in_active_command:
self.endEditCommand()
# return the edited features
MAP = self.editBuffer().addedFeatures()
......
......@@ -27,6 +27,10 @@ from typing import List, Tuple
import sip
import textwrap
from PyQt5.QtCore import QAbstractTableModel, pyqtSignal, Qt, QModelIndex, QVariant, QPoint, QTimer, QPointF, pyqtSlot
from PyQt5.QtGui import QColor, QDragMoveEvent, QDropEvent, QIcon, QDragEnterEvent, QContextMenuEvent
from .core import *
import collections
from ..externals.pyqtgraph import PlotItem, PlotWindow, PlotCurveItem
......@@ -2184,7 +2188,7 @@ class SpectralProfileFieldFormatter(QgsFieldFormatter):
def representValue(self, layer: QgsVectorLayer, fieldIndex: int, config: dict, cache, value):
if value not in [None, NULL]:
if value not in [None, QVariant()]:
return SPECTRAL_PROFILE_FIELD_REPRESENT_VALUE
else:
return 'Empty'
......@@ -2608,7 +2612,9 @@ class SpectralLibraryWidget(AttributeTableWidget):
if not addAuto:
# delete previous current profiles from speclib
speclib.beginEditCommand('Remove temporary profiles')
speclib.deleteFeatures(oldCurrentIDs)
speclib.endEditCommand()
plotWidget.removeSpectralProfilePDIs(oldCurrentKeys, updateScene=False)
# now there shouldn't be any PDI or style ref related to an old ID
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment