(self, *, gpc, gui_vars)
| 13 | |
| 14 | class PreviewPlotCount(QWidget): |
| 15 | def __init__(self, *, gpc, gui_vars): |
| 16 | super().__init__() |
| 17 | |
| 18 | # Global processing classes |
| 19 | self.gpc = gpc |
| 20 | # Global GUI variables (used for control of GUI state) |
| 21 | self.gui_vars = gui_vars |
| 22 | |
| 23 | self.cb_color_scheme = QComboBox() |
| 24 | # TODO: make color schemes global |
| 25 | self._color_schemes = ("viridis", "jet", "bone", "gray", "Oranges", "hot") |
| 26 | self.cb_color_scheme.addItems(self._color_schemes) |
| 27 | self.cb_color_scheme.currentIndexChanged.connect(self.cb_color_scheme_current_index_changed) |
| 28 | |
| 29 | self.combo_linear_log = QComboBox() |
| 30 | self.combo_linear_log.addItems(["Linear", "Log"]) |
| 31 | self.combo_linear_log.currentIndexChanged.connect(self.combo_linear_log_current_index_changed) |
| 32 | |
| 33 | self.combo_pixels_positions = QComboBox() |
| 34 | self.combo_pixels_positions.addItems(["Pixels", "Positions"]) |
| 35 | self.combo_pixels_positions.currentIndexChanged.connect(self.combo_pixels_positions_current_index_changed) |
| 36 | |
| 37 | self.range = RangeManager(add_sliders=True) |
| 38 | self.range.setMaximumWidth(200) |
| 39 | self.range.selection_changed.connect(self.range_selection_changed) |
| 40 | |
| 41 | self.mpl_canvas = FigureCanvas(self.gpc.plot_model._fig_maps) |
| 42 | self.mpl_toolbar = NavigationToolbar(self.mpl_canvas, self) |
| 43 | |
| 44 | # Keep layout without change when canvas is hidden (invisible) |
| 45 | sp_retain = self.mpl_canvas.sizePolicy() |
| 46 | sp_retain.setRetainSizeWhenHidden(True) |
| 47 | self.mpl_canvas.setSizePolicy(sp_retain) |
| 48 | |
| 49 | vbox = QVBoxLayout() |
| 50 | |
| 51 | hbox = QHBoxLayout() |
| 52 | hbox.addWidget(self.cb_color_scheme) |
| 53 | hbox.addWidget(self.combo_linear_log) |
| 54 | hbox.addWidget(self.combo_pixels_positions) |
| 55 | hbox.addStretch(1) |
| 56 | hbox.addWidget(QLabel("Range (counts):")) |
| 57 | hbox.addWidget(self.range) |
| 58 | vbox.addLayout(hbox) |
| 59 | |
| 60 | vbox.addWidget(self.mpl_toolbar) |
| 61 | vbox.addWidget(self.mpl_canvas) |
| 62 | |
| 63 | self.setLayout(vbox) |
| 64 | |
| 65 | self._set_tooltips() |
| 66 | |
| 67 | def cb_color_scheme_current_index_changed(self, index): |
| 68 | logger.debug(f"Color scheme is changed to {self._color_schemes[index]}") |
nothing calls this directly
no test coverage detected