Dialogs for manipulating formatoptions.

Classes:

BasemapDialog(plotter, *args, **kwargs)

A dialog to modify the basemap settings.

CmapDialog(project, *args, **kwargs)

A dialog to modify color bounds and colormaps.

ColorbarPreview(plotter[, parent])

A preview widget of a colorbar.

FakePlotter([data, ax, auto_update, ...])

A dummy plotter for the colorbar preview.

FormatoptionsEditor(fmto, *args, **kwargs)

A widget to update a formatoption.

LabelDialog(project, *fmts)

A dialog to change labels.

LabelWidgetLine(fmto, project, fmto_widget)

A widget to change a formatoption.

class psy_view.dialogs.BasemapDialog(plotter: Plotter, *args, **kwargs)[source]

Bases: QDialog

A dialog to modify the basemap settings.

Attributes:

background_img_box

A box for selecting the background image

button_box

Button box to cancel the operator or update the plotter

colors

colors that affect the map background

default_colors

Get default colors for the color labels in widgets.

grid_labels_box

group box drawing grid lines and labels

lsm_box

group box for modifying the resolution of the land-sea-mask, see opt_110m, opt_50m, opt_10m

meridionals_box

Group box for options specific to meridionals (see opt_meri_auto, opt_meri_at and opt_meri_every, opt_meri_num)

opt_10m

Radiobutton for 10m resolution of lsm

opt_110m

Radiobutton for 110m resolution of lsm

opt_50m

Radiobutton for 50m resolution of lsm

opt_google_image

Radio button for using the google_map_detail formatoption

opt_meri_at

Radiobutton for giving the exact position of meridionals (see txt_meri_at)

opt_meri_auto

Radiobutton for automatic drawing of meridionals

opt_meri_every

Radiobutton for equal-width spaced meridionals (see txt_meri_every)

opt_meri_num

Radiobutton to draw a specific number of meridionals with equal-distance (see also txt_meri_num)

opt_para_at

Radiobutton for giving the exact position of parallels (see txt_para_at)

opt_para_auto

Radiobutton for automatic drawing of parallels

opt_para_every

Radiobutton for equal-width spaced parallels (see txt_para_every)

opt_para_num

Radiobutton to draw a specific number of parallels with equal-distance (see also txt_para_num)

opt_stock_img

Radio button for using the stock_image formatoption

parallels_box

Group box for options specific to parallels (see opt_para_auto, opt_para_at and opt_para_every, opt_para_num)

sb_google_image

Test box for specifying the detail

txt_clat

text box for the central latitude (clat formatoption)

txt_clon

text box for the central longitude (clon formatoption)

txt_grid_fontsize

text box for the fontsize of grid labels

txt_meri_at

Text field to enter the location of the meridionals on the map (see opt_meri_at)

txt_meri_every

Text box to specify the distance between two meridionals (see opt_meri_every)

txt_meri_num

Text box to set the number of meridionals to be shown (see opt_meri_num)

txt_para_at

Text field to enter the location of the parallels on the map (see opt_para_at)

txt_para_every

Text box to specify the distance between two parallels (see opt_para_every)

txt_para_num

Text box to set the number of parallels to be shown (see opt_para_num)

value

Get the formatoptions of this dialog to update a plotter.

xgrid_value

ygrid_value

Methods:

fill_from_plotter(plotter)

Fill the dialog from a given plotter.

get_colors(plotter)

Get the colors for widgets from the plotter formatoptions.

update_forms()

Update text widgets for the options to draw merdionals and parallels.

update_plotter(plotter)

Open a BasemapDialog to update a plotter.

background_img_box

A box for selecting the background image

button_box

Button box to cancel the operator or update the plotter

colors

colors that affect the map background

property default_colors: Dict[str, Any]

Get default colors for the color labels in widgets.

fill_from_plotter(plotter: Plotter) None[source]

Fill the dialog from a given plotter.

Parameters:

plotter (psy_maps.plotters.MapPlotter) – The plotter to get the formatoptions from.

get_colors(plotter: Plotter) Dict[str, Any][source]

Get the colors for widgets from the plotter formatoptions.

Parameters:

plotter (psy_maps.plotters.MapPlotter) – The plotter with the formatoptions

Returns:

A mapping from formatoptions in colors to the corresponding color in the plotter.

Return type:

dict

grid_labels_box

group box drawing grid lines and labels

lsm_box

group box for modifying the resolution of the land-sea-mask, see opt_110m, opt_50m, opt_10m

meridionals_box

Group box for options specific to meridionals (see opt_meri_auto, opt_meri_at and opt_meri_every, opt_meri_num)

opt_10m

Radiobutton for 10m resolution of lsm

opt_110m

Radiobutton for 110m resolution of lsm

opt_50m

Radiobutton for 50m resolution of lsm

opt_google_image

Radio button for using the google_map_detail formatoption

opt_meri_at

Radiobutton for giving the exact position of meridionals (see txt_meri_at)

opt_meri_auto

Radiobutton for automatic drawing of meridionals

opt_meri_every

Radiobutton for equal-width spaced meridionals (see txt_meri_every)

opt_meri_num

Radiobutton to draw a specific number of meridionals with equal-distance (see also txt_meri_num)

opt_para_at

Radiobutton for giving the exact position of parallels (see txt_para_at)

opt_para_auto

Radiobutton for automatic drawing of parallels

opt_para_every

Radiobutton for equal-width spaced parallels (see txt_para_every)

opt_para_num

Radiobutton to draw a specific number of parallels with equal-distance (see also txt_para_num)

opt_stock_img

Radio button for using the stock_image formatoption

parallels_box

Group box for options specific to parallels (see opt_para_auto, opt_para_at and opt_para_every, opt_para_num)

sb_google_image

Test box for specifying the detail

txt_clat

text box for the central latitude (clat formatoption)

txt_clon

text box for the central longitude (clon formatoption)

txt_grid_fontsize

text box for the fontsize of grid labels

txt_meri_at

Text field to enter the location of the meridionals on the map (see opt_meri_at)

txt_meri_every

Text box to specify the distance between two meridionals (see opt_meri_every)

txt_meri_num

Text box to set the number of meridionals to be shown (see opt_meri_num)

txt_para_at

Text field to enter the location of the parallels on the map (see opt_para_at)

txt_para_every

Text box to specify the distance between two parallels (see opt_para_every)

txt_para_num

Text box to set the number of parallels to be shown (see opt_para_num)

update_forms() None[source]

Update text widgets for the options to draw merdionals and parallels.

classmethod update_plotter(plotter: Plotter) None[source]

Open a BasemapDialog to update a plotter.

Parameters:

plotter (psy_maps.plotters.MapPlotter) – The plotter to update.

property value: Dict[str, Any]

Get the formatoptions of this dialog to update a plotter.

xgrid_value: str | Tuple[Any, Any] | None
ygrid_value: str | Tuple[Any, Any] | None
class psy_view.dialogs.CmapDialog(project: Project, *args, **kwargs)[source]

Bases: QDialog

A dialog to modify color bounds and colormaps.

Attributes:

button_box

Button box to accept or cancel this dialog

cbar_preview

ColorbarPreview to show a preview of the colorbar with the selected formatoption in fmt_widgets

fmt_widgets

Mapping from formatoption key to LabelWidgetLine widgets to controlling the formatoption

fmts

Map from formatoption in fmt_widgets to values.

plotter

Get the plotter with the formatoptions we use to fill this dialog.

tabs

tabs for switching between bounds (bounds_widget) and colorbar ticks (cticks_widget)

Methods:

update_preview()

Update the cbar_preview from the various fmt_widgets.

update_project(project)

Create a CmapDialog to update a project

button_box

Button box to accept or cancel this dialog

cbar_preview

ColorbarPreview to show a preview of the colorbar with the selected formatoption in fmt_widgets

fmt_widgets

Mapping from formatoption key to LabelWidgetLine widgets to controlling the formatoption

property fmts: Dict[str, Any]

Map from formatoption in fmt_widgets to values.

property plotter: Plotter

Get the plotter with the formatoptions we use to fill this dialog.

tabs

tabs for switching between bounds (bounds_widget) and colorbar ticks (cticks_widget)

update_preview() None[source]

Update the cbar_preview from the various fmt_widgets.

classmethod update_project(project: Project) None[source]

Create a CmapDialog to update a project

This classmethod creates a new CmapDialog instance, fills it with the formatoptions of the first plotter in project, enters the main event loop, and updates the project upon acceptance.

Parameters:

project (psyplot.project.Project) – The psyplot project to update

psy_view.dialogs.Color(*args, **kwds) = typing.Any

Find a more appropriate description here

Type:

TODO

class psy_view.dialogs.ColorbarPreview(plotter: Plotter, parent: QWidget | None = None, *args, **kwargs)[source]

Bases: FigureCanvasQTAgg

A preview widget of a colorbar.

This matplotlib figure contains one single axes to display the colorbar filled by the formatoptions of a given plotter.

Attributes:

fake_plotter

Create a plotter with the formatoptions of the real plotter.

plotter

The plotter to use for displaying the colorbar

Methods:

init_colorbar(plotter)

Initialize the colorbar.

resizeEvent(event)

Reimplemented to make sure we cannot get smaller than 0.

update_colorbar(**kwargs)

Update the colorbar with new formatoptions.

property fake_plotter: FakePlotter

Create a plotter with the formatoptions of the real plotter.

We can update this plotter without impacting the origin plotter

init_colorbar(plotter: Plotter) None[source]

Initialize the colorbar.

This method extracts the formatoptions of the given plotter and draws the colorbar.

plotter

The plotter to use for displaying the colorbar

resizeEvent(event: QEvent) Any[source]

Reimplemented to make sure we cannot get smaller than 0.

update_colorbar(**kwargs) None[source]

Update the colorbar with new formatoptions.

This method takes the fake_plotter, updates it from the given kwargs, updates the colorbar preview.

Parameters:

**kwargsbounds, cmap, cticks or cbar formatoption keyword-value pairs

class psy_view.dialogs.FakePlotter(data=None, ax=None, auto_update=None, project=None, draw=False, make_plot=True, clear=False, enable_post=False, **kwargs)[source]

Bases: Plotter

A dummy plotter for the colorbar preview.

Attributes:

bounds

Dummy formatoption for static type checking.

cbar

Dummy formatoption for static type checking.

cmap

Dummy formatoption for static type checking.

cticks

Dummy formatoption for static type checking.

bounds: Formatoption

Dummy formatoption for static type checking.

This is just a workaround for the static type checker to be able to tell what the FakePlotter formatoptions are, used in ColorbarPreview.fake_plotter

cbar: Formatoption

Dummy formatoption for static type checking.

This is just a workaround for the static type checker to be able to tell what the FakePlotter formatoptions are, used in ColorbarPreview.fake_plotter

cmap: Formatoption

Dummy formatoption for static type checking.

This is just a workaround for the static type checker to be able to tell what the FakePlotter formatoptions are, used in ColorbarPreview.fake_plotter

cticks: Formatoption

Dummy formatoption for static type checking.

This is just a workaround for the static type checker to be able to tell what the FakePlotter formatoptions are, used in ColorbarPreview.fake_plotter

class psy_view.dialogs.FormatoptionsEditor(fmto: Formatoption, *args, **kwargs)[source]

Bases: QWidget

A widget to update a formatoption.

This widget is a light-weight version of the psyplot_gui.fmt_widget.FormatoptionsWidget class. It contains a line editor and a text editor to set the value of a specific formatoption.

Attributes:

btn_multiline

A tool button to switch from the single line editor line_edit to the multi-line editor text_edit

changed

Check if the value in this editor differs from the original fmto.

fmto

The Formatoption that fills this widget

initial_value

Value of the fmto at the initialization of this widget

line_edit

A single line editor holding the formatoption value (see also text_edit and btn_multiline)

multiline

True if the text_edit should be visible.

text

Text of the text_edit (or line_edit).

text_edit

A multi-line editor holiding the value of fmto (see also line_edit and btn_multiline)

value

Load the value of text with yaml.

Methods:

clear_text()

Clear the editor.

get_obj()

Alias for value.

insert_obj(obj)

Add a string to the formatoption widget.

set_obj(obj)

Clear the editor and set another object.

toggle_multiline()

Switch from line_edit and text_edit or back.

btn_multiline

A tool button to switch from the single line editor line_edit to the multi-line editor text_edit

property changed: bool

Check if the value in this editor differs from the original fmto.

clear_text() None[source]

Clear the editor.

fmto

The Formatoption that fills this widget

get_obj() Any[source]

Alias for value.

initial_value

Value of the fmto at the initialization of this widget

insert_obj(obj: Any) None[source]

Add a string to the formatoption widget.

Parameters:

obj (object) – The object to insert into the line editor. it will be dumped using yaml and displayed in the text_edit (or line_edit)

line_edit

A single line editor holding the formatoption value (see also text_edit and btn_multiline)

property multiline: bool

True if the text_edit should be visible.

set_obj(obj: Any) None[source]

Clear the editor and set another object.

property text: str

Text of the text_edit (or line_edit).

text_edit

A multi-line editor holiding the value of fmto (see also line_edit and btn_multiline)

toggle_multiline() None[source]

Switch from line_edit and text_edit or back.

property value: Any

Load the value of text with yaml.

psy_view.dialogs.LSM_T(*args, **kwargs)

Find a more appropriate description here

Type:

TODO

alias of Dict[str, Any]

class psy_view.dialogs.LabelDialog(project: Project, *fmts: str)[source]

Bases: QDialog

A dialog to change labels.

This class contains one LabelWidgetLine per text formatoption.

Attributes:

fmts

Mapping from formatoption key to value in this dialog.

Methods:

update_project(project, *fmts)

Create a LabelDialog to update the labels in a project.

property fmts: Dict[str, Any]

Mapping from formatoption key to value in this dialog.

classmethod update_project(project: Project, *fmts: str) None[source]

Create a LabelDialog to update the labels in a project.

This classmethod creates a new LabelDialog instance, fills it with the formatoptions of the first plotter in project, enters the main event loop, and updates the project upon acceptance.

Parameters:
  • project (psyplot.project.Project) – The psyplot project to update. Note that we will only use the very first plotter in this project

  • *fmts – The formatoption keys to display. Each formatoption should be a subclass of psy_simple.base.TextBase

class psy_view.dialogs.LabelWidgetLine(fmto: Formatoption, project: Project, fmto_widget: Type[QtWidgets.QWidget], widget_kws: Dict[str, Any] = {}, *args, **kwargs)[source]

Bases: QGroupBox

A widget to change a formatoption.

This class holds a FormatoptionsEditor to control the appearance of a specific formatoption. Additionally it displays the formatoption specific line widget (see psyplot.plotter.Formatoption.get_fmt_widget()) to contol it.