spinetoolbox.widgets.settings_widget
Widget for controlling user settings.
Module Contents
Classes
|
|
A widget to change user's preferred settings, but only for the Spine db editor. |
|
A widget to change user's preferred settings. |
Functions
|
Returns the kernel name corresponding to given executable or an empty string if not found. |
Checks if given Julia kernel's project matches the given Julia project. |
|
|
- class spinetoolbox.widgets.settings_widget.SettingsWidgetBase(qsettings)[source]
Bases:
PySide6.QtWidgets.QWidget
- Parameters
qsettings (QSettings) – Toolbox settings
- keyPressEvent(e)[source]
Close settings form when escape key is pressed.
- Parameters
e (QKeyEvent) – Received key press event.
- mousePressEvent(e)[source]
Save mouse position at the start of dragging.
- Parameters
e (QMouseEvent) – Mouse event
- mouseReleaseEvent(e)[source]
Save mouse position at the end of dragging.
- Parameters
e (QMouseEvent) – Mouse event
- mouseMoveEvent(e)[source]
Moves the window when mouse button is pressed and mouse cursor is moved.
- Parameters
e (QMouseEvent) – Mouse event
- class spinetoolbox.widgets.settings_widget.SpineDBEditorSettingsMixin[source]
- class spinetoolbox.widgets.settings_widget.SpineDBEditorSettingsWidget(multi_db_editor)[source]
Bases:
SpineDBEditorSettingsMixin
,SettingsWidgetBase
A widget to change user’s preferred settings, but only for the Spine db editor.
Initialize class.
- class spinetoolbox.widgets.settings_widget.SettingsWidget(toolbox)[source]
Bases:
SpineDBEditorSettingsMixin
,SettingsWidgetBase
A widget to change user’s preferred settings.
- Parameters
toolbox (ToolboxUI) – Parent widget.
Returns a context-menu for Python kernel comboBox.
Returns a context-menu for Julia kernel comboBox.
- eventFilter(o, event)[source]
Event filter that catches mouse right button release events. This event typically closes the context-menu, but we want to prevent this and show a context-menu instead.
- Parameters
o (QObject) – Watcher
event (QEvent) – Event
- Returns
True when event is caught, False otherwise
- Return type
bool
- _update_python_widgets_enabled(state)[source]
Enables or disables some widgets based on given boolean state.
- _update_julia_widgets_enabled(state)[source]
Enables or disables some widgets based on given boolean state.
- _update_remote_execution_page_widget_status(state)[source]
Enables or disables widgets on Remote Execution page, based on the state of remote execution enabled check box.
- browse_gams_button_clicked(_=False)[source]
Calls static method that shows a file browser for selecting a Gams executable.
- browse_julia_button_clicked(_=False)[source]
Calls static method that shows a file browser for selecting a Julia path.
- browse_julia_project_button_clicked(_=False)[source]
Calls static method that shows a folder browser for selecting a Julia project.
- browse_python_button_clicked(_=False)[source]
Calls static method that shows a file browser for selecting a Python interpreter.
- browse_conda_button_clicked(_=False)[source]
Calls static method that shows a file browser for selecting a Conda executable.
- browse_certificate_directory_clicked(_=False)[source]
Calls static method that shows a file browser for selecting the security folder for Engine Server.
- make_python_kernel(_=False)[source]
Makes a Python kernel for Jupyter Console based on selected Python interpreter. If a kernel using this Python interpreter already exists, sets that kernel selected in the comboBox.
- make_julia_kernel(_=False)[source]
Makes a Julia kernel for Jupyter Console based on selected Julia executable and Julia project. If a kernel using the selected Julia executable and project already exists, sets that kernel selected in the comboBox.
Shows the context-menu on Python kernels combobox.
Shows the context-menu on Julia kernels combobox.
Shows the context-menu on Python kernels combobox popup list.
Shows the context-menu on Julia kernels combobox popup list.
- browse_work_path(_=False)[source]
Open file browser where user can select the path to wanted work directory.
- update_bg_color()[source]
Set tool button icon as the selected color and update Design View scene background color.
- read_settings()[source]
Read saved settings from app QSettings instance and update UI to display them.
- save_settings()[source]
Get selections and save them to persistent memory. Note: On Linux, True and False are saved as boolean values into QSettings. On Windows, booleans and integers are saved as strings. To make it consistent, we should use strings.
- _save_engine_settings()[source]
Stores Engine settings to application settings.
- Returns
True if settings were stored successfully, False otherwise
- Return type
bool
- set_work_directory(new_work_dir)[source]
Sets new work directory.
- Parameters
new_work_dir (str) – Possibly a new work directory
- update_ui()[source]
Updates UI to reflect current settings. Called when the user choses to cancel their changes. Undoes all temporary UI changes that resulted from the user playing with certain settings.
- _edit_remote_host(new_text)[source]
Prepends host line edit with the protocol for user convenience.
- Parameters
new_text (str) – Text in the line edit after user has entered a character
- add_julia_kernel(kernel_name, resource_dir, conda, icon, deats)[source]
Adds a kernel entry as an item to Julia kernels comboBox.
- restore_saved_julia_kernel()[source]
Sets saved or given julia kernel selected after kernels have been loaded.
- start_fetching_python_kernels(conda_path_updated=False)[source]
Starts a thread for fetching Python kernels.
- add_python_kernel(kernel_name, resource_dir, conda, icon, deats)[source]
Adds a kernel entry as an item to Python kernels comboBox.
- restore_saved_python_kernel()[source]
Sets saved or given python kernel selected after kernels have been loaded.
- spinetoolbox.widgets.settings_widget._get_kernel_name_by_exe(p, kernel_model)[source]
Returns the kernel name corresponding to given executable or an empty string if not found.
- Parameters
p (str) – Absolute path to an executable
kernel_model (QStandardItemModel) – Model containing items, which contain kernel spec details as item data
- Returns
Kernel name or an empty string
- Return type
str
- spinetoolbox.widgets.settings_widget._selected_project_matches_kernel_project(julia_kernel_name, julia_project, kernel_model)[source]
Checks if given Julia kernel’s project matches the given Julia project.
- Parameters
julia_kernel_name (str) – Kernel name
julia_project (str) – Path or some other string (e.g. ‘@.’) to denote the Julia project
kernel_model (QStandardItemModel) – Model containing kernels
- Returns
True if projects match, False otherwise
- Return type
bool