GUI Kwargs Dicts Options

Provides a custom QDialog subclass that allows for the projection keyword argument dicts to be modified properly in the Projection GUI preferences.

class prism._gui.widgets.preferences.kwargs_dicts.KwargsDictBoxLayout(options_dialog_obj, *args, **kwargs)[source]

Defines the KwargsDictBoxLayout class for the preferences window.

This class provides the options entry box that gives the user access to a separate window, where the various different keyword dicts can be modified.

__init__(options_dialog_obj, *args, **kwargs)[source]

Initialize an instance of the KwargsDictBoxLayout class.

Parameters:

options_dialog_obj (OptionsDialog object) – Instance of the OptionsDialog class that acts as the parent of the KwargsDictDialog this layout creates.

Other Parameters:
 
  • args (positional arguments) – The positional arguments that must be passed to the constructor of the QHBoxLayout class.
  • kwargs (keyword arguments) – The keyword arguments that must be passed to the constructor of the QHBoxLayout class.
add_dict(*args, **kwargs)[source]

Adds a new kwargs dict to the box layout, by calling the add_page() method using the provided args and kwargs.

init()[source]

Sets up the box layout after it has been initialized.

This function is mainly responsible for initializing the KwargsDictDialog class and binding it.

class prism._gui.widgets.preferences.kwargs_dicts.KwargsDictDialog(options_dialog_obj, *args, **kwargs)[source]

Defines the KwargsDictDialog class for the preferences window.

This class provides the ‘Projection keyword argument dicts’ dialog, which allows for the various different kwargs dicts to be modified by the user.

__init__(options_dialog_obj, *args, **kwargs)[source]

Initialize an instance of the KwargsDictDialog class.

Parameters:

options_dialog_obj (OptionsDialog object) – Instance of the OptionsDialog class that acts as the parent of this dialog.

Other Parameters:
 
  • args (positional arguments) – The positional arguments that must be passed to the constructor of the QDialog class.
  • kwargs (keyword arguments) – The keyword arguments that must be passed to the constructor of the QDialog class.
add_page(name, option_key, *args, **kwargs)[source]

Initializes a new KwargsDictDialogPage object with name name and adds it to this dialog.

Parameters:
  • name (str) – The name that this kwargs dict page will have.
  • option_key (str) – The name of the options entry that this page will create. The value of option_key must correspond to the name the associated dict has in the project() method.
Other Parameters:
 
  • args (positional arguments) – The positional arguments that must be passed to the constructor of the KwargsDictDialogPage class.
  • kwargs (keyword arguments) – The keyword arguments that must be passed to the constructor of the KwargsDictDialogPage class.
init()[source]

Sets up the kwargs dict dialog after it has been initialized.

This function is mainly responsible for setting up the layout of the dialog, and making sure that new kwargs dict pages can be added.

class prism._gui.widgets.preferences.kwargs_dicts.KwargsDictDialogPage(kwargs_dict_dialog_obj, name, std_entries, banned_entries, *args, **kwargs)[source]

Defines the KwargsDictDialogPage class for the kwargs dict dialog.

This class provides the tab/page in the kwargs dict dialog where the items of the associated kwargs dict can be viewed and modified by the user.

__init__(kwargs_dict_dialog_obj, name, std_entries, banned_entries, *args, **kwargs)[source]

Initialize an instance of the KwargsDictDialogPage class.

Parameters:
  • kwargs_dict_dialog_obj (KwargsDictDialog object) – Instance of the KwargsDictDialog class that initialized this kwargs dict page.
  • name (str) – The name of this kwargs dict page.
  • std_entries (list of str) – A list of all standard entry types that this kwargs dict should accept.
  • banned_entries (list of str) – A list of all entry types that this kwargs dict should not accept. Usually, these entry types are used by PRISM and therefore should not be modified by the user.
Other Parameters:
 
  • args (positional arguments) – The positional arguments that must be passed to the constructor of the BaseBox class.
  • kwargs (keyword arguments) – The keyword arguments that must be passed to the constructor of the BaseBox class.
add_editable_entry()[source]

Adds a new editable entry to the kwargs dict page, which allows for the user to edit the contents of the kwargs dict.

This function acts as a Qt slot.

cmap_selected(cmap)[source]

Qt slot that checks a provided cmap and shows an error message if cmap is a terrible colormap.

static create_cmap_icon(cmap, size)[source]

Creates a QIcon object of the given cmap with the provided size.

Parameters:
  • cmap (Colormap object or str) – The colormap for which an icon needs to be created.
  • size (tuple) – A tuple containing the width and height dimension values of the icon to be created.
Returns:

icon (QIcon object) – The instance of the QIcon class that was created from the provided cmap and size.

create_type_alpha()[source]

Creates the ‘alpha’ entry and returns it.

create_type_cmap()[source]

Creates the ‘cmap’ entry and returns it.

create_type_color()[source]

Creates the ‘color’ entry and returns it.

create_type_dpi()[source]

Creates the ‘dpi’ entry and returns it.

create_type_figsize()[source]

Creates the ‘figsize’ entry and returns it.

create_type_linestyle()[source]

Creates the ‘linestyle’ entry and returns it.

create_type_linewidth()[source]

Creates the ‘linewidth’ entry and returns it.

create_type_marker()[source]

Creates the ‘marker’ entry and returns it.

create_type_markersize()[source]

Creates the ‘markersize’ entry and returns it.

create_type_scale(axis)[source]

Base function for creating the entry types ‘xscale’ and ‘yscale’.

create_type_xscale()[source]

Creates the ‘xscale’ entry and returns it.

create_type_yscale()[source]

Creates the ‘yscale’ entry and returns it.

entry_type_selected(entry_type, kwargs_box)[source]

Qt slot that modifies the field box associated with the provided kwargs_box to given entry_type.

Parameters:
  • entry_type (str) – The entry type that is requested for the field box.
  • kwargs_box (QW_QEditableComboBox object) – The combobox that is used for setting the entry type of this entry.
get_box_value()[source]

Returns the current value of the kwargs dict page.

Returns:page_dict (dict) – A dict containing all valid entries that are currently on this kwargs dict page. Any invalid entries (banned or empty ones) are ignored.
init()[source]

Sets up the kwargs dict page after it has been initialized.

This function is mainly responsibe for creating the layout of the page; determining what entry types are available; and preparing for the user to add entries.

remove_editable_entry(kwargs_box)[source]

Removes the editable entry associated with the provided kwargs_box.

This function acts as a Qt slot.

Parameters:kwargs_box (QW_QEditableComboBox object) – The combobox that is used for setting the entry type of this entry.
set_box_value(page_dict)[source]

Sets the current value of the kwargs dict page to page_dict.

Parameters:page_dict (dict) – A dict containing all entries that this kwargs dict page must have. Current entries that are also in page_dict will be reused, otherwise they are deleted.