Skip to content

Commit

Permalink
Merge pull request #1552 from SasView/enable_mpl_toolbar
Browse files Browse the repository at this point in the history
Enable mpl toolbar
  • Loading branch information
butlerpd committed May 29, 2020
2 parents ade9adb + e542c83 commit 22ee686
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/sas/qtgui/Plotting/Plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ def createContextMenu(self):
# Add the title change for dialogs
self.contextMenu.addSeparator()
self.actionWindowTitle = self.contextMenu.addAction("Window Title")
self.contextMenu.addSeparator()
self.actionToggleMenu = self.contextMenu.addAction("Toggle Navigation Menu")

# Define the callbacks
self.actionAddText.triggered.connect(self.onAddText)
Expand All @@ -287,6 +289,7 @@ def createContextMenu(self):
self.actionSetGraphRange.triggered.connect(self.onSetGraphRange)
self.actionResetGraphRange.triggered.connect(self.onResetGraphRange)
self.actionWindowTitle.triggered.connect(self.onWindowsTitle)
self.actionToggleMenu.triggered.connect(self.onToggleMenu)

def addPlotsToContextMenu(self):
"""
Expand Down
3 changes: 3 additions & 0 deletions src/sas/qtgui/Plotting/Plotter2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ def createContextMenu(self):
self.contextMenu.addSeparator()
self.actionChangeScale = self.contextMenu.addAction("Toggle Linear/Log Scale")
self.actionChangeScale.triggered.connect(self.onToggleScale)
self.contextMenu.addSeparator()
self.actionToggleMenu = self.contextMenu.addAction("Toggle Navigation Menu")
self.actionToggleMenu.triggered.connect(self.onToggleMenu)

def createContextMenuQuick(self):
"""
Expand Down
15 changes: 4 additions & 11 deletions src/sas/qtgui/Plotting/PlotterBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,12 @@ def defaultContextMenu(self):
self.actionSaveImage = self.contextMenu.addAction("Save Image")
self.actionPrintImage = self.contextMenu.addAction("Print Image")
self.actionCopyToClipboard = self.contextMenu.addAction("Copy to Clipboard")
#self.contextMenu.addSeparator()
#self.actionToggleMenu = self.contextMenu.addAction("Toggle Navigation Menu")
self.contextMenu.addSeparator()


# Define the callbacks
self.actionSaveImage.triggered.connect(self.onImageSave)
self.actionPrintImage.triggered.connect(self.onImagePrint)
self.actionCopyToClipboard.triggered.connect(self.onClipboardCopy)
#self.actionToggleMenu.triggered.connect(self.onToggleMenu)

def createContextMenu(self):
"""
Expand Down Expand Up @@ -389,13 +385,10 @@ def onToggleMenu(self):
"""
Toggle navigation menu visibility in the chart
"""
self.toolbar.hide()
# Current toolbar menu is too buggy.
# Comment out until we support 3.x, then recheck.
#if self.toolbar.isVisible():
# self.toolbar.hide()
#else:
# self.toolbar.show()
if self.toolbar.isVisible():
self.toolbar.hide()
else:
self.toolbar.show()

def offset_graph(self):
"""
Expand Down
3 changes: 2 additions & 1 deletion src/sas/qtgui/Plotting/UnitTesting/PlotterBaseTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def done():
# Make sure clipboard got updated.
self.assertTrue(self.clipboard_called)

## Trigger toggle navigation bar and make sure the method is called
# Trigger toggle navigation bar and make sure the method is called
#self.assertEqual(actions[4].text(), "Toggle Navigation Menu")
#isShown = self.plotter.toolbar.isVisible()
#self.assertTrue(isShow)
Expand Down Expand Up @@ -193,5 +193,6 @@ def testOnMplWheel(self):
""" Test what happens on mouse pick in chart """
pass


if __name__ == "__main__":
unittest.main()

0 comments on commit 22ee686

Please sign in to comment.