Skip to content

Commit

Permalink
Title Editor: Make update-timer single-shot
Browse files Browse the repository at this point in the history
- No need to stop it after it fires
- Also, parent to class so it will be stopped if it's active when
  dialog closes (as unlikely as that may be)
  • Loading branch information
ferdnyc committed Mar 14, 2022
1 parent ee66141 commit 2bb5dce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/windows/title_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def __init__(self, *args, edit_file_path=None, duplicate=False, **kwargs):
super().__init__(*args, **kwargs)

# A timer to pause until user input stops before updating the svg
self.update_timer = QTimer()
self.update_timer = QTimer(self)
self.update_timer.setInterval(300)
self.update_timer.setSingleShot(True)
self.update_timer.timeout.connect(self.save_and_reload)

self.app = get_app()
Expand Down Expand Up @@ -366,7 +367,6 @@ def writeToFile(self, xmldoc):

def save_and_reload(self):
"""Something changed, so update temp SVG and redisplay"""
self.update_timer.stop()
self.writeToFile(self.xmldoc)
self.display_svg()

Expand Down

0 comments on commit 2bb5dce

Please sign in to comment.