Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laita editointi päälle kohdetasolle kun templaatti valitaan #26

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions arho_feature_template/core/feature_template_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def _uncheck_others(self, item: QStandardItem) -> None:
def start_digitizing_for_layer(self, layer: QgsVectorLayer) -> None:
self.digitize_map_tool.clean()
self.digitize_map_tool.setLayer(layer)
if not layer.isEditable():
succeeded = layer.startEditing()
if not succeeded:
logger.warning("Failed to start editing layer %s", layer.name())
return
iface.mapCanvas().setMapTool(self.digitize_map_tool)

def ask_for_feature_attributes(self, feature: QgsFeature) -> None:
Expand All @@ -151,11 +156,6 @@ def ask_for_feature_attributes(self, feature: QgsFeature) -> None:
attribute,
widget.text(),
)
if not layer.isEditable():
succeeded = layer.startEditing()
if not succeeded:
logger.warning("Failed to start editing layer %s", layer.name())
return

layer.beginEditCommand("Create feature from template")
layer.addFeature(feature)
Expand Down
Loading