2021-02-10 23:48:25 +13:00
|
|
|
import webbrowser
|
|
|
|
|
2022-10-24 02:06:54 +13:00
|
|
|
from PyQt5.QtCore import pyqtSignal
|
2021-02-10 23:48:25 +13:00
|
|
|
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QMessageBox, QLabel, QPushButton
|
2021-03-19 00:45:59 +13:00
|
|
|
|
2022-02-26 06:43:27 +13:00
|
|
|
from rare.shared import LegendaryCoreSingleton, GlobalSignalsSingleton
|
2022-07-27 02:58:17 +12:00
|
|
|
from rare.utils.misc import icon
|
2021-02-10 23:48:25 +13:00
|
|
|
|
|
|
|
|
2022-08-14 03:53:00 +12:00
|
|
|
class AccountWidget(QWidget):
|
2022-11-01 03:57:35 +13:00
|
|
|
logout: pyqtSignal = pyqtSignal()
|
2022-10-24 02:06:54 +13:00
|
|
|
|
2022-10-29 23:23:50 +13:00
|
|
|
def __init__(self, parent):
|
2022-10-23 10:54:11 +13:00
|
|
|
super(AccountWidget, self).__init__(parent=parent)
|
2022-02-26 06:43:27 +13:00
|
|
|
self.core = LegendaryCoreSingleton()
|
|
|
|
self.signals = GlobalSignalsSingleton()
|
2022-08-14 03:53:00 +12:00
|
|
|
|
2023-01-09 08:41:02 +13:00
|
|
|
username = self.core.lgd.userdata.get("displayName")
|
2021-03-12 00:56:38 +13:00
|
|
|
if not username:
|
2021-10-08 07:19:24 +13:00
|
|
|
username = "Offline"
|
2021-03-12 00:56:38 +13:00
|
|
|
|
2022-03-16 09:25:54 +13:00
|
|
|
self.open_browser = QPushButton(icon("fa.external-link"), self.tr("Account settings"))
|
2021-04-07 21:50:35 +12:00
|
|
|
self.open_browser.clicked.connect(
|
2021-12-24 22:09:50 +13:00
|
|
|
lambda: webbrowser.open(
|
|
|
|
"https://www.epicgames.com/account/personal?productName=epicgames"
|
|
|
|
)
|
|
|
|
)
|
2021-03-01 08:01:15 +13:00
|
|
|
self.logout_button = QPushButton(self.tr("Logout"))
|
2022-11-01 03:57:35 +13:00
|
|
|
self.logout_button.clicked.connect(self.logout)
|
2022-08-14 03:53:00 +12:00
|
|
|
|
|
|
|
layout = QVBoxLayout(self)
|
|
|
|
layout.addWidget(QLabel(self.tr("Account")))
|
|
|
|
layout.addWidget(QLabel(self.tr("Logged in as <b>{}</b>").format(username)))
|
|
|
|
layout.addWidget(self.open_browser)
|
|
|
|
layout.addWidget(self.logout_button)
|