diff --git a/arho_feature_template/gui/components/additional_information_widget.py b/arho_feature_template/gui/components/additional_information_widget.py index fdd55908..c272bd39 100644 --- a/arho_feature_template/gui/components/additional_information_widget.py +++ b/arho_feature_template/gui/components/additional_information_widget.py @@ -15,6 +15,7 @@ ) from arho_feature_template.core.models import AdditionalInformation +from arho_feature_template.gui.components.required_field_label import RequiredFieldLabel from arho_feature_template.gui.components.value_input_widgets import ( ValueWidgetManager, ) @@ -72,7 +73,7 @@ def __init__(self, additional_information: AdditionalInformation, parent=None): if self.value_widget_manager.value_widget is not None else QLabel("Syötekenttää tälle tyypille ei ole vielä toteutettu") ) - self._add_widget(QLabel("Arvo"), widget) + self._add_widget(RequiredFieldLabel("Arvo:"), widget) def _add_widget(self, label: QLabel, widget: QWidget): self.form_layout.addRow(label, widget) diff --git a/arho_feature_template/gui/components/additional_information_widget.ui b/arho_feature_template/gui/components/additional_information_widget.ui index 2e1d78f1..df109dd6 100644 --- a/arho_feature_template/gui/components/additional_information_widget.ui +++ b/arho_feature_template/gui/components/additional_information_widget.ui @@ -96,7 +96,7 @@ - Laji + Laji: diff --git a/arho_feature_template/gui/components/general_regulation_group_widget.ui b/arho_feature_template/gui/components/general_regulation_group_widget.ui index 31b7bf7b..df188c0a 100644 --- a/arho_feature_template/gui/components/general_regulation_group_widget.ui +++ b/arho_feature_template/gui/components/general_regulation_group_widget.ui @@ -134,7 +134,7 @@ - Nimi + Otsikko: diff --git a/arho_feature_template/gui/components/plan_document_widget.ui b/arho_feature_template/gui/components/plan_document_widget.ui index 9b26f0ee..e5e68395 100644 --- a/arho_feature_template/gui/components/plan_document_widget.ui +++ b/arho_feature_template/gui/components/plan_document_widget.ui @@ -79,7 +79,7 @@ - Nimi + Nimi: @@ -116,7 +116,7 @@ - URL + URL: @@ -126,7 +126,7 @@ - Tyyppi + <span style="color: red;">*</span> Tyyppi: @@ -136,7 +136,7 @@ - Julkisuusluokka + <span style="color: red;">*</span> Julkisuusluokka: @@ -146,7 +146,7 @@ - Kieli + <span style="color: red;">*</span> Kieli: @@ -162,7 +162,7 @@ - Päätös + <html><head/><body><p><span style=" color:#ff0000;">*</span> Päätös:</p></body></html> @@ -175,21 +175,21 @@ - + - Henkilötietosisältö + <span style="color: red;">*</span> Henkilötietosisältö: - Säilytysaika + <span style="color: red;">*</span> Säilytysaika: @@ -203,7 +203,7 @@ - Asiakirjan päivämäärä + <html><head/><body><p><span style=" color:#ff0000;">*</span> Asiakirjan päivämäärä:</p></body></html> diff --git a/arho_feature_template/gui/components/plan_proposition_widget.ui b/arho_feature_template/gui/components/plan_proposition_widget.ui index c1b9049a..d0d9d910 100644 --- a/arho_feature_template/gui/components/plan_proposition_widget.ui +++ b/arho_feature_template/gui/components/plan_proposition_widget.ui @@ -107,7 +107,7 @@ - Sisältö + <span style="color: red;">*</span> Sisältö: diff --git a/arho_feature_template/gui/components/plan_regulation_group_widget.ui b/arho_feature_template/gui/components/plan_regulation_group_widget.ui index bda291f6..fc019c2b 100644 --- a/arho_feature_template/gui/components/plan_regulation_group_widget.ui +++ b/arho_feature_template/gui/components/plan_regulation_group_widget.ui @@ -143,7 +143,7 @@ - Nimi + Otsikko: @@ -163,7 +163,7 @@ - Lyhyt nimi + Lyhyt nimi: diff --git a/arho_feature_template/gui/components/plan_regulation_widget.py b/arho_feature_template/gui/components/plan_regulation_widget.py index 34eab7a7..27f77f87 100644 --- a/arho_feature_template/gui/components/plan_regulation_widget.py +++ b/arho_feature_template/gui/components/plan_regulation_widget.py @@ -16,6 +16,7 @@ ) from arho_feature_template.gui.components.additional_information_widget import AdditionalInformationWidget from arho_feature_template.gui.components.code_combobox import HierarchicalCodeComboBox +from arho_feature_template.gui.components.required_field_label import RequiredFieldLabel from arho_feature_template.gui.components.value_input_widgets import ( IntegerInputWidget, SinglelineTextInputWidget, @@ -84,12 +85,12 @@ def __init__(self, regulation: Regulation, parent=None): def _init_widgets(self): # Value input if self.config.default_value: - self._add_widget(QLabel("Arvo"), self.value_widget_manager.value_widget) + self._add_widget(RequiredFieldLabel("Arvo"), self.value_widget_manager.value_widget) if self.config.regulation_code == "sanallinenMaarays": self.type_of_verbal_regulation_widget = HierarchicalCodeComboBox() self.type_of_verbal_regulation_widget.populate_from_code_layer(VerbalRegulationType) - self._add_widget(QLabel("Sanallisen määräyksen laji"), self.type_of_verbal_regulation_widget) + self._add_widget(RequiredFieldLabel("Sanallisen määräyksen laji"), self.type_of_verbal_regulation_widget) if self.regulation.verbal_regulation_type_id is not None: self.type_of_verbal_regulation_widget.set_value(self.regulation.verbal_regulation_type_id) diff --git a/arho_feature_template/gui/components/plan_regulation_widget.ui b/arho_feature_template/gui/components/plan_regulation_widget.ui index ec97b39c..93e1399f 100644 --- a/arho_feature_template/gui/components/plan_regulation_widget.ui +++ b/arho_feature_template/gui/components/plan_regulation_widget.ui @@ -101,7 +101,7 @@ - Laji + Laji: diff --git a/arho_feature_template/gui/components/required_field_label.py b/arho_feature_template/gui/components/required_field_label.py new file mode 100644 index 00000000..6ce7d369 --- /dev/null +++ b/arho_feature_template/gui/components/required_field_label.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +from qgis.PyQt.QtWidgets import QLabel, QWidget + + +class RequiredFieldLabel(QLabel): + """QLabel that prefixes the text with a red asterisk.""" + + def __init__(self, text: str, parent: QWidget | None = None): + super().__init__(self._prefix(text), parent) + + def setText(self, text: str): # noqa: N802 + return super().setText(self._prefix(text)) + + @staticmethod + def _prefix(text: str) -> str: + return f'* {text}' diff --git a/arho_feature_template/gui/components/value_input_widgets.py b/arho_feature_template/gui/components/value_input_widgets.py index 0c9e0868..a8fd89a2 100644 --- a/arho_feature_template/gui/components/value_input_widgets.py +++ b/arho_feature_template/gui/components/value_input_widgets.py @@ -132,9 +132,9 @@ def __init__(self, title: str | None = None, code_list: str | None = None, code_ self.code_value_widget = SinglelineTextInputWidget(default_value=code_value, editable=True) layout = QFormLayout() - layout.addRow("Otsikko", self.title_widget) - layout.addRow("Koodisto", self.code_list_widget) - layout.addRow("Koodiarvo", self.code_value_widget) + layout.addRow("Otsikko:", self.title_widget) + layout.addRow("Koodisto:", self.code_list_widget) + layout.addRow('* Koodiarvo:', self.code_value_widget) self.setLayout(layout) def get_value(self) -> tuple[str | None, str | None, str | None]: diff --git a/arho_feature_template/gui/dialogs/plan_attribute_form.ui b/arho_feature_template/gui/dialogs/plan_attribute_form.ui index af09f1e7..28218ab0 100644 --- a/arho_feature_template/gui/dialogs/plan_attribute_form.ui +++ b/arho_feature_template/gui/dialogs/plan_attribute_form.ui @@ -80,7 +80,7 @@ - Pysyvä kaavatunnus: + <html><head/><body><p>Pysyvä kaavatunnus:</p></body></html> permanent_identifier_line_edit @@ -97,7 +97,7 @@ - Nimi*: + <html><head/><body><p><span style=" color:#ff0000;">*</span> Nimi:</p></body></html> name_line_edit @@ -114,7 +114,7 @@ - Kuvaus: + <html><head/><body><p>Kuvaus:</p></body></html> description_text_edit @@ -131,7 +131,7 @@ - Kaavalaji*: + <span style="color: red;">*</span> Kaavalaji: plan_type_combo_box @@ -148,7 +148,7 @@ - Elinkaaren tila*: + <span style="color: red;">*</span> Elinkaaren tila: lifecycle_status_combo_box @@ -165,7 +165,7 @@ - Organisaatio*: + <span style="color: red;">*</span> Organisaatio: diff --git a/arho_feature_template/gui/dialogs/plan_feature_form.ui b/arho_feature_template/gui/dialogs/plan_feature_form.ui index 3e0705c3..9081504b 100644 --- a/arho_feature_template/gui/dialogs/plan_feature_form.ui +++ b/arho_feature_template/gui/dialogs/plan_feature_form.ui @@ -26,7 +26,7 @@ - Nimi + Nimi: @@ -36,7 +36,7 @@ - Kuvaus + Kuvaus: @@ -53,7 +53,7 @@ - Maanalaisuus + <html><head/><body><p><span style=" color:#ff0000;">*</span> Maanalaisuus:</p></body></html> diff --git a/arho_feature_template/gui/dialogs/plan_regulation_group_form.ui b/arho_feature_template/gui/dialogs/plan_regulation_group_form.ui index fddd83fb..3a0ce103 100644 --- a/arho_feature_template/gui/dialogs/plan_regulation_group_form.ui +++ b/arho_feature_template/gui/dialogs/plan_regulation_group_form.ui @@ -29,7 +29,7 @@ - Otsikko + Otsikko: @@ -39,7 +39,7 @@ - Lyhyt nimi + Lyhyt nimi: @@ -49,7 +49,7 @@ - Ryhmänumero + Ryhmänumero: @@ -69,7 +69,7 @@ - Värikoodi + Värikoodi: @@ -79,7 +79,7 @@ - Tyyppi + <html><head/><body><p><span style=" color:#ff0000;">*</span> Tyyppi:</p></body></html> @@ -154,8 +154,8 @@ p, li { white-space: pre-wrap; } 0 0 - 38 - 18 + 587 + 577 @@ -193,8 +193,8 @@ p, li { white-space: pre-wrap; } 0 0 - 120 - 49 + 851 + 577