1
0
Fork 0
mirror of synced 2024-06-30 20:20:53 +12:00

Merge branch 'main' into dev

This commit is contained in:
Dummerle 2021-09-05 22:00:14 +02:00 committed by GitHub
commit 5f0e918323
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 133 deletions

View file

@ -1,6 +1,9 @@
--- ---
name: Bug report about: Create a report to help us improve title: '' name: Bug report
labels: bug assignees: '' about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''
--- ---
@ -9,7 +12,6 @@ A clear and concise description of what the bug is.
**To Reproduce** **To Reproduce**
Steps to reproduce the behavior: Steps to reproduce the behavior:
1. Go to '...' 1. Go to '...'
2. Click on '....' 2. Click on '....'
3. Scroll down to '....' 3. Scroll down to '....'
@ -21,10 +23,14 @@ A clear and concise description of what you expected to happen.
**Screenshots** **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
**System information (please complete the following information):** **Desktop (please complete the following information):**
- OS: [e.g. Manjaro/Windows 10]
- OS (e.g. Ubuntu 20.04 or Windows 10) - Version [e.g. 1.6.2]
- Installation [e.g. pip/msi/AppImage]
- Python version - Python version
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.
**Error message**
You can find error message in ~/.cache/rare/logs/

View file

@ -1,6 +1,9 @@
--- ---
name: Feature request about: Suggest an idea for this project title: '' name: Feature request
labels: feature-request assignees: '' about: Suggest an idea for this project
title: "[Feature Request]"
labels: feature-request
assignees: ''
--- ---

View file

@ -102,9 +102,6 @@ jobs:
- name: cx_freeze - name: cx_freeze
run: pip3 install --upgrade cx_freeze wheel run: pip3 install --upgrade cx_freeze wheel
- name: prepare Files
run: mv rare/__main__.py rare/Rare.py
- name: Build - name: Build
run: python freeze.py bdist_msi run: python freeze.py bdist_msi
@ -119,33 +116,3 @@ jobs:
asset_name: Rare.msi asset_name: Rare.msi
tag: ${{ github.ref }} tag: ${{ github.ref }}
overwrite: true overwrite: true
mac_os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Rare Dependencies
run: pip install -r requirements.txt
- name: install pyinstaller
run: 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 __main__.py
- name: upload to GitHub
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Rare.app
asset_name: Rare_MacOS.app
tag: ${{ github.ref }}
overwrite: true

103
freeze.py
View file

@ -1,82 +1,35 @@
import sys
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
from rare import __version__ from rare import __version__
# Packages to include shortcut_table = [
python_packages = [ ("DesktopShortcut", # Shortcut
"PyQt5", "DesktopFolder", # Directory_
'requests', "Rare", # Name
'PIL', "TARGETDIR", # Component_
'qtawesome', "[TARGETDIR]Rare.exe", # Target
'psutil', None, # Arguments
'pypresence', None, # Description
'win32com' None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # WkDir
)
] ]
# Modules to include msi_data = {"Shortcut": shortcut_table}
python_modules = [] bdist_msi_options = {'data': msi_data}
base = "Win32GUI"
base = None setup(
name = None name="Rare",
build_options = {} version=__version__,
build_exe_options = {} description="A GUI for Legendary",
shortcutName = None options={
shortcutDir = None "bdist_msi": bdist_msi_options,
bdist_msi_options = None },
src_files = [] executables=[Executable("rare/__main__.py",
external_so_files = [] base=base, icon="rare/resources/images/Rare.ico",
target_name="Rare")]
if sys.platform == 'win32': )
base = 'Win32GUI'
name = 'Rare.exe'
shortcut_table = [
('DesktopShortcut', # Shortcut
'DesktopFolder', # Directory
'Rare', # Name
'TARGETDIR', # Component
'[TARGETDIR]' + name, # Target
None, # Arguments
'A gui for Legendary.', # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # Working Directory
)]
msi_data = {"Shortcut": shortcut_table}
bdist_msi_options = {'data': msi_data, "all_users": False}
build_options["bdist_msi"] = bdist_msi_options
else:
name = 'Rare'
src_files += [
'LICENSE',
'README.md',
'rare/resources/images/Rare.ico',
]
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options["packages"] = python_packages
build_exe_options["include_files"] = src_files + external_so_files
build_exe_options["includes"] = python_modules
build_exe_options["excludes"] = ["setuptools", "tkinter", "pkg_resources"]
# Set options
build_options["build_exe"] = build_exe_options
setup(name='Rare',
version=__version__,
description='A gui for Legendary.',
options=build_options,
executables=[
Executable('rare/Rare.py',
targetName=name,
icon='rare/resources/images/Rare.ico',
base=base,
shortcutName=shortcutName,
shortcutDir=shortcutDir,
),
],
)

View file

@ -8,7 +8,9 @@ from rare.utils import singleton, utils
def main(): def main():
# CLI Options # CLI Options
parser = ArgumentParser() parser = ArgumentParser()
parser.add_argument("-V", "--version", action="store_true", help="Shows version and exits") parser.add_argument("-V", "--version", action="store_true", help="Shows version and exits")
parser.add_argument("-S", "--silent", action="store_true", parser.add_argument("-S", "--silent", action="store_true",
@ -56,12 +58,14 @@ def main():
# fix error in cx_freeze # fix error in cx_freeze
import multiprocessing
multiprocessing.freeze_support()
from rare.app import start from rare.app import start
start(args) start(args)
if __name__ == '__main__': if __name__ == '__main__':
import multiprocessing
multiprocessing.freeze_support()
main() main()

View file

@ -265,14 +265,18 @@ def create_rare_desktop_link(type_of_link):
# Path to location of link file # Path to location of link file
pathLink = os.path.join(target_folder, linkName) pathLink = os.path.join(target_folder, linkName)
exexutable = sys.executable if sys.executable.endswith("Rare.exe"):
if "python.exe" in exexutable: executable = sys.executable
exexutable = exexutable.replace("python.exe", "pythonw.exe") else:
executable = f"{sys.executable} {os.path.abspath(sys.argv[0])}"
if "python.exe" in executable:
executable = executable.replace("python.exe", "pythonw.exe")
# Add shortcut # Add shortcut
shell = Dispatch('WScript.Shell') shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(pathLink) shortcut = shell.CreateShortCut(pathLink)
shortcut.Targetpath = exexutable shortcut.Targetpath = executable
shortcut.Arguments = os.path.abspath(sys.argv[0]) shortcut.Arguments = os.path.abspath(sys.argv[0])
shortcut.WorkingDirectory = os.getcwd() shortcut.WorkingDirectory = os.getcwd()
@ -285,14 +289,15 @@ def create_rare_desktop_link(type_of_link):
def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop") -> bool: def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop") -> bool:
igame = core.get_installed_game(app_name) igame = core.get_installed_game(app_name)
if os.path.exists(
os.path.join(QSettings('Rare', 'Rare').value('img_dir', os.path.join(data_dir, 'images'), str), if os.path.exists(p := os.path.join(image_dir, igame.app_name, 'Thumbnail.png')):
igame.app_name, 'Thumbnail.png')): icon = p
icon = os.path.join(QSettings('Rare', 'Rare').value('img_dir', os.path.join(data_dir, 'images'), str), elif os.path.exists(p := os.path.join(image_dir, igame.app_name, "DieselGameBoxLogo.png")):
igame.app_name, 'Thumbnail') icon = p
else: else:
icon = os.path.join(QSettings('Rare', 'Rare').value('img_dir', os.path.join('images'), str), icon = os.path.join(os.path.join(image_dir, igame.app_name, "DieselGameBoxTall.png"))
igame.app_name, 'DieselGameBoxTall') icon = icon.replace(".png", "")
# Linux # Linux
if platform.system() == "Linux": if platform.system() == "Linux":
if type_of_link == "desktop": if type_of_link == "desktop":
@ -332,8 +337,6 @@ def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop") -
if not os.path.exists(target_folder): if not os.path.exists(target_folder):
return False return False
target = os.path.abspath(sys.argv[0])
# Name of link file # Name of link file
linkName = igame.title linkName = igame.title
for c in r'<>?":|\/*': for c in r'<>?":|\/*':
@ -347,8 +350,12 @@ def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop") -
# Add shortcut # Add shortcut
shell = Dispatch('WScript.Shell') shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(pathLink) shortcut = shell.CreateShortCut(pathLink)
shortcut.Targetpath = sys.executable if sys.executable.endswith("Rare.exe"):
shortcut.Arguments = f'{target} launch {app_name}' executable = sys.executable
else:
executable = f"{sys.executable} {os.path.abspath(sys.argv[0])}"
shortcut.Targetpath = executable
shortcut.Arguments = f'launch {app_name}'
shortcut.WorkingDirectory = os.getcwd() shortcut.WorkingDirectory = os.getcwd()
# Icon # Icon