Skip to content

Commit

Permalink
Add Reset main window settings and Reset all settings buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Nov 29, 2024
1 parent 0d27a72 commit 239922c
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 68 deletions.
100 changes: 69 additions & 31 deletions spinetoolbox/ui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,40 +212,45 @@ def setupUi(self, SettingsForm):
self.groupBox_ui.setObjectName(u"groupBox_ui")
self.gridLayout_2 = QGridLayout(self.groupBox_ui)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.checkBox_use_smooth_zoom = QCheckBox(self.groupBox_ui)
self.checkBox_use_smooth_zoom.setObjectName(u"checkBox_use_smooth_zoom")
self.checkBox_color_toolbar_icons = QCheckBox(self.groupBox_ui)
self.checkBox_color_toolbar_icons.setObjectName(u"checkBox_color_toolbar_icons")

self.gridLayout_2.addWidget(self.checkBox_use_smooth_zoom, 10, 0, 1, 1)
self.gridLayout_2.addWidget(self.checkBox_color_toolbar_icons, 0, 0, 1, 1)

self.checkBox_datetime = QCheckBox(self.groupBox_ui)
self.checkBox_datetime.setObjectName(u"checkBox_datetime")
self.checkBox_color_properties_widgets = QCheckBox(self.groupBox_ui)
self.checkBox_color_properties_widgets.setObjectName(u"checkBox_color_properties_widgets")

self.gridLayout_2.addWidget(self.checkBox_datetime, 8, 0, 1, 1)
self.gridLayout_2.addWidget(self.checkBox_color_properties_widgets, 1, 0, 1, 1)

self.checkBox_use_curved_links = QCheckBox(self.groupBox_ui)
self.checkBox_use_curved_links.setObjectName(u"checkBox_use_curved_links")

self.gridLayout_2.addWidget(self.checkBox_use_curved_links, 4, 0, 1, 1)

self.checkBox_color_properties_widgets = QCheckBox(self.groupBox_ui)
self.checkBox_color_properties_widgets.setObjectName(u"checkBox_color_properties_widgets")
self.gridLayout_2.addWidget(self.checkBox_use_curved_links, 2, 0, 1, 1)

self.gridLayout_2.addWidget(self.checkBox_color_properties_widgets, 3, 0, 1, 1)

self.checkBox_color_toolbar_icons = QCheckBox(self.groupBox_ui)
self.checkBox_color_toolbar_icons.setObjectName(u"checkBox_color_toolbar_icons")
self.checkBox_drag_to_draw_links = QCheckBox(self.groupBox_ui)
self.checkBox_drag_to_draw_links.setObjectName(u"checkBox_drag_to_draw_links")

self.gridLayout_2.addWidget(self.checkBox_color_toolbar_icons, 2, 0, 1, 1)
self.gridLayout_2.addWidget(self.checkBox_drag_to_draw_links, 3, 0, 1, 1)

self.checkBox_prevent_overlapping = QCheckBox(self.groupBox_ui)
self.checkBox_prevent_overlapping.setObjectName(u"checkBox_prevent_overlapping")

self.gridLayout_2.addWidget(self.checkBox_prevent_overlapping, 6, 0, 1, 1)
self.gridLayout_2.addWidget(self.checkBox_prevent_overlapping, 4, 0, 1, 1)

self.checkBox_use_rounded_items = QCheckBox(self.groupBox_ui)
self.checkBox_use_rounded_items.setObjectName(u"checkBox_use_rounded_items")

self.gridLayout_2.addWidget(self.checkBox_use_rounded_items, 7, 0, 1, 1)
self.gridLayout_2.addWidget(self.checkBox_use_rounded_items, 5, 0, 1, 1)

self.checkBox_datetime = QCheckBox(self.groupBox_ui)
self.checkBox_datetime.setObjectName(u"checkBox_datetime")

self.gridLayout_2.addWidget(self.checkBox_datetime, 6, 0, 1, 1)

self.checkBox_use_smooth_zoom = QCheckBox(self.groupBox_ui)
self.checkBox_use_smooth_zoom.setObjectName(u"checkBox_use_smooth_zoom")

self.gridLayout_2.addWidget(self.checkBox_use_smooth_zoom, 7, 0, 1, 1)

self.formLayout = QFormLayout()
self.formLayout.setObjectName(u"formLayout")
Expand Down Expand Up @@ -337,12 +342,33 @@ def setupUi(self, SettingsForm):
self.formLayout.setWidget(1, QFormLayout.FieldRole, self.frame_1)


self.gridLayout_2.addLayout(self.formLayout, 12, 0, 1, 1)
self.gridLayout_2.addLayout(self.formLayout, 8, 0, 1, 1)

self.checkBox_drag_to_draw_links = QCheckBox(self.groupBox_ui)
self.checkBox_drag_to_draw_links.setObjectName(u"checkBox_drag_to_draw_links")
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.label_17 = QLabel(self.groupBox_ui)
self.label_17.setObjectName(u"label_17")

self.horizontalLayout.addWidget(self.label_17)

self.toolButton_reset_main_window = QToolButton(self.groupBox_ui)
self.toolButton_reset_main_window.setObjectName(u"toolButton_reset_main_window")
icon6 = QIcon()
icon6.addFile(u":/icons/menu_icons/undo.svg", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.toolButton_reset_main_window.setIcon(icon6)

self.gridLayout_2.addWidget(self.checkBox_drag_to_draw_links, 5, 0, 1, 1)
self.horizontalLayout.addWidget(self.toolButton_reset_main_window)

self.toolButton_reset_all_settings = QToolButton(self.groupBox_ui)
self.toolButton_reset_all_settings.setObjectName(u"toolButton_reset_all_settings")
icon7 = QIcon()
icon7.addFile(u":/icons/menu_icons/trash-alt.svg", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.toolButton_reset_all_settings.setIcon(icon7)

self.horizontalLayout.addWidget(self.toolButton_reset_all_settings)


self.gridLayout_2.addLayout(self.horizontalLayout, 9, 0, 1, 1)


self.verticalLayout_6.addWidget(self.groupBox_ui)
Expand Down Expand Up @@ -1012,7 +1038,9 @@ def setupUi(self, SettingsForm):
QWidget.setTabOrder(self.radioButton_bg_tree, self.radioButton_bg_solid)
QWidget.setTabOrder(self.radioButton_bg_solid, self.toolButton_bg_color)
QWidget.setTabOrder(self.toolButton_bg_color, self.horizontalSlider_data_flow_animation_duration)
QWidget.setTabOrder(self.horizontalSlider_data_flow_animation_duration, self.lineEdit_gams_path)
QWidget.setTabOrder(self.horizontalSlider_data_flow_animation_duration, self.toolButton_reset_main_window)
QWidget.setTabOrder(self.toolButton_reset_main_window, self.toolButton_reset_all_settings)
QWidget.setTabOrder(self.toolButton_reset_all_settings, self.lineEdit_gams_path)
QWidget.setTabOrder(self.lineEdit_gams_path, self.toolButton_browse_gams)
QWidget.setTabOrder(self.toolButton_browse_gams, self.radioButton_use_julia_basic_console)
QWidget.setTabOrder(self.radioButton_use_julia_basic_console, self.radioButton_use_julia_jupyter_console)
Expand Down Expand Up @@ -1120,22 +1148,23 @@ def retranslateUi(self, SettingsForm):
#endif // QT_CONFIG(tooltip)
self.checkBox_open_previous_project.setText(QCoreApplication.translate("SettingsForm", u"Open previous project at startup", None))
self.groupBox_ui.setTitle(QCoreApplication.translate("SettingsForm", u"UI", None))
self.checkBox_color_toolbar_icons.setText(QCoreApplication.translate("SettingsForm", u"Color toolbar icons", None))
self.checkBox_color_properties_widgets.setText(QCoreApplication.translate("SettingsForm", u"Color properties widgets", None))
#if QT_CONFIG(tooltip)
self.checkBox_use_smooth_zoom.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>Controls whether smooth or discete zoom is used in Design and Graph Views.</p></body></html>", None))
self.checkBox_use_curved_links.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>Controls whether smooth or straight connectors are used in Design View.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.checkBox_use_smooth_zoom.setText(QCoreApplication.translate("SettingsForm", u"Smooth zoom", None))
self.checkBox_use_curved_links.setText(QCoreApplication.translate("SettingsForm", u"Curved links", None))
self.checkBox_drag_to_draw_links.setText(QCoreApplication.translate("SettingsForm", u"Drag to draw links", None))
self.checkBox_prevent_overlapping.setText(QCoreApplication.translate("SettingsForm", u"Prevent items from overlapping", None))
self.checkBox_use_rounded_items.setText(QCoreApplication.translate("SettingsForm", u"Rounded items", None))
#if QT_CONFIG(tooltip)
self.checkBox_datetime.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>If checked, date and time string is appended into Event Log messages</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.checkBox_datetime.setText(QCoreApplication.translate("SettingsForm", u"Show date and time in Event Log messages", None))
#if QT_CONFIG(tooltip)
self.checkBox_use_curved_links.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>Controls whether smooth or straight connectors are used in Design View.</p></body></html>", None))
self.checkBox_use_smooth_zoom.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>Controls whether smooth or discete zoom is used in Design and Graph Views.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.checkBox_use_curved_links.setText(QCoreApplication.translate("SettingsForm", u"Curved links", None))
self.checkBox_color_properties_widgets.setText(QCoreApplication.translate("SettingsForm", u"Color properties widgets", None))
self.checkBox_color_toolbar_icons.setText(QCoreApplication.translate("SettingsForm", u"Color toolbar icons", None))
self.checkBox_prevent_overlapping.setText(QCoreApplication.translate("SettingsForm", u"Prevent items from overlapping", None))
self.checkBox_use_rounded_items.setText(QCoreApplication.translate("SettingsForm", u"Rounded items", None))
self.checkBox_use_smooth_zoom.setText(QCoreApplication.translate("SettingsForm", u"Smooth zoom", None))
self.label_7.setText(QCoreApplication.translate("SettingsForm", u"Background", None))
self.radioButton_bg_grid.setText(QCoreApplication.translate("SettingsForm", u"Grid", None))
self.radioButton_bg_tree.setText(QCoreApplication.translate("SettingsForm", u"Tree of Life", None))
Expand All @@ -1147,7 +1176,16 @@ def retranslateUi(self, SettingsForm):
self.label_4.setText(QCoreApplication.translate("SettingsForm", u"Link flash speed", None))
self.label_5.setText(QCoreApplication.translate("SettingsForm", u"Slow", None))
self.label_8.setText(QCoreApplication.translate("SettingsForm", u"Fast", None))
self.checkBox_drag_to_draw_links.setText(QCoreApplication.translate("SettingsForm", u"Drag to draw links", None))
#if QT_CONFIG(tooltip)
self.label_17.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>See tool tip in button</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.label_17.setText(QCoreApplication.translate("SettingsForm", u"Reset to factory defaults", None))
#if QT_CONFIG(tooltip)
self.toolButton_reset_main_window.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>Resets main window size, position, dock widget sizes and positions, and slider positions to factory defaults.</p><p><span style=\" font-weight:700;\">The app must be shutdown</span> for the changes to take effect, so make sure to close all windows and save the project before clicking this button.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(tooltip)
self.toolButton_reset_all_settings.setToolTip(QCoreApplication.translate("SettingsForm", u"<html><head/><body><p>Resets all settings to factory defaults.</p><p><span style=\" font-weight:700;\">The app must be shutdown</span> for the changes to take effect, so make sure to close all windows and save the project before clicking this button.</p></body></html>", None))
#endif // QT_CONFIG(tooltip)
self.groupBox_gams.setTitle(QCoreApplication.translate("SettingsForm", u"GAMS", None))
self.label_11.setText(QCoreApplication.translate("SettingsForm", u"GAMS executable", None))
#if QT_CONFIG(tooltip)
Expand Down
98 changes: 68 additions & 30 deletions spinetoolbox/ui/settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -353,27 +353,21 @@
<string>UI</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="10" column="0">
<widget class="QCheckBox" name="checkBox_use_smooth_zoom">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Controls whether smooth or discete zoom is used in Design and Graph Views.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_color_toolbar_icons">
<property name="text">
<string>Smooth zoom</string>
<string>Color toolbar icons</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="checkBox_datetime">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If checked, date and time string is appended into Event Log messages&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_color_properties_widgets">
<property name="text">
<string>Show date and time in Event Log messages</string>
<string>Color properties widgets</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_use_curved_links">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Controls whether smooth or straight connectors are used in Design View.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
Expand All @@ -384,34 +378,47 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_color_properties_widgets">
<widget class="QCheckBox" name="checkBox_drag_to_draw_links">
<property name="text">
<string>Color properties widgets</string>
<string>Drag to draw links</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_color_toolbar_icons">
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_prevent_overlapping">
<property name="text">
<string>Color toolbar icons</string>
<string>Prevent items from overlapping</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="checkBox_use_rounded_items">
<property name="text">
<string>Rounded items</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkBox_prevent_overlapping">
<widget class="QCheckBox" name="checkBox_datetime">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If checked, date and time string is appended into Event Log messages&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Prevent items from overlapping</string>
<string>Show date and time in Event Log messages</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="checkBox_use_rounded_items">
<widget class="QCheckBox" name="checkBox_use_smooth_zoom">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Controls whether smooth or discete zoom is used in Design and Graph Views.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Rounded items</string>
<string>Smooth zoom</string>
</property>
</widget>
</item>
<item row="12" column="0">
<item row="8" column="0">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
Expand Down Expand Up @@ -585,12 +592,41 @@
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="checkBox_drag_to_draw_links">
<property name="text">
<string>Drag to draw links</string>
</property>
</widget>
<item row="9" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_17">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;See tool tip in button&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Reset to factory defaults</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_reset_main_window">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Resets main window size, position, dock widget sizes and positions, and slider positions to factory defaults.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:700;&quot;&gt;The app must be shutdown&lt;/span&gt; for the changes to take effect, so make sure to close all windows and save the project before clicking this button.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="icon">
<iconset resource="resources/resources_icons.qrc">
<normaloff>:/icons/menu_icons/undo.svg</normaloff>:/icons/menu_icons/undo.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_reset_all_settings">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Resets all settings to factory defaults.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:700;&quot;&gt;The app must be shutdown&lt;/span&gt; for the changes to take effect, so make sure to close all windows and save the project before clicking this button.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="icon">
<iconset resource="resources/resources_icons.qrc">
<normaloff>:/icons/menu_icons/trash-alt.svg</normaloff>:/icons/menu_icons/trash-alt.svg</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
Expand Down Expand Up @@ -1732,6 +1768,8 @@
<tabstop>radioButton_bg_solid</tabstop>
<tabstop>toolButton_bg_color</tabstop>
<tabstop>horizontalSlider_data_flow_animation_duration</tabstop>
<tabstop>toolButton_reset_main_window</tabstop>
<tabstop>toolButton_reset_all_settings</tabstop>
<tabstop>lineEdit_gams_path</tabstop>
<tabstop>toolButton_browse_gams</tabstop>
<tabstop>radioButton_use_julia_basic_console</tabstop>
Expand Down Expand Up @@ -1805,7 +1843,7 @@
</connection>
</connections>
<buttongroups>
<buttongroup name="engine_processes_button_group"/>
<buttongroup name="persistent_processes_button_group"/>
<buttongroup name="engine_processes_button_group"/>
</buttongroups>
</ui>
Loading

0 comments on commit 239922c

Please sign in to comment.