def login(self): """Run login dialog and get the api_conn set up""" login = LoginWindow(self) login.exec_() self.connected = True
print(data) try: if data == None: raise ApiException('Error could not connect to api') if data.get('error'): login = LoginWindow() trayIcon = SystemTrayIcon(QIcon(Config.icon)) #Maybe move this inside the SystemTray class, keep the main clean yo trayIcon.StartWorking.setEnabled(False) trayIcon.dashboard.setEnabled(False) trayIcon.settings.setEnabled(False) trayIcon.timer.setEnabled(False) trayIcon.show() #lol.button.clicked.connect(run)#self.button.clicked if login.exec_() == QDialog.Accepted: ex = TimerWindow() trayIcon.ex = ex trayIcon.StartWorking.setEnabled(True) trayIcon.dashboard.setEnabled(True) trayIcon.settings.setEnabled(True) trayIcon.timer.setEnabled(True) #trayIcon = SystemTrayIcon(QIcon(Config.icon), ex) #trayIcon.show() sys.exit(app.exec_()) else: #For autologin ex = TimerWindow() trayIcon = SystemTrayIcon(QIcon(Config.icon), ex) ex.systray = trayIcon trayIcon.show()