Core module for the psyplot graphical user interface

This module redefines the psyplot.project.Project class with additional features for an interactive usage with graphical qt user interface. There is no need to import this module because the GuiProject class defined here replaces the project class in the psyplot.project module.

Classes:

MainWindow([show])

Data:

mainwindow

The PyQt5.QtWidgets.QMainWindow of the graphical user interface

class psyplot_gui.main.MainWindow(show=True)[source]

Bases: QMainWindow

Methods:

about()

About the tool

add_mp_to_menu()

change_cwd(path)

Change the current working directory

close(self)

closeEvent(event)

closeEvent reimplementation

edit_preferences([exec_])

Edit Spyder preferences

eventually_add_mp_to_menu(p)

excepthook(type, value, traceback)

A method to replace the sys.excepthook

export_mp(*args, **kwargs)

export_sp(*args, **kwargs)

focus_on_console(*args, **kwargs)

Put focus on the ipython console

load_mp_preset()

load_sp_preset()

new_data_frame_editor([df, title])

Open a new dataframe editor

new_plots([exec_])

open_external_files([fnames, project, ...])

Open external files

open_files(fnames)

Open a file and ask the user how

open_mp(*args, **kwargs)

Open a new main project

open_sp(*args, **kwargs)

Open a subproject and add it to the current main project

register_shortcut(action, shortcut[, context])

Register an action for a shortcut

reset_rcParams()

run([fnames, project, engine, plot_method, ...])

Create a mainwindow and open the given files or project

run_app(*args, **kwargs)

Create a QApplication, open the given files or project and enter the mainloop

save_mp(*args, **kwargs)

Save the current main project.

save_mp_preset()

save_sp(*args, **kwargs)

Save the current sub project.

save_sp_preset()

set_central_widget(name)

Set the central widget

setup_default_layout()

Set up the default window layout

show_dependencies([exec_])

Open a dialog that shows the dependencies

start_open_files_server()

This method listens to the open_files_port and opens the plot creator for new files

update_project_action(num)

Attributes:

central_widget_key

The key for the central widget for the main window in the plugins dictionary

console

Inprocess console

current_shortcuts

The current keyboard shortcuts

dataframeeditors

the DataFrameEditor widgets

default_shortcuts

The keyboard shortcuts of the default layout

default_widths

default widths of the dock widgets

dockwidgets

The dockwidgets of this instance

ds_tree

tree widget displaying the open datasets

figures

list of figures from the psyplot backend

figures_tree

tree widget displaying the open figures

fmt_widget

general formatoptions widget

help_explorer

help explorer

logger

The logger of this instance

open_external(*args, **kwargs)

A signal that is emmitted when the a signal is received through the open_files_server

open_files_server

The server to open external files

project_content

tab widget displaying the arrays in current main and sub project tree widget displaying the open datasets

about()[source]

About the tool

add_mp_to_menu()[source]
central_widget_key = 'console'

The key for the central widget for the main window in the plugins dictionary

change_cwd(path)[source]

Change the current working directory

close(self) bool[source]
closeEvent(event)[source]

closeEvent reimplementation

console = None

Inprocess console

current_shortcuts = []

The current keyboard shortcuts

dataframeeditors = None

the DataFrameEditor widgets

default_shortcuts = []

The keyboard shortcuts of the default layout

default_widths = {}

default widths of the dock widgets

dockwidgets = []

The dockwidgets of this instance

ds_tree = None

tree widget displaying the open datasets

edit_preferences(exec_=None)[source]

Edit Spyder preferences

eventually_add_mp_to_menu(p)[source]
excepthook(type, value, traceback)[source]

A method to replace the sys.excepthook

export_mp(*args, **kwargs)[source]
export_sp(*args, **kwargs)[source]
figures = []

list of figures from the psyplot backend

figures_tree = None

tree widget displaying the open figures

fmt_widget = None

general formatoptions widget

focus_on_console(*args, **kwargs)[source]

Put focus on the ipython console

help_explorer = None

help explorer

load_mp_preset()[source]
load_sp_preset()[source]
property logger

The logger of this instance

new_data_frame_editor(df=None, title='DataFrame Editor')[source]

Open a new dataframe editor

Parameters:
  • df (pandas.DataFrame) – The dataframe to display

  • title (str) – The title of the dock window

Returns:

The newly created editor

Return type:

psyplot_gui.dataframeeditor.DataFrameEditor

new_plots(exec_=None)[source]
open_external(*args, **kwargs)

A signal that is emmitted when the a signal is received through the open_files_server

open_external_files(fnames=[], project=None, engine=None, plot_method=None, name=None, dims=None, encoding=None, enable_post=False, seaborn_style=None, concat_dim=None, chname={}, preset=None, decoder=None)[source]

Open external files

Parameters:
  • fnames (list of str) – Either the filenames to show, or, if the project parameter is set, the a list of ,-separated filenames to make a mapping from the original filename to a new one

  • name (list of str) – The variable names to plot if the output parameter is set

  • dims (dict) – A mapping from coordinate names to integers if the project is not given

  • plot_method (str) – The name of the plot_method to use

  • project (str) – If set, the project located at the given file name is loaded

  • engine (str) – The engine to use for opening the dataset (see psyplot.data.open_dataset())

  • encoding (str) – The encoding to use for loading the project. If None, it is automatically determined by pickle. Note: Set this to 'latin1' if using a project created with python2 on python3.

  • enable_post (bool) – Enable the post processing formatoption. If True/set, post processing scripts are enabled in the given project. Only set this if you are sure that you can trust the given project file because it may be a security vulnerability.

  • seaborn_style (str) – The name of the style of the seaborn package that can be used for the seaborn.set_style() function

  • concat_dim (str) – The concatenation dimension if multiple files in fnames are provided

  • chname (dict) – A mapping from variable names in the project to variable names in the datasets that should be used instead

  • preset (str) – The filename or identifier of a preset. If the given preset is the path to an existing yaml file, it will be loaded. Otherwise we look up the preset in the psyplot configuration directory (see get_configdir()).

  • decoder (str) – Keyword arguments for the decoder.

open_files(fnames)[source]

Open a file and ask the user how

open_files_server = None

The server to open external files

open_mp(*args, **kwargs)[source]

Open a new main project

open_sp(*args, **kwargs)[source]

Open a subproject and add it to the current main project

project_content = None

tab widget displaying the arrays in current main and sub project tree widget displaying the open datasets

register_shortcut(action, shortcut, context=2)[source]

Register an action for a shortcut

reset_rcParams()[source]
classmethod run(fnames=[], project=None, engine=None, plot_method=None, name=None, dims=None, encoding=None, enable_post=False, seaborn_style=None, concat_dim=None, chname={}, preset=None, decoder=None, show=True)[source]

Create a mainwindow and open the given files or project

This class method creates a new mainwindow instance and sets the global mainwindow variable.

Parameters:
  • fnames (list of str) – Either the filenames to show, or, if the project parameter is set, the a list of ,-separated filenames to make a mapping from the original filename to a new one

  • name (list of str) – The variable names to plot if the output parameter is set

  • dims (dict) – A mapping from coordinate names to integers if the project is not given

  • plot_method (str) – The name of the plot_method to use

  • project (str) – If set, the project located at the given file name is loaded

  • engine (str) – The engine to use for opening the dataset (see psyplot.data.open_dataset())

  • encoding (str) – The encoding to use for loading the project. If None, it is automatically determined by pickle. Note: Set this to 'latin1' if using a project created with python2 on python3.

  • enable_post (bool) – Enable the post processing formatoption. If True/set, post processing scripts are enabled in the given project. Only set this if you are sure that you can trust the given project file because it may be a security vulnerability.

  • seaborn_style (str) – The name of the style of the seaborn package that can be used for the seaborn.set_style() function

  • concat_dim (str) – The concatenation dimension if multiple files in fnames are provided

  • chname (dict) – A mapping from variable names in the project to variable names in the datasets that should be used instead

  • preset (str) – The filename or identifier of a preset. If the given preset is the path to an existing yaml file, it will be loaded. Otherwise we look up the preset in the psyplot configuration directory (see get_configdir()).

  • decoder (str) – Keyword arguments for the decoder.

  • show (bool) – If True, the created mainwindow is show

Notes

  • There can be only one mainwindow at the time

  • This method does not create a QApplication instance! See run_app()

See also

run_app

classmethod run_app(*args, **kwargs)[source]

Create a QApplication, open the given files or project and enter the mainloop

Parameters:
  • fnames (list of str) – Either the filenames to show, or, if the project parameter is set, the a list of ,-separated filenames to make a mapping from the original filename to a new one

  • name (list of str) – The variable names to plot if the output parameter is set

  • dims (dict) – A mapping from coordinate names to integers if the project is not given

  • plot_method (str) – The name of the plot_method to use

  • project (str) – If set, the project located at the given file name is loaded

  • engine (str) – The engine to use for opening the dataset (see psyplot.data.open_dataset())

  • encoding (str) – The encoding to use for loading the project. If None, it is automatically determined by pickle. Note: Set this to 'latin1' if using a project created with python2 on python3.

  • enable_post (bool) – Enable the post processing formatoption. If True/set, post processing scripts are enabled in the given project. Only set this if you are sure that you can trust the given project file because it may be a security vulnerability.

  • seaborn_style (str) – The name of the style of the seaborn package that can be used for the seaborn.set_style() function

  • concat_dim (str) – The concatenation dimension if multiple files in fnames are provided

  • chname (dict) – A mapping from variable names in the project to variable names in the datasets that should be used instead

  • preset (str) – The filename or identifier of a preset. If the given preset is the path to an existing yaml file, it will be loaded. Otherwise we look up the preset in the psyplot configuration directory (see get_configdir()).

  • decoder (str) – Keyword arguments for the decoder.

  • show (bool) – If True, the created mainwindow is show

See also

run

save_mp(*args, **kwargs)[source]

Save the current main project.

save_mp_preset()[source]
save_sp(*args, **kwargs)[source]

Save the current sub project.

save_sp_preset()[source]
set_central_widget(name)[source]

Set the central widget

Parameters:

name (str or QWidget) – The key or the plugin widget in the plugins dictionary

setup_default_layout()[source]

Set up the default window layout

show_dependencies(exec_=None)[source]

Open a dialog that shows the dependencies

start_open_files_server()[source]

This method listens to the open_files_port and opens the plot creator for new files

This method is inspired and to most parts copied from spyder

update_project_action(num)[source]
psyplot_gui.main.mainwindow = None

The PyQt5.QtWidgets.QMainWindow of the graphical user interface