code: def new_eventtype(self, test_type_str=None):
          
          if self.annot is None:  # remove if buttons are disabled
              self.parent.statusBar().showMessage('No score file loaded')
              return
  
          if test_type_str:
              answer = test_type_str, True
          else:
              answer = QInputDialog.getText(self, 'New Event Type',
                                            'Enter new event\'s name')
          if answer[1]:
              self.annot.add_event_type(answer[0])
              self.display_eventtype()
              n_eventtype = self.idx_eventtype.count()
              self.idx_eventtype.setCurrentIndex(n_eventtype - 1)
              
          return answer
docs: Action: create dialog to add new event type.