-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_dlg.py
More file actions
executable file
·48 lines (37 loc) · 1.53 KB
/
setup_dlg.py
File metadata and controls
executable file
·48 lines (37 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
__author__ = "helljump"
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
import settings
import logging
log = logging.getLogger(__name__)
class SetupDialog(QDialog):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
uic.loadUi("assets/setup.ui", self)
self.buttonBox.button(QDialogButtonBox.Save).clicked.connect(self.save)
self.buttonBox.button(QDialogButtonBox.Cancel).clicked.connect(self.close)
params = settings.STORAGE.get('captcha', {})
self.antigate_rb.setChecked(params.get('antigate', True))
self.antigate_le.setText(params.get('antigate_key', ''))
self.captchabot_rb.setChecked(params.get('captchabot', False))
self.captchabot_le.setText(params.get('captchabot_key', ''))
self.ripcaptcha_rb.setChecked(params.get('ripcaptcha', False))
self.ripcaptcha_le.setText(params.get('ripcaptcha_key', ''))
def save(self):
log.debug('save')
settings.STORAGE['captcha'] = {
'antigate': self.antigate_rb.isChecked(),
'antigate_key': self.antigate_le.text(),
'captchabot': self.captchabot_rb.isChecked(),
'captchabot_key': self.captchabot_le.text(),
'ripcaptcha': self.ripcaptcha_rb.isChecked(),
'ripcaptcha_key': self.ripcaptcha_le.text(),
}
self.close()
if __name__ == '__main__':
w = SetupDialog()
w.exec_()