2022-11-04 09:34:50 +13:00
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
from PyQt5.QtCore import Qt
|
2021-10-12 10:19:32 +13:00
|
|
|
from PyQt5.QtWidgets import QVBoxLayout, QWidget, QLabel, QSpacerItem, QSizePolicy
|
|
|
|
|
2023-02-19 04:33:25 +13:00
|
|
|
from rare.widgets.side_tab import SideTabWidget
|
2021-10-17 12:17:54 +13:00
|
|
|
from .egl_sync_group import EGLSyncGroup
|
2022-11-04 09:34:50 +13:00
|
|
|
from .eos_group import EOSGroup
|
2023-02-19 04:33:25 +13:00
|
|
|
from .import_group import ImportGroup
|
2022-11-04 09:34:50 +13:00
|
|
|
from .ubisoft_group import UbisoftGroup
|
2021-10-12 10:19:32 +13:00
|
|
|
|
|
|
|
|
2022-11-04 09:39:48 +13:00
|
|
|
class IntegrationsTabs(SideTabWidget):
|
2021-10-12 10:19:32 +13:00
|
|
|
def __init__(self, parent=None):
|
2022-11-04 09:39:48 +13:00
|
|
|
super(IntegrationsTabs, self).__init__(show_back=True, parent=parent)
|
|
|
|
self.import_widget = IntegrationsWidget(
|
2021-10-12 10:19:32 +13:00
|
|
|
ImportGroup(self),
|
2021-12-24 22:09:50 +13:00
|
|
|
self.tr("To import games from Epic Games Store, please enable EGL Sync."),
|
|
|
|
self,
|
2021-10-12 10:19:32 +13:00
|
|
|
)
|
2023-01-30 10:51:25 +13:00
|
|
|
self.import_index = self.addTab(self.import_widget, self.tr("Import Games"))
|
2021-10-12 10:19:32 +13:00
|
|
|
|
2022-11-04 09:39:48 +13:00
|
|
|
self.egl_sync_widget = IntegrationsWidget(
|
2021-10-12 10:19:32 +13:00
|
|
|
EGLSyncGroup(self),
|
2021-12-24 22:09:50 +13:00
|
|
|
self.tr("To import EGL games from directories, please use Import Game."),
|
|
|
|
self,
|
2021-10-12 10:19:32 +13:00
|
|
|
)
|
2023-01-30 10:51:25 +13:00
|
|
|
self.egl_sync_index = self.addTab(self.egl_sync_widget, self.tr("Sync with EGL"))
|
2021-10-12 10:19:32 +13:00
|
|
|
|
2022-11-04 09:39:48 +13:00
|
|
|
self.eos_ubisoft = IntegrationsWidget(
|
2022-11-04 09:34:50 +13:00
|
|
|
None,
|
|
|
|
self.tr(""),
|
2022-11-04 01:53:58 +13:00
|
|
|
self,
|
|
|
|
)
|
2022-11-04 09:39:48 +13:00
|
|
|
self.eos_ubisoft.addWidget(UbisoftGroup(self.eos_ubisoft))
|
|
|
|
self.eos_ubisoft.addWidget(EOSGroup(self.eos_ubisoft))
|
2023-01-30 10:51:25 +13:00
|
|
|
self.eos_ubisoft_index = self.addTab(self.eos_ubisoft, self.tr("Epic Overlay and Ubisoft"))
|
2022-11-04 01:53:58 +13:00
|
|
|
|
2023-01-30 10:51:25 +13:00
|
|
|
self.setCurrentIndex(self.import_index)
|
2021-10-12 10:19:32 +13:00
|
|
|
|
|
|
|
def show_import(self):
|
2023-01-30 10:51:25 +13:00
|
|
|
self.setCurrentIndex(self.import_index)
|
2021-10-12 10:19:32 +13:00
|
|
|
|
|
|
|
def show_egl_sync(self):
|
2023-01-30 10:51:25 +13:00
|
|
|
self.setCurrentIndex(self.egl_sync_index)
|
2021-10-12 10:19:32 +13:00
|
|
|
|
2022-11-04 01:53:58 +13:00
|
|
|
def show_eos_ubisoft(self):
|
2023-01-30 10:51:25 +13:00
|
|
|
self.setCurrentIndex(self.eos_ubisoft_index)
|
2022-11-04 01:53:58 +13:00
|
|
|
|
2021-10-12 10:19:32 +13:00
|
|
|
|
2022-11-04 09:39:48 +13:00
|
|
|
class IntegrationsWidget(QWidget):
|
2022-11-04 09:34:50 +13:00
|
|
|
def __init__(self, widget: Optional[QWidget], info: str, parent=None):
|
2022-11-04 09:39:48 +13:00
|
|
|
super(IntegrationsWidget, self).__init__(parent=parent)
|
2022-11-04 01:53:58 +13:00
|
|
|
self.info = QLabel(f"<b>{info}</b>")
|
2022-03-19 05:03:14 +13:00
|
|
|
|
2023-02-22 02:26:19 +13:00
|
|
|
layout = QVBoxLayout(self)
|
2022-11-04 09:34:50 +13:00
|
|
|
if widget is not None:
|
|
|
|
layout.addWidget(widget)
|
2022-03-19 05:03:14 +13:00
|
|
|
layout.addWidget(self.info)
|
|
|
|
layout.addItem(
|
2021-12-24 22:09:50 +13:00
|
|
|
QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
|
|
|
|
)
|
2022-11-04 09:34:50 +13:00
|
|
|
|
|
|
|
def addWidget(self, widget: QWidget, stretch: int = 0, alignment: Qt.AlignmentFlag = Qt.Alignment()):
|
|
|
|
self.layout().insertWidget(self.layout().count() - 2, widget, stretch, alignment)
|