def add_bookmark(self, time):
        """Run this function when user adds a new bookmark.

        Parameters
        ----------
        time : tuple of float
            start and end of the new bookmark, in s
        """
        if self.annot is None:  # remove if buttons are disabled
            msg = 'No score file loaded'
            lg.debug(msg)
            error_dialog = QErrorMessage()
            error_dialog.setWindowTitle('Error adding bookmark')
            error_dialog.showMessage(msg)
            error_dialog.exec()
            return

        answer = QInputDialog.getText(self, 'New Bookmark',
                                      'Enter bookmark\'s name')
        if answer[1]:
            name = answer[0]
            self.annot.add_bookmark(name, time)
            lg.info('Added Bookmark ' + name + 'at ' + str(time))

        self.update_annotations()
def add_bookmark ( self , time ) : if self . annot is None : msg = 'No score file loaded' lg . debug ( msg ) error_dialog = QErrorMessage ( ) error_dialog . setWindowTitle ( 'Error adding bookmark' ) error_dialog . showMessage ( msg ) error_dialog . exec ( ) return answer = QInputDialog . getText ( self , 'New Bookmark' , 'Enter bookmark\'s name' ) if answer [ 1 ] : name = answer [ 0 ] self . annot . add_bookmark ( name , time ) lg . info ( 'Added Bookmark ' + name + 'at ' + str ( time ) ) self . update_annotations ( )
Run this function when user adds a new bookmark.

        Parameters
        ----------
        time : tuple of float
            start and end of the new bookmark, in s