Update console and origin launch
This commit is contained in:
parent
8ac9a1c41f
commit
a978771d82
|
@ -43,8 +43,8 @@ class ConsoleWindow(QWidget):
|
|||
def log(self, text: str, end: str = "\n"):
|
||||
self.console.log(text + end)
|
||||
|
||||
def error(self, text):
|
||||
self.console.error(text)
|
||||
def error(self, text, end: str = "\n"):
|
||||
self.console.error(text + end)
|
||||
|
||||
|
||||
class Console(QPlainTextEdit):
|
||||
|
@ -55,11 +55,13 @@ class Console(QPlainTextEdit):
|
|||
self._cursor_output = self.textCursor()
|
||||
|
||||
def log(self, text):
|
||||
self._cursor_output.insertText(text)
|
||||
html = f"<p style=\"color:#999;white-space:pre\">{text}</p>"
|
||||
self._cursor_output.insertHtml(html)
|
||||
self.scroll_to_last_line()
|
||||
|
||||
def error(self, text):
|
||||
self._cursor_output.insertHtml(f'<font color="Red">{text}</font>')
|
||||
html = f"<p style=\"color:#eee;white-space:pre\">{text}</p>"
|
||||
self._cursor_output.insertHtml(html)
|
||||
self.scroll_to_last_line()
|
||||
|
||||
def scroll_to_last_line(self):
|
||||
|
|
|
@ -175,7 +175,7 @@ class GameUtils(QObject):
|
|||
if game.third_party_store != "Origin":
|
||||
self._launch_game(igame, process, offline, skip_update_check, ask_always_sync)
|
||||
else:
|
||||
self._launch_origin(igame.app_name, process)
|
||||
self._launch_origin(app_name, process)
|
||||
|
||||
env = self.core.get_app_environment(app_name, wine_pfx=wine_pfx)
|
||||
pre_cmd, wait = self.core.get_pre_launch_command(app_name)
|
||||
|
@ -192,7 +192,7 @@ class GameUtils(QObject):
|
|||
logger.info(f"Game exited with exit code: {exit_code}")
|
||||
self.signals.set_discord_rpc.emit("")
|
||||
is_origin = self.core.get_game(app_name).third_party_store == "Origin"
|
||||
if exit_code == 53 and is_origin:
|
||||
if exit_code == 1 and is_origin:
|
||||
msg_box = QMessageBox()
|
||||
msg_box.setText(
|
||||
self.tr(
|
||||
|
@ -204,7 +204,8 @@ class GameUtils(QObject):
|
|||
resp = msg_box.exec()
|
||||
# click install button
|
||||
if resp == 0:
|
||||
webbrowser.open("https://www.dm.origin.com/download")
|
||||
QDesktopServices.openUrl(QUrl("https://www.dm.origin.com/download"))
|
||||
return
|
||||
if exit_code != 0:
|
||||
QMessageBox.warning(
|
||||
None,
|
||||
|
@ -241,7 +242,6 @@ class GameUtils(QObject):
|
|||
|
||||
def _launch_pre_command(self, env: dict):
|
||||
proc = QProcess()
|
||||
proc.setProcessChannelMode(QProcess.MergedChannels)
|
||||
environment = QProcessEnvironment()
|
||||
for e in env:
|
||||
environment.insert(e, env[e])
|
||||
|
@ -261,7 +261,6 @@ class GameUtils(QObject):
|
|||
|
||||
def _get_process(self, app_name, env):
|
||||
process = GameProcess(app_name)
|
||||
process.setProcessChannelMode(GameProcess.MergedChannels)
|
||||
|
||||
environment = QProcessEnvironment()
|
||||
for e in env:
|
||||
|
@ -307,7 +306,7 @@ class GameUtils(QObject):
|
|||
)
|
||||
process.deleteLater()
|
||||
return
|
||||
|
||||
command.append(origin_uri)
|
||||
process.start(command[0], command[1:])
|
||||
|
||||
def _launch_game(self, igame: InstalledGame, process: QProcess, offline: bool,
|
||||
|
|
Loading…
Reference in a new issue