Changeset aadf0af1 in sasview for src/sas/qtgui/PlotterBase.py


Ignore:
Timestamp:
Jan 4, 2017 4:35:08 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
570a58f9
Parents:
257bd57
Message:

Plot specific part of the context menu SASVIEW-427

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/PlotterBase.py

    rd3ca363 raadf0af1  
    9494        self.canvas.mpl_connect('scroll_event', self.onMplWheel) 
    9595 
     96        self.contextMenu = QtGui.QMenu(self) 
     97 
    9698        if not quickplot: 
    97             # set the layout 
     99            # Add the toolbar 
    98100            layout.addWidget(self.toolbar) 
    99             # Add the context menu 
    100             self.contextMenu() 
    101101            # Notify PlotHelper about the new plot 
    102102            self.upatePlotHelper() 
    103         else: 
    104             self.contextMenuQuickPlot() 
    105103 
    106104        self.setLayout(layout) 
     
    177175        """ 
    178176        # Actions 
    179         self.contextMenu = QtGui.QMenu(self) 
     177        self.contextMenu.clear() 
    180178        self.actionSaveImage = self.contextMenu.addAction("Save Image") 
    181179        self.actionPrintImage = self.contextMenu.addAction("Print Image") 
     
    188186        self.actionCopyToClipboard.triggered.connect(self.onClipboardCopy) 
    189187 
    190     def contextMenu(self): 
     188    def createContextMenu(self): 
    191189        """ 
    192190        Define common context menu and associated actions for the MPL widget 
     
    194192        raise NotImplementedError("Context menu method must be implemented in derived class.") 
    195193 
    196     def contextMenuQuickPlot(self): 
     194    def createContextMenuQuick(self): 
    197195        """ 
    198196        Define context menu and associated actions for the quickplot MPL widget 
     
    204202        Display the context menu 
    205203        """ 
     204        if not self.quickplot: 
     205            self.createContextMenu() 
     206        else: 
     207            self.createContextMenuQuick() 
     208 
    206209        event_pos = event.pos() 
    207210        self.contextMenu.exec_(self.canvas.mapToGlobal(event_pos)) 
Note: See TracChangeset for help on using the changeset viewer.