From 7bafb552919492468e536b4f28f9b127b5b4af94 Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Tue, 12 Apr 2022 21:21:38 +0200 Subject: [PATCH] Correctly restart dirty flag timer --- src/tailor/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tailor/app.py b/src/tailor/app.py index 63434f7..8a8e173 100644 --- a/src/tailor/app.py +++ b/src/tailor/app.py @@ -78,6 +78,11 @@ def __init__(self): # store reference to this code in data tab self.ui.data.code = self + # set up dirty timer + self._dirty_timer = QtCore.QTimer() + self._dirty_timer.timeout.connect(self.mark_project_dirty) + + # clear all program state self.clear_all() # Enable close buttons... @@ -293,7 +298,7 @@ def mark_project_dirty(self, is_dirty=True): self.update_window_title() if not is_dirty: # FIXME: this can be implemented much better by actually detecting changes. - QtCore.QTimer.singleShot(DIRTY_TIMEOUT, self.mark_project_dirty) + self._dirty_timer.start(DIRTY_TIMEOUT) def column_moved(self, logidx, oldidx, newidx): """Move column in reaction to UI signal.