1
0
Fork 0
mirror of synced 2024-06-29 03:31:06 +12:00

remove option to import games from egs in import widget

This commit is contained in:
Dummerle 2021-05-20 11:16:57 +02:00
parent 760c75e45b
commit 27b1c10206
2 changed files with 3 additions and 50 deletions

View file

@ -9,7 +9,7 @@ from rare.components.dialogs.install_dialog import InstallDialog
from rare.components.tab_utils import TabBar, TabButtonWidget
from rare.components.tabs.account import MiniWidget
from rare.components.tabs.cloud_saves import SyncSaves
from rare.components.tabs.downloads.__init__ import DownloadTab
from rare.components.tabs.downloads import DownloadTab
from rare.components.tabs.games import GameTab
from rare.components.tabs.settings import SettingsTab
from rare.utils.models import InstallOptions

View file

@ -44,7 +44,7 @@ class ImportWidget(QWidget):
self.gb_layout.addWidget(self.import_game_info)
self.override_app_name_label = QLabel(
self.tr("Override app name (Only if imported game from legendary or the app could not find the app name)"))
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)
@ -71,13 +71,8 @@ class ImportWidget(QWidget):
self.layout.addWidget(self.import_one_game)
self.layout.addStretch(1)
self.auto_import = QLabel(f"<h3>{self.tr('Auto import all existing games')}</h3>")
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.auto_import_button = QPushButton(self.tr("Import all games from Epic Games Launcher"))
self.auto_import_button.clicked.connect(self.import_games_prepare)
self.layout.addWidget(self.auto_import_button)
self.layout.addStretch(1)
self.main_layout.addLayout(self.layout)
@ -129,45 +124,3 @@ class ImportWidget(QWidget):
logger.warning("Failed to import" + app_name)
self.info_label.setText(self.tr("Failed to import {}").format(app_name))
return
def auto_import_games(self, game_path):
imported = 0
if not os.path.exists(game_path):
return 0
if os.listdir(game_path) == 0:
logger.info(f"No Games found in {game_path}")
return 0
for path in os.listdir(game_path):
json_path = game_path + path
if not os.path.isdir(json_path):
logger.info(f"Game at {game_path + path} doesn't exist")
continue
app_name = self.find_app_name(json_path)
if not app_name:
logger.warning("Could not find app name at " + game_path)
continue
if legendary_utils.import_game(self.core, app_name, game_path + path):
imported += 1
return imported
def import_games_prepare(self):
# Automatically import from windows
imported = 0
if os.name == "nt":
available_drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)]
for drive in available_drives:
path = f"{drive}/Program Files/Epic Games/"
if os.path.exists(path):
imported += self.auto_import_games(path)
else:
possible_wineprefixes = [os.path.expanduser("~/.wine"), os.path.expanduser("~/Games/epic-games-store")]
for wine_prefix in possible_wineprefixes:
imported += self.auto_import_games(os.path.join(wine_prefix, "drive_c/Program Files/Epic Games/"))
if imported > 0:
QMessageBox.information(self, "Imported Games",
self.tr("Successfully imported {} Games. Reloading Library").format(imported))
self.update_list.emit()
else:
QMessageBox.information(self, "Imported Games", self.tr("No Games were found"))