MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / TwoPanelWidget

Class TwoPanelWidget

pyxrf/gui_module/central_widget.py:8–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7
8class TwoPanelWidget(QSplitter):
9 def __init__(self, *, gpc, gui_vars):
10 super().__init__(Qt.Horizontal)
11
12 # Global processing classes
13 self.gpc = gpc
14 # Global GUI variables (used for control of GUI state)
15 self.gui_vars = gui_vars
16
17 self.frame_left = QFrame(self)
18 self.frame_left.setFrameShape(QFrame.StyledPanel)
19
20 self.frame_right = QFrame(self)
21 self.frame_right.setFrameShape(QFrame.StyledPanel)
22
23 self.addWidget(self.frame_left)
24 self.addWidget(self.frame_right)
25
26 hbox = QHBoxLayout()
27 self.left_panel = LeftPanel(gpc=self.gpc, gui_vars=self.gui_vars)
28 hbox.addWidget(self.left_panel)
29 self.frame_left.setLayout(hbox)
30
31 hbox = QHBoxLayout()
32 self.right_panel = RightPanel(gpc=self.gpc, gui_vars=self.gui_vars)
33 hbox.addWidget(self.right_panel)
34 self.frame_right.setLayout(hbox)
35
36 self._show_first_time = True
37
38 # Set stretch factor of the left panel to 0 (we want it to keep its width
39 # as the window is resized. The panel can still be resized manually
40 self.setStretchFactor(0, 0)
41 # Set stretch factor for the right panel to some non-zero value, e.g. 1
42 self.setStretchFactor(1, 1)
43
44 def showEvent(self, event):
45 # Set the ratio for the splitter (only the first time the window is shown)
46 if self._show_first_time:
47 self.setSizes([460, self.width() - 460])
48 self._show_first_time = False
49
50 def update_widget_state(self, condition=None):
51 self.left_panel.update_widget_state(condition)
52 self.right_panel.update_widget_state(condition)

Callers 1

initializeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected