This repository has been archived by the owner on Feb 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathauthWindow.py
58 lines (47 loc) · 1.75 KB
/
authWindow.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from Sources.json_handler import json_handler
from UI.ui_AuthWindow import Ui_AuthWindow
from UI.ui_MainWindow import *
import logWindow
import optionsWindow
import handler
import Sources.drive as drive
from PyQt5.QtWidgets import (
QMessageBox
)
class AuthWindow(QtWidgets.QMainWindow, Ui_AuthWindow):
def __init__(self, *args, **kwargs):
QtWidgets.QMainWindow.__init__(self, *args, **kwargs)
Ui_AuthWindow.__init__(self)
self.init_ui()
def init_ui(self):
self.setupUi(self)
self.setFixedSize(812,706)
# view handler
self.bt_back.clicked.connect(self.backToMain)
self.bt_drive.clicked.connect(self.backToMain)
self.bt_log_viewer.clicked.connect(self.startLogWindow)
self.bt_options.clicked.connect(self.startOptionsWindow)
self.bt_save_cred.clicked.connect(self.save_cred)
def save_cred(self):
cred = drive.get_credentials(self.lb_code.toPlainText()) # Return a boolean
if cred:
QMessageBox.information(self, "Info", "Credentials saved")
json_data = json_handler()
json_data.write_field("DRIVE",True,"AUTHENTICATED")
# Cloud sizes update
self.ui = handler.MainWindow()
self.ui.check_cloud_changes()
else:
QMessageBox.information(self, "Info", "Invalid credentials")
def backToMain(self):
self.hide()
self.ui = handler.MainWindow()
self.ui.show()
def startLogWindow(self):
self.hide()
self.ui = logWindow.LogWindow()
self.ui.show()
def startOptionsWindow(self):
self.hide()
self.ui = optionsWindow.OptionsWindow()
self.ui.show()