Ejemplo n.º 1
0
 def __init__(self, plotCanvas, parent):
     # create the default toolbar
     NavigationToolbar2QT.__init__(self, plotCanvas, parent)
     self.canvas = plotCanvas
     # add new toolbar buttons
     self.addAction(self._icon('filesave.png'), 'Export to CSV file',
                    self.saveCSV)
Ejemplo n.º 2
0
 def __init__(self, canvas, parent=None):
     NavigationToolbar.__init__(self, canvas, parent, coordinates=False)
     self.canvas = canvas
     self.addRateField()
     self.coordLabel = QW.QLabel("")
     self.addWidget(self.coordLabel)
     self.toggleRate(False)
Ejemplo n.º 3
0
    def __init__(self, plotCanvas, parent, coordinates):
        NavigationToolbar.__init__(self, plotCanvas, parent, coordinates)
        iconDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               "..", "_tools",
                               "").replace('\\library.zip', '')
        self.plotCanvas = plotCanvas
        self.addSeparator()
        self.a = self.addAction(QIcon(iconDir + "select.png"),
                                "Select data manually",
                                self.select_data('manual'))
        self.a.setToolTip("Select data manually")

        self.b = self.addAction(QIcon(iconDir + "calendar.png"),
                                "Select data by dates",
                                self.select_data('time'))
        self.b.setToolTip("Select data by dates")

        self.c = self.addAction(QIcon(iconDir + "ic-activity.png"),
                                "Select by peaks", self.select_data('peaks'))
        self.c.setToolTip("Select data by peaks")

        self.d = self.addAction(QIcon(iconDir + "table.png"),
                                "Stats by selection",
                                self.select_data('spanselector'))
        self.d.setToolTip("Stats by selection")
Ejemplo n.º 4
0
 def __init__(self, figure_canvas, parent=None):
     self.toolitems = (
         ('Home', 'Reset original view', 'mdi.home', 'home'),
         ('Back', 'Back to previous view', 'mdi.arrow-left', 'back'),
         ('Forward', 'Forward to next view', 'mdi.arrow-right', 'forward'),
         (None, None, None, None),
         ('Pan', 'Pan axes with left mouse, zoom with right',
          'mdi.arrow-all', 'pan'),
         ('Zoom', 'Zoom to rectangle', 'mdi.magnify', 'zoom'),
         (None, None, None, None),
         ('Show major', 'Show major gridlines', 'mdi.grid-large',
          'show_major_gridlines'),
         ('Show minor', 'Show minor gridlines', 'mdi.grid',
          'show_minor_gridlines'),
         (None, None, None, None),
         ('Subplots', 'Edit subplots', 'mdi.settings',
          'configure_subplots'),
         ('Save', 'Save the figure', 'mdi.content-save', 'save_figure'),
         (None, None, None, None),
         ('Show/hide legend', 'Toggles the legend on/off', None,
          'toggle_legend'),
     )
     self.is_major_grid_on = False
     self.is_minor_grid_on = False
     NavigationToolbar.__init__(self, figure_canvas, parent=parent)
     self.uncheck_autoscale_notifier = GenericObservable()
     self.enable_autoscale_notifier = GenericObservable()
     self.disable_autoscale_notifier = GenericObservable()
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
 def __init__(self, canvas, parent, fig):
     # plt.clf()
     # fig.clear()
     self.ece = None
     # self.canvas = canvas
     # self.parent = parent
     # C:\Python36\Lib\site-packages\matplotlib\mpl-data\images is the directory
     # you want to put image as (name)_large.png. it should be 48 x 48.
     # where to put the images for Anaconda
     # C:\Users\"UserName"\Anaconda3\Lib\site-packages\matplotlib\mpl-data\images
     self.fig = fig
     self.toolitems = (
         # Name, Hover Over Brief Detail, Image, function call
         ("ImportDB", "Import DB file", "import", "importDB"),
         #("ImportCSV", "Import CAV file", "importcsv", "importCSV"),
         ('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'),
         # (None, None, None, None),
         ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
         ('Subplots', 'Configure subplots', 'subplots',
          'configure_subplots'),
         # (None, None, None, None),
         ('Save', 'Save the figure', 'camera', 'save_figure'),
         ("Export", "Export DB to CSV", "export", "exportCSV"),
         ("Help", "Help", "question", 'help'),
         ("Annotate", "Enable Annotate", "annotate", "enableAnnotate"),
         ("Calibrate", "Calibrate Your Plot", "calibration", "importCal"))
     NavigationToolbar.__init__(self, canvas, parent, coordinates=True)
     self._actions["enableAnnotate"].setCheckable(True)
Ejemplo n.º 7
0
 def __init__(self, plotCanvas, parent):
     # create the default toolbar
     # plotCanvas is the tk Canvas we want to link to the toolbar,
     # parent is the iseult main app
     NavigationToolbar2QT.__init__(self, plotCanvas, parent)
     # print(self._nav_stack)
     self.parent = parent
Ejemplo n.º 8
0
 def __init__(self, figure_canvas, parent=None):
     self.toolitems = (
                         ('Home', 'Reset original view', 'home', 'home'),
                         ('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'),
                         ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
                         ('Save','Save the figure', 'filesave', 'save_figure'),
                      )
     NavigationToolbar.__init__(self, figure_canvas, parent=None)
Ejemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        NavigationToolbar2QT.__init__(self, *args, **kwargs)

        self.init_buttons()
        self.panAction.setCheckable(True)
        self.zoomAction.setCheckable(True)

        # remove the subplots action
        self.removeAction(self.subplotsAction)
Ejemplo n.º 10
0
	def __init__(self, *args, **kwargs):
		NavigationToolbar2QT.__init__(self, *args, **kwargs)

		self.init_buttons()
		self.panAction.setCheckable(True)
		self.zoomAction.setCheckable(True)

		# remove the subplots action
		self.removeAction( self.subplotsAction )
Ejemplo n.º 11
0
 def __init__(self, canvas_, parent_):
     self.toolitems = (
         ('Home', 'Reset Original View', 'home', 'home'),
         ('Back', 'Go To Previous View', 'back', 'back'),
         ('Forward', 'Return to Next View', 'forward', 'forward'),
         (None, None, None, None),
         ('Pan', 'Click and Drag to Pan', 'move', 'pan'),
         ('Zoom', 'Select Region to Zoon', 'zoom_to_rect', 'zoom'),
     )
     NavigationToolbar.__init__(self, canvas_, parent_)
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 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'),
                       (None, None, None,
                        None), ('Save', 'Save the figure', 'filesave',
                                'save_figure'))
     NavigationToolbar.__init__(self, canvas_, parent_)
Ejemplo n.º 14
0
    def __init__(self, data, canvas, parent=None):
        """ Set up the custom toolbar. """
        NavigationToolbar.__init__(self, canvas, parent)
        self.data = data
        self.canvas = canvas
        self.ann = Annotate(self.canvas, data)
        # self.iconDir = os.path.join(os.path.dirname(
        # os.path.abspath(__file__)),
        #    "..", "images", "icons", "")

        # self.a = self.addAction(QIcon(iconDir + "BYE2.ico"),
        self.addSeparator()
        a = self.addAction("Annotate", self.ann.toggle)
Ejemplo n.º 15
0
    def __init__(self, canvas_, parent_):
#        backend.figureoptions = None  # Monkey patched to kill the figure options button on matplotlib 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'),
#            (None, None, None, None),
#            ('Save', 'Save the current image', 'filesave', 'save_figure'),
#            )
        NavigationToolbar2QT.__init__(self, canvas_, parent_)
Ejemplo n.º 16
0
 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'),
         ('Axes Scaling', 'Toggles the axes scaling',
          os.path.dirname(os.path.abspath(__file__)) + '/img/axis_equal',
          'toggle_axes_aspect'),
     )
     NavigationToolbar.__init__(self, canvas_, parent_)
Ejemplo n.º 17
0
    def __init__(self, parent, canvas, direction='h'):

        self.canvas = canvas
        QWidget.__init__(self, parent)

        if direction == 'h':
            self.layout = QHBoxLayout(self)
        else:
            self.layout = QVBoxLayout(self)

        # self.layout.setMargin( 2 )
        # self.layout.setSpacing( 0 )

        NavigationToolbar.__init__(self, self, self.canvas, self)
Ejemplo n.º 18
0
    def __init__(self, figure_canvas, parent=None, ):
        self.parent = 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'),
                          ('Subplots', 'putamus parum claram', 'subplots', 'configure_subplots'),
                          ('Save', 'sollemnes in futurum', 'filesave', 'save_figure'),
                          (None, None, None, None),
                          ('Markers', 'Change', "change", 'change_state')
                          )

        NavigationToolbar2QT.__init__(self, figure_canvas, parent=self.parent)
Ejemplo n.º 19
0
    def __init__(self, parent, canvas):
        """ Initialization
        built-in methods
        - drag_zoom(self, event): triggered during holding the mouse and moving
        """
        NavigationToolbar2QT.__init__(self, canvas, canvas)

        # parent
        self._myParent = parent
        # tool bar mode
        self._myMode = NAVIGATION_MODE_NONE

        # connect the events to parent
        self.home_button_pressed.connect(self._myParent.evt_toolbar_home)
        self.canvas_zoom_released.connect(self._myParent.evt_zoom_released)
Ejemplo n.º 20
0
    def __init__(self, figure_canvas, parent=None):
        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', 'Edit subplots', 'subplots', 'configure_subplots'),
                          ('Save', 'Save the figure', 'filesave', 'save_figure'),
                          (None, None, None, None),
                          ('Show/hide legend', 'Toggles the legend on/off', "select", 'toggle_legend'),
                          )

        NavigationToolbar.__init__(self, figure_canvas, parent=parent)
    def update_focus_canvas(self, canvas):
        self.lb_canvas.setText(canvas.get_name())
        for key, _a in self.actions.items():
            _a.setChecked(False)

        self.focusing_canvas = canvas
        NavigationToolbar2QT.__init__(self, canvas, self.mainwindow.wg_canvas)

        grid_main, grid_sub = self.focusing_canvas.set_grid_status()
        self.ax_main_toolbtns["grid"].setChecked(grid_main)
        self.ax_sub_toolbtns["grid"].setChecked(grid_sub)

        self.ax_main_toolbtns["crosslines"].setChecked(
            self.focusing_canvas.draggable_lines[0].vline.get_visible())
        self.ax_sub_toolbtns["crosslines"].setChecked(
            self.focusing_canvas.draggable_lines[1].vline.get_visible())
Ejemplo n.º 22
0
    def __init__(self, canvas, parent):
        NavigationToolbar2QT.__init__(self, canvas, parent)
        self.canvas = canvas

        actions = self.findChildren(QtWidgets.QAction)
        toolsBlacklist = ['Customize', 'Forward', 'Back', 'Subplots', 'Save']
        for a in actions:
            if a.text() in toolsBlacklist:
                self.removeAction(a)

        # Remove the labels (x,y,val).
        self.locLabel.deleteLater()

        self.actionPickMarkers = self.addAction('Pick')
        self.actionClearMarkers = self.addAction('Clear')
        self.actionImageSettings = self.addAction('Image Settings')
        self.insertSeparator(self.actionImageSettings)
        self.actionPickMarkers.setCheckable(True)
Ejemplo n.º 23
0
 def __init__(self, figure_canvas, parent=None):
     self.Window = 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'),
         (None, None, None, None),
         ('Add Peak', 'Add peak manually', 'add_peak', 'add_peak_tool'),
     )
     NavigationToolbar.__init__(self, figure_canvas, parent=None)
     self._actions['add_peak_tool'].setCheckable(True)
    def __init__(self, canvas, parent=None):
        self.mainwindow = parent
        self.focusing_canvas = canvas
        self.toolitems = [
        ]  # clear NavigationToolbar2QT object default setting
        self.actions = {}
        NavigationToolbar2QT.__init__(self, canvas, parent)

        toolitems = [  # toolitem = (name, icon_name, hover_text, callback)
            ('Home', 'home', 'Default-view', 'home'),
            ('Back', 'back-arrow', 'Previous view', 'back'),
            ('Forward', 'forward-arrow', 'Next view', 'forward'),
            ('Pan', 'move', 'move', 'pan'),
            ('Zoom', 'zoom-in', 'Zoom in', 'zoom'),
            ('Save', 'filesave', 'Save figure', 'save_figure'),
            ('Setting', 'setting', 'Canvas setting', 'edit_parameter'),
            # ('Lines', 'cross-line', 'Draggable vertical line', 'show_draggable_lines'),
            ('Y-scale', 'y-scale', 'Autoscale y axis', 'autoscale_yaxis'),
        ]

        self.initUI(toolitems)
Ejemplo n.º 25
0
 def __init__(self, canvas_, parent_):
     # list of toolitems to add to the toolbar, format is:
     # (
     #   text, # the text of the button (often not visible to users)
     #   tooltip_text, # the tooltip shown on hover (where possible)
     #   image_file, # name of the image for the button (without the extension)
     #   name_of_method, # name of the method in NavigationToolbar2 to call
     # )
     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'), ('Settings',
                                         'Change file I/O preferences',
                                         'Settings', 'settings_nav'))
     NavigationToolbar.__init__(self, canvas_, parent_)
Ejemplo n.º 26
0
 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)
Ejemplo n.º 27
0
    def __init__(self, canvas, parent ):
        NavigationToolbar2QT.__init__(self,canvas,parent)
        self.showLegend = False
        
        # 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
            #Verwijder buttons die we niet willen
            if str(c.text()) in ('Home','Customize','Forward','Back','Subplots'):
                c.defaultAction().setVisible(False)
                continue
            # Need to keep track of pan and zoom buttons
            if str(c.text()) in ('Pan','Zoom'):
                next=None
        
        #Define legend button
        legendButton=QAction("Toggle legend",self)
        legendButton.setIcon(QApplication.style().standardIcon(QStyle.SP_MessageBoxInformation))
        legendButton.setCheckable(True)
        legendButton.setToolTip("Toggle legend")
        self.legendButton = legendButton
        button=QToolButton(self)
        button.setDefaultAction(self.legendButton)

        #Add it to the toolbar, and connect up event
        self.insertWidget(next.defaultAction(),button)
        legendButton.toggled.connect(self.legendToggled)
        
        #Send a signal when the zoom or pan button is pressed.
        self.release_zoom('button_release_event')
        self.canvas.mpl_connect('button_release_event', self.viewChange)
        self.release_pan('button_release_event')
        self.canvas.mpl_connect('button_release_event', self.viewChange)      
Ejemplo n.º 28
0
 def __init__(self, canvas, parent, coordinates=True):
     NavigationToolbar.__init__(self, canvas, parent, coordinates)
     self.setIconSize(QtCore.QSize(15, 15))
Ejemplo n.º 29
0
 def __init__(self, plotCanvas, parent):
     NavigationToolbar.__init__(self, plotCanvas, parent)
Ejemplo n.º 30
0
 def __init__(self, canvas, parent):
     NavigationToolbar.__init__(self, canvas, parent, coordinates=False)
     self.setOrientation(Qt.Vertical)
     self.additional_action_list = []
     LOG.debug("Toolbar OK")
Ejemplo n.º 31
0
 def __init__(self, canvas, parent, coordinates=True):
     NavigationToolbar.__init__(self, canvas, parent, coordinates)
     self.setIconSize(QtCore.QSize(15, 15))
Ejemplo n.º 32
0
 def __init__(self, canvas_, parent_):
     NavigationToolbar.__init__(self, canvas_, parent_)
Ejemplo n.º 33
0
 def __init__(self, plotCanvas, parent):
     NavigationToolbar.__init__(self, plotCanvas, parent)
Ejemplo n.º 34
0
 def __init__(self, canvas_, parent_):
     self.toolitems = tuple([
         t for t in NavigationToolbar2QT.toolitems
         if t[0] in ('Home', 'Back', 'Forward', 'Pan', 'Zoom', 'Save')
     ])
     NavigationToolbar2QT.__init__(self, canvas_, parent_)