コード例 #1
0
 def touch_note(self, state, x, y):
     '''touch the x/y cell on the current page - either a control, or a note'''
     if state == 'play':
         # Is touch control or note?
         self.apply_control(x, y)
         # Apply touch to current temp page and source page
         # self.get_curr_page().touch_note(x, y)
     elif state == 'ins_cfg':
         cb_text, _x, _y = get_cb_from_touch(self.cb_grid, x, y)
         if not cb_text:
             return
         cb_func = self.__getattribute__(
             'cb_' + cb_text)  # Lookup the relevant conductor function
         cb_func(
             _x,
             _y)  # call it, passing it x/y args (which may not be needed)
     return True
コード例 #2
0
 def touch_note(self, state, x, y):
     '''touch the x/y cell on the current page'''
     if state == 'play':
         page = self.get_curr_page()
         if not page.validate_touch(x, y):
             return False
         page.touch_note(x, y)
         return True
     elif state == 'ins_cfg':
         cb_text, _x, _y = get_cb_from_touch(self.cb_grid, x, y)
         if not cb_text:
             return
         cb_func = self.__getattribute__(
             'cb_' + cb_text)  # Lookup the relevant conductor function
         cb_func(
             _x,
             _y)  # call it, passing it x/y args (which may not be needed)
         return True
コード例 #3
0
    def touch_note(self, x, y):
        if self.current_state in ['play', 'ins_cfg']:
            # self.get_curr_instrument().instrument_cmd_bus.put({'state': self.current_state, 'action': 'button_touch', 'details': (x, y)})
            self.get_curr_instrument().touch_note(self.current_state, x, y)
        # elif self.current_state == 'ins_cfg':
        #     self.get_curr_instrument().touch_note(self.current_state, x, y)
        #     self.get_curr_instrument().instrument_cmd_bus.put({'state': 'ins_cfg', 'action': 'button_touch', 'details': (x, y)})

        elif self.current_state == 'load':
            c.logging.info("loading")
            filenum = filenum_from_touch(x, y)
            if not validate_filenum(filenum):
                return
            if filenum == 1:
                return
            self.load(load_filenum(filenum))
            c.logging.info("loaded {}".format(filenum))
            self.current_state == 'play'
        elif self.current_state == 'save':
            c.logging.info("Saving {} {}".format(x, y))
            filenum = filenum_from_touch(x, y)
            if validate_filenum(filenum):
                c.logging.info("already exists, ignoring")
                self.current_state == 'play'
                return  # don't overwrite existing files
            self.save(filenum)
            c.logging.info("saved")
            self.current_state == 'play'
        elif self.current_state == 'gbl_cfg':
            cb_text, _x, _y = get_cb_from_touch(
                self.gbl_cfg_cb_grid, x, y)  # Find which area was touched
            if not cb_text:
                return
            cb_func = self.__getattribute__(
                'cb_' + cb_text)  # Lookup the relevant conductor function
            cb_func(
                _x,
                _y)  # call it, passing it x/y args (which may not be needed)
            # cb = get_cb_from_touch(get_ins_cfg_cb_grid(self.get_curr_instrument_num()), x, y)
        return