[issue30779] IDLE: configdialog -- factor out Changes class

Cheryl Sabella report at bugs.python.org
Thu Jul 6 19:05:12 EDT 2017


Cheryl Sabella added the comment:

I've made the first pull request for the changes to config.py.  I have to apologize because I really couldn't figure out how to do 'save_all' without including 'set_user_value' since 'set_user_value' updates userCfg with the values from ConfigChanges.

Also, in `__init__`, you had self.pages, but *self* itself is the same thing, i.e. self['main'], etc is created in the for-loop, so I couldn't figure out the difference between self and self.pages, except in the context of the Page class.

I kept the code as close to the original as possible.  One side effect is that sometimes we have `self[page]` and sometimes `self[config_type]`.

I also commented out the call to `self.save_all_changed_extensions` in `save_all`.  In configdialog, `save_all_changed_extensions` iterates over what would be ConfigChanges['extensions'], with the section = ext_name and item = opt.  It calls `set_extension_value` with each ext_name/opt, but the difference between this and the others is that opt (item) itself is a dictionary with 'name', 'default', and 'var' keys, whereas 'main', 'keys', and 'highlight' have items with one value (at least in set_user_value).

So, if `set_user_value` stays in ConfigChanges, I believe `set_extension_value` and `save_all_changed_extensions` can be copied there as intact also.  Neither one uses anything from configdialog directly, just things from ConfigChanges and idleConf.

Thanks!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30779>
_______________________________________


More information about the Python-bugs-list mailing list