spinetoolbox.widgets.settings_widget

Widget for controlling user settings.

author
  1. Savolainen (VTT)

date

17.1.2018

Module Contents

Classes

SettingsWidgetBase

param qsettings

Toolbox settings

SpineDBEditorSettingsMixin

SpineDBEditorSettingsWidget

A widget to change user’s preferred settings, but only for the Spine db editor.

SettingsWidget

A widget to change user’s preferred settings.

Functions

_get_python_exe_by_kernel_name(kernel_name)

_get_python_kernel_name_by_exe(python_exe)

_get_julia_env_by_kernel_name(kernel_name)

_get_julia_kernel_name_by_env(julia_exe, julia_project)

_samefile(a, b)

class spinetoolbox.widgets.settings_widget.SettingsWidgetBase(qsettings)[source]

Bases: PySide2.QtWidgets.QWidget

Parameters

qsettings (QSettings) – Toolbox settings

connect_signals(self)[source]

Connect signals.

keyPressEvent(self, e)[source]

Close settings form when escape key is pressed.

Parameters

e (QKeyEvent) – Received key press event.

mousePressEvent(self, e)[source]

Save mouse position at the start of dragging.

Parameters

e (QMouseEvent) – Mouse event

mouseReleaseEvent(self, e)[source]

Save mouse position at the end of dragging.

Parameters

e (QMouseEvent) – Mouse event

mouseMoveEvent(self, e)[source]

Moves the window when mouse button is pressed and mouse cursor is moved.

Parameters

e (QMouseEvent) – Mouse event

update_ui(self)[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.

save_settings(self)[source]

Gets selections and saves them to persistent memory.

update_ui_and_close(self, checked=False)[source]

Updates UI to reflect current settings and close.

save_and_close(self, checked=False)[source]

Saves settings and close.

class spinetoolbox.widgets.settings_widget.SpineDBEditorSettingsMixin[source]
connect_signals(self)[source]

Connect signals.

read_settings(self)[source]

Read saved settings from app QSettings instance and update UI to display them.

save_settings(self)[source]

Get selections and save them to persistent memory.

update_ui(self)[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.

show(self)[source]
set_auto_expand_objects(self, checked=False)[source]
class spinetoolbox.widgets.settings_widget.SettingsWidget(toolbox)[source]

Bases: SpineDBEditorSettingsMixin, SettingsWidgetBase

A widget to change user’s preferred settings.

Parameters

toolbox (ToolboxUI) – Parent widget.

connect_signals(self)[source]

Connect signals.

_handle_python_kernel_changed(self, kernel_name)[source]
_handle_python_exe_changed(self)[source]
_handle_julia_kernel_changed(self, kernel_name)[source]
_handle_julia_env_changed(self)[source]
_show_install_julia_wizard(self)[source]
_show_add_up_spine_opt_wizard(self)[source]
set_auto_expand_objects(self, checked=False)[source]
browse_gams_path(self, checked=False)[source]

Open file browser where user can select a GAMS program.

browse_julia_button_clicked(self, checked=False)[source]

Calls static method that shows a file browser for selecting the Julia path.

browse_julia_project_button_clicked(self, checked=False)[source]

Calls static method that shows a file browser for selecting a Julia project.

browse_python_button_clicked(self, checked=False)[source]

Calls static method that shows a file browser for selecting Python interpreter.

show_python_kernel_editor(self, checked=False)[source]

Opens kernel editor, where user can make a kernel for the Python Console.

python_kernel_editor_closed(self, ret_code)[source]

Catches the selected Python kernel name when the editor is closed.

show_julia_kernel_editor(self, checked=False)[source]

Opens kernel editor, where user can make a kernel the Julia Console.

julia_kernel_editor_closed(self, ret_code)[source]

Catches the selected Julia kernel name when the editor is closed.

browse_work_path(self, checked=False)[source]

Open file browser where user can select the path to wanted work directory.

show_color_dialog(self, checked=False)[source]

Let user pick the bg color.

Parameters

checked (boolean) – Value emitted with clicked signal

update_bg_color(self)[source]

Set tool button icon as the selected color and update Design View scene background color.

update_scene_bg(self, checked=False)[source]

Draw background on scene depending on radiobutton states.

Parameters

checked (boolean) – Toggle state

set_toolbar_colored_icons(self, checked=False)[source]
read_settings(self)[source]

Read saved settings from app QSettings instance and update UI to display them.

read_project_settings(self)[source]

Get project name and description and update widgets accordingly.

save_settings(self)[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.

_get_julia_settings(self)[source]
update_project_settings(self)[source]

Update project name and description if these have been changed.

set_work_directory(self, new_work_dir)[source]

Sets new work directory.

Parameters

new_work_dir (str) – Possibly a new work directory

update_ui(self)[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.

spinetoolbox.widgets.settings_widget._get_python_exe_by_kernel_name(kernel_name)[source]
spinetoolbox.widgets.settings_widget._get_python_kernel_name_by_exe(python_exe)[source]
spinetoolbox.widgets.settings_widget._get_julia_env_by_kernel_name(kernel_name)[source]
spinetoolbox.widgets.settings_widget._get_julia_kernel_name_by_env(julia_exe, julia_project)[source]
spinetoolbox.widgets.settings_widget._samefile(a, b)[source]