Skip to content

Commit 17cb25e

Browse files
committed
Changes based on review
- Renamed AddFeaturePanel to TemplateLibraryPanel - Changed how UI files are loaded and placed - Commented out attribute_layer from FeatureTemplate
1 parent a87a047 commit 17cb25e

6 files changed

+16
-8
lines changed

arho_feature_template/core/feature_template.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import TYPE_CHECKING, Sequence
55

66
if TYPE_CHECKING:
7-
from qgis.core import QgsMapLayer, QgsVectorLayer
7+
from qgis.core import QgsVectorLayer
88
from qgis.gui import QgsDoubleSpinBox, QgsSpinBox
99
from qgis.PyQt.QtGui import QIcon
1010
from qgis.PyQt.QtWidgets import QLineEdit
@@ -15,7 +15,7 @@ class FeatureAttribute:
1515
name: str
1616
display_name: str
1717
feature_attribte_group: str
18-
attribute_layer: QgsMapLayer # Is this correct type?
18+
# attribute_layer: QgsMapLayer # Is this correct type?
1919
additional_information: str
2020
input_field_type: QLineEdit | QgsSpinBox | QgsDoubleSpinBox | None
2121
modifiable: bool = False

arho_feature_template/core/forms/feature_attribute_form.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
from importlib import resources
2+
3+
from qgis.PyQt import uic
14
from qgis.PyQt.QtWidgets import QDialog
25

36
from arho_feature_template.core.feature_template import FeatureTemplate
4-
from arho_feature_template.qgis_plugin_tools.tools.resources import load_ui
57

8+
ui_path = resources.files(__package__) / "feature_attribute_form.ui"
9+
FormClass, _ = uic.loadUiType(ui_path)
610

7-
class FeatureAttributeForm(QDialog, load_ui("feature_attribute_form.ui")):
11+
class FeatureAttributeForm(QDialog, FormClass):
812
"""Parent class for feature forms for adding and modifying feature attribute data."""
913

1014
def __init__(self, feature_template: FeatureTemplate):

arho_feature_template/core/panels/add_feature_panel.py arho_feature_template/core/panels/template_library_panel.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
from importlib import resources
2+
3+
from qgis.PyQt import uic
14
from qgis.PyQt.QtWidgets import QWidget
25

36
from arho_feature_template.core.feature_template_library import FeatureTemplateLibrary
4-
from arho_feature_template.qgis_plugin_tools.tools.resources import load_ui
57

8+
ui_path = resources.files(__package__) / "template_library_panel.ui"
9+
FormClass, _ = uic.loadUiType(ui_path)
610

7-
class AddFeaturePanel(QWidget, load_ui("add_feature_panel.ui")):
11+
class TemplateLibraryPanel(QWidget, FormClass):
812
"""Dock widget for selecting a feature template."""
913

1014
def __init__(self, feature_template_library: FeatureTemplateLibrary):

arho_feature_template/plugin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from qgis.utils import iface
1010

1111
from arho_feature_template.core.feature_template_library import FeatureTemplateLibrary
12-
from arho_feature_template.core.panels.add_feature_panel import AddFeaturePanel
12+
from arho_feature_template.core.panels.template_library_panel import TemplateLibraryPanel
1313
from arho_feature_template.qgis_plugin_tools.tools.custom_logging import setup_logger, teardown_logger
1414
from arho_feature_template.qgis_plugin_tools.tools.i18n import setup_translation
1515
from arho_feature_template.qgis_plugin_tools.tools.resources import plugin_name, resources_path
@@ -129,7 +129,7 @@ def unload(self) -> None:
129129

130130
def run(self) -> None:
131131
self.feature_template_dock= QgsDockWidget()
132-
self.add_feature_panel = AddFeaturePanel(self.active_library)
132+
self.add_feature_panel = TemplateLibraryPanel(self.active_library)
133133
self.feature_template_dock.setWidget(self.add_feature_panel)
134134
self.feature_template_dock.setWindowTitle("ARHO") # NOTE: Placeholder name
135135

0 commit comments

Comments
 (0)