Some nice dialogs
This commit is contained in:
parent
7b481da8db
commit
50bbea2b75
|
@ -38,12 +38,16 @@ class GameSettingsDialog(QDialog):
|
||||||
return self.action
|
return self.action
|
||||||
|
|
||||||
def uninstall(self):
|
def uninstall(self):
|
||||||
dia = AcceptDialog(f"Do you really want to delete {self.game.title}")
|
msg = QMessageBox()
|
||||||
if dia.get_accept():
|
msg.setIcon(QMessageBox.Warning)
|
||||||
|
msg.setText(f"Do you really want to delete {self.game.title}")
|
||||||
|
msg.setWindowTitle("Uninstall Game")
|
||||||
|
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
|
||||||
|
ret = msg.exec_()
|
||||||
|
|
||||||
|
if ret == QMessageBox.Ok:
|
||||||
self.action = "uninstall"
|
self.action = "uninstall"
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def exit_settings(self):
|
def exit_settings(self):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
|
@ -53,26 +53,29 @@ class GameListInstalled(QScrollArea):
|
||||||
|
|
||||||
def import_games_prepare(self):
|
def import_games_prepare(self):
|
||||||
# Automatically import from windows
|
# Automatically import from windows
|
||||||
|
imported = 0
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
available_drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)]
|
available_drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)]
|
||||||
for drive in available_drives:
|
for drive in available_drives:
|
||||||
path = f"{drive}/Program Files/Epic Games/"
|
path = f"{drive}/Program Files/Epic Games/"
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
self.auto_import_games(path)
|
imported += self.auto_import_games(path)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
possible_wineprefixes = [os.path.expanduser("~/.wine/"), os.path.expanduser("~/Games/epic-games-store/")]
|
possible_wineprefixes = [os.path.expanduser("~/.wine/"), os.path.expanduser("~/Games/epic-games-store/")]
|
||||||
for wine_prefix in possible_wineprefixes:
|
for wine_prefix in possible_wineprefixes:
|
||||||
self.auto_import_games(f"{wine_prefix}drive_c/Program Files/Epic Games/")
|
imported += self.auto_import_games(f"{wine_prefix}drive_c/Program Files/Epic Games/")
|
||||||
|
|
||||||
|
QMessageBox.information(self, "Imported Games", f"Successfully imported {imported} Games")
|
||||||
logger.info("Restarting app to import games")
|
logger.info("Restarting app to import games")
|
||||||
|
|
||||||
def auto_import_games(self, game_path):
|
def auto_import_games(self, game_path):
|
||||||
|
imported = 0
|
||||||
if not os.path.exists(game_path):
|
if not os.path.exists(game_path):
|
||||||
return
|
return 0
|
||||||
if os.listdir(game_path) == 0:
|
if os.listdir(game_path) == 0:
|
||||||
logger.info(f"No Games found in {game_path}")
|
logger.info(f"No Games found in {game_path}")
|
||||||
return
|
return 0
|
||||||
for path in os.listdir(game_path):
|
for path in os.listdir(game_path):
|
||||||
json_path = game_path + path + "/.egstore"
|
json_path = game_path + path + "/.egstore"
|
||||||
print(json_path)
|
print(json_path)
|
||||||
|
@ -83,4 +86,6 @@ class GameListInstalled(QScrollArea):
|
||||||
for file in os.listdir(json_path):
|
for file in os.listdir(json_path):
|
||||||
if file.endswith(".mancpn"):
|
if file.endswith(".mancpn"):
|
||||||
app_name = json.load(open(os.path.join(json_path, file)))["AppName"]
|
app_name = json.load(open(os.path.join(json_path, file)))["AppName"]
|
||||||
legendaryUtils.import_game(self.core, app_name, game_path + path)
|
if legendaryUtils.import_game(self.core, app_name, game_path + path):
|
||||||
|
imported +=1
|
||||||
|
return imported
|
||||||
|
|
Loading…
Reference in a new issue