summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x9kwpyqt.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/9kwpyqt.py b/9kwpyqt.py
index f6ec392..c2ca068 100755
--- a/9kwpyqt.py
+++ b/9kwpyqt.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import configparser
+import os
import sys
import time
from PyQt5.QtCore import Qt, QTimer, QUrl, pyqtSignal
@@ -11,6 +12,8 @@ from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtMultimedia import QSound
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
+THIS_DIR = os.path.dirname(os.path.abspath(__file__))
+
class ExtendedQLabel(QLabel):
clicked = pyqtSignal(int, str)
image = False # QPixmap()
@@ -338,7 +341,7 @@ class CaptchaGUI(QWidget):
defaultconfig['Autostart'] = 'no'
self.config = configparser.ConfigParser(defaultconfig)
try:
- with open('9kwpyqt.ini') as configfile:
+ with open(os.path.join(THIS_DIR, '9kwpyqt.ini')) as configfile:
self.config.read_file(configfile)
except FileNotFoundError:
self.writeConfig()
@@ -349,14 +352,14 @@ class CaptchaGUI(QWidget):
# Use config settings
self.apiurl = self.config['DEFAULT']['API_URL']+"?source=pythonapi&apikey="+self.config['DEFAULT']['API_KEY']+"&"
- self.sound = QSound(self.config['DEFAULT']['Soundfile'])
+ self.sound = QSound(os.path.join(THIS_DIR, self.config['DEFAULT']['Soundfile']))
self.soundCheckbox.setChecked( self.config.getboolean('DEFAULT', 'Sound') )
if self.config.getboolean('DEFAULT', 'Autostart'):
self.toggleRunning(force_start=True)
return True
def writeConfig(self):
- with open('9kwpyqt.ini', 'w') as configfile:
+ with open(os.path.join(THIS_DIR, '9kwpyqt.ini'), 'w') as configfile:
self.config.write(configfile)
def skipCaptcha(self):