コード例 #1
0
ファイル: main.py プロジェクト: JohnPeoplefox/Python
    def __init__(self, parent=None):

        super(MainWindow, self).__init__(parent)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        path = QDir.currentPath()

        self.browser_model = QFileSystemModel()
        self.browser_model.setRootPath(path)
        self.browser_model.setFilter(QDir.NoDotAndDotDot | QDir.AllDirs)

        self.ui.browser.setModel(self.browser_model)

        self.details_model = QFileSystemModel()
        self.details_model.setRootPath(path)
        self.details_model.setFilter(QDir.NoDotAndDotDot | QDir.AllEntries)

        self.ui.details.setModel(self.details_model)

        column_count = self.browser_model.columnCount()
        for i in range(1, column_count):
            self.ui.browser.hideColumn(i)

        self.setupUi()
コード例 #2
0
class browser(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        # Connect the query function with the search button
        self.ui.pushButton.clicked.connect(self.query)

    def query(self):
        # Empty the list
        self.ui.listWidget.clear()
        # Get the words in the query
        words = cleanQuery(self.ui.lineEdit.text())
        # Collect the information for each word of the query
        index = {}
        for word in words:
            index[word] = collection.find({'_id': word})[0]['info']

# Rank the documents according to the query
        results = rankDocuments(index, words)
        results1 = rankDocuments1(index, words)
        size = len(results)
        print(size)
        #print(results1[0])
        #results1 = rankDocuments1(index, words)
        i = 0
        rankings = {}
        for result in results:
            if (i < 10):
                self.ui.listWidget.addItem(result[0] + ' : ' +
                                           str(round(result[1], 2)))
                j = 0
                for j in range(size):
                    if (result[0] == results1[j][0]):
                        break
                self.ui.listWidget.addItem(str(" ".join(results1[j][1])))
                '''for word in words:
					for document in index[word]['document(s)'].keys():
    						# Term Frequency (log to reduce document size scale effect)
						TF = index[word]['document(s)'][document]['position(s)']
						for file in files:
							name = re.match('(^[^.]*)', file).group(0)
							if name==document:
								data = open(file).read().splitlines()   
								words = parsing.clean(data)     
            				# Store scores in the ranking dictionary
						if document not in rankings:
							rankings[document] = words[TF[0]-10:TF[0]+10]
						else:
							rankings[document] += words[TF[0]-10:TF[0]+10]
						#self.ui.listWidget.addItem(rankings[document])
						print(rankings[document])'''
            i = i + 1
コード例 #3
0
class browser(QtGui.QMainWindow):
    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        # Connect the query function with the search button
        self.ui.pushButton.clicked.connect(self.query)
    def query(self):
        # Empty the list
        self.ui.listWidget.clear()
        # Get the words in the query
        words = cleanQuery(self.ui.lineEdit.text())
        # Collect the information for each word of the query
        index = {}
        for word in words:
            index[word] = collection.find({'_id' : word})[0]['info']
        # Rank the documents according to the query
        results = rankDocuments(index, words)
        for result in results:
            self.ui.listWidget.addItem(result[0]+' : '+str(round(result[1], 2)))
コード例 #4
0
ファイル: main.py プロジェクト: JohnPeoplefox/Python
class MainWindow(QMainWindow):
    def __init__(self, parent=None):

        super(MainWindow, self).__init__(parent)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        path = QDir.currentPath()

        self.browser_model = QFileSystemModel()
        self.browser_model.setRootPath(path)
        self.browser_model.setFilter(QDir.NoDotAndDotDot | QDir.AllDirs)

        self.ui.browser.setModel(self.browser_model)

        self.details_model = QFileSystemModel()
        self.details_model.setRootPath(path)
        self.details_model.setFilter(QDir.NoDotAndDotDot | QDir.AllEntries)

        self.ui.details.setModel(self.details_model)

        column_count = self.browser_model.columnCount()
        for i in range(1, column_count):
            self.ui.browser.hideColumn(i)

        self.setupUi()

    def setupUi(self):
        self.ui.browser.clicked.connect(self.browser_clicked)

    def browser_clicked(self, index):

        file_info = self.browser_model.fileInfo(index)
        path = file_info.absoluteFilePath()
        self.ui.details.setRootIndex(self.details_model.setRootPath(path))
コード例 #5
0
 def __init__(self, parent = None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     # Connect the query function with the search button
     self.ui.pushButton.clicked.connect(self.query)
コード例 #6
0
 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     
     # General Window settings
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.db = None
     self.wdb = None
           
     # Directory browser
     self.model = QtGui.QFileSystemModel()
     #self.model.setRootPath(QtCore.QDir.absolutePath(QtCore.QDir('/home/tiago/Code/py/NeuroDAQ-Analysis/testData/')))
     self.model.setRootPath(QtCore.QDir.absolutePath(QtCore.QDir('/Users/adam/')))       
     self.model.setNameFilters(['*.hdf5'])
     self.ui.dirTree.setModel(self.model)
     self.ui.dirTree.setColumnHidden(1, True)
     self.ui.dirTree.setColumnHidden(2, True)
     self.ui.dirTree.setColumnHidden(3, True)
     #self.ui.dirTree.setRootIndex(self.model.index(QtCore.QDir.absolutePath(QtCore.QDir('/home/tiago/Code/py/NeuroDAQ-Analysis/testData/'))))
     self.ui.dirTree.setRootIndex(self.model.index(QtCore.QDir.absolutePath(QtCore.QDir('/Users/adam'))))   
     self.ui.dirTree.selectionModel().selectionChanged.connect(self.loadH5OnSelectionChanged)      #### not in Class ####
     self.currentOpenFile = []
     self.currentSaveFile = []
     
     # hdf5 browser
     self.ui.hdfTree.data = []
     self.ui.hdfTree.setColumnCount(1)
     self.ui.hdfTree.setHeaderLabels(['Data'])
     self.ui.hdfTree.currentItemChanged.connect(self.plotOnSelectionChanged)
     self.ui.hdfTree.itemSelectionChanged.connect(self.storeSelection)
     
     # working hdf5 tree
     self.ui.workingTree.data = []
     self.ui.workingTree.setColumnCount(1)
     self.ui.workingTree.setHeaderLabels(['Working Data'])
     self.ui.actionLoadData.triggered.connect(self.loadH5OnLoadPush)
     self.ui.actionNewFile.triggered.connect(self.createH5OnNewPush)
     self.ui.actionSaveFile.triggered.connect(self.saveH5OnSavePush)
     self.ui.actionSaveFileAs.triggered.connect(self.saveH5OnSaveAsPush)
     self.connect(self.ui.workingTree, QtCore.SIGNAL('dropped'), self.moveItemsAcross)
     self.connect(self.ui.workingTree, QtCore.SIGNAL('targetPosition'), self.setTargetPosition)
     self.ui.workingTree.propsDt = ''
     self.ui.workingTree.propsDescription = ''   
     
     # context menus
     self.ui.workingTree.customContextMenuRequested.connect(self.openWorkingTreeMenu)
     self.ui.actionAddRootGroup.triggered.connect(self.addRootGroupOnMenu)
     self.ui.actionAddChildGroup.triggered.connect(self.addChildGroupOnMenu)
     self.ui.actionRenameTreeItem.triggered.connect(self.renameItemOnMenu)
     self.ui.actionRemoveTreeItem.triggered.connect(self.removeItemOnMenu)
     self.ui.actionShowInTable.triggered.connect(self.showInTableOnMenu)        
     
     # properties table        
     self.ui.propsTableWidget.setRowCount(2)
     self.ui.propsTableWidget.setColumnCount(1)
     self.ui.propsTableWidget.horizontalHeader().setVisible(False)
     self.ui.workingTree.propsItemDtLabel = QtGui.QTableWidgetItem('dt')
     self.ui.workingTree.propsItemDt = QtGui.QTableWidgetItem(self.ui.workingTree.propsDt)
     self.ui.workingTree.propsItemDescriptionLabel = QtGui.QTableWidgetItem('Description')
     self.ui.workingTree.propsItemDescription = QtGui.QTableWidgetItem(self.ui.workingTree.propsDescription)                
     self.ui.propsTableWidget.setVerticalHeaderItem(0, self.ui.workingTree.propsItemDtLabel)
     self.ui.propsTableWidget.setItem(0,0,self.ui.workingTree.propsItemDt)
     self.ui.propsTableWidget.setVerticalHeaderItem(1, self.ui.workingTree.propsItemDescriptionLabel)
     self.ui.propsTableWidget.setItem(1,0,self.ui.workingTree.propsItemDescription)
     self.ui.propsTableWidget.cellChanged.connect(self.updateTableEntry)        
     
     # data table
     self.ui.dataTableWidget.setRowCount(100)
     self.ui.dataTableWidget.setColumnCount(100)
             
     # main plotting mouse actions
     self.ui.plotsWidget.plotDataIndex = None
     self.ui.plotsWidget.insertNavigationBar(self)
     self.ui.plotsWidget.toolbar.addAction(self.ui.actionPlotData)
     self.ui.actionPlotData.triggered.connect(self.plotSelected)
     self.ui.plotsWidget.toolbar.addAction(self.ui.actionShowCursors)
     self.ui.actionShowCursors.toggled.connect(self.showCursors)
     self.ui.plotsWidget.toolbar.addAction(self.ui.actionZoomOut)
     self.ui.actionZoomOut.triggered.connect(self.zoomOut)
     self.mouseIsPressed = False
     cidPress = self.ui.plotsWidget.canvas.mpl_connect('button_press_event', self.on_press)
     cidMotion = self.ui.plotsWidget.canvas.mpl_connect('motion_notify_event', self.on_motion)        
     cidRelease = self.ui.plotsWidget.canvas.mpl_connect('button_release_event', self.on_release)    
     
     # analysis actions
     self.ui.plotsWidget.toolbar.addAction(self.ui.actionBaseline)
     self.ui.actionBaseline.triggered.connect(self.baseline)
     self.ui.plotsWidget.toolbar.addAction(self.ui.actionAverage)
     self.ui.actionAverage.triggered.connect(self.average)
     self.ui.plotsWidget.toolbar.addAction(self.ui.actionStats)
     self.ui.actionStats.triggered.connect(self.measureStats)        
             
     self.show()              
コード例 #7
0
class dataBrowser(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        
        # General Window settings
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.db = None
        self.wdb = None
              
        # Directory browser
        self.model = QtGui.QFileSystemModel()
        #self.model.setRootPath(QtCore.QDir.absolutePath(QtCore.QDir('/home/tiago/Code/py/NeuroDAQ-Analysis/testData/')))
        self.model.setRootPath(QtCore.QDir.absolutePath(QtCore.QDir('/Users/adam/')))       
        self.model.setNameFilters(['*.hdf5'])
        self.ui.dirTree.setModel(self.model)
        self.ui.dirTree.setColumnHidden(1, True)
        self.ui.dirTree.setColumnHidden(2, True)
        self.ui.dirTree.setColumnHidden(3, True)
        #self.ui.dirTree.setRootIndex(self.model.index(QtCore.QDir.absolutePath(QtCore.QDir('/home/tiago/Code/py/NeuroDAQ-Analysis/testData/'))))
        self.ui.dirTree.setRootIndex(self.model.index(QtCore.QDir.absolutePath(QtCore.QDir('/Users/adam'))))   
        self.ui.dirTree.selectionModel().selectionChanged.connect(self.loadH5OnSelectionChanged)      #### not in Class ####
        self.currentOpenFile = []
        self.currentSaveFile = []
        
        # hdf5 browser
        self.ui.hdfTree.data = []
        self.ui.hdfTree.setColumnCount(1)
        self.ui.hdfTree.setHeaderLabels(['Data'])
        self.ui.hdfTree.currentItemChanged.connect(self.plotOnSelectionChanged)
        self.ui.hdfTree.itemSelectionChanged.connect(self.storeSelection)
        
        # working hdf5 tree
        self.ui.workingTree.data = []
        self.ui.workingTree.setColumnCount(1)
        self.ui.workingTree.setHeaderLabels(['Working Data'])
        self.ui.actionLoadData.triggered.connect(self.loadH5OnLoadPush)
        self.ui.actionNewFile.triggered.connect(self.createH5OnNewPush)
        self.ui.actionSaveFile.triggered.connect(self.saveH5OnSavePush)
        self.ui.actionSaveFileAs.triggered.connect(self.saveH5OnSaveAsPush)
        self.connect(self.ui.workingTree, QtCore.SIGNAL('dropped'), self.moveItemsAcross)
        self.connect(self.ui.workingTree, QtCore.SIGNAL('targetPosition'), self.setTargetPosition)
        self.ui.workingTree.propsDt = ''
        self.ui.workingTree.propsDescription = ''   
        
        # context menus
        self.ui.workingTree.customContextMenuRequested.connect(self.openWorkingTreeMenu)
        self.ui.actionAddRootGroup.triggered.connect(self.addRootGroupOnMenu)
        self.ui.actionAddChildGroup.triggered.connect(self.addChildGroupOnMenu)
        self.ui.actionRenameTreeItem.triggered.connect(self.renameItemOnMenu)
        self.ui.actionRemoveTreeItem.triggered.connect(self.removeItemOnMenu)
        self.ui.actionShowInTable.triggered.connect(self.showInTableOnMenu)        
        
        # properties table        
        self.ui.propsTableWidget.setRowCount(2)
        self.ui.propsTableWidget.setColumnCount(1)
        self.ui.propsTableWidget.horizontalHeader().setVisible(False)
        self.ui.workingTree.propsItemDtLabel = QtGui.QTableWidgetItem('dt')
        self.ui.workingTree.propsItemDt = QtGui.QTableWidgetItem(self.ui.workingTree.propsDt)
        self.ui.workingTree.propsItemDescriptionLabel = QtGui.QTableWidgetItem('Description')
        self.ui.workingTree.propsItemDescription = QtGui.QTableWidgetItem(self.ui.workingTree.propsDescription)                
        self.ui.propsTableWidget.setVerticalHeaderItem(0, self.ui.workingTree.propsItemDtLabel)
        self.ui.propsTableWidget.setItem(0,0,self.ui.workingTree.propsItemDt)
        self.ui.propsTableWidget.setVerticalHeaderItem(1, self.ui.workingTree.propsItemDescriptionLabel)
        self.ui.propsTableWidget.setItem(1,0,self.ui.workingTree.propsItemDescription)
        self.ui.propsTableWidget.cellChanged.connect(self.updateTableEntry)        
        
        # data table
        self.ui.dataTableWidget.setRowCount(100)
        self.ui.dataTableWidget.setColumnCount(100)
                
        # main plotting mouse actions
        self.ui.plotsWidget.plotDataIndex = None
        self.ui.plotsWidget.insertNavigationBar(self)
        self.ui.plotsWidget.toolbar.addAction(self.ui.actionPlotData)
        self.ui.actionPlotData.triggered.connect(self.plotSelected)
        self.ui.plotsWidget.toolbar.addAction(self.ui.actionShowCursors)
        self.ui.actionShowCursors.toggled.connect(self.showCursors)
        self.ui.plotsWidget.toolbar.addAction(self.ui.actionZoomOut)
        self.ui.actionZoomOut.triggered.connect(self.zoomOut)
        self.mouseIsPressed = False
        cidPress = self.ui.plotsWidget.canvas.mpl_connect('button_press_event', self.on_press)
        cidMotion = self.ui.plotsWidget.canvas.mpl_connect('motion_notify_event', self.on_motion)        
        cidRelease = self.ui.plotsWidget.canvas.mpl_connect('button_release_event', self.on_release)    
        
        # analysis actions
        self.ui.plotsWidget.toolbar.addAction(self.ui.actionBaseline)
        self.ui.actionBaseline.triggered.connect(self.baseline)
        self.ui.plotsWidget.toolbar.addAction(self.ui.actionAverage)
        self.ui.actionAverage.triggered.connect(self.average)
        self.ui.plotsWidget.toolbar.addAction(self.ui.actionStats)
        self.ui.actionStats.triggered.connect(self.measureStats)        
                
        self.show()              
    
    # Tree methods
    def openWorkingTreeMenu(self, position):
        self.workingTreeMenu = QtGui.QMenu()
        self.workingTreeMenu.addAction(self.ui.actionAddRootGroup)
        self.workingTreeMenu.addAction(self.ui.actionAddChildGroup)
        self.workingTreeMenu.addAction(self.ui.actionAddDataset)
        self.workingTreeMenu.addAction(self.ui.actionRenameTreeItem)
        self.workingTreeMenu.addAction(self.ui.actionRemoveTreeItem)
        self.workingTreeMenu.addAction(self.ui.actionShowInTable)

        if len(self.ui.workingTree.selectedItems())==0: 
            self.ui.actionAddChildGroup.setDisabled(True)
            self.ui.actionRenameTreeItem.setDisabled(True)
        else:
            self.ui.actionAddChildGroup.setDisabled(False)
            self.ui.actionRenameTreeItem.setDisabled(False)
            
        self.workingTreeMenu.exec_(self.ui.workingTree.viewport().mapToGlobal(position))
    
    def loadH5OnSelectionChanged(self, newSelection, oldSelection):
        #newIndex = newSelection.indexes()[0]
        #oldIndex = oldSelection.indexes()[0]
        #currentFile = str(newIndex.model().filePath(newIndex))
        #oldFile = str(newIndex.model().filePath(newIndex))
        if self.db: 
            self.db.close()
            self.db = None
        loadH5(self, self.ui.hdfTree, push=False)
       
    def loadH5OnLoadPush(self):
        loadH5(self, self.ui.workingTree, push=True)
        
    def createH5OnNewPush(self):
        createH5(self, self.ui.workingTree)

    def saveH5OnSavePush(self):
        if self.currentSaveFile:
            saveH5(self, self.ui.workingTree)
        else: 
            fname, ok = QtGui.QInputDialog.getText(self, 'New file', 'Enter file name:')
            if ok:
                self.currentSaveFile = str(self.model.rootPath()) + '/' + fname + '.hdf5'
                saveH5(self, self.ui.workingTree)
        
    def saveH5OnSaveAsPush(self):
        fname, ok = QtGui.QInputDialog.getText(self, 'New file', 'Enter file name:')
        if ok:
            savePath = '/Users/adam/DataAnalysis'
            self.currentSaveFile = savePath + '/' + fname + '.hdf5'      
            #self.currentSaveFile = str(self.model.rootPath()) + '/' + fname + '.hdf5'
            saveH5(self, self.ui.workingTree)

    def addRootGroupOnMenu(self):
        addTreeGroup(self, self.ui.workingTree, 'root')
       
    def addChildGroupOnMenu(self):
        addTreeGroup(self, self.ui.workingTree, 'child')
    
    def renameItemOnMenu(self):
        text, ok = QtGui.QInputDialog.getText(self, 'Rename item', 'Enter new name:')
        if ok: renameTreeItem(self, self.ui.workingTree, str(text))

    def removeItemOnMenu(self):
        removeTreeItem(self, self.ui.workingTree)

    def showInTableOnMenu(self):
        clearTable(self)
        putDataOnTable(self)
    
    def storeSelection(self):
        self.dragItems = []
        #for item in self.ui.hdfTree.selectedItems():
        #    self.dragItems.append([item.path, item.text(0), item.dataIndex])    
        for originalIndex in self.ui.hdfTree.selectedIndexes():
            item = self.ui.workingTree.itemFromIndex(QtCore.QModelIndex(originalIndex))
            self.dragItems.append([item.path, item.text(0), item.dataIndex, originalIndex]) 
    
    def setTargetPosition(self, parent, row):
        self.dragTargetParent = parent
        self.dragTargetRow = row
    
    def moveItemsAcross(self):
        targetItems = []
        for item in self.dragItems:
            i = h5Item([str(item[1])])
            i.path = item[0]
            i.dataIndex = item[2]
            i.originalIndex = item[3]
            targetItems.append(i)            
        
        parentIndex = self.ui.workingTree.indexFromItem(self.dragTargetParent)
        for row in np.arange(0, len(self.dragItems)):
            index = self.ui.workingTree.model().index(self.dragTargetRow+row, 0, parentIndex)        
            temp_item = self.ui.workingTree.itemFromIndex(QtCore.QModelIndex(index))
            sip.delete(temp_item)        
            if parentIndex.isValid():
                self.dragTargetParent.insertChild(index.row(), targetItems[row])
                originalParentWidget = self.ui.hdfTree.itemFromIndex(QtCore.QModelIndex(targetItems[row].originalIndex))
                populateH5dragItems(self, originalParentWidget, targetItems[row])
            else:
                self.ui.workingTree.insertTopLevelItem(index.row(), targetItems[row])     
                originalParentWidget = self.ui.hdfTree.itemFromIndex(QtCore.QModelIndex(targetItems[row].originalIndex))
                populateH5dragItems(self, originalParentWidget, targetItems[row])

    # Properties methods
    def updateTableEntry(self, row, col):
        if row==0: self.ui.workingTree.propsDt = self.ui.propsTableWidget.item(row, col).text() 
        if row==1: self.ui.workingTree.propsDescription = self.ui.propsTableWidget.item(row, col).text() 
        
    # Plot methods
    def plotOnSelectionChanged(self, current, previous):
        if current:
            if 'dataset' in str(self.db[current.path]):
                plotSingleData(self, self.ui.dataPlotWidget, self.db[current.path][:])
    
    def plotSelected(self):
        plotMultipleData(self, self.ui.plotsWidget)   
    
    def showCursors(self):
        if self.ui.plotsWidget.toolbar._active=="ZOOM": self.ui.plotsWidget.toolbar.zoom()  
        if self.ui.plotsWidget.toolbar._active=="PAN": self.ui.plotsWidget.toolbar.pan()      
        if self.ui.actionShowCursors.isChecked():
            self.ui.plotsWidget.createCursor()
            self.ui.plotsWidget.initCursor()
        else:
            self.ui.plotsWidget.hideCursor()

    def zoomOut(self):
        if self.ui.plotsWidget.homeAxis: 
            self.ui.plotsWidget.canvas.ax.axis(self.ui.plotsWidget.homeAxis)
            self.ui.plotsWidget.cursor1.set_visible(False)
            self.ui.plotsWidget.cursor2.set_visible(False)
            self.ui.plotsWidget.canvas.draw()
            self.ui.plotsWidget.background = self.ui.plotsWidget.canvas.copy_from_bbox(self.ui.plotsWidget.canvas.ax.bbox)                 
            if self.ui.actionShowCursors.isChecked():
                x1,x2,y1,y2 = self.ui.plotsWidget.canvas.ax.axis()
                self.ui.plotsWidget.cursor1.set_data([self.ui.plotsWidget.cursor1Pos, self.ui.plotsWidget.cursor1Pos], [y1,y2])         
                self.ui.plotsWidget.cursor2.set_data([self.ui.plotsWidget.cursor2Pos, self.ui.plotsWidget.cursor2Pos], [y1,y2]) 
                self.ui.plotsWidget.cursor1.set_visible(True)
                self.ui.plotsWidget.cursor2.set_visible(True)
                self.ui.plotsWidget.canvas.ax.draw_artist(self.ui.plotsWidget.cursor1)
                self.ui.plotsWidget.canvas.ax.draw_artist(self.ui.plotsWidget.cursor2)
            self.ui.plotsWidget.canvas.draw()                     
    
    def on_press(self, event):        
        if (event.button==1) & (self.ui.actionShowCursors.isChecked()):
          if (self.ui.plotsWidget.toolbar._active<>"PAN") & (self.ui.plotsWidget.toolbar._active<>"ZOOM"):
            self.mouseIsPressed = True
            self.ui.plotsWidget.showCursor(event)
        elif (event.button==3) & (self.ui.actionShowCursors.isChecked()):
            self.mouseIsPressed = True        
            self.ui.plotsWidget.refreshCursor(event)

    def on_release(self, event):        
        self.mouseIsPressed = False
        
    def on_motion(self, event):
        if (self.ui.plotsWidget.toolbar._active<>"PAN") & (self.ui.plotsWidget.toolbar._active<>"ZOOM"):         
          if self.mouseIsPressed:
            if (event.button==1) & (self.ui.actionShowCursors.isChecked()):
                self.ui.plotsWidget.showCursor(event)
            elif (event.button==3) & (self.ui.actionShowCursors.isChecked()):
                self.ui.plotsWidget.refreshCursor(event)

    # Analysis methods
    def baseline(self):
        if self.ui.plotsWidget.plotDataIndex:
            if self.ui.plotsWidget.cursor1Pos: alib.baseline(self)

    def average(self):
        if self.ui.plotsWidget.plotDataIndex: alib.average(self)
        
    def measureStats(self):
        if self.ui.plotsWidget.plotDataIndex:
            if self.ui.plotsWidget.cursor1Pos: alib.measureStats(self)