Skip to content

bpo-37530: simplify, optimize and clean up IDLE code context#14675

Merged
taleinat merged 7 commits into
python:masterfrom
taleinat:codecontext-improvements
Jul 17, 2019
Merged

bpo-37530: simplify, optimize and clean up IDLE code context#14675
taleinat merged 7 commits into
python:masterfrom
taleinat:codecontext-improvements

Conversation

@taleinat

@taleinat taleinat commented Jul 9, 2019

Copy link
Copy Markdown
Contributor
  • Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows.
  • Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates.
  • When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated.
  • Use the editor window's getlineno() method where applicable.
  • Fix a bare except:.

https://bugs.python.org/issue37530

* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Fix a bare "except:"
@terryjreedy terryjreedy changed the title simplify, optimize and clean up code context bpo-37530: simplify, optimize and clean up IDLE code context Jul 9, 2019
@taleinat

Copy link
Copy Markdown
Contributor Author

I've tested this on Windows, macOS and Ubuntu Linux. Seems working well.

@terryjreedy, would you like a NEWS entry for this?

@terryjreedy

Copy link
Copy Markdown
Member
  1. Does that mean you think this is ready to commit?
  2. Yes. "Optimize code context to reduce unneeded background activity" seems to be the essence of the improvement (including not creating instances for non-editors) in words that users should be able to appreciate.

An update loop is only needed for an active editor with code context, rather all editors with such. Whatever this PR does not do (have not read details yet) can be another PR.

@taleinat

Copy link
Copy Markdown
Contributor Author
  1. Yes.
  2. Great wording! Done.

@terryjreedy

Copy link
Copy Markdown
Member

Then I will look at this this evening.

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a sentence to blurb. Edit if you want. Please merge and update line number patch.

After adding line numbers, we might want to experiment with the order in which changes are applied. See example.

Comment thread Lib/idlelib/editor.py
@terryjreedy

Copy link
Copy Markdown
Member

I presume you are working on fixing test_font. It might be doing more than is needed, such as restoring the font of the temporary text instance.

Travis also had an unrelated doctest failure. I will open a new issue for that if not one already.

@taleinat
taleinat merged commit 7036e1d into python:master Jul 17, 2019
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @taleinat for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 17, 2019
…H-14675)

* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
(cherry picked from commit 7036e1d)

Co-authored-by: Tal Einat <taleinat@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-14807 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 17, 2019
…H-14675)

* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
(cherry picked from commit 7036e1d)

Co-authored-by: Tal Einat <taleinat@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-14808 is a backport of this pull request to the 3.7 branch.

@taleinat
taleinat deleted the codecontext-improvements branch July 17, 2019 08:32
@taleinat

Copy link
Copy Markdown
Contributor Author

@terryjreedy

Please merge and update line number patch.

Done.

miss-islington added a commit that referenced this pull request Jul 17, 2019
* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
(cherry picked from commit 7036e1d)

Co-authored-by: Tal Einat <taleinat@gmail.com>
miss-islington added a commit that referenced this pull request Jul 17, 2019
* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
(cherry picked from commit 7036e1d)

Co-authored-by: Tal Einat <taleinat@gmail.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
…H-14675)

* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…H-14675)

* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
…H-14675)

* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants