示例#1
0
    def assign_select(self, track):
        self.unbind()
        if track is None:
            self.disable()
            return
        self._track = track

        def unbind():
            self._handle_color_changed.subject = None
            return

        def update(blink_state=0):
            self._button.send_index(
                self._track != self.song().view.selected_track and 1 or 0)

        def action():
            self._track_editor.handle_track_select(self._track)

        self._handle_color_changed.subject = track
        self._button.set_color(toHSB(self._track.color))
        self._unbinder = unbind
        self._valueupdater = update
        self._action = action
        self._use_track_color = True
        return
示例#2
0
 def _handle_color_changed(self):
     if self._clip:
         _, oncolor = toHSB(self._clip.color)
         self.on_color = oncolor + 2
         self.bs_color = oncolor
         self._page_handler.update_buttons()
         self._assign_notes(True)
示例#3
0
 def get_color_cmode_base(self, clip_slot):
     if clip_slot != None:
         if clip_slot.has_clip:
             color = toHSB(clip_slot.clip.color)
             return color
         if clip_slot.controls_other_clips:
             pass
     return (0, 0)
示例#4
0
 def set_track(self, track):
     self.__track = track
     if track:
         self.__color = toHSB(track.color)[1]
         self._output_meter_changed.subject = track
     else:
         self._output_meter_changed.subject = None
     return
示例#5
0
 def _update_button_color(self, button):
     button.empty = has_active_clips(button.scene)
     color = button.scene.color
     button.rgbcolor = color
     if color == 0:
         button.set_color((30, 28))
     else:
         button.set_color(toHSB(color))
示例#6
0
 def send_color(self, value=0):
     if not self.__active:
         return
     if self.__track:
         color = toHSB(self.__track.color)
         self.__button.send_color_direct(
             color[self.__track != self.song().view.selected_track and 1
                   or 0])
     else:
         self.__button.send_color_direct(0)
示例#7
0
    def _assign_button(self):
        if self.__page_control:
            clip = self.__page_control.get_clip()
            color = (4, 6)
            if clip:
                color = toHSB(clip.color)
            if self.__page_select:
                quant, clip_len, grids = self.__page_control.get_grid_info()
                pages = clip_len / quant / grids / 8
                pv = int(pages) + (pages - int(pages) > 0 and 1 or 0)
                for button in self._buttons:
                    button.scene = None
                    index = button.index
                    if index < pv:
                        button.set_color((126, 124))
                        button.send_index(index != self.__page_offset and 1
                                          or 0)
                        button.page_off = button.index
                    else:
                        button.set_color((COLOR_BLACK, COLOR_BLACK))
                        button.send_index(0)
                        button.page_off = None

            else:
                pos, pages = self.__page_control.page_index()
                rpos = pos % 8
                offset = self.__page_offset * 8
                viewpages = min(8, pages - offset)
                self.__follow_pos = None
                for button in self._buttons:
                    button.scene = None
                    index = button.index
                    if index < viewpages:
                        button.set_color(color)
                        button.send_index(index != rpos and 1 or 0)
                        button.page = offset + index
                    else:
                        button.set_color((COLOR_BLACK, COLOR_BLACK))
                        button.send_index(0)
                        button.page = None

        else:
            for scene_index in range(8):
                scene = self.__session.scene(scene_index)
                button = self._buttons[scene_index]
                button.scene = scene._scene
                if scene._scene:
                    self._update_button_color(button)
                    button.send_index(1)
                else:
                    button.set_color(colorOnOff(CI_OFF))
                    button.send_index(0)
                    button.empty = True

        return
示例#8
0
 def assign_highlighted_clip_slot(self):
     self._clip = self.song().view.detail_clip
     if self._clip and self._clip.is_midi_clip:
         _, oncolor = toHSB(self._clip.color)
         self.on_color = oncolor + 2
         self.bs_color = BASE_NOTE_FIX_COLOR - 1
         self._handle_play_head.subject = self._clip
         self._handle_notes_changed.subject = self._clip
         self._handle_end_time_changed.subject = self._clip
         self._handle_loop_end_changed.subject = self._clip
         self._handle_playing.subject = self._clip
         self._handle_color_changed.subject = self._clip
示例#9
0
 def _get_color(self):
     if self._scene == None:
         return (COLOR_BLACK, COLOR_BLACK)
     color = self._scene.color == 0 and SCENE_DEFAULT_COLOR or toHSB(
         self._scene.color)
     if self._scene.is_triggered:
         self.blinking = True
     else:
         self.blinking = False
     count, playcount = play_count(self._scene)
     if playcount > 0:
         self.active = True
         return color
     self.active = False
     if count > 0:
         return color
     return color
     return (COLOR_BLACK, COLOR_BLACK)
示例#10
0
    def assign_stop(self, track):
        self.unbind()
        if track is None:
            self.disable()
            return
        self._track = track
        self._handle_arm.subject = track

        def unbind():
            pass

        def update(blink_state=0):
            has_clip, clip_playing, stop_fired, _ = track_status(self._track)
            if has_clip:
                if stop_fired:
                    if blink_state % 2 == 1:
                        self._button.send_index(0)
                    else:
                        self._button.send_index(1)
                elif clip_playing:
                    self._button.send_index(1)
                else:
                    self._button.send_index(0)
            else:
                self._button.send_index(0)

        def action():
            self._track.stop_all_clips()

        oncolor, offcolor = toHSB(self._track.color)
        self._button.set_color((offcolor, oncolor))
        self._unbinder = unbind
        self._valueupdater = update
        self._action = action
        self._use_track_color = True
        return
示例#11
0
 def _handle_color_changed(self):
     if self._track and self._use_track_color:
         self._button.set_color(toHSB(self._track.color))
示例#12
0
 def _get_ref_color(self):
     if self._focus_track:
         return toHSB(self._focus_track.color)
     return (72, 75)