Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions physiolabxr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import os


def physiolabxr():
import multiprocessing
import sys
import webbrowser

from PyQt6 import QtWidgets
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QSystemTrayIcon, QMenu
from PyQt6.QtWidgets import QSystemTrayIcon, QMenu, QInputDialog, QMessageBox
from PyQt6.QtCore import QSettings

from physiolabxr.configs.configs import AppConfigs
from physiolabxr.configs.NetworkManager import NetworkManager
from physiolabxr.ui.SplashScreen import SplashScreen

from physiolabxr.ui.SplashScreen import SplashLoadingTextNotifier
from physiolabxr.ui.Login import LoginDialog
AppConfigs(_reset=False) # create the singleton app configs object
NetworkManager()

Expand All @@ -30,6 +34,18 @@ def physiolabxr():
splash = SplashScreen()
splash.show()

SplashLoadingTextNotifier().set_loading_text("Logging in...")

login_dialog = LoginDialog()

auto_login_success = login_dialog.auto_login()

if not auto_login_success:
if login_dialog.exec() != QtWidgets.QDialog.DialogCode.Accepted:
splash.close()
QMessageBox.critical(None, "Access Denied", "Login required to access the application.")
sys.exit()

# load default settings
from physiolabxr.utils.setup_utils import run_setup_check
run_setup_check()
Expand All @@ -56,4 +72,4 @@ def physiolabxr():
sys.exit(app.exec())
except KeyboardInterrupt:
print('App terminate by KeyboardInterrupt')
sys.exit()
sys.exit()
130 changes: 130 additions & 0 deletions physiolabxr/_ui/login.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>425</width>
<height>358</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>130</x>
<y>10</y>
<width>191</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Welcome to PhysioLabXR!</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>40</x>
<y>150</y>
<width>331</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Log In</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>40</x>
<y>270</y>
<width>331</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Sign Up</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>40</x>
<y>70</y>
<width>331</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>40</x>
<y>50</y>
<width>58</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Email:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>40</x>
<y>100</y>
<width>58</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Password:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>40</x>
<y>120</y>
<width>331</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>40</x>
<y>240</y>
<width>251</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Doesn't have an account with us yet?</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>80</x>
<y>200</y>
<width>251</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Remember my account on this device</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
24 changes: 21 additions & 3 deletions physiolabxr/_ui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1554</width>
<height>857</height>
<width>1524</width>
<height>810</height>
</rect>
</property>
<layout class="QHBoxLayout" name="scrollAreaWidgetContents_3_layout">
Expand Down Expand Up @@ -293,7 +293,7 @@
<x>0</x>
<y>0</y>
<width>1600</width>
<height>21</height>
<height>37</height>
</rect>
</property>
<widget class="QMenu" name="menufile">
Expand All @@ -303,6 +303,7 @@
<addaction name="actionShow_Recordings"/>
<addaction name="actionSettings"/>
<addaction name="separator"/>
<addaction name="actionSign_Out"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuHelp">
Expand All @@ -312,8 +313,15 @@
<addaction name="actionRepo"/>
<addaction name="actionDocumentation"/>
</widget>
<widget class="QMenu" name="menuAccount">
<property name="title">
<string>Account</string>
</property>
<addaction name="actionSign_out"/>
</widget>
<addaction name="menufile"/>
<addaction name="menuHelp"/>
<addaction name="menuAccount"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionAbout">
Expand Down Expand Up @@ -346,6 +354,16 @@
<string>Settings</string>
</property>
</action>
<action name="actionSign_out">
<property name="text">
<string>Sign out</string>
</property>
</action>
<action name="actionSign_Out">
<property name="text">
<string>Sign Out</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
Expand Down
6 changes: 5 additions & 1 deletion physiolabxr/configs/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class AppConfigs(metaclass=Singleton):
_app_data_name: str = 'RenaLabApp'

app_data_path = os.path.join(QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppDataLocation), _app_data_name)

print("⚠️" + app_data_path)
# appearance configs
theme: str = 'dark' # TODO: refactor this to an enum, replace config.value

Expand Down Expand Up @@ -130,6 +130,10 @@ class AppConfigs(metaclass=Singleton):
# Tobii Pro Fusion Eye Tracker Manager
tobii_app_path: str = None

# user login
remembered_token: str = None
refresh_token: str = None

_media_paths = ['physiolabxr/_media/icons', 'physiolabxr/_media/logo', 'physiolabxr/_media/gifs']
_supported_media_formats = ['.svg', '.gif']
_ui_path = 'physiolabxr/_ui'
Expand Down
Loading