Skip to content

Commit 870e144

Browse files
committed
Make sure panels are resizable so that full GUI window can be resized
1 parent 590440e commit 870e144

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

openmc_plotter/docks.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,23 @@ def __init__(self, model, font_metric, parent=None):
9191
self.tallyPanel = TallyPanel(model, font_metric, parent, self)
9292
self.meshAnnotationPanel = MeshPanel(model, font_metric, parent, self)
9393

94+
# Wrap panels in scroll areas
95+
geometryScroll = QScrollArea()
96+
geometryScroll.setWidget(self.geometryPanel)
97+
geometryScroll.setWidgetResizable(True)
98+
99+
tallyScroll = QScrollArea()
100+
tallyScroll.setWidget(self.tallyPanel)
101+
tallyScroll.setWidgetResizable(True)
102+
103+
meshScroll = QScrollArea()
104+
meshScroll.setWidget(self.meshAnnotationPanel)
105+
meshScroll.setWidgetResizable(True)
106+
94107
# Add panels as tabs
95-
self.tabWidget.addTab(self.geometryPanel, "Geometry")
96-
self.tabWidget.addTab(self.tallyPanel, "Tallies")
97-
self.tabWidget.addTab(self.meshAnnotationPanel, "Meshes")
108+
self.tabWidget.addTab(geometryScroll, "Geometry")
109+
self.tabWidget.addTab(tallyScroll, "Tallies")
110+
self.tabWidget.addTab(meshScroll, "Meshes")
98111

99112
# Create Apply Changes button
100113
self.applyButton = QPushButton("Apply Changes")
@@ -421,18 +434,7 @@ def __init__(self, model, font_metric, main_window, parent=None):
421434
self.panelLayout.addWidget(HorizontalLine())
422435
self.panelLayout.addWidget(self.tallyColorForm)
423436

424-
# Create widget for scroll area and apply main layout
425-
self.scroll = QScrollArea()
426-
self.scroll.setWidgetResizable(True)
427-
self.widget = QWidget()
428-
self.widget.setLayout(self.panelLayout)
429-
self.scroll.setWidget(self.widget)
430-
431-
# Set scroll area as main layout
432-
mainLayout = QVBoxLayout()
433-
mainLayout.setContentsMargins(0, 0, 0, 0)
434-
mainLayout.addWidget(self.scroll)
435-
self.setLayout(mainLayout)
437+
self.setLayout(self.panelLayout)
436438

437439
def _createFilterTree(self, spatial_filters):
438440
av = self.model.activeView

0 commit comments

Comments
 (0)