Skip to content

Commit

Permalink
chore: Refactor code to remove unnecessary time delay in startButton …
Browse files Browse the repository at this point in the history
…click event handler
  • Loading branch information
LyubomirT committed Jul 26, 2024
1 parent d021e69 commit 59ddff6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def start_typing(self):

self.startButton.setEnabled(False)
self.stopButton.setEnabled(True)
QTimer.singleShot(delay * 1000, lambda: self.initiate_typing(text, interval, type_enter, chars_per_stroke))
time.sleep(delay)
self.initiate_typing(text, interval, type_enter, chars_per_stroke)

def initiate_typing(self, text, interval, type_enter, chars_per_stroke):
self.thread = TypingThread(text, interval, type_enter, chars_per_stroke)
Expand All @@ -66,7 +67,7 @@ def initiate_typing(self, text, interval, type_enter, chars_per_stroke):

def update_progress(self, value):
self.progressBar.setValue(value)

def typing_finished(self):
self.startButton.setEnabled(True)
self.stopButton.setEnabled(False)
Expand Down

0 comments on commit 59ddff6

Please sign in to comment.