DavidoTek / ProtonUp-Qt

Install and manage GE-Proton, Luxtorpeda & more for Steam and Wine-GE & more for Lutris with this graphical user interface.
https://davidotek.github.io/protonup-qt
GNU General Public License v3.0
1.17k stars 39 forks source link

Config: Use read_update_config_value for advancedmode and theme #308

Closed sonic2kk closed 7 months ago

sonic2kk commented 7 months ago

This PR replaces the logic in util#config_theme and util#config_advanced_mode to use the generic function util#read_update_config_value from #306, a change which was discussed in passing in that PR.

The logic in these functions was used as a template to create read_update_config_value, so there should be no compatibility breaking changes. The option names are also have not been changed. This change just makes the code slightly cleaner :-)

This PR does not touch install_directory or config_custom_install_location, as discussed we could implement this in future if we feel we need such a change.

Thanks!

DavidoTek commented 7 months ago

Thanks!


I made a small change to read_update_config_value. The default behaviour of config_theme is to return None if no parameter is given and the config doesn't exist yet, while the behaviour of read_update_config_value was to return ''.

This would break the combobox index matching in the about dialog when no config file exists:

https://github.com/DavidoTek/ProtonUp-Qt/blob/4ac3b5f9aaa289b3aa68123137ecb5cd4cdf2a55/pupgui2/pupgui2aboutdialog.py#L63

I adjusted it to return the "inherited" value. That shouldn't break the api token configs either. If we need the default return value to be a string, we can define this in the "parent" function.