def setup_line_selection(self) -> None: """Setup the row for selecting new lines.""" self.combo_lines = QtWidgets.QComboBox() self.combo_lines.setEditable(False) self.combo_lines.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.combo_lines.currentIndexChanged.connect(self.trigger_refresh) self.btn_add = utils.add_pushbutton(QtGui.QIcon(get_psy_icon('plus')), lambda: self.add_line(), "Add a line to the plot", icon=True) self.btn_del = utils.add_pushbutton(QtGui.QIcon(get_psy_icon('minus')), self.remove_line, "Add a line to the plot", icon=True)
def setup_projection_buttons(self) -> None: """Set up the buttons to modify the basemap.""" self.btn_proj = utils.add_pushbutton(self.get_projection_label( rcParams["projections"][0]), self.choose_next_projection, "Change the basemap projection", toolbutton=True) self.btn_proj.setMenu(self.setup_projection_menu()) self.btn_proj.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.btn_proj.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup) self.btn_proj_settings = utils.add_pushbutton( utils.get_icon('proj_settings'), self.edit_basemap_settings, "Edit basemap settings", icon=True)
def setup_color_buttons(self) -> None: """Set up the buttons to change the colormap, etc.""" self.btn_cmap = pswc.CmapButton() self.btn_cmap.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.btn_cmap.setToolTip("Select a different colormap") self.btn_cmap.colormap_changed.connect(self.set_cmap) self.btn_cmap.colormap_changed[mcol.Colormap].connect(self.set_cmap) self.setup_cmap_menu() self.btn_cmap_settings = utils.add_pushbutton( utils.get_icon('color_settings'), self.edit_color_settings, "Edit color settings", icon=True)
def setup_plot_buttons(self) -> None: """Setup the second row of formatoption widgets.""" self.combo_plot = QtWidgets.QComboBox() self.plot_types: List[Optional[PlotType]] = [ PlotType.mesh, PlotType.contourf, PlotType.contour, PlotType.poly, None ] self.combo_plot.setEditable(False) self.combo_plot.addItems([ "Default", "Filled contours", "Contours", "Gridcell polygons", "Disable" ]) self.combo_plot.currentIndexChanged.connect(self._set_plot_type) self.btn_datagrid = utils.add_pushbutton( "Gridcell boundaries", self.toggle_datagrid, "Toggle the visibility of grid cell boundaries") self.btn_datagrid.setCheckable(True) return
def setup_labels_button(self) -> None: """Add a button to modify the text labels.""" self.btn_labels = utils.add_pushbutton( "Edit labels", self.edit_labels, "Edit title, colorbar labels, etc.")