Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Jul 17, 2019

Conversation

taleinat
Copy link
Contributor

@taleinat taleinat commented Jul 9, 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.
  • 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
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
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
Contributor Author

  1. Yes.
  2. Great wording! Done.

@terryjreedy
Copy link
Member

Then I will look at this this evening.

Copy link
Member

@terryjreedy terryjreedy left a comment

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.

Lib/idlelib/editor.py Show resolved Hide resolved
@terryjreedy
Copy link
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
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 <[email protected]>
@bedevere-bot
Copy link

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 <[email protected]>
@bedevere-bot
Copy link

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
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 <[email protected]>
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 <[email protected]>
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