Skip to content

Commit a46bb91

Browse files
committed
show description of selected plan regulation in new plan regulation group form
1 parent d4a06de commit a46bb91

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

arho_feature_template/gui/new_plan_regulation_group_form.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from qgis.PyQt import uic
77
from qgis.PyQt.QtCore import Qt
8-
from qgis.PyQt.QtWidgets import QDialog, QTreeWidget, QTreeWidgetItem
8+
from qgis.PyQt.QtWidgets import QDialog, QTextBrowser, QTreeWidget, QTreeWidgetItem
99

1010
from arho_feature_template.core.plan_regulation_config import PlanRegulationConfig, PlanRegulationsSet
1111
from arho_feature_template.gui.plan_regulation_widget import PlanRegulationWidget
@@ -28,10 +28,12 @@ def __init__(self):
2828
self.plan_regulations_view: QTreeWidget
2929
self.plan_regulations_scroll_area_contents: QWidget
3030
self.plan_regulations_layout: QBoxLayout
31+
self.plan_regulation_info: QTextBrowser
3132

3233
# INIT
3334
self.initialize_plan_regulations()
3435
self.plan_regulations_view.itemDoubleClicked.connect(self.add_selected_plan_regulation)
36+
self.plan_regulations_view.itemClicked.connect(self.update_selected_plan_regulation)
3537

3638
def _initalize_regulation_from_config(self, config: PlanRegulationConfig, parent: QTreeWidgetItem | None = None):
3739
tree_item = QTreeWidgetItem(parent)
@@ -50,6 +52,10 @@ def initialize_plan_regulations(self):
5052
for config in PlanRegulationsSet.get_regulations():
5153
self._initalize_regulation_from_config(config)
5254

55+
def update_selected_plan_regulation(self, item: QTreeWidgetItem, column: int):
56+
config: PlanRegulationConfig = item.data(column, Qt.UserRole) # Retrieve the associated config
57+
self.plan_regulation_info.setText(config.description)
58+
5359
def add_selected_plan_regulation(self, item: QTreeWidgetItem, column: int):
5460
config: PlanRegulationConfig = item.data(column, Qt.UserRole) # Retrieve the associated config
5561
if config.category_only:

arho_feature_template/gui/new_plan_regulation_group_form.ui

+2-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
</widget>
148148
</item>
149149
<item>
150-
<widget class="QTextBrowser" name="textBrowser">
150+
<widget class="QTextBrowser" name="plan_regulation_info">
151151
<property name="sizePolicy">
152152
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
153153
<horstretch>0</horstretch>
@@ -159,9 +159,8 @@
159159
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
160160
p, li { white-space: pre-wrap; }
161161
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
162-
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;ESIMERKKI&lt;/span&gt;: Ilmaisee, että kaavakohde kuvaa asumisen rakennuksille tai asunnoille tarkoitetun alueen. Käytetään asemakaavoissa ilmaisemaan asuinrakennusten alueita, joille voidaan rakentaa eri tyyppisiä asuinrakennuksia. Maakunta- ja yleiskaavoissa käytetään ilmaisemaan asuntoalueita, jolla kerrosalasta pääosa on tarkoitettu asumiseen. Koodi liittyy lähtökohtaisesti kaavakohteeseen, joka on geometrialtaan alue.&lt;/p&gt;
163162
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
164-
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Kaavamääräyksen lyhyt nimi: A (AK ja YK) &amp;amp; AA (MK)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
163+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
165164
</property>
166165
</widget>
167166
</item>

0 commit comments

Comments
 (0)