diff --git a/document_management_system/gui/relation_editor_document_side_widget.py b/document_management_system/gui/relation_editor_document_side_widget.py index 9a9c52d..911fbec 100644 --- a/document_management_system/gui/relation_editor_document_side_widget.py +++ b/document_management_system/gui/relation_editor_document_side_widget.py @@ -15,24 +15,21 @@ ) from qgis.PyQt.QtCore import ( Qt, - QObject, + QTimer, pyqtSlot ) from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtWidgets import ( - QMessageBox, - QTreeWidgetItem, QAction, - QInputDialog + QInputDialog, + QMessageBox, + QTreeWidgetItem ) from qgis.PyQt.uic import loadUiType from qgis.core import ( QgsProject, QgsRelation, QgsPolymorphicRelation, - QgsExpression, - QgsExpressionContext, - QgsExpressionContextUtils, QgsGeometry, QgsFeature, QgsFeatureRequest, @@ -72,6 +69,9 @@ class RelationEditorDocumentSideWidget(QgsAbstractRelationEditorWidget, WidgetUi def __init__(self, config, parent): super().__init__(config, parent) + self._updateUiTimer = QTimer() + self._updateUiTimer.setSingleShot(True) + self._updateUiTimer.timeout.connect(self.updateUiTimeout) self.setupUi(self) self.polymorphicRelationEnabled = False @@ -144,7 +144,10 @@ def setConfig(self, config): self._setCardinality() def updateUi(self): - print('DocumentRelationEditorDocumentSideWidget.updateUi') + self._updateUiTimer.start(200) + + def updateUiTimeout(self): + print('DocumentRelationEditorDocumentSideWidget.updateUiTimeout') self.mFeaturesTreeWidget.clear() diff --git a/document_management_system/gui/relation_editor_feature_side_widget.py b/document_management_system/gui/relation_editor_feature_side_widget.py index ad9b8a8..b72fe4b 100644 --- a/document_management_system/gui/relation_editor_feature_side_widget.py +++ b/document_management_system/gui/relation_editor_feature_side_widget.py @@ -12,9 +12,8 @@ import os from enum import Enum from qgis.PyQt.QtCore import ( - QObject, QDir, - QSysInfo, + QTimer, QUrl, QVariant, pyqtSignal, @@ -24,24 +23,18 @@ from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtWidgets import ( QAction, - QMessageBox, - QVBoxLayout + QMessageBox ) from qgis.PyQt.uic import loadUiType from qgis.core import ( - QgsApplication, - QgsProject, - QgsRelation, - QgsPolymorphicRelation, QgsExpression, QgsExpressionContext, QgsExpressionContextUtils, - QgsFields, - QgsVectorLayerTools, - QgsVectorLayerUtils, QgsGeometry, - QgsFeature, - QgsSettingsEntryString + QgsProject, + QgsRelation, + QgsSettingsEntryString, + QgsVectorLayerUtils ) from qgis.gui import ( QgsAbstractRelationEditorWidget, @@ -70,6 +63,9 @@ class LastView(str, Enum): def __init__(self, config, parent): super().__init__(config, parent) + self._updateUiTimer = QTimer() + self._updateUiTimer.setSingleShot(True) + self._updateUiTimer.timeout.connect(self.updateUiTimeout) self.setupUi(self) print('DocumentRelationEditorFeatureSideWidget.__init__') @@ -181,7 +177,9 @@ def setConfig(self, config): self.document_filename = config['document_filename'] def updateUi(self): - print('DocumentRelationEditorFeatureSideWidget.updateUi') + self._updateUiTimer.start(200) + + def updateUiTimeout(self): self.model.init(self.relation(), self.nmRelation(), self.feature(),