Skip to content

Commit

Permalink
Merge pull request #34 from opengisch/fixpolylinking
Browse files Browse the repository at this point in the history
Fix linking on generated polymorphic relations
  • Loading branch information
domi4484 authored Feb 20, 2023
2 parents 00fd2a2 + c2188d4 commit c419623
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# Fix end of files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -11,7 +11,7 @@ repos:

# Remove unused imports/variables
- repo: https://github.com/myint/autoflake
rev: v1.4
rev: v2.0.1
hooks:
- id: autoflake
args:
Expand All @@ -22,7 +22,7 @@ repos:

# Sort imports
- repo: https://github.com/pycqa/isort
rev: "5.7.0"
rev: "5.12.0"
hooks:
- id: isort
args:
Expand All @@ -31,7 +31,7 @@ repos:

# Black formatting
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.1.0
hooks:
- id: black
language_version: python3
Expand Down
9 changes: 2 additions & 7 deletions linking_relation_editor/gui/linking_relation_editor_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ def parentFormValueChanged(self, attribute, newValue):
QgsMessageLog.logMessage("parentFormValueChanged()")

def updateUiSingleEdit(self):

self.mFormViewButton.setVisible(not self.mOneToOne)
self.mTableViewButton.setVisible(not self.mOneToOne)
self.mMultiEditInfoLabel.setVisible(False)
Expand Down Expand Up @@ -542,7 +541,6 @@ def duplicateSelectedFeatures(self):
self.duplicateFeatures(self.mFeatureSelectionMgr.selectedFeatureIds())

def _execLinkFeatureDialog(self):

layer = None

if self.nmRelation().isValid():
Expand All @@ -568,7 +566,6 @@ def _execLinkFeatureDialog(self):
relationEditorLinkChildManagerDialog.show()

def _linkFeatures(self, featureIds):

if len(featureIds) == 0:
return

Expand All @@ -585,9 +582,8 @@ def _linkFeatures(self, featureIds):
polyRel = self.relation().polymorphicRelation()
assert polyRel.isValid()

linkAttributes.insert(
fields.indexFromName(polyRel.referencedLayerField()),
polyRel.layerRepresentation(self.relation().referencedLayer()),
linkAttributes[fields.indexFromName(polyRel.referencedLayerField())] = polyRel.layerRepresentation(
self.relation().referencedLayer()
)

linkFeatureDataList = []
Expand Down Expand Up @@ -754,7 +750,6 @@ def afterSetRelations(self):
self.updateButtons()

def _checkTransactionGroup(self):

self._layerInSameTransactionGroup = False
connectionString = PluginHelper.connectionString(self.relation().referencedLayer().source())
transactionGroup = QgsProject.instance().transactionGroup(
Expand Down

0 comments on commit c419623

Please sign in to comment.