Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

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

`ToolManager`
Class that makes the bridge between user interaction (key press,
toolbar clicks, ..) and the actions in response to the user inputs.
Expand DownExpand Up@@ -86,7 +90,17 @@ def __init__(self, figure, num):

self.window.add_element_to_window(self.canvas, True, True, 0, 'center')

self.toolmanager = self._get_toolmanager()
self.toolbar = self._get_toolbar()

if self.toolmanager:
tools.add_tools_to_manager(self.toolmanager)
if self.toolbar:
tools.add_tools_to_container(self.toolbar)
self.statusbar = self._backend.Statusbar(self.toolmanager)
h += self.window.add_element_to_window(self.statusbar, False,
False, 0, 'south')

if self.toolbar is not None:
h += self.window.add_element_to_window(self.toolbar,
False, False, 0, 'south')
Expand All@@ -98,7 +112,7 @@ def __init__(self, figure, num):

def notify_axes_change(fig):
'this will be called whenever the current axes is changed'
if self.toolbar is not None:
if self.toolmanager is None and self.toolbar is not None:
self.toolbar.update()
self.canvas.figure.add_axobserver(notify_axes_change)

Expand DownExpand Up@@ -157,12 +171,22 @@ def set_window_title(self, title):
def _get_toolbar(self):
# must be inited after the window, drawingArea and figure
# attrs are set
if rcParams['toolbar'] == 'toolbar2':
if rcParams['toolbar'] == 'toolmanager':
toolbar = self._backend.Toolbar(self.toolmanager)
elif rcParams['toolbar'] == 'toolbar2':
toolbar = self._backend.Toolbar2(self.canvas, self.window)
else:
toolbar = None
return toolbar

def _get_toolmanager(self):
# must be initialised after toolbar has been setted
if rcParams['toolbar'] != 'toolbar2':
toolmanager = ToolManager(self.canvas)
else:
toolmanager = None
return toolmanager

def show_popup(self, msg):
"""
Display message in a popup -- GUI only
Expand Down
12 changes: 11 additions & 1 deletionlib/matplotlib/backends/backend_gtk3.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -372,6 +372,10 @@ def stop_event_loop(self):
FigureCanvasBase.stop_event_loop_default(self)
stop_event_loop.__doc__=FigureCanvasBase.stop_event_loop_default.__doc__


_flow = [Gtk.Orientation.HORIZONTAL, Gtk.Orientation.VERTICAL]


class Window(WindowBase, Gtk.Window):
def __init__(self, title):
WindowBase.__init__(self, title)
Expand DownExpand Up@@ -413,14 +417,19 @@ def _setup_box(self, name, orientation, grow, parent):

def add_element_to_window(self, element, expand, fill, pad, place):
element.show()

flow = _flow[not _flow.index(self._layout[place].get_orientation())]
separator = Gtk.Separator(orientation=flow)
if place in ['north', 'west', 'center']:
self._layout[place].pack_start(element, expand, fill, pad)
self._layout[place].pack_start(separator, False, False, 0)
elif place in ['south', 'east']:
self._layout[place].pack_end(element, expand, fill, pad)
self._layout[place].pack_end(separator, False, False, 0)
else:
raise KeyError('Unknown value for place, %s' % place)
size_request = element.size_request()
return size_request.height
return size_request.height + separator.size_request().height

def set_default_size(self, width, height):
Gtk.Window.set_default_size(self, width, height)
Expand DownExpand Up@@ -1034,5 +1043,6 @@ def error_msg_gtk(msg, parent=None):
backend_tools.ToolRubberband = RubberbandGTK3

Toolbar = ToolbarGTK3
Statusbar = StatusbarGTK3
FigureCanvas = FigureCanvasGTK3
FigureManager = FigureManagerGTK3
2 changes: 2 additions & 0 deletionslib/matplotlib/backends/backend_gtk3agg.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,6 +122,8 @@ def new_figure_manager_given_figure(num, figure):
FigureCanvas = FigureCanvasGTK3Agg
FigureManager = FigureManagerGTK3Agg
Window = backend_gtk3.Window
Toolbar = backend_gtk3.Toolbar
Statusbar = backend_gtk3.Statusbar
Toolbar2 = backend_gtk3.NavigationToolbar2GTK3
MainLoop = backend_gtk3.MainLoop
show = backend_gtk3.show
2 changes: 2 additions & 0 deletionslib/matplotlib/backends/backend_gtk3cairo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,6 +73,8 @@ def new_figure_manager_given_figure(num, figure):
FigureCanvas = FigureCanvasGTK3Cairo
FigureManager = FigureManagerGTK3Cairo
Window = backend_gtk3.Window
Toolbar = backend_gtk3.Toolbar
Statusbar = backend_gtk3.Statusbar
Toolbar2 = backend_gtk3.NavigationToolbar2GTK3
MainLoop = backend_gtk3.MainLoop
show = backend_gtk3.show

[8]ページ先頭

©2009-2025 Movatter.jp