Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backend refactor #8777

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

Closed
wants to merge 58 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9813e43
Refactor pass 1. Refactoring Gcf out of specific backend (backend_gt…
OceanWolf Feb 21, 2015
91cbffc
Refactor Pass 2. Refactored Gcf out of all backend code.
OceanWolf Feb 22, 2015
aa3ff59
Quick fix to figure for safe unpickling.
OceanWolf Feb 25, 2015
f046e01
GTK3Agg
OceanWolf Feb 26, 2015
39ff708
Refactored making `FigureManager` a *figure* manager, plus added miss…
OceanWolf Feb 27, 2015
45c5fc2
keyword
OceanWolf Feb 27, 2015
ebf0c57
Make add_element more general, and make sure the code complies with it.
OceanWolf Feb 27, 2015
9d25441
Better destroy order.
OceanWolf Feb 27, 2015
6ae52f2
GTK simplifications
OceanWolf Feb 28, 2015
1a47d3b
Added doc and cleaned backend_managers, don't want our new file dirty.
OceanWolf Mar 3, 2015
bc17372
Improve layout!
OceanWolf Apr 6, 2015
3fb46f2
Move knowledge of the backend to the manager.
OceanWolf Apr 7, 2015
2758f3f
Incorporate MEP22 into MEP27
OceanWolf Apr 12, 2015
f354d3c
Improved new toolbar and updated tool_manager example accoridingly.
OceanWolf Apr 12, 2015
51c0598
fullscreen
OceanWolf Apr 13, 2015
6b35d85
MEP update
OceanWolf Apr 14, 2015
724b622
Finish MEP22 conversion
OceanWolf Apr 14, 2015
0b42bbe
rename window method
OceanWolf Apr 17, 2015
ef65740
Add backend anme to widgets
OceanWolf Apr 17, 2015
fb5202a
Handle FigureManager destroy internaly without pyplot.
OceanWolf Jun 4, 2015
26ce3e6
Make functionality more consistant for embedded applications
OceanWolf Jun 7, 2015
1cfebc4
Backend getter method for FigureManager
OceanWolf Jun 13, 2015
bc32fb1
Improve example after new method
OceanWolf Jun 13, 2015
81b9e69
Clean up the code a bit
OceanWolf Jun 13, 2015
85f0668
Remove old code from backend_managers
OceanWolf Jun 15, 2015
6535148
Cleanup
OceanWolf Jun 22, 2015
73e1122
Explicity get set manager as None if appropiate.
OceanWolf Jun 22, 2015
592c49b
figure attribute and canvas property
fariza Jun 22, 2015
b5d7f57
Fix FigureCanvasBase
OceanWolf Jun 23, 2015
b842bdc
super
OceanWolf Jun 25, 2015
92de15e
figure setter
fariza Jun 25, 2015
b619923
Improve MEP22 Tool Searching Structure
OceanWolf Jun 25, 2015
a07e482
adding example file
fariza Jun 25, 2015
2dd8895
super dooper
OceanWolf Jun 26, 2015
ce9c8e7
Revert old example and fix new one.
OceanWolf Jun 26, 2015
5542c5a
Improve MEP22 tool-searching method.
OceanWolf Jun 27, 2015
a975717
MEP22 Save Figure Tool
OceanWolf Jun 27, 2015
ecf1f23
pep8
OceanWolf Jun 27, 2015
4531085
Make ToolConfigureSubplots a generic tool
OceanWolf Jun 28, 2015
87fbd59
Improve flow handling and make it a lot more generic
OceanWolf Jun 28, 2015
f7eb33d
Missing resize method
OceanWolf Jun 28, 2015
0a2aa5c
Convert to new structure for finding tools
OceanWolf Jun 28, 2015
777b162
doc
OceanWolf Jun 29, 2015
468bdd7
Add ExpandableBase
OceanWolf Jun 29, 2015
209af6b
Template Backend plus fix FigManager for non-GUI backends and add gen…
OceanWolf Jun 29, 2015
06686c7
rcParam and Travis
OceanWolf Jul 19, 2015
2d93df8
test always MEP27
OceanWolf Jul 20, 2015
6b15982
Fix FigureManager to allow pyplot to work for non GUI backends
OceanWolf Jul 27, 2015
61f61f6
Fix Gcf.show_all()
OceanWolf Jul 27, 2015
71f4813
doc
OceanWolf Jul 27, 2015
d3064b6
pep8
OceanWolf Jul 27, 2015
2ca898c
remove show_popup
OceanWolf Jul 27, 2015
a567af6
AttributeError
OceanWolf Sep 22, 2015
09fc887
Fixes for MEP27
OceanWolf Aug 3, 2016
f60333d
STY: replace \ with () for line continuation
tacaswell Jun 19, 2017
072c47a
ENH: make MainLoopBase a context manager
tacaswell Jun 19, 2017
214b684
MNT: further simplify MainLoopBase
tacaswell Jun 25, 2017
35838c9
WIP:
tacaswell Jun 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH: make MainLoopBase a context manager
  • Loading branch information
tacaswell committed Jun 19, 2017
commit 072c47ac7a2ce792217ed189dfbfa5562013a948
10 changes: 10 additions & 0 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,14 @@ def get_registered_canvas_class(format):

class MainLoopBase(object):
"""This gets used as a key maintaining the event loop.

Backends should only need to override begin and end.
It should not matter if this gets used as a singleton or not due to
clever magic.
"""
_instance_count = {}
_running = False

def __init__(self):
MainLoopBase._instance_count.setdefault(self.__class__, 0)
MainLoopBase._instance_count[self.__class__] += 1
Expand All @@ -177,6 +179,14 @@ def __del__(self):
not is_interactive() and MainLoopBase._running):
self.end()

def __enter__(self):
pass

def __exit__(self, excp_type, excp_value, excp_traceback):
if not excp_type:
self.begin()
self.end()


class ShowBase(object):
"""
Expand Down