-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_thread.py
40 lines (28 loc) · 984 Bytes
/
setup_thread.py
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
import time
import PySide2.QtCore as QtCore
from data_manager import DataStore
import network
class Thread(QtCore.QThread):
done_setup = QtCore.Signal()
login_status = QtCore.Signal(str)
def __init__(self, is_first_time):
super().__init__()
self.is_first_time = is_first_time
def exit(self):
self.running = False
self.wait()
def run(self):
self.running = True
while self.running:
login_status = network.get('/lol-summoner/v1/current-summoner')
if login_status.get('httpStatus') is not None:
self.login_status.emit(
'Not logged in. Please Log in to the client')
time.sleep(2)
continue
else:
self.login_status.emit('Logged in.')
if self.is_first_time:
DataStore.setup()
self.done_setup.emit()
self.running = False