Exemplo n.º 1
1
 def on_button_press3(self, event, x, y):
   if self.y1 < y < self.y2: # A right click toggle the note
     time     = self.x_to_round_time(x)
     stringid = min(int((y - self.y1 - 30.0) / 5.0), len(self.strings) - 1)
     self.select_at(time, stringid)
     
     for selection in self.selection: selection.on_set_value(-selection.note.value)
     
     if selection.note.value > 0: view.playnote(self.partition.instrument, selection.note.value)
       
     self.checktime()
   else: view.TabView.on_button_press3(self, event, x, y)
Exemplo n.º 2
0
 def on_key_press(self, event):
   if not self.selection: return
   
   key = event.keycode
   if   (event.char == "+") or (event.char == "="):
     for selection in self.selection[:]:
       if selection.note.value > 0:
         new_graphic_note = selection.on_set_value(selection.note.value + 1 * cmp(selection.note.value, 0))
         if new_graphic_note: self.add_selection(new_graphic_note)
       else:
         selection.on_set_value(-selection.note.value)
         
     if (len(self.selection) == 1) and (self.selection[0].note.value > 0): view.playnote(self.partition.instrument, self.selection[0].note.value)
     
   elif event.char == "-":
     for selection in self.selection[:]:
       if selection.note.value > 0:
         new_graphic_note = selection.on_set_value(selection.note.value - 1 * cmp(selection.note.value, 0))
         if new_graphic_note: self.add_selection(new_graphic_note)
       else:
         selection.on_set_value(-selection.note.value)
         
     if (len(self.selection) == 1) and (self.selection[0].note.value > 0): view.playnote(self.partition.instrument, self.selection[0].note.value)
     
   elif key == 57: self.on_set_effect(song.Note)        # n : normal
   elif key == 43: self.on_set_effect(song.HammerNote)  # h : hammer
   elif key == 39: self.on_set_effect(song.SlideNote)   # s : slide
   elif key == 56: self.on_set_effect(song.BendNote)    # b : bend
   elif key == 28: self.on_set_effect(song.TremoloNote) # t : tremolo
   elif key == 40: self.on_set_effect(song.DeadNote)    # d : dead note
   
   else: return view.TabView.on_key_press(self, event)