Skip to content

Commit

Permalink
Some cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Dec 2, 2024
1 parent 8158050 commit cdcff96
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spinetoolbox/widgets/settings_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def keyPressEvent(self, e):
Args:
e (QKeyEvent): Received key press event.
"""
if e.key() == Qt.Key_Escape:
if e.key() == Qt.Key.Key_Escape:
self.update_ui_and_close()

def mousePressEvent(self, e):
Expand Down Expand Up @@ -322,10 +322,10 @@ def __init__(self, toolbox):
self._remote_host = ""
# Initial scene bg color. Is overridden immediately in read_settings() if it exists in qSettings
self.bg_color = self._toolbox.ui.graphicsView.scene().bg_color
for item in self.ui.listWidget.findItems("*", Qt.MatchWildcard):
for item in self.ui.listWidget.findItems("*", Qt.MatchFlag.MatchWildcard):
item.setSizeHint(QSize(128, 44))
# Ensure this window gets garbage-collected when closed
self.setAttribute(Qt.WA_DeleteOnClose)
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
self.connect_signals()
self.read_settings()
self._update_python_widgets_enabled(self.ui.radioButton_use_python_jupyter_console.isChecked())
Expand Down Expand Up @@ -437,7 +437,7 @@ def _update_remote_execution_page_widget_status(self, state):
def _remove_all_settings(self, _=False):
msg = ("Do you want to reset all settings to factory defaults? <b>Spine Toolbox will be shutdown</b> "

Check warning on line 438 in spinetoolbox/widgets/settings_widget.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/widgets/settings_widget.py#L438

Added line #L438 was not covered by tests
"for the changes to take effect.<br/>Continue?")
box_title = "Return to factory defaults and shutdown?"
box_title = "Close app and return to factory defaults?"
box = QMessageBox(

Check warning on line 441 in spinetoolbox/widgets/settings_widget.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/widgets/settings_widget.py#L440-L441

Added lines #L440 - L441 were not covered by tests
QMessageBox.Icon.Question,
box_title,
Expand All @@ -448,7 +448,7 @@ def _remove_all_settings(self, _=False):
box.button(QMessageBox.StandardButton.Ok).setText("Reset and Shutdown")
answer = box.exec()

Check warning on line 449 in spinetoolbox/widgets/settings_widget.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/widgets/settings_widget.py#L448-L449

Added lines #L448 - L449 were not covered by tests
if answer != QMessageBox.StandardButton.Ok:
return False
return
self._toolbox.shutdown_and_clear_settings = True
self.close()
self._toolbox.close()

Check warning on line 454 in spinetoolbox/widgets/settings_widget.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/widgets/settings_widget.py#L451-L454

Added lines #L451 - L454 were not covered by tests
Expand Down Expand Up @@ -795,7 +795,7 @@ def read_settings(self):
if save_spec == 0:
self.ui.checkBox_save_spec_before_closing.setCheckState(Qt.CheckState.Unchecked)
elif save_spec == 1:
self.ui.checkBox_save_spec_before_closing.setCheckState(Qt.PartiallyChecked)
self.ui.checkBox_save_spec_before_closing.setCheckState(Qt.CheckState.PartiallyChecked)
else: # save_spec == 2:
self.ui.checkBox_save_spec_before_closing.setCheckState(Qt.CheckState.Checked)
if spec_show_undo == 2:
Expand Down Expand Up @@ -1050,7 +1050,7 @@ def _edit_remote_host(self, new_text):
"""
prep_str = "tcp://"
if new_text.startswith(prep_str): # prep str already present
new = new_text[len(prep_str) :]
new = new_text[len(prep_str):]

Check warning on line 1053 in spinetoolbox/widgets/settings_widget.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/widgets/settings_widget.py#L1053

Added line #L1053 was not covered by tests
else: # First letter has been entered
new = new_text
# Clear when only prep str present or when clear (x) button is clicked
Expand Down

0 comments on commit cdcff96

Please sign in to comment.