Skip to content

Commit c81f4cd

Browse files
chore: minor code cleanups
1 parent 1787524 commit c81f4cd

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

rare/components/tabs/__init__.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent):
2929
self.signals = rcore.signals()
3030
self.args = rcore.args()
3131

32-
self.tab_bar = MainTabBar(parent=self)
33-
self.setTabBar(self.tab_bar)
32+
self.main_bar = MainTabBar(parent=self)
33+
self.main_bar.installEventFilter(self)
34+
self.setTabBar(self.main_bar)
3435

3536
# Generate Tabs
3637
self.games_tab = GamesLibrary(self.settings, self.rcore, self)
@@ -52,11 +53,10 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent):
5253
# Space Tab
5354
space_index = self.addTab(QWidget(self), "Rare")
5455
self.setTabEnabled(space_index, False)
55-
self.tab_bar.expanded_idx = space_index
56+
self.main_bar.expanded_idx = space_index
5657

5758
# Integrations Tab
5859
self.integrations_tab = IntegrationsTab(self.rcore, self)
59-
self.integrations_tab.back_clicked.connect(lambda: self.setCurrentWidget(self.games_tab))
6060
self.integrations_index = self.addTab(self.integrations_tab, self.tr("Integrations"))
6161

6262
# Account Tab
@@ -74,7 +74,7 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent):
7474
# Settings Tab
7575
self.settings_tab = SettingsTab(settings, rcore, self)
7676
self.settings_index = self.addTab(self.settings_tab, qta_icon("fa.gear", "fa6s.gear"), "")
77-
self.settings_tab.about.update_available_ready.connect(lambda: self.tab_bar.setTabText(self.settings_index, "(!)"))
77+
self.settings_tab.about.update_available_ready.connect(lambda: self.main_bar.setTabText(self.settings_index, "(!)"))
7878

7979
# Open game list on click on Games tab button
8080
self.tabBarClicked.connect(self.mouse_clicked)
@@ -88,17 +88,16 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent):
8888
QShortcut("Alt+5", self).activated.connect(lambda: self.setCurrentIndex(self.settings_index))
8989

9090
self.setCurrentIndex(self.games_index)
91-
self.tab_bar.installEventFilter(self)
9291

9392
def eventFilter(self, w: QObject, e: QEvent) -> bool:
9493
if not isinstance(e, QEvent):
9594
return True
96-
if w is self.tab_bar and e.type() == QEvent.Type.MouseButtonPress:
97-
tab_idx = self.tab_bar.tabAt(e.pos())
95+
if w is self.main_bar and e.type() == QEvent.Type.MouseButtonPress:
96+
tab_idx = self.main_bar.tabAt(e.pos())
9897
if tab_idx == self.account_index:
9998
if e.button() == Qt.MouseButton.LeftButton:
10099
self.account_menu.exec(
101-
self.mapToGlobal(self.tab_bar.tabRect(tab_idx).bottomRight() - self.account_menu.rect().topRight())
100+
self.mapToGlobal(self.main_bar.tabRect(tab_idx).bottomRight() - self.account_menu.rect().topRight())
102101
)
103102
return True
104103
return False
@@ -138,7 +137,7 @@ def mouse_clicked(self, index):
138137
self.integrations_tab.show_import()
139138

140139
def resizeEvent(self, event):
141-
self.tab_bar.setMinimumWidth(self.width())
140+
self.main_bar.setMinimumWidth(self.width())
142141
super(MainTabWidget, self).resizeEvent(event)
143142

144143
@Slot(int)

rare/components/tabs/integrations/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class IntegrationsTab(SideTabWidget):
1616
def __init__(self, rcore: RareCore, parent=None):
17-
super(IntegrationsTab, self).__init__(show_back=True, parent=parent)
17+
super(IntegrationsTab, self).__init__(show_back=False, parent=parent)
1818
self.import_group = ImportGroup(rcore, self)
1919
self.import_widget = IntegrationsWidget(
2020
self.import_group,

rare/components/tabs/library/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def update_count_games_label(self):
114114

115115
def setup_game_list(self):
116116
for rgame in self.rcore.games:
117-
# self.library_list.addItem(QListWidgetItem(QIcon(rgame.get_pixmap(ImageSize.Icon)), rgame.app_title))
118117
widget = self.add_library_widget(rgame)
119118
if not widget:
120119
logger.warning("Excluding %s from the game list", rgame.app_title)

rare/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def main() -> int:
111111
)
112112

113113
# Subreaper command
114-
subreaper_parser = subparsers.add_parser("subreaper", aliases=["reaper"])
114+
subparsers.add_parser("subreaper", aliases=["reaper"])
115115

116116
args, other = parser.parse_known_args()
117117

0 commit comments

Comments
 (0)