From d93294536a880107c360878070ca3802af23026a Mon Sep 17 00:00:00 2001 From: Dummerle <44114474+Dummerle@users.noreply.github.com> Date: Sat, 11 Dec 2021 00:18:57 +0100 Subject: [PATCH] Add --test-start to use in appimage-builder --- AppImageBuilder.yml | 38 +++++++++++------------ rare/__main__.py | 1 + rare/app.py | 4 +++ rare/components/dialogs/login/__init__.py | 3 ++ 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml index cdb1f8ca..cfcf9e56 100644 --- a/AppImageBuilder.yml +++ b/AppImageBuilder.yml @@ -23,20 +23,20 @@ AppDir: exec: usr/bin/python3 exec_args: $APPDIR/usr/src/rare/__main__.py $@ apt: - arch: amd64 - allow_unauthenticated: true - sources: - - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy main restricted - - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-updates main restricted - - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy universe - - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-updates universe - - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy multiverse - - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-updates multiverse - - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-backports main restricted - universe multiverse - - sourceline: deb http://security.ubuntu.com/ubuntu groovy-security main restricted - - sourceline: deb http://security.ubuntu.com/ubuntu groovy-security universe - - sourceline: deb http://security.ubuntu.com/ubuntu groovy-security multiverse + arch: amd64 + allow_unauthenticated: true + sources: + - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy main restricted + - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-updates main restricted + - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy universe + - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-updates universe + - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy multiverse + - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-updates multiverse + - sourceline: deb http://de.archive.ubuntu.com/ubuntu/ groovy-backports main restricted + universe multiverse + - sourceline: deb http://security.ubuntu.com/ubuntu groovy-security main restricted + - sourceline: deb http://security.ubuntu.com/ubuntu groovy-security universe + - sourceline: deb http://security.ubuntu.com/ubuntu groovy-security multiverse include: - python3 - python3-distutils @@ -56,23 +56,23 @@ AppDir: test: fedora: image: appimagecrafters/tests-env:fedora-30 - command: ./AppRun + command: ./AppRun --test-start use_host_x: true debian-stable: image: appimagecrafters/tests-env:debian-stable - command: ./AppRun + command: ./AppRun --test-start use_host_x: true archlinux-latest: image: appimagecrafters/tests-env:archlinux-latest - command: ./AppRun + command: ./AppRun --test-start use_host_x: true centos-7: image: appimagecrafters/tests-env:centos-7 - command: ./AppRun + command: ./AppRun --test-start use_host_x: true ubuntu-xenial: image: appimagecrafters/tests-env:ubuntu-xenial - command: ./AppRun + command: ./AppRun --test.start use_host_x: true AppImage: diff --git a/rare/__main__.py b/rare/__main__.py index 7d225ef0..84979549 100644 --- a/rare/__main__.py +++ b/rare/__main__.py @@ -23,6 +23,7 @@ def main(): help="Launch Rare in background. Open it from System Tray Icon") parser.add_argument("--debug", action="store_true", help="Launch in debug mode") parser.add_argument("--offline", action="store_true", help="Launch Rare in offline mode") + parser.add_argument("--test-start", action="store_true", help="Quit immediately after launch") parser.add_argument("--desktop-shortcut", action="store_true", dest="desktop_shortcut", help="Use this, if there is no link on desktop to start Rare") diff --git a/rare/app.py b/rare/app.py index a1d5a872..4de758d6 100644 --- a/rare/app.py +++ b/rare/app.py @@ -139,6 +139,7 @@ class App(QApplication): self.launch_dialog.login() + def start_app(self): self.mainwindow = MainWindow() self.launch_dialog.close() @@ -162,6 +163,9 @@ class App(QApplication): "Could not find {} in installed games. Did you modify the shortcut? ").format( shared.args.app_name)) + if shared.args.test_start: + self.exit_app(0) + def tray(self, reason): if reason == QSystemTrayIcon.DoubleClick: self.mainwindow.show() diff --git a/rare/components/dialogs/login/__init__.py b/rare/components/dialogs/login/__init__.py index bd65a524..9312c793 100644 --- a/rare/components/dialogs/login/__init__.py +++ b/rare/components/dialogs/login/__init__.py @@ -5,6 +5,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QSizePolicy, QLayout, QDialog, QMessageBox from legendary.core import LegendaryCore +from rare import shared from rare.components.dialogs.login.browser_login import BrowserLogin from rare.components.dialogs.login.import_login import ImportLogin from rare.ui.components.dialogs.login.login_dialog import Ui_LoginDialog @@ -79,6 +80,8 @@ class LoginDialog(QDialog, Ui_LoginDialog): self.import_page.do_login() def login(self): + if shared.args.test_start: + return False self.exec_() return self.logged_in