Skip to content

Commit aca081c

Browse files
committed
fix: add instructions labels to fault adjacency and stratigraphic units tables
1 parent 0e8db15 commit aca081c

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

loopstructural/gui/modelling/fault_adjacency_tab.py

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,57 @@ def init_ui(self):
3333
def create_fault_adjacency_table(self):
3434
"""Create a table with QPushButtons for fault adjacency."""
3535
faults = ['Fault A', 'Fault B', 'Fault C'] # Example fault names, replace with actual data
36-
36+
# Add instructions label
37+
instructions = (
38+
"Rows: faults being affected\n"
39+
"Columns: affecting faults\n"
40+
"Toggle cell colour to indicate fault interaction:\n"
41+
"Green: row fault is cut by column fault\n"
42+
"Red: row fault stops at column fault\n"
43+
"White: no interaction"
44+
)
45+
instructions_label = QLabel(instructions)
46+
instructions_label.setWordWrap(True)
47+
self.layout().addWidget(instructions_label)
3748
self.table = QTableWidget(len(faults), len(faults), self)
3849
self.table.setHorizontalHeaderLabels(faults)
3950
self.table.setVerticalHeaderLabels(faults)
4051

4152
for row in range(len(faults)):
4253
for col in range(len(faults)):
43-
button = QPushButton()
44-
button.setStyleSheet("background-color: white;")
45-
button.clicked.connect(lambda _, b=button: self.change_button_color(b))
46-
self.table.setCellWidget(row, col, button)
54+
if row == col:
55+
# If it's the same fault, set a label instead of a button
56+
item = QTableWidgetItem(faults[row])
57+
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
58+
self.table.setItem(row, col, item)
59+
else:
60+
button = QPushButton()
61+
button.setStyleSheet("background-color: white;")
62+
button.clicked.connect(lambda _, b=button: self.change_button_color(b))
63+
self.table.setCellWidget(row, col, button)
4764

4865
def create_stratigraphic_units_table(self):
4966
"""Create a table with QPushButtons for stratigraphic units."""
67+
# Add instructions label
68+
instructions = (
69+
"Rows: stratigraphic units\n"
70+
"Columns: faults\n"
71+
"Toggle cell colour to indicate interaction:\n"
72+
"Red: unit is faulted by fault\n"
73+
"White: no interaction"
74+
)
75+
instructions_label = QLabel(instructions)
76+
instructions_label.setWordWrap(True)
77+
self.layout().addWidget(instructions_label)
5078
units = ['unit1', 'unit2', 'unit3']
5179
faults = ['Fault A', 'Fault B', 'Fault C'] # Example fault names, replace with actual data
5280

53-
self.stratigraphic_table = QTableWidget(len(units), len(faults), self)
54-
self.stratigraphic_table.setHorizontalHeaderLabels(units)
55-
self.stratigraphic_table.setVerticalHeaderLabels(faults)
81+
self.stratigraphic_table = QTableWidget(len(faults), len(units), self)
82+
self.stratigraphic_table.setHorizontalHeaderLabels(faults)
83+
self.stratigraphic_table.setVerticalHeaderLabels(units)
5684

57-
for row in range(len(units)):
58-
for col in range(len(faults)):
85+
for row in range(len(faults)):
86+
for col in range(len(units)):
5987
button = QPushButton()
6088
button.setStyleSheet("background-color: white;")
6189
button.clicked.connect(lambda _, b=button: self.change_button_colour_binary(b))

0 commit comments

Comments
 (0)