示例#1
0
 def __show_colour(self,red,green,blue,length):
     if red is not None and (red < 0.0 or red > 1.0):
         return errors.invalid_thing(red, 'show')
     if green is not None and (green < 0.0 or green > 1.0):
         return errors.invalid_thing(green, 'show')
     if blue is not None and (blue < 0.0 or blue > 1.0):
         return errors.invalid_thing(blue, 'show')
     if length < 0:
         return errors.invalid_thing(length, 'show')
     us = int(1000000*length)
     v = piw.tuplenull_nb(0)
     v = piw.tupleadd_nb(v, piw.makelong_nb(self.__index,0))
     if red is None:
         v = piw.tupleadd_nb(v, piw.makenull_nb(0))
     else:
         v = piw.tupleadd_nb(v, piw.makefloat_nb(red,0))
     if green is None:
         v = piw.tupleadd_nb(v, piw.makenull_nb(0))
     else:
         v = piw.tupleadd_nb(v, piw.makefloat_nb(green,0))
     if blue is None:
         v = piw.tupleadd_nb(v, piw.makenull_nb(0))
     else:
         v = piw.tupleadd_nb(v, piw.makefloat_nb(blue,0))
     v = piw.tupleadd_nb(v, piw.makelong_nb(us,0))
     return piw.trigger(self.__agent.blink.show_colour(),v),None
示例#2
0
 def __show_colour(self, red, green, blue, length):
     if red is not None and (red < 0.0 or red > 1.0):
         return errors.invalid_thing(red, 'show')
     if green is not None and (green < 0.0 or green > 1.0):
         return errors.invalid_thing(green, 'show')
     if blue is not None and (blue < 0.0 or blue > 1.0):
         return errors.invalid_thing(blue, 'show')
     if length < 0:
         return errors.invalid_thing(length, 'show')
     us = int(1000000 * length)
     v = piw.tuplenull_nb(0)
     v = piw.tupleadd_nb(v, piw.makelong_nb(self.__index, 0))
     if red is None:
         v = piw.tupleadd_nb(v, piw.makenull_nb(0))
     else:
         v = piw.tupleadd_nb(v, piw.makefloat_nb(red, 0))
     if green is None:
         v = piw.tupleadd_nb(v, piw.makenull_nb(0))
     else:
         v = piw.tupleadd_nb(v, piw.makefloat_nb(green, 0))
     if blue is None:
         v = piw.tupleadd_nb(v, piw.makenull_nb(0))
     else:
         v = piw.tupleadd_nb(v, piw.makefloat_nb(blue, 0))
     v = piw.tupleadd_nb(v, piw.makelong_nb(us, 0))
     return piw.trigger(self.__agent.blink.show_colour(), v), None
示例#3
0
 def __move_mouse(self, ctx, subj, dummy, v1, v2):
     x = int(action.abstract_string(v1))
     y = int(action.abstract_string(v2))
     if x < 0:
         return errors.invalid_thing(v1, 'move')
     if y < 0:
         return errors.invalid_thing(v2, 'move')
     v = piw.tuplenull_nb(0)
     v = piw.tupleadd_nb(v, piw.makelong_nb(x, 0))
     v = piw.tupleadd_nb(v, piw.makelong_nb(y, 0))
     return piw.trigger(self.sysin_events.move_mouse(), v), None
 def __move_mouse(self,ctx,subj,dummy,v1,v2):
     x = int(action.abstract_string(v1))
     y = int(action.abstract_string(v2))
     if x < 0:
         return errors.invalid_thing(v1, 'move')
     if y < 0:
         return errors.invalid_thing(v2, 'move')
     v = piw.tuplenull_nb(0)
     v = piw.tupleadd_nb(v, piw.makelong_nb(x,0))
     v = piw.tupleadd_nb(v, piw.makelong_nb(y,0))
     return piw.trigger(self.sysin_events.move_mouse(),v),None
示例#5
0
 def __set_midi_control(self, ctx, subj, ctl, val):
     c = action.mass_quantity(ctl)
     to = action.abstract_wordlist(val)[0]
     c_val = int(c)
     to_val = int(to)
     if c_val < 0 or c_val > 127:
         return errors.invalid_thing(c, 'set')
     if to_val < 0 or to_val > 127:
         return errors.invalid_thing(to, 'set')
     return piw.trigger(
         self.host.change_cc(),
         utils.makedict_nb(
             {
                 'ctl': piw.makelong_nb(c_val, 0),
                 'val': piw.makelong_nb(to_val, 0)
             }, 0)), None
示例#6
0
 def __set_bank_change(self, ctx, subj, dummy, val):
     to = action.abstract_wordlist(val)[0]
     to_val = int(to)
     if to_val < 0 or to_val > 127:
         return errors.invalid_thing(to, 'set')
     return piw.trigger(self.host.change_bank(), piw.makelong_nb(to_val,
                                                                 0)), None
示例#7
0
 def __set_program_change(self, ctx, subj, dummy, val):
     to = action.abstract_wordlist(val)[0]
     to_val = int(to)
     if to_val < 0 or to_val > 127:
         return errors.invalid_thing(to, 'set')
     return piw.trigger(self.__midi_from_belcanto.change_program(),
                        piw.makelong_nb(to_val, 0)), None
示例#8
0
 def __press_key(self, ctx, subj, dummy, val):
     v = action.abstract_wordlist(val)[0]
     v_val = int(v)
     if v_val < 0:
         return errors.invalid_thing(val, 'press')
     return piw.trigger(self.sysin_events.press_key(),
                        piw.makelong_nb(v_val, 0)), None
示例#9
0
 def __position_create(self, ctx, subj, dummy, arg):
     v = int(action.abstract_string(arg))
     if v < 1 or v > 10000:
         print 'position out of range'
         return async .success(errors.out_of_range('1 to 10000', 'set'))
     return piw.trigger(self.__agent.model.set_position(),
                        piw.makelong_nb(v - 1, 0)), None
示例#10
0
 def __end_change(self,v):
     fc = piw.fastchange(self.__agent.model.set_loopend())
     fc(piw.makelong_nb(v-1,0))
     return True
 def __press_key(self,ctx,subj,dummy,val):
     v = action.abstract_wordlist(val)[0]
     v_val = int(v)
     if v_val < 0:
         return errors.invalid_thing(val, 'press')
     return piw.trigger(self.sysin_events.press_key(),piw.makelong_nb(v_val,0)),None