MainWindow#
MainWindow documentation with own methods only
MainWindow documentation with inherited methods too
MainWindow with own methods only#
- class pydidas.gui.MainWindow(parent=None, geometry=None)#
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 (Union[tuple, list, 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()#
Create the instances for all registered frames.
- Raises:
PydidasGuiError – If a similar menu entry has already been registered.
Create the toolbar menu to select between different widgets in the centralWidget.
- export_main_window_state()#
Export the main window’s state.
- Returns:
The state of the main window required to restore the look.
- Return type:
dict
- register_frame(frame)#
Register a frame class with the MainWindow and add it to the PydidasFrameStack.
This method takes a
BaseFrame
and 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[pydidas.widgets.framework.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='saved', filename=None)#
Restore the window states from saved information.
This method also updates the left toolbar entry according to the restored frame.
- Parameters:
state (str, optional) – 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.
filename (Union[None, str], optional) – The filename to be used to restore the state. This kwarg will only be used if the state kwarg is set to “manual”.
- restore_main_window_state(state)#
Restore the main window’s state from saved information.
- Parameters:
state (dict) – The stored state of the main window.
- select_item(label)#
Select an item from the left toolbar and select the corresponding frame in the centralWidget.
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()#
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.
- update_status(text)#
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.
MainWindow with inherited methods too#
- class pydidas.gui.MainWindow(parent=None, geometry=None)
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 (Union[tuple, list, 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.
- check_for_updates(force_check: bool = False, auto_check: bool = False)
Check if the pydidas version is up-to-date and show a dialog if not.
- Parameters:
force_check (bool, optional) – Flag to force a check even when the user disabled checking for updates. The default is False.
auto_check (bool, optional) – Flag to signalize an automatic update check. This will only display a notice when the local and remote versions differ. The default is False.
- closeEvent(event: QEvent)
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)
Show the given temporary window.
- Parameters:
window (QtCore.QWidget) – The window to be shown.
- create_frame_instances()
Create the instances for all registered frames.
- Raises:
PydidasGuiError – If a similar menu entry has already been registered.
- create_toolbar_menu()
Create the toolbar menu to select between different widgets in the centralWidget.
- deleteLater()
Add deleteLater entries for the associated windows.
- export_gui_state(filename: Path | str)
This function exports the GUI state.
- Parameters:
filename (Union[Path, str]) – The full file system path of the configuration file.
- export_main_window_state()
Export the main window’s state.
- Returns:
The state of the main window required to restore the look.
- Return type:
dict
- register_frame(frame)
Register a frame class with the MainWindow and add it to the PydidasFrameStack.
This method takes a
BaseFrame
and 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[pydidas.widgets.framework.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)
Remove the specified window from the list of child window.
- Parameters:
name (str) – The name key for the window.
- restore_frame_states(state: dict)
Restore the states of all the frames in the PydidasFrameStack.
- Parameters:
state (dict) – The state information for all frames.
- restore_gui_state(state='saved', filename=None)
Restore the window states from saved information.
This method also updates the left toolbar entry according to the restored frame.
- Parameters:
state (str, optional) – 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.
filename (Union[None, str], optional) – The filename to be used to restore the state. This kwarg will only be used if the state kwarg is set to “manual”.
- restore_main_window_state(state)
Restore the main window’s state from saved information.
- Parameters:
state (dict) – The stored state of the main window.
- restore_window_states(state: dict)
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)
Select an item from the left toolbar and select the corresponding frame in the centralWidget.
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()
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)
Show a separate window.
- Parameters:
name (str) – The name key of the window to be shown.
- update_status(text)
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.