Skip to content

Commit

Permalink
Schema 300 styles v2 (#293)
Browse files Browse the repository at this point in the history
* Applied styles-v2.

* Added automatic setup of the form widgets based on model dataclass field type declaration.

* Multiple issues (reported on initial testing phase) fixes.

---------

Co-authored-by: lukasz.debek <[email protected]>
  • Loading branch information
leendertvanwolfswinkel and ldebek committed Jan 21, 2025
1 parent 6a94fc0 commit 1efee15
Show file tree
Hide file tree
Showing 322 changed files with 15,688 additions and 55,612 deletions.
4 changes: 2 additions & 2 deletions threedi_schematisation_editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def on_3di_project_read(self):
if lm not in self.workspace_context_manager:
lm.load_all_layers(from_project=True)
self.workspace_context_manager.register_layer_manager(lm)
self.uc.bar_info("3Di User Layers registered!")
self.uc.bar_info("Project schematisations loaded!")
self.check_macros_status()
self.toggle_active_project_actions()

Expand Down Expand Up @@ -256,7 +256,7 @@ def load_schematisation(self, model_gpkg=None):
return
lm.load_all_layers()
self.workspace_context_manager.register_layer_manager(lm)
self.uc.bar_info("3Di User Layers registered!")
self.uc.bar_info(f"Schematisation {lm.model_name} loaded!")
self.check_macros_status()
self.toggle_active_project_actions()
if self.model_gpkg and not is_gpkg_connection_exists(self.model_gpkg):
Expand Down
2 changes: 2 additions & 0 deletions threedi_schematisation_editor/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ class Culvert(ModelObject):
invert_level_end: float
discharge_coefficient_positive: float
discharge_coefficient_negative: float
material_id: int
friction_value: float
friction_type: FrictionType
connection_node_id_start: int
Expand All @@ -276,6 +277,7 @@ def display_names() -> list:
"Invert level end point",
"Discharge coefficient positive",
"Discharge coefficient negative",
"Material ID",
"Friction value",
"Friction type",
"Connection node start ID",
Expand Down
4 changes: 2 additions & 2 deletions threedi_schematisation_editor/enumerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class Unit(Enum):


class MeasureVariable(Enum):
S1 = "s1"
VOL1 = "vol1"
WATER_LEVEL = "water_level"
VOLUME = "volume"


class ControlType(Enum):
Expand Down
10 changes: 6 additions & 4 deletions threedi_schematisation_editor/forms/custom_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,12 @@ def setup_tag_widgets(self):
tag_descriptions = [tag_feat["description"] for tag_feat in tags_layer.getFeatures(tag_ids)]
self.tags.setText(", ".join(tag_descriptions))

def populate_with_extra_widgets(self):
"""Populate widgets for other layers attributes."""
if self.creation is True:
self.fill_related_attributes()
self.populate_widgets()


class AbstractFormWithDistribution(AbstractBaseForm):
"""Base edit form for user layers with distribution table."""
Expand Down Expand Up @@ -1370,10 +1376,6 @@ class ConnectionNodeForm(AbstractFormWithTag):

MODEL = dm.ConnectionNode

def populate_with_extra_widgets(self):
# Populate widgets based on features attributes
self.populate_widgets()


class PipeForm(AbstractFormWithStartEndNode, AbstractFormWithXSTable, AbstractFormWithTag):
"""Pipe user layer edit form logic."""
Expand Down
4 changes: 2 additions & 2 deletions threedi_schematisation_editor/forms/ui/channel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Bank level</string>
<string>Bank level [m MSL]</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand Down Expand Up @@ -1913,7 +1913,7 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>Reference level [m]</string>
<string>Reference level [m MSL]</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Bank level [m]</string>
<string>Bank level [m MSL]</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand All @@ -928,7 +928,7 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>Reference level [m]</string>
<string>Reference level [m MSL]</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand Down
Loading

0 comments on commit 1efee15

Please sign in to comment.