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

Skip to content

Commit 663a429

Browse files
authored
Merge pull request matplotlib#15262 from anntzer/qtfigureoptions
MNT: Declare qt figureoptions tool in toolitems.
2 parents 8189978 + c5b42a2 commit 663a429

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
@@ -651,6 +651,13 @@ def set_window_title(self, title):
651651
class NavigationToolbar2QT(NavigationToolbar2, QtWidgets.QToolBar):
652652
message = QtCore.Signal(str)
653653

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

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

0 commit comments

Comments
 (0)