Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/CeditQt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def refresh_reference_lists(self, *_args):
self.compartments_tab.set_material_ids(material_ids)
self.wall_vents_tab.set_compartment_ids(compartment_ids)
self.wall_vents_tab.set_target_ids(target_ids)
self.ceiling_floor_vents_tab.set_compartment_ids(compartment_ids)
self.ceiling_floor_vents_tab.set_compartments(self.compartments_tab.compartments)
self.ceiling_floor_vents_tab.set_target_ids(target_ids)
self.mechanical_vents_tab.set_compartments(self.compartments_tab.compartments)
self.mechanical_vents_tab.set_target_ids(target_ids)
Expand Down
16 changes: 13 additions & 3 deletions Source/CeditQt/tabs/ceiling_floor_vents_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
QWidget,
)

from cfast_case import CeilingFloorVent, CfastCase
from cfast_case import CeilingFloorVent, CfastCase, Compartment
from table_widgets import HoverEditTableWidget
from units import AREA, LENGTH, TIME, format_number, format_value, parse_number, parse_value, unit_label

Expand Down Expand Up @@ -66,6 +66,7 @@ def __init__(self, parent=None):
self.current_row = -1
self.loading_editor = False
self.compartment_ids: list[str] = []
self.compartment_sizes: dict[str, tuple[float, float]] = {}
self.target_ids: list[str] = []
self.schedules: dict[int, tuple[list[float], list[float]]] = {}
self.opening_details: dict[int, dict[str, str]] = {}
Expand Down Expand Up @@ -236,6 +237,10 @@ def build_geometry_group(self):
group.setLayout(layout)
return group

def set_compartments(self, compartments: list[Compartment]):
self.compartment_sizes = {comp.id: (comp.width, comp.depth) for comp in compartments if comp.id}
self.set_compartment_ids([comp.id for comp in compartments])

def set_compartment_ids(self, compartment_ids: list[str]):
self.compartment_ids = [comp_id for comp_id in compartment_ids if comp_id]
choices = ["Outside"] + self.compartment_ids
Expand Down Expand Up @@ -605,6 +610,11 @@ def add_vent(self):
self.summary_table.insertRow(row)

num = self.next_vent_number()
width, depth = (
self.compartment_sizes.get(self.default_first_compartment())
or self.compartment_sizes.get(self.default_second_compartment())
or (0.0, 0.0)
)
self.set_summary_row(
row,
[
Expand All @@ -614,8 +624,8 @@ def add_vent(self):
self.default_second_compartment(),
"ROUND",
format_value(AREA, 1.0),
format_value(LENGTH, 0.0),
format_value(LENGTH, 0.0),
format_value(LENGTH, width / 2.0),
format_value(LENGTH, depth / 2.0),
],
)
self.opening_details[row] = self.default_opening_details()
Expand Down
Loading