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

Add metadata to BasicGameSaveGameInfo(Widget) #109

Merged
merged 7 commits into from
Oct 8, 2023

Conversation

ZashIn
Copy link
Contributor

@ZashIn ZashIn commented Jul 15, 2023

Adds optional metadata to the BasicGameSaveGameInfoWidget, similar to TES / Gamebryo games:

BasicGameSaveGameInfo()  # Adds "File Date" by default
BasicGameSaveGameInfo(
    get_preview = lambda p: Path(p, "screenshot.png"), # Save preview
    get_metadata = lambda p, save: {"Name": save.getName(), ...}
)

Example from Cyberpunk 2077, included in #105:
image

Adds a default file date to all BasicGames, taken from the save game files (GameSaveExtension etc.)

@Holt59 Holt59 changed the base branch from qt6 to master July 15, 2023 20:50
@Holt59
Copy link
Member

Holt59 commented Sep 24, 2023

Sorry for the delay, could you try rebasing/merging against latest master so that these change can be merged? If you don't have time, I can have a look at it myself.

@ZashIn
Copy link
Contributor Author

ZashIn commented Sep 24, 2023

Sorry for the delay, could you try rebasing/merging against latest master so that these change can be merged? If you don't have time, I can have a look at it myself.

I can probably get to it tomorrow, have to check python 11 changes (my local poetry will be conflicting, too).
If I remember correctly, I made this as backwards compatible as possible, but there is at least one game, which implements BasicGameSaveGameInfoWidget, that should be tested.

From a quick search that would still be only: Black & White 2.

@ZashIn ZashIn force-pushed the feat/savegameinfo-metadata branch from bc3128d to 3df1550 Compare September 25, 2023 22:02
@ZashIn
Copy link
Contributor Author

ZashIn commented Sep 25, 2023

Rebase done. No problems besides the ugly None vs default param checks above.

@Holt59
Copy link
Member

Holt59 commented Sep 26, 2023

Thanks for the update!

@Silarn Added save metadata preview to Blade & Sorcery recently, could you see if these could be moved to your new generic metadata system?

@Silarn
Copy link
Member

Silarn commented Sep 26, 2023

Obviously this would need to be merged in first but yeah, I think you can just migrate the BaSSaveGameWidget code to a new 'bas_parse_metadata' function passed into the updated BasicSaveGameInfo.

@ZashIn ZashIn force-pushed the feat/savegameinfo-metadata branch 2 times, most recently from be8df3c to b347ab3 Compare September 26, 2023 17:42
@ZashIn
Copy link
Contributor Author

ZashIn commented Sep 26, 2023

Obviously this would need to be merged in first but yeah, I think you can just migrate the BaSSaveGameWidget code to a new 'bas_parse_metadata' function passed into the updated BasicSaveGameInfo.

I added an option to set the (max) widget width and refactored blade & sorcery, should work.
Cleaned up Black & White 2, since it was not actually using its minimal custom widget.

Want me to cleanup the history before merge?

@ZashIn ZashIn mentioned this pull request Sep 26, 2023
10 tasks
@ZashIn ZashIn force-pushed the feat/savegameinfo-metadata branch 2 times, most recently from ecacbdf to cc95749 Compare September 27, 2023 19:53
@ZashIn
Copy link
Contributor Author

ZashIn commented Sep 27, 2023

Ok, widget size, default parameter handling and an easier option to set a custom widget added:
BasicGameSaveGameInfo.with_widget(ISaveGameInfoWidget)

Widget tested with Cyberpunk.
A test for Blade & Sorcery would be good, with only the metadata.

@Silarn
Copy link
Member

Silarn commented Sep 27, 2023

Unfortunately I was having a requester on Discord test my initial changes. But I might be able to get a hold of him.

@ZashIn ZashIn force-pushed the feat/savegameinfo-metadata branch 2 times, most recently from 3c8e908 to 403558f Compare September 27, 2023 21:05
@ZashIn
Copy link
Contributor Author

ZashIn commented Sep 27, 2023

Commits cleaned up. Ready to merge (Blade & Sorcery tested, too).

@ZashIn ZashIn force-pushed the feat/savegameinfo-metadata branch from 403558f to 734acdb Compare October 7, 2023 19:52
@ZashIn
Copy link
Contributor Author

ZashIn commented Oct 7, 2023

I removed Cyberpunk BasicGameSaveGameInfo from this PR, to be included in #105.

@ZashIn ZashIn changed the title Add metadata to BasicGameSaveGameInfo(Widget) + Cyberpunk saves Add metadata to BasicGameSaveGameInfo(Widget) Oct 7, 2023
@ZashIn ZashIn force-pushed the feat/savegameinfo-metadata branch from 734acdb to f36e386 Compare October 8, 2023 15:12
@ZashIn
Copy link
Contributor Author

ZashIn commented Oct 8, 2023

Rebased on master, with PR #122, rdy for merge.

@Holt59 Holt59 merged commit 44645a5 into ModOrganizer2:master Oct 8, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants