Skip to content

Commit

Permalink
Correct some logic around apply button and "if modified" state
Browse files Browse the repository at this point in the history
  • Loading branch information
athompson673 authored Jan 17, 2025
1 parent 55e59de commit 8da0093
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions spyder/plugins/editor/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ def __init__(self, parent):
super().__init__(parent)
self.editor_config_page = parent
mouse_shortcuts = CONF.get('editor', 'mouse_shortcuts')
self.modified = False
self.setWindowFlags(self.windowFlags() &
~Qt.WindowContextHelpButtonHint)

Expand Down Expand Up @@ -497,7 +496,11 @@ def __init__(self, parent):
def apply_mouse_shortcuts(self):
self.editor_config_page.set_option('mouse_shortcuts',
self.mouse_shortcuts)
self.modified = False
self.scrollflag_shortcut.apply_modifiers()
self.goto_def_shortcut.apply_modifiers()
self.add_cursor_shortcut.apply_modifiers()
self.column_cursor_shortcut.apply_modifiers()
self.apply_button.setEnabled(False)

def accept(self):
self.apply_mouse_shortcuts()
Expand All @@ -513,9 +516,6 @@ def validate(self):
self.column_cursor_shortcut.is_changed()
)

# TODO enable/disable ok/apply based on if changed
pass

@property
def mouse_shortcuts(self):
return {'jump_to_position': self.scrollflag_shortcut.modifiers(),
Expand Down Expand Up @@ -564,7 +564,7 @@ def __init__(self, parent, label, modifiers):

self.setLayout(layout)

self.initial_modifiers = self.modifiers()
self.apply_modifiers()

def validate(self):
if (
Expand Down Expand Up @@ -593,5 +593,7 @@ def modifiers(self):
return "+".join(modifiers)

def is_changed(self):
print(self.initial_modifiers, self.modifiers())
return self.initial_modifiers != self.modifiers()
return self.current_modifiers != self.modifiers()

def apply_modifiers(self):
self.current_modifiers = self.modifiers()

0 comments on commit 8da0093

Please sign in to comment.