示例#1
0
 def rename(self, *args, **kwargs):
     """
     Show a rename dialog to update the name of the midi record.
     
     """
     text = get_text_from_dialog(
                 prompt="Enter a new name:",
                 initial=self.midi_data.name,
                 title="Rename midi")
     if text is not None:
         self.midi_data.name = text
         self.midi_data.save()
         # Update the label that shows the name
         self.name_label.set_text(text)
示例#2
0
 def rename_midi(self, *args, **kwargs):
     midi = self.get_selection()
     if midi is not None:
         # Also note what item was selected
         model,seliter = self.treeview.get_selection().get_selected()
         text = get_text_from_dialog(
                         prompt="Enter a new name:",
                         initial=midi.name,
                         title="Rename midi"
                     )
         if text is not None:
             midi.name = text
             midi.save()
             # Update the name in the list
             self.liststore.set(seliter, 1, midi.name)