1
0
Fork 0
mirror of synced 2024-05-19 12:02:54 +12:00
Rare/rare/components/tabs/account/__init__.py
loathingKernel 891804ae37 AccountWidget: Remove dead signals after the offline mode fix
Signals, if they carry the same datatype, can be chained simply
with `signal.connect(othersignal)` without the need to use a `lambda`
expression and `emit()`

TabWidget: Fix error because the `exit_app` signal was called directly
2022-10-31 17:00:01 +02:00

36 lines
1.3 KiB
Python

import webbrowser
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QMessageBox, QLabel, QPushButton
from rare.shared import LegendaryCoreSingleton, GlobalSignalsSingleton
from rare.utils.misc import icon
class AccountWidget(QWidget):
logout: pyqtSignal = pyqtSignal()
def __init__(self, parent):
super(AccountWidget, self).__init__(parent=parent)
self.core = LegendaryCoreSingleton()
self.signals = GlobalSignalsSingleton()
username = self.core.lgd.userdata.get("display_name")
if not username:
username = "Offline"
self.open_browser = QPushButton(icon("fa.external-link"), self.tr("Account settings"))
self.open_browser.clicked.connect(
lambda: webbrowser.open(
"https://www.epicgames.com/account/personal?productName=epicgames"
)
)
self.logout_button = QPushButton(self.tr("Logout"))
self.logout_button.clicked.connect(self.logout)
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)