From 1a19a6e89ff1e3efe856a5184af89f96e736b38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Wed, 6 Apr 2016 15:31:28 +0200 Subject: Remove Submit/Skip Button Use enter/return to submit. Use escape or submit an empty message to skip. --- 9kwpyqt.py | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/9kwpyqt.py b/9kwpyqt.py index 51da3b0..ed796de 100755 --- a/9kwpyqt.py +++ b/9kwpyqt.py @@ -71,12 +71,8 @@ class CaptchaGUI(QWidget): self.statsLabel = QLabel("online stats") self.statsLabel.setAlignment(Qt.AlignRight) - # self.timerLabel.setStyleSheet("QLabel { color: darkred; }") - self.LayoutStats = QHBoxLayout() self.LayoutStats.addWidget(self.accountLabel) - # self.LayoutStats.addWidget(self.timerLabel) - # self.LayoutStats.addWidget(self.timerProgress) self.LayoutStats.addWidget(self.statsLabel) self.LayoutStats.sizeConstraint = QLayout.SetMinimumSize @@ -93,30 +89,18 @@ class CaptchaGUI(QWidget): self.captchaBox = QHBoxLayout() self.captchaBox.addWidget(self.captchaImage) - # Bottom: Input + Submit/Skip-Buttons + # Bottom: StartStop/Sound-Button self.captchaInputLine = QLineEdit() self.startstopButton = QPushButton("Start") self.startstopButton.setCheckable(True) - # self.saveImageButton = QPushButton("Sa&ve Image") - self.submitButton = QPushButton("&Submit") - self.skipButton = QPushButton("S&kip") self.startstopButton.clicked.connect(self.toggleRunning) - # self.saveImageButton.clicked.connect(self.saveImage) - self.submitButton.clicked.connect(self.submitCaptcha) - self.skipButton.clicked.connect(self.skipCaptcha) - - self.LayoutSubmitLine = QHBoxLayout() - self.LayoutSubmitLine.addWidget(self.startstopButton) - self.LayoutSubmitLine.addWidget(self.captchaInputLine) - # self.LayoutSubmitLine.addWidget(self.saveImageButton) - self.LayoutSubmitButtons = QHBoxLayout() - self.LayoutSubmitButtons.addWidget(self.submitButton) - self.LayoutSubmitButtons.addWidget(self.skipButton) + self.LayoutSettings = QHBoxLayout() + self.LayoutSettings.addWidget(self.startstopButton) self.LayoutSubmit = QVBoxLayout() - self.LayoutSubmit.addLayout(self.LayoutSubmitLine) - self.LayoutSubmit.addLayout(self.LayoutSubmitButtons) + self.LayoutSubmit.addWidget(self.captchaInputLine) + self.LayoutSubmit.addLayout(self.LayoutSettings) # Compile layout mainLayout = QVBoxLayout() @@ -170,9 +154,7 @@ class CaptchaGUI(QWidget): if key == Qt.Key_Escape: self.skipCaptcha() elif key == Qt.Key_Enter or key == Qt.Key_Return: - if self.skipButton.hasFocus(): - self.skipCaptcha() - elif self.startstopButton.hasFocus(): + if self.startstopButton.hasFocus(): self.toggleRunning() else: self.submitCaptcha() @@ -200,10 +182,6 @@ class CaptchaGUI(QWidget): self.startstopButton.setText(self.running and "Stop" or "Start") self.startstopButton.setChecked(self.running) - def saveImage(self): - if self.captchaImage.image: - self.captchaImage.image.save("captcha-"+str(time.time())+".jpg") - ################################################## # Handle network ################################################## -- cgit v1.2.3