summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2018-06-04 19:01:51 +0200
committerAndré Glüpker <git@wgmd.de>2018-06-04 19:01:51 +0200
commit7a32912c75d52e7d3d59a5ba94d1046cc9acf761 (patch)
tree8a8ffd0ee1d6f134cc7c671c9dad0976d4422506
parentdccd954f955bfb937520247a2be30e9286c5444e (diff)
download9kwpyqt-7a32912c75d52e7d3d59a5ba94d1046cc9acf761.tar.gz
9kwpyqt-7a32912c75d52e7d3d59a5ba94d1046cc9acf761.tar.bz2
9kwpyqt-7a32912c75d52e7d3d59a5ba94d1046cc9acf761.zip
Play annoying warning, when time is running short
-rwxr-xr-x9kwpyqt.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/9kwpyqt.py b/9kwpyqt.py
index 7e25142..618a211 100755
--- a/9kwpyqt.py
+++ b/9kwpyqt.py
@@ -44,6 +44,7 @@ class CaptchaGUI(QWidget):
config = None # Configuration (9kwpyqt.ini)
sound = False # QSound()
timer = False # QTimer() for 30sec timing
+ soundUrgent = False # QSound() for urgent message (low time)
running = False
startCredits = None
@@ -55,6 +56,7 @@ class CaptchaGUI(QWidget):
currentWorker = 0
offlinemessage = "Click \"Start\" to fetch next captcha."
timeleft = None
+ urgentSoundPlayed = False
waitingoncaptcha = 0
@@ -348,6 +350,7 @@ class CaptchaGUI(QWidget):
# Use config settings
self.apiurl = self.config['DEFAULT']['API_URL']+"?source=pythonapi&apikey="+self.config['DEFAULT']['API_KEY']+"&"
self.sound = QSound(os.path.join(THIS_DIR, self.config['DEFAULT']['Soundfile']))
+ self.soundUrgent = QSound(os.path.join(THIS_DIR, self.config['DEFAULT']['SoundfileUrgent']))
self.soundCheckbox.setChecked( self.config.getboolean('DEFAULT', 'Sound') )
if self.config.getboolean('DEFAULT', 'Autostart'):
self.toggleRunning(force_start=True)
@@ -373,10 +376,14 @@ class CaptchaGUI(QWidget):
def onTimerTick(self):
if not self.timeleft:
self.captchaTimer.setText("...")
+ self.urgentSoundPlayed = False
self.timer.stop()
else:
timing = self.timeleft - time.time()
self.captchaTimer.setText(str(round(timing, 1))+"s")
+ if self.soundCheckbox.isChecked() and not self.urgentSoundPlayed and timing <= 10:
+ self.urgentSoundPlayed = True
+ self.soundUrgent.play()
if timing <= 0:
self.toggleRunning(force_stop=True)
self.offlinemessage = "30 seconds passed without input."