MainWindow#
MainWindow documentation with own methods only
MainWindow documentation with inherited methods too
MainWindow with own methods only#
- class pydidas.gui.MainWindow(parent: QWidget | None = None, geometry: tuple | list | None = None, export_exit_state: bool = True)#
Inherits from
qtpy.QtWidgets.QMainWindow.The MainWindow is used to organize frames and for managing the menu and global application parameters.
- Parameters:
parent (QtWidgets.QWidget, optional) – The widget’s parent. The default is None.
geometry (tuple or list or None, optional) – The geometry as a 4-tuple or list. The entries are the top left corner coordinates (x0, y0) and width and height. If None, the default values will be used. The default is None.
- create_frame_instances() None#
Create the instances for all registered frames.
Create the toolbar menu to select between widgets in the FrameStack.
- export_main_window_state() dict#
Export the main window’s state.
- Returns:
The state of the main window required to restore the look.
- Return type:
dict
- register_frame(frame: type[BaseFrame]) None#
Register a frame class with the MainWindow and add it to the PydidasFrameStack.
This method takes a
BaseFrameand creates an instance which is registers with the PydidasFrameStack. It also stores the required metadata to create an actionbar link to open the frame.- Parameters:
frame (type[BaseFrame]) – The class of the Frame. This must be a subclass of BaseFrame. If a string is passed, an empty frame class with the metadata given by title, menu_entry and icon is created.
- restore_gui_state(state: str = 'saved', filename: str | Path | None = None) None#
Restore the window states from saved information.
This method also updates the left toolbar entry according to the restored frame.
- Parameters:
state (str) – The state to be restored. Can be “saved” to restore the last saved state, “exit” to restore the state on exit or “manual” to manually give a filename. The default is “saved”.
filename (str or Path or None, optional) – The filename to be used to restore the state. This kwarg will only be used if the state kwarg is set to “manual”. The default is None.
- restore_main_window_state(state: dict) None#
Restore the main window’s state from saved information.
- Parameters:
state (dict) – The stored state of the main window.
- select_item(label: str) None#
Handle the selection of an item from the left toolbar.
For labels that have frames attached to them, this method will show the frame. For labels which are only entries in the menu tree, this method will show/hide the respective toolbar.
- Parameters:
label (str) – The label of the selected item.
- show() None#
Insert a create_toolbar_menu method call into the show method if the toolbars have not been created at the time of the show call.
MainWindow with inherited methods too#
- class pydidas.gui.MainWindow(parent: QWidget | None = None, geometry: tuple | list | None = None, export_exit_state: bool = True)
Inherits from
qtpy.QtWidgets.QMainWindow.The MainWindow is used to organize frames and for managing the menu and global application parameters.
- Parameters:
parent (QtWidgets.QWidget, optional) – The widget’s parent. The default is None.
geometry (tuple or list or None, optional) – The geometry as a 4-tuple or list. The entries are the top left corner coordinates (x0, y0) and width and height. If None, the default values will be used. The default is None.
- class PaintDeviceMetric(*values)
- class RenderFlag(*values)
- check_for_updates(force_check: bool = False, auto_check: bool = False) None
Check if the pydidas version is up-to-date and show a dialog if not.
- Parameters:
- closeEvent(event: QEvent) None
Handle the Qt closeEvent.
This method adds calls to the child windows to close themselves.
- Parameters:
event (QtCore.QEvent) – The closing event.
- create_and_show_temp_window(window: QWidget) None
Show the given temporary window.
- Parameters:
window (type[QtWidgets.QWidget]) – The window class to be instantiated and shown.
- create_frame_instances() None
Create the instances for all registered frames.
- create_toolbar_menu() None
Create the toolbar menu to select between widgets in the FrameStack.
- deleteLater() None
Add deleteLater entries for the associated windows.
- export_gui_state(filename: Path | str) None
This function exports the GUI state.
- Parameters:
filename (Path or str) – The full file system path of the configuration file.
- export_main_window_state() dict
Export the main window’s state.
- Returns:
The state of the main window required to restore the look.
- Return type:
dict
- painters
ushort
- q_settings_get(key: str, dtype: type[Integral] | type[Real] | type | None = None, default: Any | None = None) Any
Get the value from a QSetting key.
- Parameters:
key (str) – The QSetting reference key.
dtype (type[Integral] | type[Real] | Type | None, optional) – A return datatype. If not None, the output will be returned as dtype(value), otherwise, the generic string/int will be returned. The default is None.
default (Any, optional) – The default value which is returned if the key defaults to None. The default is None.
- Returns:
value – The value, converted to the type associated with the Parameter referenced by param_key or dtype, if given.
- Return type:
Any
- q_settings_remove(key: str)
Remove a stored QSettings key.
- Parameters:
key (str) – The name of the key to be deleted.
- q_settings_set(key: str, value: Any)
Set the value of a QSettings key.
- Parameters:
key (str) – The name of the key.
value (Any) – The value to be stored.
- register_frame(frame: type[BaseFrame]) None
Register a frame class with the MainWindow and add it to the PydidasFrameStack.
This method takes a
BaseFrameand creates an instance which is registers with the PydidasFrameStack. It also stores the required metadata to create an actionbar link to open the frame.- Parameters:
frame (type[BaseFrame]) – The class of the Frame. This must be a subclass of BaseFrame. If a string is passed, an empty frame class with the metadata given by title, menu_entry and icon is created.
- remove_window_from_children(name: str) None
Remove the specified window from the list of child window.
- Parameters:
name (str) – The name key for the window.
- restore_frame_states(state: dict) None
Restore the states of all the frames in the PydidasFrameStack.
- Parameters:
state (dict) – The state information for all frames.
- restore_gui_state(state: str = 'saved', filename: str | Path | None = None) None
Restore the window states from saved information.
This method also updates the left toolbar entry according to the restored frame.
- Parameters:
state (str) – The state to be restored. Can be “saved” to restore the last saved state, “exit” to restore the state on exit or “manual” to manually give a filename. The default is “saved”.
filename (str or Path or None, optional) – The filename to be used to restore the state. This kwarg will only be used if the state kwarg is set to “manual”. The default is None.
- restore_main_window_state(state: dict) None
Restore the main window’s state from saved information.
- Parameters:
state (dict) – The stored state of the main window.
- restore_window_states(state: dict) None
Get the states of the main’s child windows for exporting.
- Returns:
state – The dictionary with the required information to store and restore window states.
- Return type:
dict
- select_item(label: str) None
Handle the selection of an item from the left toolbar.
For labels that have frames attached to them, this method will show the frame. For labels which are only entries in the menu tree, this method will show/hide the respective toolbar.
- Parameters:
label (str) – The label of the selected item.
- show() None
Insert a create_toolbar_menu method call into the show method if the toolbars have not been created at the time of the show call.
- show_window(name: str) None
Show a separate window.
- Parameters:
name (str) – The name key of the window to be shown.
- update_status(text: str) None
Get a text message and show it in the global status widget.
This slot can be used by any QObject to send an update which will be added to the global list of status messages.
- Parameters:
text (str) – The status message.