1
0
Fork 0
mirror of synced 2024-06-26 10:11:19 +12:00

Add ImportSyncTabs

Move ImportWidget to the ImportSyncTabs.
Move EGLSyncWidget to the ImportSyncTabs.
This commit is contained in:
Stelios Tsampas 2021-10-12 00:19:32 +03:00 committed by Dummerle
parent 0c1f26d2f2
commit 5bed54350d
No known key found for this signature in database
GPG key ID: AB68CC59CA39F2F1
12 changed files with 891 additions and 142 deletions

View file

@ -20,19 +20,19 @@ from .game_widgets.installing_game_widget import InstallingGameWidget
from .game_widgets.uninstalled_icon_widget import IconWidgetUninstalled
from .game_widgets.uninstalled_list_widget import ListWidgetUninstalled
from .head_bar import GameListHeadBar
from .import_widget import ImportWidget
from .import_sync import ImportSyncTabs
logger = getLogger("GamesTab")
class GamesTab(QStackedWidget, Ui_GamesTab):
widgets = {}
running_games = []
widgets = dict()
running_games = list()
updates = set()
active_filter = 0
def __init__(self):
super(GamesTab, self).__init__()
def __init__(self, parent=None):
super(GamesTab, self).__init__(parent=parent)
self.setupUi(self)
self.core = shared.core
self.signals = shared.signals
@ -44,7 +44,9 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
self.mac_games = shared.api_results.mac_games
self.no_assets = shared.api_results.no_asset_games
self.head_bar = GameListHeadBar()
self.head_bar = GameListHeadBar(self)
self.head_bar.import_clicked.connect(self.show_import)
self.head_bar.egl_sync_clicked.connect(self.show_egl_sync)
self.games.layout().insertWidget(0, self.head_bar)
self.game_info_tabs = GameInfoTabs(self.dlcs, self)
@ -53,8 +55,9 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
self.game_info_tabs.info.verification_finished.connect(self.verification_finished)
self.import_widget = ImportWidget()
self.addWidget(self.import_widget)
self.import_sync_tabs = ImportSyncTabs(self)
self.import_sync_tabs.back_clicked.connect(lambda: self.setCurrentIndex(0))
self.addWidget(self.import_sync_tabs)
self.uninstalled_info_tabs = UninstalledInfoTabs(self)
self.uninstalled_info_tabs.back_clicked.connect(lambda: self.setCurrentIndex(0))
@ -62,7 +65,6 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
# navigation
self.head_bar.import_game.clicked.connect(lambda: self.setCurrentIndex(2))
self.import_widget.back_button.clicked.connect(lambda: self.setCurrentIndex(0))
self.no_asset_names = []
if not shared.args.offline:
@ -80,7 +82,7 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
self.scroll_widget.layout().insertWidget(1, self.icon_view)
self.head_bar.search_bar.textChanged.connect(lambda x: self.filter_games("", x))
self.head_bar.filter_changed_signal.connect(self.filter_games)
self.head_bar.filterChanged.connect(self.filter_games)
self.head_bar.refresh_list.clicked.connect(self.update_list)
self.head_bar.view.toggled.connect(self.toggle_view)
@ -117,6 +119,14 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
self.setCurrentIndex(0)
self.update_list([game.app_name])
def show_import(self):
self.setCurrentIndex(2)
self.import_sync_tabs.show_import()
def show_egl_sync(self, idx):
self.setCurrentIndex(2)
self.import_sync_tabs.show_egl_sync()
def show_game_info(self, game):
self.game_info_tabs.update_game(game, self.dlcs)
self.setCurrentIndex(1)

View file

@ -6,10 +6,10 @@ from rare.utils.extra_widgets import SelectViewWidget
class GameListHeadBar(QWidget):
filter_changed_signal = pyqtSignal(str)
filterChanged = pyqtSignal(str)
def __init__(self):
super(GameListHeadBar, self).__init__()
def __init__(self, parent=None):
super(GameListHeadBar, self).__init__(parent=parent)
self.setLayout(QHBoxLayout())
# self.installed_only = QCheckBox(self.tr("Installed only"))
self.settings = QSettings()
@ -35,8 +35,15 @@ class GameListHeadBar(QWidget):
self.layout().addStretch(1)
self.import_game = QPushButton(icon("mdi.import"), self.tr("Import Game"))
self.import_clicked = self.import_game.clicked
self.layout().addWidget(self.import_game)
self.egl_sync = QPushButton(icon("mdi.sync"), self.tr("Sync with EGL"))
self.egl_sync_clicked = self.egl_sync.clicked
self.layout().addWidget(self.egl_sync)
# FIXME: Until it is ready
self.egl_sync.setEnabled(False)
self.layout().addStretch(1)
self.search_bar = QLineEdit()
@ -55,10 +62,11 @@ class GameListHeadBar(QWidget):
self.view = SelectViewWidget(checked)
self.layout().addWidget(self.view)
self.layout().addStretch(1)
self.refresh_list = QPushButton()
self.refresh_list.setIcon(icon("fa.refresh")) # Reload icon
self.layout().addWidget(self.refresh_list)
def filter_changed(self, i):
self.filter_changed_signal.emit(self.available_filters[i])
self.filterChanged.emit(self.available_filters[i])
self.settings.setValue("filter", i)

View file

@ -0,0 +1,52 @@
from PyQt5.QtWidgets import QVBoxLayout, QWidget, QLabel, QSpacerItem, QSizePolicy
from rare.utils.extra_widgets import SideTabWidget
from .egl_sync_widget import EGLSyncGroup
from .import_widget import ImportGroup
class ImportSyncTabs(SideTabWidget):
def __init__(self, parent=None):
super(ImportSyncTabs, self).__init__(show_back=True, parent=parent)
self.import_widget = ImportSyncWidget(
ImportGroup(self),
self.tr('Import Game'),
self.tr('To import games from Epic Games Store, please enable EGL Sync.'),
self
)
self.addTab(self.import_widget, self.tr("Import Games"))
self.egl_sync_widget = ImportSyncWidget(
EGLSyncGroup(self),
self.tr('Sync with EGL'),
self.tr('To import EGL games from directories, please use Import Game.'),
self
)
self.addTab(self.egl_sync_widget, self.tr("Sync with EGL"))
# FIXME: Until it is ready
self.setTabEnabled(2, False)
self.tabBar().setCurrentIndex(1)
def show_import(self):
self.setCurrentIndex(1)
def show_egl_sync(self):
self.setCurrentIndex(2)
class ImportSyncWidget(QWidget):
def __init__(self, widget: QWidget, title: str, info: str, parent=None):
super(ImportSyncWidget, self).__init__(parent=parent)
self.layout = QVBoxLayout()
self.title = QLabel(f"<h2>{title}</h2")
self.layout.addWidget(self.title)
self.group = widget
self.layout.addWidget(self.group)
self.info = QLabel(f"<h4>{info}</h4>")
self.layout.addWidget(self.info)
self.layout.addItem(QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding))
self.setLayout(self.layout)

View file

@ -0,0 +1,273 @@
import os
import platform
from logging import getLogger
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QLabel, QGroupBox, \
QCheckBox, QPushButton, QListWidgetItem, QDialog, QFileDialog
import rare.shared as shared
from rare.ui.components.tabs.games.import_sync.egl_sync_widget import Ui_EGLSyncGroup
from rare.utils.extra_widgets import PathEdit
logger = getLogger("EGLSync")
class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup):
importable_items = list()
exportable_items = list()
def __init__(self, parent=None):
super(EGLSyncGroup, self).__init__(parent=parent)
self.setupUi(self)
self.egl_path_info.setText(
self.tr("EGL path is at C:\\ProgramData\\Epic\\EpicGamesLauncher\\Data\\Manifests"))
egl_path = os.path.expanduser("~/")
if egl_path := shared.legendary_core.egl.programdata_path:
pass
elif egl_path := shared.legendary_core.lgd.config.get("default", "wine_prefix", fallback=""):
egl_data_path = os.path.join(shared.legendary_core.lgd.config.get("default", "wine_prefix", fallback=""),
'drive_c/ProgramData/Epic/EpicGamesLauncher/Data')
egl_path = os.path.join(egl_data_path, 'Manifests')
else:
possible_wine_prefixes = [os.path.expanduser("~/.wine"),
os.path.expanduser("~/Games/epic-games-store")]
for i in possible_wine_prefixes:
if os.path.exists(p := os.path.join(i, "drive_c/ProgramData/Epic/EpicGamesLauncher/Data/Manifests")):
egl_path = p
self.egl_path_edit = PathEdit(egl_path, QFileDialog.DirectoryOnly, save_func=self.save_egl_path)
self.egl_path_layout.addWidget(self.egl_path_edit)
if platform.system() != "Windows":
shared.legendary_core.lgd.config.set('Legendary', 'egl_programdata', egl_path)
shared.legendary_core.egl.programdata_path = egl_path
if shared.legendary_core.egl_sync_enabled:
self.refresh_button.setText(self.tr("Disable sync"))
else:
self.refresh_button.setText(self.tr("Enable Sync"))
self.refresh_button.clicked.connect(self.sync)
# self.enable_sync_button.clicked.connect(self.enable_sync)
# self.sync_once_button.clicked.connect(shared.lgd_core.egl_sync)
self.export_list.itemDoubleClicked.connect(
lambda item:
item.setCheckState(Qt.Unchecked) if item.checkState() != Qt.Unchecked else item.setCheckState(Qt.Checked))
self.import_list.itemDoubleClicked.connect(
lambda item:
item.setCheckState(Qt.Unchecked) if item.checkState() != Qt.Unchecked else item.setCheckState(Qt.Checked))
self.export_select_all_button.clicked.connect(
lambda: self.select_items(self.exportable_items, Qt.Checked))
self.export_select_none_button.clicked.connect(
lambda: self.select_items(self.exportable_items, Qt.Unchecked))
self.import_select_all_button.clicked.connect(
lambda: self.select_items(self.importable_items, Qt.Checked))
self.import_select_none_button.clicked.connect(
lambda: self.select_items(self.importable_items, Qt.Unchecked))
self.export_button.clicked.connect(self.export_selected)
self.import_button.clicked.connect(self.import_selected)
def check_egl_path(self, path):
pass
def save_egl_path(self):
shared.legendary_core.lgd.config.set("Legendary", "egl_programdata", self.egl_path_edit.text())
shared.legendary_core.egl.programdata_path = self.egl_path_edit.text()
shared.legendary_core.lgd.save_config()
self.update_lists()
def update_export_list(self):
self.export_button.setDisabled(not bool(shared.legendary_core.egl.programdata_path))
self.export_select_all_button.setDisabled(not bool(shared.legendary_core.egl.programdata_path))
self.export_select_none_button.setDisabled(not bool(shared.legendary_core.egl.programdata_path))
self.export_list.clear()
self.exportable_items.clear()
exportable_games = shared.legendary_core.egl_get_exportable()
for igame in exportable_games:
ew = EGLSyncItem(igame, True, self.export_list)
self.exportable_items.append(ew)
self.export_list.addItem(ew)
self.export_group.setEnabled(bool(exportable_games))
self.export_button.setEnabled(bool(exportable_games))
self.export_label.setVisible(not bool(exportable_games))
def update_import_list(self):
self.import_button.setDisabled(not bool(shared.legendary_core.egl.programdata_path))
self.import_select_all_button.setDisabled(not bool(shared.legendary_core.egl.programdata_path))
self.import_select_none_button.setDisabled(not bool(shared.legendary_core.egl.programdata_path))
self.import_list.clear()
self.importable_items.clear()
importable_games = shared.legendary_core.egl_get_importable()
for game in importable_games:
iw = EGLSyncItem(game, False, self.import_list)
self.importable_items.append(iw)
self.import_list.addItem(iw)
self.import_group.setEnabled(bool(importable_games))
self.import_button.setEnabled(bool(importable_games))
self.import_label.setVisible(not bool(importable_games))
def update_lists(self):
self.export_list.setVisible(bool(shared.legendary_core.egl.programdata_path))
self.import_list.setVisible(bool(shared.legendary_core.egl.programdata_path))
if not shared.legendary_core.egl.programdata_path:
return
self.update_export_list()
self.update_import_list()
def enable_sync(self):
if not shared.legendary_core.egl.programdata_path:
if os.path.exists(path := self.egl_path_edit.text()):
shared.legendary_core.lgd.config.set("Legendary", "egl_programdata", path)
shared.legendary_core.lgd.save_config()
shared.legendary_core.egl.programdata_path = path
shared.legendary_core.lgd.config.set('Legendary', 'egl_sync', "true")
shared.legendary_core.egl_sync()
shared.legendary_core.lgd.save_config()
self.refresh_button.setText(self.tr("Disable Sync"))
self.enable_sync_button.setDisabled(True)
@staticmethod
def select_items(item_list, state):
for w in item_list:
w.setCheckState(state)
def export_selected(self):
for ew in self.exportable_items:
if ew.is_checked():
ew.export_game()
self.export_list.takeItem(self.export_list.row(ew))
self.update_export_list()
def import_selected(self):
for iw in self.importable_items:
if iw.is_checked:
iw.import_game()
self.import_list.takeItem(self.import_list.row(iw))
self.update_import_list()
def sync(self):
if shared.legendary_core.egl_sync_enabled:
# disable sync
info = DisableSyncDialog().get_information()
if info[0] == 0:
if info[1]:
shared.legendary_core.lgd.config.remove_option('Legendary', 'egl_sync')
else:
shared.legendary_core.lgd.config.remove_option('Legendary', 'egl_programdata')
shared.legendary_core.lgd.config.remove_option('Legendary', 'egl_sync')
# remove EGL GUIDs from all games, DO NOT remove .egstore folders because that would fuck things up.
for igame in shared.legendary_core.get_installed_list():
igame.egl_guid = ''
shared.legendary_core.install_game(igame)
shared.legendary_core.lgd.save_config()
self.refresh_button.setText(self.tr("Enable Sync"))
else:
# enable sync
# self.enable_sync_button.setDisabled(False)
self.update_lists()
class EGLSyncItem(QListWidgetItem):
def __init__(self, game, export: bool, parent=None):
super(EGLSyncItem, self).__init__(parent=parent)
self.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
self.setCheckState(Qt.Unchecked)
self.game = game
self.export = export
if export:
self.setText(game.title)
else:
self.setText(shared.legendary_core.get_game(game.app_name).app_title)
def is_checked(self):
return True if self.checkState() == Qt.Checked else False
def export_game(self):
shared.legendary_core.egl_export(self.game.app_name)
def import_game(self):
shared.legendary_core.egl_import(self.game.app_name)
class DisableSyncDialog(QDialog):
info = 1, False
def __init__(self, parent=None):
super(DisableSyncDialog, self).__init__(parent=parent)
self.layout = QVBoxLayout()
self.question = QLabel(self.tr("Do you really want to disable sync with Epic Games Store"))
self.layout.addWidget(self.question)
self.remove_metadata = QCheckBox(self.tr("Remove metadata from installed games"))
self.layout.addWidget(self.remove_metadata)
self.button_layout = QHBoxLayout()
self.button_layout.addStretch(1)
self.ok_button = QPushButton(self.tr("Ok"))
self.cancel_button = QPushButton(self.tr("Cancel"))
self.ok_button.clicked.connect(self.ok)
self.cancel_button.clicked.connect(self.cancel)
self.button_layout.addWidget(self.ok_button)
self.button_layout.addWidget(self.cancel_button)
self.layout.addStretch(1)
self.layout.addLayout(self.button_layout)
self.setLayout(self.layout)
def ok(self):
self.info = 0, self.remove_metadata.isChecked()
self.close()
def cancel(self):
self.close()
def get_information(self):
self.exec_()
return self.info
class EGLSyncItemWidget(QGroupBox):
def __init__(self, game, export: bool, parent=None):
super(EGLSyncItemWidget, self).__init__(parent=parent)
self.layout = QHBoxLayout()
self.export = export
self.game = game
if export:
self.app_title_label = QLabel(game.title)
else:
title = shared.legendary_core.get_game(game.app_name).app_title
self.app_title_label = QLabel(title)
self.layout.addWidget(self.app_title_label)
self.button = QPushButton(self.tr("Export") if export else self.tr("Import"))
if export:
self.button.clicked.connect(self.export_game)
else:
self.button.clicked.connect(self.import_game)
self.layout.addWidget(self.button)
self.setLayout(self.layout)
def export_game(self):
shared.legendary_core.egl_export(self.game.app_name)
# FIXME: on update_egl_widget this is going to crash because
# FIXME: the item is not removed from the list in the python's side
self.deleteLater()
def import_game(self):
shared.legendary_core.egl_import(self.game.app_name)
# FIXME: on update_egl_widget this is going to crash because
# FIXME: the item is not removed from the list in the python's side
self.deleteLater()

View file

@ -0,0 +1,102 @@
import json
import os
from logging import getLogger
from typing import Tuple
from PyQt5.QtWidgets import QFileDialog, QGroupBox
import rare.shared as shared
from rare.ui.components.tabs.games.import_sync.import_widget import Ui_ImportGroup
from rare.utils import legendary_utils
from rare.utils.extra_widgets import IndicatorLineEdit, PathEdit
logger = getLogger("Import")
class ImportGroup(QGroupBox, Ui_ImportGroup):
def __init__(self, parent=None):
super(ImportGroup, self).__init__(parent=parent)
self.setupUi(self)
self.core = shared.legendary_core
self.game_list = [i.app_name for i in self.core.get_game_list()]
self.path_edit = PathEdit(
self.core.get_default_install_dir(),
QFileDialog.DirectoryOnly,
edit_func=self.path_edit_cb,
parent=self
)
self.path_edit.textChanged.connect(self.path_changed)
self.path_edit_layout.addWidget(self.path_edit)
self.app_name = IndicatorLineEdit(
ph_text=self.tr("Use in case the app name was not found automatically"),
edit_func=self.app_name_edit_cb,
parent=self
)
self.app_name.textChanged.connect(self.app_name_changed)
self.app_name_layout.addWidget(self.app_name)
self.import_button.setEnabled(False)
self.import_button.clicked.connect(self.import_game)
def path_edit_cb(self, path) -> Tuple[bool, str]:
if os.path.exists(path):
if os.path.exists(os.path.join(path, ".egstore")):
return True, path
return False, path
def path_changed(self, path):
if self.path_edit.is_valid:
self.app_name.setText(self.find_app_name(path))
else:
self.app_name.setText(str())
def app_name_edit_cb(self, text) -> Tuple[bool, str]:
if not text:
return False, text
if text in self.game_list:
return True, text
else:
return False, text
def app_name_changed(self, text):
if self.app_name.is_valid:
self.import_button.setEnabled(True)
else:
self.import_button.setEnabled(False)
def find_app_name(self, path):
if not os.path.exists(os.path.join(path, ".egstore")):
return None
for i in os.listdir(os.path.join(path, ".egstore")):
if i.endswith(".mancpn"):
file = os.path.join(path, ".egstore", i)
break
else:
logger.warning("File was not found")
return None
return json.load(open(file, "r"))["AppName"]
def import_game(self, path=None):
app_name = self.app_name.text()
if not path:
path = self.path_edit.text()
if not app_name:
# try to find app name
if a_n := self.find_app_name(path):
app_name = a_n
else:
self.info_label.setText(self.tr("Could not find app name"))
return
if legendary_utils.import_game(self.core, app_name=app_name, path=path):
self.info_label.setText(self.tr("Successfully imported {}. Reload library").format(
self.core.get_installed_game(app_name).title))
self.app_name.setText("")
shared.signals.update_game_list.emit(app_name)
else:
logger.warning("Failed to import" + app_name)
self.info_label.setText(self.tr("Failed to import {}").format(app_name))
return

View file

@ -1,126 +0,0 @@
import json
import os
from logging import getLogger
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QPushButton, QVBoxLayout, QFileDialog, QLineEdit, \
QGroupBox
from qtawesome import icon
from rare import shared
from rare.utils import legendary_utils
from rare.utils.extra_widgets import PathEdit
logger = getLogger("Import")
class ImportWidget(QWidget):
def __init__(self):
super(ImportWidget, self).__init__()
self.core = shared.core
self.game_list = [i.app_name for i in self.core.get_game_list()]
self.main_layout = QHBoxLayout()
self.back_button = QPushButton(icon("mdi.keyboard-backspace"), self.tr("Back"))
self.right_layout = QVBoxLayout()
self.right_layout.addWidget(self.back_button)
self.right_layout.addStretch(1)
self.main_layout.addLayout(self.right_layout)
self.back_button.setFixedWidth(75)
self.layout = QVBoxLayout()
self.title = QLabel("<h2>Import Game</h2")
self.layout.addWidget(self.title)
# self.import_one_game = QLabel(f"<h3>{self.tr('Import existing game from Epic Games Launcher')}</h3>")
self.import_one_game = QGroupBox(self.tr('Import existing game from Epic Games Launcher'))
self.import_one_game.setObjectName("group")
self.gb_layout = QVBoxLayout()
self.import_game_info = QLabel(self.tr("Select path to game"))
self.gb_layout.addWidget(self.import_game_info)
self.override_app_name_label = QLabel(
self.tr("Override app name (Only if the app could not find the app name)"))
self.override_app_name_label.setWordWrap(True)
self.app_name_input = QLineEdit()
self.app_name_input.setFixedHeight(32)
minilayout = QHBoxLayout()
minilayout.addStretch(1)
self.indicator_label = QLabel("")
minilayout.addWidget(self.indicator_label)
self.app_name_input.setLayout(minilayout)
self.app_name_input.textChanged.connect(self.app_name_changed)
self.path_edit = PathEdit(os.path.expanduser("~"), QFileDialog.DirectoryOnly, edit_func=self.path_changed)
self.gb_layout.addWidget(self.path_edit)
self.gb_layout.addWidget(self.override_app_name_label)
self.gb_layout.addWidget(self.app_name_input)
self.info_label = QLabel("")
self.gb_layout.addWidget(self.info_label)
self.import_button = QPushButton(self.tr("Import Game"))
self.gb_layout.addWidget(self.import_button)
self.import_button.clicked.connect(self.import_game)
self.import_one_game.setLayout(self.gb_layout)
self.layout.addWidget(self.import_one_game)
self.auto_import = QLabel(
f"<h4>{self.tr('To import games from Epic Games Store, please enable EGL Sync in legendary settings')}</h4>")
self.layout.addWidget(self.auto_import)
self.layout.addStretch(1)
self.main_layout.addLayout(self.layout)
# self.main_layout.addStretch(1)
self.setLayout(self.main_layout)
def app_name_changed(self, text):
if text in self.game_list:
self.indicator_label.setPixmap(icon("ei.ok-sign", color="green").pixmap(16, 16))
else:
self.indicator_label.setPixmap(icon("ei.remove-sign", color="red").pixmap(16, 16))
def path_changed(self, path):
if os.path.exists(path):
if os.path.exists(os.path.join(path, ".egstore")):
self.app_name_input.setText(self.find_app_name(path))
return True, path
return False, path
def find_app_name(self, path):
if not os.path.exists(os.path.join(path, ".egstore")):
return None
for i in os.listdir(os.path.join(path, ".egstore")):
if i.endswith(".mancpn"):
file = os.path.join(path, ".egstore", i)
break
else:
logger.warning("File was not found")
return None
return json.load(open(file, "r"))["AppName"]
def import_game(self, path=None):
app_name = self.app_name_input.text()
if not path:
path = self.path_edit.text()
if not app_name:
# try to find app name
if a_n := self.find_app_name(path):
app_name = a_n
else:
self.info_label.setText(self.tr("Could not find app name"))
return
if legendary_utils.import_game(self.core, app_name=app_name, path=path):
self.info_label.setText(self.tr("Successfully imported {}. Reload library").format(
self.core.get_installed_game(app_name).title))
self.app_name_input.setText("")
shared.signals.update_gamelist.emit([app_name])
else:
logger.warning("Failed to import" + app_name)
self.info_label.setText(self.tr("Failed to import {}").format(app_name))
return

View file

@ -26,7 +26,6 @@ class TabWidget(QTabWidget):
# Generate Tabs
self.games_tab = GamesTab()
self.addTab(self.games_tab, self.tr("Games"))
if not shared.args.offline:
# updates = self.games_tab.default_widget.game_list.updates
self.downloadTab = DownloadTab(self.games_tab.updates)
@ -67,7 +66,7 @@ class TabWidget(QTabWidget):
# update dl tab text
self.signals.update_download_tab_text.connect(self.update_dl_tab_text)
# imported
# self.games_tab.import_widget.update_list.connect(self.game_imported)
shared.signals.update_game_list.connect(self.game_imported)
if not shared.args.offline:
# install dlc

View file

@ -0,0 +1,119 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'rare/ui/components/tabs/games/import_sync/egl_sync_widget.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_EGLSyncGroup(object):
def setupUi(self, EGLSyncGroup):
EGLSyncGroup.setObjectName("EGLSyncGroup")
EGLSyncGroup.resize(694, 440)
self.egl_sync_layout = QtWidgets.QGridLayout(EGLSyncGroup)
self.egl_sync_layout.setObjectName("egl_sync_layout")
self.refresh_button = QtWidgets.QPushButton(EGLSyncGroup)
self.refresh_button.setObjectName("refresh_button")
self.egl_sync_layout.addWidget(self.refresh_button, 2, 0, 1, 1)
self.egl_sync_check = QtWidgets.QCheckBox(EGLSyncGroup)
self.egl_sync_check.setObjectName("egl_sync_check")
self.egl_sync_layout.addWidget(self.egl_sync_check, 3, 0, 1, 1)
self.egl_path_info = QtWidgets.QLabel(EGLSyncGroup)
self.egl_path_info.setObjectName("egl_path_info")
self.egl_sync_layout.addWidget(self.egl_path_info, 1, 0, 1, 1)
self.export_import_layout = QtWidgets.QHBoxLayout()
self.export_import_layout.setObjectName("export_import_layout")
self.export_group = QtWidgets.QGroupBox(EGLSyncGroup)
self.export_group.setObjectName("export_group")
self.export_layout = QtWidgets.QVBoxLayout(self.export_group)
self.export_layout.setObjectName("export_layout")
self.export_label = QtWidgets.QLabel(self.export_group)
self.export_label.setObjectName("export_label")
self.export_layout.addWidget(self.export_label)
self.export_list = QtWidgets.QListWidget(self.export_group)
self.export_list.setAlternatingRowColors(True)
self.export_list.setObjectName("export_list")
self.export_layout.addWidget(self.export_list)
self.export_buttons_layout = QtWidgets.QHBoxLayout()
self.export_buttons_layout.setObjectName("export_buttons_layout")
self.export_select_all_button = QtWidgets.QPushButton(self.export_group)
self.export_select_all_button.setObjectName("export_select_all_button")
self.export_buttons_layout.addWidget(self.export_select_all_button)
self.export_select_none_button = QtWidgets.QPushButton(self.export_group)
self.export_select_none_button.setObjectName("export_select_none_button")
self.export_buttons_layout.addWidget(self.export_select_none_button)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.export_buttons_layout.addItem(spacerItem)
self.export_button = QtWidgets.QPushButton(self.export_group)
self.export_button.setObjectName("export_button")
self.export_buttons_layout.addWidget(self.export_button)
self.export_layout.addLayout(self.export_buttons_layout)
self.export_import_layout.addWidget(self.export_group)
self.import_group = QtWidgets.QGroupBox(EGLSyncGroup)
self.import_group.setObjectName("import_group")
self.import_layout = QtWidgets.QVBoxLayout(self.import_group)
self.import_layout.setObjectName("import_layout")
self.import_label = QtWidgets.QLabel(self.import_group)
self.import_label.setObjectName("import_label")
self.import_layout.addWidget(self.import_label)
self.import_list = QtWidgets.QListWidget(self.import_group)
self.import_list.setAlternatingRowColors(True)
self.import_list.setObjectName("import_list")
self.import_layout.addWidget(self.import_list)
self.import_buttons_layout = QtWidgets.QHBoxLayout()
self.import_buttons_layout.setObjectName("import_buttons_layout")
self.import_select_all_button = QtWidgets.QPushButton(self.import_group)
self.import_select_all_button.setObjectName("import_select_all_button")
self.import_buttons_layout.addWidget(self.import_select_all_button)
self.import_select_none_button = QtWidgets.QPushButton(self.import_group)
self.import_select_none_button.setObjectName("import_select_none_button")
self.import_buttons_layout.addWidget(self.import_select_none_button)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.import_buttons_layout.addItem(spacerItem1)
self.import_button = QtWidgets.QPushButton(self.import_group)
self.import_button.setObjectName("import_button")
self.import_buttons_layout.addWidget(self.import_button)
self.import_layout.addLayout(self.import_buttons_layout)
self.export_import_layout.addWidget(self.import_group)
self.egl_sync_layout.addLayout(self.export_import_layout, 4, 0, 1, 1)
self.egl_path_layout = QtWidgets.QVBoxLayout()
self.egl_path_layout.setObjectName("egl_path_layout")
self.egl_sync_layout.addLayout(self.egl_path_layout, 0, 0, 1, 1)
self.retranslateUi(EGLSyncGroup)
QtCore.QMetaObject.connectSlotsByName(EGLSyncGroup)
def retranslateUi(self, EGLSyncGroup):
_translate = QtCore.QCoreApplication.translate
EGLSyncGroup.setWindowTitle(_translate("EGLSyncGroup", "EGLSyncGroup"))
EGLSyncGroup.setTitle(_translate("EGLSyncGroup", "Sync with Epic Games Launcher"))
self.refresh_button.setText(_translate("EGLSyncGroup", "Refresh"))
self.egl_sync_check.setText(_translate("EGLSyncGroup", "Enable automatic sync"))
self.egl_path_info.setText(_translate("EGLSyncGroup", "TextLabel"))
self.export_group.setTitle(_translate("EGLSyncGroup", "Exportable games"))
self.export_label.setText(_translate("EGLSyncGroup", "No games to export to EGS"))
self.export_list.setSortingEnabled(True)
self.export_select_all_button.setText(_translate("EGLSyncGroup", "Select all"))
self.export_select_none_button.setText(_translate("EGLSyncGroup", "Select none"))
self.export_button.setText(_translate("EGLSyncGroup", "Export"))
self.import_group.setTitle(_translate("EGLSyncGroup", "Importable games"))
self.import_label.setText(_translate("EGLSyncGroup", "No games to import from EGS"))
self.import_list.setSortingEnabled(True)
self.import_select_all_button.setText(_translate("EGLSyncGroup", "Select all"))
self.import_select_none_button.setText(_translate("EGLSyncGroup", "Select none"))
self.import_button.setText(_translate("EGLSyncGroup", "Import"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
EGLSyncGroup = QtWidgets.QGroupBox()
ui = Ui_EGLSyncGroup()
ui.setupUi(EGLSyncGroup)
EGLSyncGroup.show()
sys.exit(app.exec_())

View file

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EGLSyncGroup</class>
<widget class="QGroupBox" name="EGLSyncGroup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>694</width>
<height>440</height>
</rect>
</property>
<property name="windowTitle">
<string>EGLSyncGroup</string>
</property>
<property name="title">
<string>Sync with Epic Games Launcher</string>
</property>
<layout class="QGridLayout" name="egl_sync_layout">
<item row="2" column="0">
<widget class="QPushButton" name="refresh_button">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="egl_sync_check">
<property name="text">
<string>Enable automatic sync</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="egl_path_info">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="export_import_layout">
<item>
<widget class="QGroupBox" name="export_group">
<property name="title">
<string>Exportable games</string>
</property>
<layout class="QVBoxLayout" name="export_layout">
<item>
<widget class="QLabel" name="export_label">
<property name="text">
<string>No games to export to EGS</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="export_list">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="export_buttons_layout">
<item>
<widget class="QPushButton" name="export_select_all_button">
<property name="text">
<string>Select all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="export_select_none_button">
<property name="text">
<string>Select none</string>
</property>
</widget>
</item>
<item>
<spacer name="export_buttons_hspacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="export_button">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="import_group">
<property name="title">
<string>Importable games</string>
</property>
<layout class="QVBoxLayout" name="import_layout">
<item>
<widget class="QLabel" name="import_label">
<property name="text">
<string>No games to import from EGS</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="import_list">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="import_buttons_layout">
<item>
<widget class="QPushButton" name="import_select_all_button">
<property name="text">
<string>Select all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="import_select_none_button">
<property name="text">
<string>Select none</string>
</property>
</widget>
</item>
<item>
<spacer name="import_buttons_hspacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="import_button">
<property name="text">
<string>Import</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="egl_path_layout"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'rare/ui/components/tabs/games/import_sync/import_widget.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_ImportGroup(object):
def setupUi(self, ImportGroup):
ImportGroup.setObjectName("ImportGroup")
ImportGroup.resize(223, 128)
self.import_layout = QtWidgets.QFormLayout(ImportGroup)
self.import_layout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.import_layout.setObjectName("import_layout")
self.path_edit_label = QtWidgets.QLabel(ImportGroup)
self.path_edit_label.setObjectName("path_edit_label")
self.import_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.path_edit_label)
self.app_name_label = QtWidgets.QLabel(ImportGroup)
self.app_name_label.setObjectName("app_name_label")
self.import_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.app_name_label)
self.path_edit_layout = QtWidgets.QHBoxLayout()
self.path_edit_layout.setObjectName("path_edit_layout")
self.import_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.path_edit_layout)
self.app_name_layout = QtWidgets.QHBoxLayout()
self.app_name_layout.setObjectName("app_name_layout")
self.import_layout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.app_name_layout)
self.import_button = QtWidgets.QPushButton(ImportGroup)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.import_button.sizePolicy().hasHeightForWidth())
self.import_button.setSizePolicy(sizePolicy)
self.import_button.setObjectName("import_button")
self.import_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.import_button)
self.info_label = QtWidgets.QLabel(ImportGroup)
self.info_label.setText("")
self.info_label.setObjectName("info_label")
self.import_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.info_label)
self.retranslateUi(ImportGroup)
QtCore.QMetaObject.connectSlotsByName(ImportGroup)
def retranslateUi(self, ImportGroup):
_translate = QtCore.QCoreApplication.translate
ImportGroup.setWindowTitle(_translate("ImportGroup", "ImportGroup"))
ImportGroup.setTitle(_translate("ImportGroup", "Import EGL game from directory"))
self.path_edit_label.setText(_translate("ImportGroup", "Select path"))
self.app_name_label.setText(_translate("ImportGroup", "Override app name"))
self.import_button.setText(_translate("ImportGroup", "Import Game"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
ImportGroup = QtWidgets.QGroupBox()
ui = Ui_ImportGroup()
ui.setupUi(ImportGroup)
ImportGroup.show()
sys.exit(app.exec_())

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ImportGroup</class>
<widget class="QGroupBox" name="ImportGroup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>223</width>
<height>128</height>
</rect>
</property>
<property name="windowTitle">
<string>ImportGroup</string>
</property>
<property name="title">
<string>Import EGL game from directory</string>
</property>
<layout class="QFormLayout" name="import_layout">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="path_edit_label">
<property name="text">
<string>Select path</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="app_name_label">
<property name="text">
<string>Override app name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="path_edit_layout"/>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="app_name_layout"/>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="import_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Import Game</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="info_label">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>