This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients cheryl.sabella, terry.reedy
Date 2017-07-06.05:23:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1499318619.07.0.440300830385.issue30779@psf.upfronthosting.co.za>
In-reply-to
Content
To get moving and unblock other issues, I decided to start with the simplest not-bad change that will work.

The factored out code belongs in config.py. This will separate integration with ConfigDialog into 2 steps.
1. Add code and tests to config and test_config, leaving configdialog untouched.
2. Modify configdialog and tests to import and use the new classes, removing the refactored classes.

We should start with ConfigChanges as a subclass of dict, with added methods as unchanged as possible.  No Page class, but the page idea appears, and will later be applied elsewhere.  No apply method, as the code only accesses changes but does not modify them.  No save_new_config, as that code bypasses changes completely. No set_user_value, as that only access idleConf.  I guessed at what delete_section should look like as I don't know where the original code is.

Attached is my untested ConfigChanges.

With step 1 done, I believe step 2 would consist of:

A. add ConfigChanges to the config import.

B. make 'changes' a global (like idleConf), after imports, with
changes = ConfigChanges()
[This could go in config, but CD is its only user.]
Remove self.reset_changed_items in CD.__init__.

C. replace names throughout file
/self.changed_items/changes/
/self.reset_changed_items/changes.clear/
/self.add_changed_items/changes.add_item/ 
/self.save_all_changed_configs/changes.save_all/

C. Removed renamed methods.  (Could do before B.)
D. Replace code moved to .delete_section with a call thereto.

E. Change test_configdialog
If you wrote tests for methods not included in ConfigChanges, they could be added here anyway.

PR2 could be prepared before PR1 is merged, but must not be applied before PR1 is merged and backported, and has to be consistent with final applied version of PR1.
History
Date User Action Args
2017-07-06 05:23:39terry.reedysetrecipients: + terry.reedy, cheryl.sabella
2017-07-06 05:23:39terry.reedysetmessageid: <1499318619.07.0.440300830385.issue30779@psf.upfronthosting.co.za>
2017-07-06 05:23:39terry.reedylinkissue30779 messages
2017-07-06 05:23:37terry.reedycreate