8000 Declare qt figureoptions tool in toolitems. · matplotlib/matplotlib@c5b42a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit c5b42a2

Browse files
committed
Declare qt figureoptions tool in toolitems.
... rather than specialcasing it in _init_toolbar.
1 parent 2aba5aa commit c5b42a2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,13 @@ def set_window_title(self, title):
652652
class NavigationToolbar2QT(NavigationToolbar2, QtWidgets.QToolBar):
653653
message = QtCore.Signal(str)
654654

655+
toolitems = [*NavigationToolbar2.toolitems]
656+
toolitems.insert(
657+
# Add 'customize' action after 'subplots'
658+
[name for name, *_ in toolitems].index("Subplots") + 1,
659+
("Customize", "Edit axis, curve and image parameters",
660+
"qt4_editor_options", "edit_parameters"))
661+
655662
def __init__(self, canvas, parent, coordinates=True):
656663
"""coordinates: should we show the coordinates on the right?"""
657664
self.canvas = canvas
@@ -695,11 +702,6 @@ def _init_toolbar(self):
695702
a.setCheckable(True)
696703
if tooltip_text is not None:
697704
a.setToolTip(tooltip_text)
698-
if text == 'Subplots':
699-
a = self.addAction(self._icon("qt4_editor_options.png",
700-
icon_color),
701-
'Customize', self.edit_parameters)
702-
a.setToolTip('Edit axis, curve and image parameters')
703705

704706
# Add the (x, y) location widget at the right side of the toolbar
705707
# The stretch factor is 1 which means any resizing of the toolbar

0 commit comments

Comments
 (0)
0