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
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
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
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
def __ochange(self, v): fc = piw.fastchange(self.bender.set_offset()) fc(piw.makefloat_nb(v, 0)) return True
def __doubletap_change(self,v): fc = piw.fastchange(self.__agent.view.set_doubletap()) fc(piw.makefloat_nb(v,0)) return True
def __fraction_change(self,v): fc = piw.fastchange(self.__agent.model.set_stepdenominator()) fc(piw.makefloat_nb(v,0)) return True
def __step_change(self,v): fc = piw.fastchange(self.__agent.model.set_stepnumerator()) fc(piw.makefloat_nb(v,0)) return True
def __encode(self,str): r,c,e = self.__split(str) t = (c<<32)|r return piw.makefloat_nb(e,t)