I've implemented a Top Games feature for tadpole where the user can supply a list of games via TopGames.txt and have those games sorted and placed at the top of the games listing.
Here are the details on the changes made:
tadpoleConfig.py changes:
Config setting _static_topGamesEnabled with default to False
Methods getTopGamesEnabled and setTopGamesEnabled to read and set the new config option
SettingsDialog.py changes:
Section "Sorting Options" with a checkbox to enable/disable the "Top Games" sorting feature.
Method topGamesToggled which calls tpConf.setTopGamesEnabled in tadpole_config
tadpole_functions.py changes:
Function read_top_games which reads the TopGames.txt file and returns it as a dictionary, with a list of games for each system
Systems are defined by a trailing colon, for example FC: or GBA:
tadpole.py changes:
Imported read_top_games from tadpole_functions.py
top_games_list initialized as an empty list
Function RunFrogTool modified to get the top_games_list and pass it to frogtool.process_sys if Top Games feature is enabled
Function loadROMsToTable modified to display top games if Top Games feature is enabled
frogtool.py changes:
Function process_sys takes an additional parameter: top_games which defaults to an empty list, which is passed to write_index_file
Function write_index_file will re-sort the games with top games if feature is enabled, before metadata pointers are generated
Added error handling to gracefully handle cases where the TopGames.txt file is missing or improperly formatted.
Conducted thorough testing to ensure the new feature functions as intended without disrupting existing functionality.
I've implemented a Top Games feature for tadpole where the user can supply a list of games via TopGames.txt and have those games sorted and placed at the top of the games listing.
Here are the details on the changes made:
tadpoleConfig.py
changes:_static_topGamesEnabled
with default to FalsegetTopGamesEnabled
andsetTopGamesEnabled
to read and set the new config optionSettingsDialog.py
changes:topGamesToggled
which callstpConf.setTopGamesEnabled
in tadpole_configtadpole_functions.py
changes:read_top_games
which reads the TopGames.txt file and returns it as a dictionary, with a list of games for each systemtadpole.py
changes:read_top_games
fromtadpole_functions.py
RunFrogTool
modified to get thetop_games_list
and pass it tofrogtool.process_sys
if Top Games feature is enabledloadROMsToTable
modified to display top games if Top Games feature is enabledfrogtool.py
changes:process_sys
takes an additional parameter: top_games which defaults to an empty list, which is passed towrite_index_file
write_index_file
will re-sort the games with top games if feature is enabled, before metadata pointers are generatedAdded error handling to gracefully handle cases where the
TopGames.txt
file is missing or improperly formatted.Conducted thorough testing to ensure the new feature functions as intended without disrupting existing functionality.