Ejemplo n.º 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
Ejemplo n.º 2
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
Ejemplo n.º 3
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
Ejemplo n.º 4
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
Ejemplo n.º 5
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
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def __fraction_create(self, ctx, subj, dummy, arg):
     v = float(action.abstract_string(arg))
     if v < 1 or v > 100:
         print 'fraction out of range'
         return async .success(errors.out_of_range('1 to 100', 'set'))
     return piw.trigger(self.__agent.model.set_stepdenominator(),
                        piw.makefloat_nb(v, 0)), None
Ejemplo n.º 8
0
 def __ocreate(self, ctx, subj, dummy, arg):
     val = float(action.abstract_string(arg))
     print 'ocreate', ctx, subj, arg, val
     if val < -72 or val > 72:
         return async .failure('offset inappropriate')
     b = piw.change2(
         self.bender.set_offset(),
         piw.slowchange_polled(
             utils.changify(self[9].get_policy().set_data), 5000))
     return piw.trigger(b, piw.makefloat_nb(val, 0)), None
Ejemplo n.º 9
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
Ejemplo n.º 10
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
Ejemplo n.º 11
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
Ejemplo n.º 12
0
 def __unplay(self,*args):
     return piw.trigger(self.model.set_playstop(),piw.makebool_nb(False,0)),None
Ejemplo n.º 13
0
 def __press_character(self, ctx, subj, dummy, val):
     v = action.abstract_string(val)
     if v.startswith('!'): v = v[1:]
     return piw.trigger(self.sysin_events.press_key(),
                        piw.makestring_nb(v, 0)), None
Ejemplo n.º 14
0
 def __press_character(self,ctx,subj,dummy,val):
     v = action.abstract_string(val)
     if v.startswith('!'): v=v[1:]
     return piw.trigger(self.sysin_events.press_key(),piw.makestring_nb(v,0)),None
Ejemplo n.º 15
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