def can_update(self, data): msgbus = int(data.strip().split('-')[0]) msgid = int(data.strip().split('-')[1]) if self.canid == msgid and self.canbus == msgbus: try: # get the value and multiply by the scale value = canparse.get_bits(data, self.sigstartbit, self.siglength)*self.scalefactor except IndexError: # no data was given return newtext = "%.1f" % value self.set_text(self.original_label + " " + newtext + " " + self.units)
def can_update(self, data): msgbus = int(data.strip().split('-')[0]) msgid = int(data.strip().split('-')[1]) if self.canid == msgid and self.canbus == msgbus: try: value = canparse.get_bits(data, self.sigbit, 1) except IndexError: return if value: self.set_cogl_texture(self.true_tex) else: self.set_cogl_texture(self.false_tex)
def can_update(self, data): msgbus = int(data.strip().split('-')[0]) msgid = int(data.strip().split('-')[1]) if self.canid == msgid and self.canbus == msgbus: try: # get the value and multiply by the scale value = canparse.get_bits(data, self.sigstartbit, self.siglength)*self.scalefactor except IndexError: # no data was given return # value is a percent, scale to angle angle = value/100*180 xcenter = self.width-(self.width*0.15) ycenter = self.height/2 self.set_rotation(clutter.Z_AXIS, angle, xcenter,ycenter,0)