Skip to content

Commit 6582d43

Browse files
committedSep 13, 2024·
architecture planning continued
1 parent cbfafc3 commit 6582d43

File tree

6 files changed

+118
-16
lines changed

6 files changed

+118
-16
lines changed
 

‎arho_feature_template/core/add_feature_form.py ‎arho_feature_template/core/forms/add_feature_form.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from qgis.PyQt.QtWidgets import QDialog
2-
31
from arho_feature_template.core.feature_template import FeatureTemplate
2+
from arho_feature_template.core.forms.feature_attribute_form import \
3+
FeatureAttributeForm
44

55

6-
class AddFeatureForm(QDialog):
6+
class AddFeatureForm(FeatureAttributeForm):
77
"""Dialog for filling and saving attribute data that opens when a new feature has been digitized."""
88

99
def __init__(self, feature_template: FeatureTemplate):
10-
self.feature_template = feature_template
10+
super().__init__(feature_template)
1111

1212
def _init_feature_attributes(self):
1313
# for feature_attribute in self.feature_template.feature_attributes:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from qgis.PyQt.QtWidgets import QDialog
2+
3+
from arho_feature_template.core.feature_template import FeatureTemplate
4+
from arho_feature_template.qgis_plugin_tools.tools.resources import load_ui
5+
6+
7+
class FeatureAttributeForm(QDialog, load_ui("feature_attribute_form.ui")):
8+
"""Parent class for feature forms for adding and modifying feature attribute data."""
9+
10+
def __init__(self, feature_template: FeatureTemplate):
11+
super().__init__()
12+
self.setupUi(self)
13+
self.feature_template = feature_template
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
21
from qgis.PyQt.QtWidgets import QWidget
32

4-
from arho_feature_template.core.feature_template_library import FeatureTemplateLibrary
5-
from arho_feature_template.qgis_plugin_tools.tools.resources import load_ui # noqa F401
3+
from arho_feature_template.core.feature_template_library import \
4+
FeatureTemplateLibrary
5+
from arho_feature_template.qgis_plugin_tools.tools.resources import load_ui
66

77

8-
# class AddFeaturePanel(QWidget, load_ui("add_feature_panel.ui")): # NOTE: UI file does not exist yet
9-
class AddFeaturePanel(QWidget):
8+
class AddFeaturePanel(QWidget, load_ui("add_feature_panel.ui")):
109
"""Dock widget for selecting a feature template."""
1110

1211
def __init__(self, feature_template_library: FeatureTemplateLibrary):
1312
super().__init__()
14-
# self.setupUi(self)
13+
self.setupUi(self)
1514
self.initialize_from_library(feature_template_library)
1615

17-
1816
def initialize_from_library(self, feature_template_library: FeatureTemplateLibrary):
1917
# Initialization logic
2018
self.library = feature_template_library

‎arho_feature_template/plugin.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
from qgis.PyQt.QtWidgets import QAction, QWidget
99
from qgis.utils import iface
1010

11-
from arho_feature_template.core.add_feature_panel import AddFeaturePanel
12-
from arho_feature_template.core.feature_template_library import FeatureTemplateLibrary
13-
from arho_feature_template.qgis_plugin_tools.tools.custom_logging import setup_logger, teardown_logger
14-
from arho_feature_template.qgis_plugin_tools.tools.i18n import setup_translation
15-
from arho_feature_template.qgis_plugin_tools.tools.resources import plugin_name, resources_path
11+
from arho_feature_template.core.feature_template_library import \
12+
FeatureTemplateLibrary
13+
from arho_feature_template.core.panels.add_feature_panel import AddFeaturePanel
14+
from arho_feature_template.qgis_plugin_tools.tools.custom_logging import (
15+
setup_logger, teardown_logger)
16+
from arho_feature_template.qgis_plugin_tools.tools.i18n import \
17+
setup_translation
18+
from arho_feature_template.qgis_plugin_tools.tools.resources import (
19+
plugin_name, resources_path)
1620

1721
LIBRARY_JSON = resources_path("asemakaava-template-library-test.json")
1822

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>Form</class>
4+
<widget class="QWidget" name="Form">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>640</width>
10+
<height>480</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
</widget>
17+
<resources/>
18+
<connections/>
19+
</ui>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>Dialog</class>
4+
<widget class="QDialog" name="Dialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>640</width>
10+
<height>480</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<widget class="QDialogButtonBox" name="buttonBox">
17+
<property name="geometry">
18+
<rect>
19+
<x>10</x>
20+
<y>440</y>
21+
<width>621</width>
22+
<height>32</height>
23+
</rect>
24+
</property>
25+
<property name="orientation">
26+
<enum>Qt::Horizontal</enum>
27+
</property>
28+
<property name="standardButtons">
29+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
30+
</property>
31+
</widget>
32+
</widget>
33+
<resources/>
34+
<connections>
35+
<connection>
36+
<sender>buttonBox</sender>
37+
<signal>accepted()</signal>
38+
<receiver>Dialog</receiver>
39+
<slot>accept()</slot>
40+
<hints>
41+
<hint type="sourcelabel">
42+
<x>248</x>
43+
<y>254</y>
44+
</hint>
45+
<hint type="destinationlabel">
46+
<x>157</x>
47+
<y>274</y>
48+
</hint>
49+
</hints>
50+
</connection>
51+
<connection>
52+
<sender>buttonBox</sender>
53+
<signal>rejected()</signal>
54+
<receiver>Dialog</receiver>
55+
<slot>reject()</slot>
56+
<hints>
57+
<hint type="sourcelabel">
58+
<x>316</x>
59+
<y>260</y>
60+
</hint>
61+
<hint type="destinationlabel">
62+
<x>286</x>
63+
<y>274</y>
64+
</hint>
65+
</hints>
66+
</connection>
67+
</connections>
68+
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.