1
0
Fork 0
mirror of synced 2024-06-28 11:11:15 +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: ''
labels: bug assignees: ''
name: Bug report
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**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
@ -21,10 +23,14 @@ A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**System information (please complete the following information):**
- OS (e.g. Ubuntu 20.04 or Windows 10)
**Desktop (please complete the following information):**
- OS: [e.g. Manjaro/Windows 10]
- Version [e.g. 1.6.2]
- Installation [e.g. pip/msi/AppImage]
- Python version
**Additional context**
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: ''
labels: feature-request assignees: ''
name: Feature request
about: Suggest an idea for this project
title: "[Feature Request]"
labels: feature-request
assignees: ''
---

View file

@ -102,9 +102,6 @@ jobs:
- name: cx_freeze
run: pip3 install --upgrade cx_freeze wheel
- name: prepare Files
run: mv rare/__main__.py rare/Rare.py
- name: Build
run: python freeze.py bdist_msi
@ -119,33 +116,3 @@ jobs:
asset_name: Rare.msi
tag: ${{ github.ref }}
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 rare import __version__
# Packages to include
python_packages = [
"PyQt5",
'requests',
'PIL',
'qtawesome',
'psutil',
'pypresence',
'win32com'
shortcut_table = [
("DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_
"Rare", # Name
"TARGETDIR", # Component_
"[TARGETDIR]Rare.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # WkDir
)
]
# Modules to include
python_modules = []
msi_data = {"Shortcut": shortcut_table}
bdist_msi_options = {'data': msi_data}
base = "Win32GUI"
base = None
name = None
build_options = {}
build_exe_options = {}
shortcutName = None
shortcutDir = None
bdist_msi_options = None
src_files = []
external_so_files = []
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,
),
],
)
setup(
name="Rare",
version=__version__,
description="A GUI for Legendary",
options={
"bdist_msi": bdist_msi_options,
},
executables=[Executable("rare/__main__.py",
base=base, icon="rare/resources/images/Rare.ico",
target_name="Rare")]
)

View file

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

View file

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