classification
Title: IDLE: Refactor breakpoint related methods
Type: enhancement Stage: needs patch
Components: IDLE Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Saimadhav.Heblikar, jesstess, terry.reedy
Priority: normal Keywords: patch

Created on 2014-07-26 15:06 by Saimadhav.Heblikar, last changed 2019-09-19 18:18 by terry.reedy.

Files
File name Uploaded Description Edit
pyshell-breakpoint-refactor.diff Saimadhav.Heblikar, 2014-07-26 15:06 review
pyshell-breakpoint-refactor-v2.diff Saimadhav.Heblikar, 2014-08-11 15:25 review
Messages (3)
msg224062 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2014-07-26 15:06
This refactoring is required to enable setting/clearing breakpoints, using linenumbering( whether using a Canvas implementation or a Text implementation http://bugs.python.org/issue17535)
The patch ensures consistency between the set_breakpoint(_here) and
clear_breakpoint(_here) methods. The clear_breakpoint_here, which is not present currently has been added.
No functionality has been added or removed, so I think it should be safe to go forward.
msg224909 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-06 05:41
The _here methods are the event handlers for the right click context menu options. Set_breakpoint, as a separate method, is only needed in the restore_file_breaks (from breakpoint file) method. I gather that you are thinking of using set/clear_breakpoint when a line number is clicked.

You have elsewhere suggested a different refactoring - replacing set and clear with toggle. That seems plausible as a good idea.  If text will have no breakpoints set after 
   self.text.update() # this enables setting "BREAK" tags to be visible
in restore_file_breaks(), there would be no problem. If not, toggle would need a force_set option. We need to know when the circumstances of when restore_file_breaks is called.

The bell is both undependable and uniformative. If breakpoints are not allowed for unnamed files, the context menu items should be grayed out (if possible, as done, for instance, for 'cut' when there is no selectionj).  If a line numbers is clicked for unnamed, we should display a message box explaining.
msg225194 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2014-08-11 15:25
This patch does two things

1. Refactor pyshell-breakpoint-refactor.diff to reflect changes in pyshell-breakpoint-refactor.diff

As in pyshell-breakpoint-refactor.diff, the set/clear(_here) breakpoint methods are refactored into logical methods.

2. If the filename is not set, text.bell() is replaced with a dialog to prompt the user to save the file.
History
Date User Action Args
2019-09-19 18:18:00terry.reedysettitle: Refactor PyShell's breakpoint related methods -> IDLE: Refactor breakpoint related methods
versions: + Python 3.9, - Python 2.7, Python 3.4, Python 3.5
2017-09-28 07:00:49taleinatsetnosy: - taleinat
2014-08-11 15:25:24Saimadhav.Heblikarsetfiles: + pyshell-breakpoint-refactor-v2.diff

messages: + msg225194
2014-08-06 05:41:56terry.reedysettype: enhancement
messages: + msg224909
stage: needs patch
2014-07-26 15:06:23Saimadhav.Heblikarcreate