Skip to content
Merged
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
41 changes: 25 additions & 16 deletions rare/components/tabs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PySide6.QtCore import Signal, Slot
from PySide6.QtGui import QShortcut
from PySide6.QtGui import QIcon, QShortcut
from PySide6.QtWidgets import QMessageBox, QTabWidget, QWidget

from rare.models.settings import RareAppSettings
Expand All @@ -10,9 +10,9 @@
from .downloads import DownloadsTab
from .integrations import IntegrationsTab
from .library import GamesLibrary
from .navigation_bar import NavigationBar
from .settings import SettingsTab
from .store import StoreTab
from .tab_widgets import MainTabBar


class MainTabWidget(QTabWidget):
Expand All @@ -29,38 +29,49 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent):
self.signals = rcore.signals()
self.args = rcore.args()

self.main_bar = MainTabBar(parent=self)
self.setTabBar(self.main_bar)
self.navigation_bar = NavigationBar(parent=self)
self.setTabBar(self.navigation_bar)
self.setTabPosition(QTabWidget.TabPosition.West)

self.collapse_index = self.addTab(
QWidget(self), qta_icon('fa5s.bars', 'fa.bars'), self.tr('Toggle')
)
self.navigation_bar.setTabToolTip(self.collapse_index, self.tr('Toggle sidebar'))
self.navigation_bar.collapse_index = self.collapse_index

# Generate Tabs
self.games_tab = GamesLibrary(self.settings, self.rcore, self)
self.games_tab.import_clicked.connect(self.show_import)
self.games_index = self.addTab(self.games_tab, self.tr('Games'))
self.games_index = self.addTab(self.games_tab, qta_icon('mdi.gamepad-variant', 'fa5s.gamepad'), self.tr('Games'))
self.navigation_bar.setTabToolTip(self.games_index, self.tr('Games'))

# Downloads Tab after Games Tab to use populated RareCore games list
self.downloads_tab = DownloadsTab(self.settings, self.rcore, self)
self.downloads_index = self.addTab(self.downloads_tab, '')
self.downloads_index = self.addTab(self.downloads_tab, qta_icon('mdi.download-box', 'fa5s.download'), '')
self.downloads_tab.update_title.connect(self.__on_downloads_update_title)
self.downloads_tab.update_queues_count()
self.setTabEnabled(self.downloads_index, not self.args.offline)

if not self.args.offline:
self.store_tab = StoreTab(self.core, parent=self)
self.store_index = self.addTab(self.store_tab, self.tr('Store (Under Construction)'))
self.store_index = self.addTab(self.store_tab, qta_icon('mdi6.store', 'fa5s.store'), self.tr('Store'))
self.navigation_bar.setTabToolTip(self.store_index, self.tr('Store'))
self.setTabEnabled(self.store_index, not self.args.offline)

# Space Tab
space_index = self.addTab(QWidget(self), 'Rare')
space_index = self.addTab(QWidget(self), QIcon(), 'Rare')
self.setTabEnabled(space_index, False)
self.main_bar.expanded_idx = space_index
self.navigation_bar.expanded_index = space_index

# Integrations Tab
self.integrations_tab = IntegrationsTab(self.rcore, self)
self.integrations_index = self.addTab(self.integrations_tab, self.tr('Integrations'))
self.integrations_index = self.addTab(self.integrations_tab, qta_icon('mdi.source-branch', 'fa6s.code-branch'), self.tr('Integrations'))
self.navigation_bar.setTabToolTip(self.integrations_index, self.tr('Integrations'))

# Settings Tab
self.settings_tab = SettingsTab(settings, rcore, self)
self.settings_index = self.addTab(self.settings_tab, qta_icon('fa.gear', 'fa6s.gear'), self.tr('Settings'))
self.navigation_bar.setTabToolTip(self.settings_index, self.tr('Settings'))
self.settings_tab.update_available.connect(self._on_update_available)

# Account Tab
Expand Down Expand Up @@ -105,7 +116,7 @@ def _on_shortcut_activated_settings(self):

@Slot()
def _on_update_available(self):
self.main_bar.setTabText(self.settings_index, self.tr('Settings (!)'))
self.setTabText(self.settings_index, self.tr('Settings (!)'))

@Slot()
@Slot(str)
Expand All @@ -131,19 +142,17 @@ def show_ubisoft(self):
@Slot(int)
def __on_downloads_update_title(self, num_downloads: int):
suffix = '' if not num_downloads else f' ({num_downloads})'
self.setTabText(
self.indexOf(self.downloads_tab),
self.tr('Downloads') + suffix,
)
self.setTabText(self.downloads_index, self.tr('Downloads') + suffix)

@Slot(int)
def mouse_clicked(self, index):
if index == self.games_index:
self.games_tab.show_library()
if index == self.integrations_index:
self.integrations_tab.show_import()

def resizeEvent(self, event):
self.main_bar.setMinimumWidth(self.width())
self.navigation_bar.setMinimumHeight(self.height() - 1)
super(MainTabWidget, self).resizeEvent(event)

@Slot(int)
Expand Down
2 changes: 1 addition & 1 deletion rare/components/tabs/account/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, signals: GlobalSignals, core: LegendaryCore, parent: QWidget
center_widget.addWidget(self.quit_button)

layout = QVBoxLayout(self)
layout.addWidget(self.center_widget, alignment=Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignTop)
layout.addWidget(self.center_widget, alignment=Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignBottom)

@Slot()
def _on_browser_clicked(self):
Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from PySide6.QtWidgets import QLabel, QSizePolicy, QVBoxLayout, QWidget

from rare.shared import RareCore
from rare.widgets.side_tab import SideTabWidget
from rare.widgets.scrollarea_tabs import ScrollAreaTabWidget

from .egl_sync_group import EGLSyncGroup
from .eos_group import EosGroup
from .import_group import ImportGroup
from .ubisoft_group import UbisoftGroup


class IntegrationsTab(SideTabWidget):
class IntegrationsTab(ScrollAreaTabWidget):
def __init__(self, rcore: RareCore, parent=None):
super(IntegrationsTab, self).__init__(show_back=False, parent=parent)
self.import_group = ImportGroup(rcore, self)
Expand Down
6 changes: 3 additions & 3 deletions rare/components/tabs/library/details/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from rare.models.settings import RareAppSettings
from rare.shared import RareCore
from rare.utils.json_formatter import QJsonModel
from rare.widgets.side_tab import SideTabContents, SideTabWidget
from rare.widgets.scrollarea_tabs import ScrollAreaTabContents, ScrollAreaTabWidget

from .cloud import CloudSaves
from .compat import LocalCompatSettings
Expand All @@ -19,7 +19,7 @@
from .game import LocalGameSettings


class GameDetailsTabs(SideTabWidget):
class GameDetailsTabs(ScrollAreaTabWidget):
# str: app_name
import_clicked = Signal(str)

Expand Down Expand Up @@ -88,7 +88,7 @@ def update_game(self, rgame: RareGame):
self.setCurrentIndex(self.details_index)


class GameMetadataView(QTreeView, SideTabContents):
class GameMetadataView(QTreeView, ScrollAreaTabContents):
def __init__(self, parent=None):
super(GameMetadataView, self).__init__(parent=parent)
self.implements_scrollarea = True
Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/library/details/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
from rare.widgets.cloudsync_widget import CloudSyncWidget
from rare.widgets.indicator_edit import IndicatorReasonsCommon, PathEdit
from rare.widgets.loading_widget import LoadingWidget
from rare.widgets.side_tab import SideTabContents
from rare.widgets.scrollarea_tabs import ScrollAreaTabContents


class CloudSaves(QWidget, SideTabContents):
class CloudSaves(QWidget, ScrollAreaTabContents):
def __init__(self, settings: RareAppSettings, rcore: RareCore, parent=None):
super(CloudSaves, self).__init__(parent=parent)
self.logger = getLogger(type(self).__name__)
Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/library/details/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
from rare.widgets.dialogs import ButtonDialog, game_title
from rare.widgets.elide_label import ElideLabel
from rare.widgets.image_widget import ImageSize, ImageWidget, LoadingImageWidget
from rare.widgets.side_tab import SideTabContents
from rare.widgets.scrollarea_tabs import ScrollAreaTabContents

logger = getLogger('GameInfo')


class GameDetails(QWidget, SideTabContents):
class GameDetails(QWidget, ScrollAreaTabContents):
# str: app_name
import_clicked = Signal(str)

Expand Down
4 changes: 2 additions & 2 deletions rare/components/tabs/library/details/dlcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from rare.ui.components.tabs.library.details.dlcs import Ui_GameDlcs
from rare.utils.misc import qta_icon, widget_object_name
from rare.widgets.image_widget import ImageSize, ImageWidget
from rare.widgets.side_tab import SideTabContents
from rare.widgets.scrollarea_tabs import ScrollAreaTabContents


class GameDlcWidget(QFrame):
Expand Down Expand Up @@ -96,7 +96,7 @@ def install_dlc(self):
self.rdlc.install()


class GameDlcs(QToolBox, SideTabContents):
class GameDlcs(QToolBox, ScrollAreaTabContents):
def __init__(self, rcore: RareCore, parent=None):
super(GameDlcs, self).__init__(parent=parent)
self.implements_scrollarea = True
Expand Down
Loading