def __init__(self, plotCanvas, parent, custom_actions=True): """ **Properties** *_firstChange* (boolean): Whether or not the y limits of the plots were changed before. *_plot_params* (dictionary): The plot parameters given as (key, value) pare. """ NavigationToolbar2QTAgg.__init__(self, plotCanvas, parent) # properties { self._firstChange = True self._plot_params = {} # } # custom actions { if custom_actions: self.addSeparator() self.action_reset = self.addAction("Reset", self.onReset) self.action_reset.setToolTip("Reset the y limits") self.action_plus = self.addAction("+", self.onPlus) self.action_plus.setToolTip("Expand the y limits") self.action_minus = self.addAction("-", self.onMinus) self.action_minus.setToolTip("Reduce the y limits")
def __init__(self, canvas, parent, plot_win, prj, coordinates=True): self.plot_win = plot_win self.prj = prj self.grid_action = None self.flagged_action = None self.flag_action = None self.unflag_action = None self.insert_action = None self.insert_sample = None self.mon_label = None self._ids_flag = None self._flag_mode = None self._flag_start = None self._flag_end = None # custom cursors pan_px = QtGui.QPixmap(os.path.join(self.media, 'pan_cursor.png')) pan_px.setMask(pan_px.mask()) self.pan_cursor = QtGui.QCursor(pan_px) grab_px = QtGui.QPixmap(os.path.join(self.media, 'grab_cursor.png')) grab_px.setMask(grab_px.mask()) self.grab_cursor = QtGui.QCursor(grab_px) NavigationToolbar2QT.__init__(self, canvas=canvas, parent=parent, coordinates=coordinates) self.setIconSize(QtCore.QSize(24, 24)) self.canvas.mpl_connect('button_press_event', self.press) self.canvas.mpl_connect('button_release_event', self.release)
def __init__(self, canvas, parent, coordinates=True): NavigationToolbar2QT.__init__(self, canvas, parent, coordinates) self.setIconSize(QtCore.QSize(16, 16)) self.ct = None self.mw = None self._idPress1 = None self._idPress2 = None self._idPress3 = None
def __init__(self, parent, canvas): """ Initialization """ NavigationToolbar2.__init__(self, canvas, canvas) self._myParent = parent self._navigationMode = MyNavigationToolbar.NAVIGATION_MODE_NONE return
def __init__(self, canvas, window, profile=True): self.toolitems = list(self.toolitems) self.toolitems.insert(6, ('Profile', 'Get the profile of a line in an image', os.path.join(imgutils.RESSOURCE_PATH, "profile"), 'profile')) self.toolitems.insert(7, ('Stats', 'Get statistics on a portion of an image/line', os.path.join(imgutils.RESSOURCE_PATH, "stats"), 'stats')) NavigationToolbar.__init__(self, canvas, window) self._actions['profile'].setCheckable(True) self._actions['stats'].setCheckable(True)
def __init__(self, canvas, parent, browser): NavigationToolbar2QT.__init__(self, canvas, parent) for c in self.findChildren(QtGui.QToolButton): #print str(c.text()) #if str(c.text()) in ('Subplots','Customize','Back','Forward','Home'): if str(c.text()) in ('Customize', 'Back', 'Forward'): c.defaultAction().setVisible(False) self.parent = parent self.browser = browser
def __init__(self, canvas, parent, browser): NavigationToolbar2QT.__init__(self,canvas,parent) for c in self.findChildren(QtGui.QToolButton): #print str(c.text()) #if str(c.text()) in ('Subplots','Customize','Back','Forward','Home'): if str(c.text()) in ('Customize','Back','Forward'): c.defaultAction().setVisible(False) self.parent = parent self.browser = browser
def __init__(self , parent , canvas , orientation = Qt.Vertical, close_button = False) : """ A simple matplotlib navigation toolbar that can be vertical Qt.Vertical or Qt.Horizontal """ NavigationToolbar2.__init__( self, canvas,parent ) self.setOrientation(orientation) if close_button: self.addSeparator() self.actionClose = self.addAction(QIcon(':/window-close.png'), 'Close')
def __init__(self,canvas_,parent_): self.toolitems = ( ('Home', 'Lorem ipsum dolor sit amet', 'home', 'home'), ('Back', 'consectetuer adipiscing elit', 'back', 'back'), ('Forward', 'sed diam nonummy nibh euismod', 'forward', 'forward'), (None, None, None, None), ('Pan', 'tincidunt ut laoreet', 'move', 'pan'), ('Zoom', 'dolore magna aliquam', 'zoom_to_rect', 'zoom'), (None, None, None, None), ('Subplots', 'putamus parum claram', 'subplots', 'configure_subplots'), ('Save', 'sollemnes in futurum', 'filesave', 'save_figure'), ) NavigationToolbar.__init__(self,canvas_,parent_)
def __init__(self, canvas, parent ): NavigationToolbar2QT.__init__(self,canvas,parent) self.clearButtons=[] # Search through existing buttons # next use for placement of custom button next=None for c in self.findChildren(QToolButton): if next is None: next=c # Don't want to see subplots and customize if str(c.text()) in ('Subplots','Customize','Forward', 'Back'): c.defaultAction().setVisible(False) continue
def __init__(self, canvas, parent): NavigationToolbar2QT.__init__(self, canvas, parent) self.clearButtons = [] # Search through existing buttons # next use for placement of custom button next = None for c in self.findChildren(QToolButton): if next is None: next = c # Don't want to see subplots and customize if str(c.text()) in ('Subplots', 'Customize', 'Forward', 'Back'): c.defaultAction().setVisible(False) continue
def __init__(self, canvas_, parent_): self.toolitems = ( ('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous view', 'back', 'back'), ('Forward', 'Forward to next view', 'forward', 'forward'), (None, None, None, None), ('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'), ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'), ('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'), (None, None, None, None), ('Save', 'Save the figure', 'filesave', 'save_figure'), ) NavigationToolbar.__init__(self, canvas_, parent_)
def __init__(self, canvas_, parent_): override.figureoptions = None # Monkey patched to kill the figure options button on matplotlib toolbar self.toolitems = ( ('Home', 'Reset original view', 'home', 'home'), ('Save', 'Save the current image', 'filesave', 'save_figure'), (None, None, None, None), ('Back', 'Back to previous view', 'back', 'back'), ('Forward', 'Forward to next view', 'forward', 'forward'), (None, None, None, None), ('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'), ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'), ) NavigationToolbar2QT.__init__(self, canvas_, parent_)
def __init__(self, parent, canvas, orientation=Qt.Vertical, close_button=False): """ A simple matplotlib navigation toolbar that can be vertical Qt.Vertical or Qt.Horizontal """ NavigationToolbar2.__init__(self, canvas, parent) self.setOrientation(orientation) if close_button: self.addSeparator() self.actionClose = self.addAction(QIcon(':/window-close.png'), 'Close')
def __init__(self, canvas, parent ): NavigationToolbar2QT.__init__(self,canvas,parent) self.clearButtons=[] # Search through existing buttons # next use for placement of custom button next=None for c in self.findChildren(QtGui.QToolButton): if next is None: next=c # Don't want to see subplots and customize """ if str(c.text()) in ('Subplots', 'Customize'): c.defaultAction().setVisible(False) continue """ # Need to keep track of pan and zoom buttons # Also grab toggled event to clear checked status of picker button if str(c.text()) in ('Pan','Zoom'): c.toggled.connect(self.clearCurs) self.clearButtons.append(c) next=None # create custom button pm=QtGui.QPixmap(32,32) pm.fill(QtGui.QApplication.palette().color(QtGui.QPalette.Normal,QtGui.QPalette.Button)) painter=QtGui.QPainter(pm) painter.fillRect(6,6,20,20,QtCore.Qt.red) painter.fillRect(15,3,3,26,QtCore.Qt.blue) painter.fillRect(3,15,26,3,QtCore.Qt.blue) painter.end() icon=QtGui.QIcon(pm) ac = self.addAction(icon, "Toggle Curs") ac.setCheckable(True) ac.toggled.connect(self.curs_toggle) self.ac = ac #button=QtGui.QToolButton(self) #button.setDefaultAction(self.ac) # Add it to the toolbar, and connect up event #self.insertWidget(next.defaultAction(),button) # Grab the picked event from the canvas canvas.mpl_connect('pick_event',self.canvasPicked)
def __init__(self,canvas_,parentframe_,parclass): self.parclass = parclass # images: Python34\Lib\site-packages\matplotlib\mpl-data\images self.toolitems = ( ('Home', 'original scale', 'home', 'home'), #('Back', 'consectetuer adipiscing elit', 'back', 'back'), #('Forward', 'sed diam nonummy nibh euismod', 'forward', 'forward'), (None, None, None, None), ('Pan', 'pan', 'move', 'pan'), (None, None, None, None), ('Zoom', 'zoom', 'zoom_to_rect', 'zoom'), (None, None, None, None), (None, None, None, None), ('Cursor','Cursor','cursor','onCursor'), (None, None, None, None), ) NavigationToolbar.__init__(self,canvas_,parentframe_,False)
def __init__(self, parent, canvas): """ Initialization FUTURE: direction='h' """ self.canvas = canvas QtGui.QWidget.__init__(self, parent) #if direction=='h' : # self.layout = QtGui.QHBoxLayout(self) #else : # self.layout = QtGui.QVBoxLayout(self) #self.layout.setMargin(2) #self.layout.setSpacing(0) NavigationToolbar.__init__(self, canvas, canvas) return
def __init__(self, parent, canvas): """ Initialization FUTURE: direction='h' """ self.canvas = canvas QtGui.QWidget.__init__(self, parent) #if direction=='h' : # self.layout = QtGui.QHBoxLayout(self) #else : # self.layout = QtGui.QVBoxLayout(self) #self.layout.setMargin(2) #self.layout.setSpacing(0) NavigationToolbar.__init__( self, canvas, canvas ) return
def __init__(self, canvas, parent, figure, remove=[]): self.canvas = canvas self.figure = figure self.span = {} self.toolitems = ( ('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous view', 'back', 'back'), ('Forward', 'Forward to next view', 'forward', 'forward'), (None, None, None, None), ('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'), ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'), (None, None, None, None), ('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'), ('Save', 'Save the figure', 'filesave', 'save_figure'), ('Csv Save', 'Save data to CSV File', '', 'csv_save'), ('Legend', 'Toggle legend', '', 'legend_switch'), ('Hold', 'Hold graph', '', 'hold_figure'), ('Cut', 'Cut figure', '', 'cut_figure'), ) NavigationToolbar2QT.__init__(self, canvas, parent) actions = self.findChildren(QtGui.QAction) self._actions["csv_save"].setIcon(QtGui.QIcon("images/CSV.png")) self._actions["legend_switch"].setIcon( QtGui.QIcon("images/legend.png")) self._actions["hold_figure"].setIcon(QtGui.QIcon("images/toggle.png")) self._actions["cut_figure"].setIcon(QtGui.QIcon("images/Cut.png")) self._actions["cut_figure"].setCheckable(1) self._actions["legend_switch"].setCheckable(1) self._actions["hold_figure"].setCheckable(1) for a in actions: if a.text() == 'Customize': self.removeAction(a) break for i in remove: self._actions[i].hide() self._actions["hold_figure"].setChecked(config["hold_graph_on_start"])
def __init__(self,canvas,parent,figure,remove=[]): self.canvas = canvas self.figure = figure self.span = {} self.toolitems = ( ('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous view', 'back', 'back'), ('Forward', 'Forward to next view', 'forward', 'forward'), (None, None, None, None), ('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'), ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'), (None, None, None, None), ('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'), ('Save', 'Save the figure', 'filesave', 'save_figure'), ('Csv Save', 'Save data to CSV File', '', 'csv_save'), ('Legend', 'Toggle legend', '', 'legend_switch'), ('Hold', 'Hold graph', '', 'hold_figure'), ('Cut', 'Cut figure', '', 'cut_figure'), ) NavigationToolbar2QT.__init__(self,canvas,parent) actions = self.findChildren(QtGui.QAction) self._actions["csv_save"].setIcon(QtGui.QIcon("images/CSV.png")) self._actions["legend_switch"].setIcon(QtGui.QIcon("images/legend.png")) self._actions["hold_figure"].setIcon(QtGui.QIcon("images/toggle.png")) self._actions["cut_figure"].setIcon(QtGui.QIcon("images/Cut.png")) self._actions["cut_figure"].setCheckable(1) self._actions["legend_switch"].setCheckable(1) self._actions["hold_figure"].setCheckable(1) for a in actions: if a.text() == 'Customize': self.removeAction(a) break for i in remove: self._actions[i].hide() self._actions["hold_figure"].setChecked(config["hold_graph_on_start"])
def __init__(self, canvas, parent): """ Initialises the toolbar """ self.toolitems = (('Home', 'Reset original view', 'home', 'home'),\ ('Back', 'Back to previous view', 'back', 'back'),\ ('Forward', 'Forward to next view', 'forward', 'forward'),\ (None, None, None, None),\ ('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'),\ ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),\ ('Reset', 'Reset the mask', 'reset','reset'),\ (None, None, None, None),\ ('Freehand', 'Freehand drawing', 'freehand', 'freehand'),\ ('Rectangle', 'Rectangle drawing', 'rectangle', 'rectangle'),\ ('Border', 'Border selection', 'border', 'border'),\ ('plus', 'Add mask', 'add_mask', 'add_mask'),\ ('minus', 'Remove mask', 'remove_mask', 'remove_mask'),\ (None, None, None, None),\ ('Normal','Normal Mask','normal_mask','normal_mask'),\ ('MaxDepth', 'Max Depth Mask', 'max_depth_mask', 'max_depth_mask'),\ ('ShelfBreak','Shelf Break Mask','shelf_break_mask','shelf_break_mask'),\ (None, None, None, None)\ ) NavigationToolbar.__init__(self, canvas, parent) self._actions['reset'].setIcon(set_icon('reset.png')) self._actions['freehand'].setCheckable(True) self._actions['freehand'].setIcon(set_icon('freehand.png')) self._actions['rectangle'].setCheckable(True) self._actions['rectangle'].setIcon(set_icon('rectangle.png')) self._actions['border'].setIcon(set_icon('border.png')) self._actions['add_mask'].setIcon(set_icon('plus.png')) self._actions['remove_mask'].setIcon(set_icon('minus.png')) self._actions['normal_mask'].setIcon((set_icon('all_mask.png'))) self._actions['normal_mask'].setCheckable(True) self._actions['max_depth_mask'].setIcon((set_icon('max_depth.png'))) self._actions['max_depth_mask'].setCheckable(True) self._actions['shelf_break_mask'].setIcon((set_icon('shelf_break.png'))) self._actions['shelf_break_mask'].setCheckable(True) self.update_height_mask(0)
def __init__(self, canvas, parent, tools=('Home', 'Pan', 'Zoom', 'Save'), **kwargs): matplotlib.backends.backend_qt4.figureoptions = None matplotlib.backends.backend_qt5.figureoptions = None self.toolitems = [t for t in NavigationToolbar2QT.toolitems if t[0] in tools] NavigationToolbar2QT.__init__(self, canvas, parent, **kwargs)
def __init__(self, *args, **kwargs): NavigationToolbar.__init__(self, *args, **kwargs)
def __init__(self, plotCanvas, parent): NavigationToolbar.__init__(self, plotCanvas, parent)
def __init__(self, canvas_, parent_, coordinates_): self.parent = parent_ NavigationToolbar2QT.__init__(self, canvas_, parent_, coordinates_)
def __init__(self, canvas, parent): _NavigationToolbar.__init__(self, canvas, parent, coordinates=False)