1
0
Fork 0
mirror of synced 2024-06-02 02:34:40 +12:00

Some optimization for macOS + workflow; cancel launch if confirm is activated; enable button, if queue widget deleted

This commit is contained in:
Dummerle 2021-11-22 19:15:46 +01:00
parent 4c9ef8acd8
commit 72d05f6e53
No known key found for this signature in database
GPG key ID: AB68CC59CA39F2F1
7 changed files with 97 additions and 11 deletions

View file

@ -131,3 +131,40 @@ jobs:
asset_name: Rare-${{github.ref}}.msi
tag: ${{ github.ref }}
overwrite: true
mac_os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Pip Dependencies
run: |
pip install -r requirements.txt
pip install ./legendary
pip install pyinstaller
- name: copy files
run: mv rare/__main__.py __main__.py
- name: run pyinstaller
run: |
pyinstaller -F --name Rare --add-data "rare/languages/*:rare/languages" --add-data "rare/resources/colors/*:rare/resources/colors" --add-data "rare/resources/images/*:rare/resources/images/" --add-data "rare/resources/stylesheets/RareStyle/*:rare/resources/stylesheets/RareStyle/" --windowed --icon rare/resources/images/Rare.icns --hidden-import=legendary __main__.py
- name: create dmg
run: |
git clone https://github.com/create-dmg/create-dmg
create-dmg/create-dmg Rare-${{github.ref}}.dmg dist/Rare.App --volname Rare --volicon rare/resources/images/Rare.icns
- name: upload to GitHub
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Rare-${{github.ref}}.dmg
asset_name: Rare-${{github.ref}}.dmg
tag: ${{ github.ref }}
overwrite: true

View file

@ -101,3 +101,36 @@ jobs:
with:
name: Rare-Windows.msi
path: dist/*.msi
mac_os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Pip Dependencies
run: |
pip install -r requirements.txt
pip install ./legendary
pip install pyinstaller
- name: copy files
run: mv rare/__main__.py __main__.py
- name: run pyinstaller
run: |
pyinstaller -F --name Rare --add-data "rare/languages/*:rare/languages" --add-data "rare/resources/colors/*:rare/resources/colors" --add-data "rare/resources/images/*:rare/resources/images/" --add-data "rare/resources/stylesheets/RareStyle/*:rare/resources/stylesheets/RareStyle/" --windowed --icon rare/resources/images/Rare.icns --hidden-import=legendary __main__.py
- name: create dmg
run: |
git clone https://github.com/create-dmg/create-dmg
create-dmg/create-dmg Rare-${{github.ref}}.dmg dist/Rare.App --volname Rare --volicon rare/resources/images/Rare.icns
- uses: actions/upload-artifact@v2
with:
name: Rare-MacOS.dmg
path: ./*.dmg

View file

@ -2,6 +2,8 @@ import os
__version__ = "1.6.9"
import platform
resources_path = os.path.join(os.path.dirname(__file__), "resources")
languages_path = os.path.join(os.path.dirname(__file__), "languages")
data_dir = ""
@ -11,6 +13,8 @@ if p := os.getenv("XDG_CACHE_HOME"):
cache_dir = os.path.join(p, "rare/cache")
elif os.name == "nt":
cache_dir = os.path.expandvars("%APPDATA%/rare/cache")
elif platform.system() == "Darwin":
cache_dir = os.path.expanduser("~/Library/rare/cache")
else:
cache_dir = os.path.expanduser("~/.cache/rare/")
@ -22,6 +26,8 @@ if p := os.getenv("XDG_DATA_HOME"):
data_dir = os.path.join(p, "rare")
if os.name == "nt":
data_dir = os.path.expandvars("%APPDATA%/rare/")
elif platform.system() == "Darwin":
cache_dir = os.path.expanduser("~/Library/rare/")
else:
data_dir = os.path.expanduser("~/.local/share/rare/")
if not os.path.exists(data_dir):

View file

@ -10,7 +10,7 @@ from legendary.models.downloading import UIUpdate
from legendary.models.game import Game, InstalledGame
from rare import shared
from rare.components.dialogs.install_dialog import InstallDialog
from rare.components.tabs.downloads.dl_queue_widget import DlQueueWidget
from rare.components.tabs.downloads.dl_queue_widget import DlQueueWidget, DlWidget
from rare.components.tabs.downloads.download_thread import DownloadThread
from rare.utils.models import InstallOptionsModel, InstallQueueItemModel
from rare.utils.utils import get_size
@ -102,10 +102,17 @@ class DownloadTab(QWidget):
for name in updates:
self.add_update(self.core.get_installed_game(name))
self.queue_widget.item_removed.connect(self.queue_item_removed)
self.setLayout(self.layout)
self.signals.install_game.connect(self.get_install_options)
def queue_item_removed(self, app_name):
if w := self.update_widgets.get(app_name):
w.update_button.setDisabled(False)
w.update_with_settings.setDisabled(False)
def add_update(self, igame: InstalledGame):
widget = UpdateWidget(self.core, igame, self)
self.update_layout.addWidget(widget)

View file

@ -57,6 +57,7 @@ class DlWidget(QWidget):
class DlQueueWidget(QGroupBox):
update_list = pyqtSignal(list)
item_removed = pyqtSignal(str)
dl_queue = []
def __init__(self):
@ -93,6 +94,7 @@ class DlQueueWidget(QGroupBox):
for index, i in enumerate(self.dl_queue):
if i.download.game.app_name == app_name:
self.dl_queue.pop(index)
self.item_removed.emit(app_name)
break
else:
logger.warning("BUG! " + app_name)

View file

@ -98,6 +98,8 @@ class GameUtils(QObject):
if not QMessageBox.question(None, "Launch", self.tr("Do you want to launch {}").format(game.app_title),
QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
logger.info("Cancel Startup")
self.finished.emit(app_name, "")
return
logger.info("Launching " + game.app_title)
if game.third_party_store == "Origin":

View file

@ -106,20 +106,19 @@ class RareSettings(QWidget, Ui_RareSettings):
self.desktop_file = os.path.expanduser("~/Desktop/Rare.lnk")
self.start_menu_link = os.path.expandvars("%appdata%\\Microsoft\\Windows\\Start Menu")
else:
self.desktop_link_btn.setText(self.tr("Not supported"))
self.desktop_link_btn.setDisabled(True)
self.startmenu_link_btn.setText(self.tr("Not supported"))
self.startmenu_link_btn.setDisabled(True)
self.desktop_file = ""
self.start_menu_link = ""
if self.desktop_file:
if os.path.exists(self.desktop_file):
self.desktop_link_btn.setText(self.tr("Remove desktop link"))
else:
self.desktop_link.setDisabled(True)
if self.desktop_file and os.path.exists(self.desktop_file):
self.desktop_link_btn.setText(self.tr("Remove desktop link"))
if self.start_menu_link:
if os.path.exists(self.start_menu_link):
self.startmenu_link_btn.setText(self.tr("Remove start menu link"))
else:
self.startmenu_link_btn.setDisabled(True)
if self.start_menu_link and os.path.exists(self.start_menu_link):
self.startmenu_link_btn.setText(self.tr("Remove start menu link"))
self.desktop_link_btn.clicked.connect(self.create_desktop_link)
self.startmenu_link_btn.clicked.connect(self.create_start_menu_link)