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.

classification
Title: IDLE: improve handling of int entry in settings dialog
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, terry.reedy
Priority: normal Keywords:

Created on 2020-01-27 23:34 by terry.reedy, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg360821 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-01-27 23:34
Spinoff from #31414, about int entry fields.  It claims: Note: a deeper problem is attaching a tracer that get called with each keystroke.  Using a StringVar avoids the error when the entry is blanked, but currently allows non-ints to be saved.  A better solution would be to not do the auto tracing, but use a IntVar and only call var_changed when the user 'leaves' the box, after checking for a count in a sane range.

Verify claim and proposed solution.
msg360867 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2020-01-28 12:32
With keeping it a StringVar, there is an issue where it writes a blank (ie, bad data) to the config file.  Steps to reproduce:

- Go into config dialog and click 'General' tab.
- Delete value from 'Auto squeeze min line'
- Click apply or OK.  A warning message appears in the terminal 
   Warning: config.py - IdleConf.GetOption -
   invalid 'int' value for configuration option 'auto-squeeze-min-lines'
   from section 'PyShell': ''
- Close out of IDLE.
- Start IDLE again - the warning reappears, but on the General tab, it shows the original value.

The issue here is that the custom config-main.cfg is being written to (and then read back in) with the blank.

I picked the auto-squeezer because it has validation on it - `validatecommand=self.digits_only`.
History
Date User Action Args
2022-04-11 14:59:25adminsetgithub: 83653
2020-01-28 12:32:21cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg360867
2020-01-27 23:34:59terry.reedycreate