Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shop refactor #269

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
70af132
EOSGroup: Check for 'user.reg' file to validate prefix path
loathingKernel Dec 3, 2023
6460e87
RareLauncher: Enable terminate and kill buttons
loathingKernel Aug 18, 2023
e7dd3b0
Wine: Run commands through `flatpak-spawn` when in flatpak
loathingKernel Aug 28, 2023
e6c1051
Rare: Move the different applications into their respective folders
loathingKernel Sep 1, 2023
52fbaad
GameInfo: Add tags groupbox
loathingKernel Sep 1, 2023
57b7783
Rare: Update scripts to use the new entry point
loathingKernel Sep 2, 2023
909c3cb
Workflows: Fix deb action
loathingKernel Sep 2, 2023
45ad3e2
Wine: Set environment through `flatpak-spawn` arguments
loathingKernel Sep 2, 2023
0246774
Wine,WineResolver: Add more logging
loathingKernel Sep 3, 2023
2fe3bdb
RareLauncher: Fix crash when a false `app_name` argument is supplied
loathingKernel Sep 3, 2023
97c7444
EOSGroup: Use UI membership instead of double inheritance
loathingKernel Sep 3, 2023
43919b9
MainWindow: Untie exit procedure from `offline` argument
loathingKernel Sep 8, 2023
f101c6d
ConfigHelper: Add wine related functions
loathingKernel Sep 8, 2023
bbeeb42
RareGame: RareEosOverlay now implements its procedures internally.
loathingKernel Sep 8, 2023
7b33e48
EosGroup: Remake the UI and integrate with Rare's facilities
loathingKernel Sep 8, 2023
9d02fec
Rare: Small fixes and typos
loathingKernel Sep 10, 2023
5319da4
RareCore: Add options to exclude non-asset games and entitlements fro…
loathingKernel Sep 10, 2023
66dcf5f
EOSGroup: Add the option to select which overlay installation to enable
loathingKernel Sep 10, 2023
239e4c9
Utils: Delete deprecated CloudWorker.
loathingKernel Sep 13, 2023
f0c3cfe
RareGame: Use the callable directly instead of a lambda
loathingKernel Sep 13, 2023
1caa530
ConfigHelper: Add generic functions to query config options with fall…
loathingKernel Sep 13, 2023
8d46a3e
RareEosOverlay: Protect against invalid prefixes
loathingKernel Sep 13, 2023
c3c9b0f
AccountWidget: Add a Quit button in the widget in case the system tray
loathingKernel Sep 13, 2023
47f153e
Rare: Unset QT_QPA_PLATFORMTHEME at startup
loathingKernel Sep 13, 2023
4311fee
ProtonSettings: Move proton search function into `utils/proton.py`
loathingKernel Sep 14, 2023
801c079
Proton: Add functions to find and integrate compatibilty tools and ru…
loathingKernel Sep 14, 2023
713573b
RareCore: Move entitlements request into an independent worker
loathingKernel Sep 14, 2023
5485e97
ConfigHelper: Fix an issue with wine prefix resolution
loathingKernel Sep 14, 2023
4827285
SteamGrades: Use orjson instead of python's implementation
loathingKernel Aug 29, 2022
9bd73f3
SteamGrades: Return the Steam game ID with the grade and store it.
loathingKernel Sep 15, 2023
14e047e
RareGame: Use None for unset steam appid.
loathingKernel Sep 15, 2023
75c8e8d
Downloads: Move auto-update change to Rare's settings instead of the …
loathingKernel Sep 19, 2023
89df980
Cleanup:
loathingKernel Sep 19, 2023
a3557a0
Wrappers/Proton/Wine WIP
loathingKernel Sep 23, 2023
95a5cc1
Store: Clean up store UI by using library widgets
loathingKernel Jan 29, 2023
a6071b7
Store: Use ElideLabel for requirements
loathingKernel Mar 12, 2023
59826dc
QtRequestsManager: Use `doc_type` instead of `type`
loathingKernel Mar 30, 2023
2992463
Wishlist: Remove embedded title
loathingKernel Mar 30, 2023
74ee9f8
ShopWidget: Cleanup shop layout
loathingKernel Mar 30, 2023
2940ea7
ShopWidget: Fix layouting again
loathingKernel Mar 30, 2023
7a15ee8
SearchResultItem: Use ShopImageWidget as a base
loathingKernel Mar 30, 2023
70b7926
ShopImageWidget: Design it to me similar to IconGameWidget
loathingKernel Mar 30, 2023
9817170
ShopGameInfo: Design it to me similar to GameInfo
loathingKernel Mar 30, 2023
5bc27c9
Store: Exploratory changes to the store page
loathingKernel Apr 4, 2023
8edaa1a
SideTabContainer: Set size policy for the container scrollarea contai…
loathingKernel Apr 10, 2023
b43bd10
Store: Exploratory changes for GraphQL API
loathingKernel Apr 10, 2023
ecc036b
Shop: Use a single QGridLayout instead of left and right VBoxLayouts
loathingKernel Apr 12, 2023
14e842e
Store WIP
loathingKernel Sep 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
tag_offset: ${{ steps.version.outputs.tag_offset }}
sha_short: ${{ steps.version.outputs.sha_short }}
full_desc: ${{ steps.version.outputs.full_desc }}
branch: ${{ steps.version.outputs.branch }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -27,10 +28,11 @@ jobs:
echo "tag_offset=$(git rev-list $tag_abbrev..HEAD --count)" >> $GITHUB_OUTPUT
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "full_desc=$(git describe --long --tags)" >> $GITHUB_OUTPUT
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT

deb-package:
needs: version
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Install Makedeb
run: |
Expand All @@ -40,9 +42,11 @@ jobs:
sudo apt install makedeb
- name: Prepare source directory
run: |
git clone https://mpr.hunterwittenborn.com/rare.git build
sed -i 's/source=.*/source=("rare-test::git+$url")/g' build/PKGBUILD
sed -i "s/\$pkgver/test/g" build/PKGBUILD
git clone https://mpr.makedeb.org/rare build
sed '/^pkgver=/d' -i build/PKGBUILD
sed '/^source=/d' -i build/PKGBUILD
echo "pkgver=${{ needs.version.outputs.tag_abbrev }}.${{ needs.version.outputs.tag_offset }}" >> build/PKGBUILD
echo "source=(\"\$pkgname-\$pkgver::git+https://github.com/${{github.repository}}#branch=${{ needs.version.outputs.branch }}\")" >> build/PKGBUILD

- name: build deb
run: |
Expand Down Expand Up @@ -72,7 +76,6 @@ jobs:
sudo pip3 install appimage-builder
- name: Build
run: |
cp rare/__main__.py .
appimage-builder --skip-test
mv Rare-*.AppImage Rare.AppImage
mv Rare-*.AppImage.zsync Rare.AppImage.zsync
Expand Down Expand Up @@ -197,7 +200,7 @@ jobs:
pip3 install -r requirements-presence.txt
pip3 install .
- name: Build
run: cxfreeze -c rare/__main__.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
run: cxfreeze -c rare/main.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
- name: Compress
run: |
python -c "import shutil; shutil.make_archive('Rare-Windows', 'zip', 'dist')"
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
twine upload dist/*

deb-package:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Install Makedeb
run: |
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Prepare source directory
run: |
git clone https://mpr.makedeb.org/rare build
sed -i "s/pkgver=.*/pkgver=${{ github.event.release.tag_name }}/g" build/PKGBUILD
sed "s/pkgver=.*/pkgver=${{ github.event.release.tag_name }}/g" -i build/PKGBUILD

- name: build deb
run: |
Expand Down Expand Up @@ -74,7 +74,6 @@ jobs:
sudo pip3 install appimage-builder
- name: Build
run: |
cp rare/__main__.py .
appimage-builder --skip-test
mv Rare-*.AppImage Rare.AppImage
mv Rare-*.AppImage.zsync Rare.AppImage.zsync
Expand Down Expand Up @@ -208,7 +207,7 @@ jobs:
pip3 install -r requirements-presence.txt
pip3 install .
- name: Build
run: cxfreeze -c rare/__main__.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
run: cxfreeze -c rare/main.py --target-dir dist --target-name rare --icon rare/resources/images/Rare.ico -OO --base-name Win32GUI
- name: Compress
run: |
python -c "import shutil; shutil.make_archive('Rare-Windows', 'zip', 'dist')"
Expand Down
5 changes: 2 additions & 3 deletions AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ version: 1

script:
# Remove any previous build
- rm -rf AppDir Rare | true
- rm -rf AppDir | true
# Make usr and icons dirs
- mkdir -p AppDir/usr/src
- mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps/
# Copy source files
- cp -r rare AppDir/usr/src/rare
- mv AppDir/usr/src/rare/__main__.py AppDir/usr/src/
# copy Logo
- cp AppDir/usr/src/rare/resources/images/Rare.png AppDir/usr/share/icons/hicolor/256x256/apps/
# Install application dependencies
Expand All @@ -23,7 +22,7 @@ AppDir:
icon: Rare
version: 1.10.3
exec: usr/bin/python3
exec_args: $APPDIR/usr/src/__main__.py $@
exec_args: $APPDIR/usr/src/rare/main.py $@
apt:
arch: amd64
allow_unauthenticated: true
Expand Down
8 changes: 5 additions & 3 deletions freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
base = "Win32GUI"

exe = Executable(
"rare/__main__.py",
base=base, icon="rare/resources/images/Rare.ico",
target_name="Rare")
"rare/main.py",
base=base,
icon="rare/resources/images/Rare.ico",
target_name=name
)

setup(
name=name,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ legendary-gl = "^0.20.32"
typing-extensions = "^4.3.0"

[tool.poetry.scripts]
start = "rare.__main__:main"
start = "rare.main:main"

[tool.poetry.dev-dependencies]
Nuitka = "^1.0.6"
Expand Down
6 changes: 6 additions & 0 deletions rare/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
__version__ = "1.10.4"
__codename__ = "Garlic Crab"

# For PyCharm profiler
if __name__ == "__main__":
import sys
from rare.main import main
sys.exit(main())
135 changes: 3 additions & 132 deletions rare/__main__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,133 +1,4 @@
#!/usr/bin/env python3
import multiprocessing
import os
import pathlib
import sys
from argparse import ArgumentParser


def main():
# fix cx_freeze
multiprocessing.freeze_support()

# insert legendary for installed via pip/setup.py submodule to path
# if not __name__ == "__main__":
# sys.path.insert(0, os.path.join(os.path.dirname(__file__), "legendary"))

# 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",
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",
)
parser.add_argument(
"--startmenu-shortcut",
action="store_true",
dest="startmenu_shortcut",
help="Use this, if there is no link in start menu to launch Rare",
)
subparsers = parser.add_subparsers(title="Commands", dest="subparser")

launch_minimal_parser = subparsers.add_parser("start", aliases=["launch"])
launch_minimal_parser.add_argument("app_name", help="AppName of the game to launch",
metavar="<App Name>", action="store")
launch_minimal_parser.add_argument("--dry-run", help="Print arguments and exit", action="store_true")
launch_minimal_parser.add_argument("--offline", help="Launch game offline",
action="store_true")
launch_minimal_parser.add_argument('--wine-bin', dest='wine_bin', action='store', metavar='<wine binary>',
default=os.environ.get('LGDRY_WINE_BINARY', None),
help='Set WINE binary to use to launch the app')
launch_minimal_parser.add_argument('--wine-prefix', dest='wine_pfx', action='store', metavar='<wine pfx path>',
default=os.environ.get('LGDRY_WINE_PREFIX', None),
help='Set WINE prefix to use')
launch_minimal_parser.add_argument("--ask-sync-saves", help="Ask to sync cloud saves",
action="store_true")
launch_minimal_parser.add_argument("--skip-update-check", help="Do not check for updates",
action="store_true")

args = parser.parse_args()

if args.desktop_shortcut or args.startmenu_shortcut:
from rare.utils.paths import create_desktop_link

if args.desktop_shortcut:
create_desktop_link(app_name="rare_shortcut", link_type="desktop")

if args.startmenu_shortcut:
create_desktop_link(app_name="rare_shortcut", link_type="start_menu")

print("Link created")
return

if args.version:
from rare import __version__, code_name
print(f"Rare {__version__} Codename: {code_name}")
return

if args.subparser == "start" or args.subparser == "launch":
from rare import game_launch_helper as helper
helper.start_game(args)
return

from rare.utils import singleton

try:
# this object only allows one instance per machine

me = singleton.SingleInstance()
except singleton.SingleInstanceException:
print("Rare is already running")
from rare.utils.paths import lock_file

with open(lock_file(), "w") as file:
file.write("show")
file.close()
return

from rare.app import start

start(args)


if __name__ == "__main__":
# run from source
# insert raw legendary submodule
# sys.path.insert(
# 0, os.path.join(pathlib.Path(__file__).parent.absolute(), "legendary")
# )

# insert source directory
if "__compiled__" not in globals():
sys.path.insert(0, str(pathlib.Path(__file__).parents[1].absolute()))

# If we are on Windows, and we are in a "compiled" GUI application form
# stdout (and stderr?) will be None. So to avoid `'NoneType' object has no attribute 'write'`
# errors, redirect both of them to devnull
if os.name == "nt" and (getattr(sys, "frozen", False) or ("__compiled__" in globals())):
# Check if stdout and stderr are None before redirecting
# This is useful in the case of test builds that enable console
if sys.stdout is None:
sys.stdout = open(os.devnull, 'w')
if sys.stderr is None:
sys.stderr = open(os.devnull, 'w')

main()
import sys
from rare.main import main
sys.exit(main())
Loading
Loading