kraanzu / smassh

Smassh your Keyboard, TUI Edition
GNU General Public License v3.0
1.41k stars 50 forks source link

Automatic update of config file #31

Closed JaceyMarvin99 closed 2 years ago

JaceyMarvin99 commented 2 years ago

The Parser class now has some mess, so I verify that there are no missing configuration items when the script first calls the Parser.get method, and write the default values from parser.py if there are any missing.

JaceyMarvin99 commented 2 years ago

In these files, it uses super-class method get() : https://github.com/kraanzu/termtyper/blob/c9220277db6f075812ed34929f2569cbf1343def/termtyper/ui/widgets/number_scroll.py#L31 https://github.com/kraanzu/termtyper/blob/c9220277db6f075812ed34929f2569cbf1343def/termtyper/ui/tui.py#L170 https://github.com/kraanzu/termtyper/blob/c9220277db6f075812ed34929f2569cbf1343def/termtyper/ui/widgets/option.py#L43

If we wrap the method again in the subclass Parser, we can use a decorator to validate it before each call to prevent accidental file corruption.

kraanzu commented 2 years ago

Hey @somenothing, Could you please add this feature to tweaks section in the README too?