示例#1
0
 def _make_text(self):
     """Render the label and live value."""
     if self.label:
         DynamicFancyText.add(self, self.label_fmt.format(self.label),
                              colors.rgb_from_name(self.label_color))
     val = self.value() if callable(self.value) else self.value  # pylint: disable=not-callable
     text = self.val_fmt.format(val)
     self.last_val = val
     DynamicFancyText.add(self, text,
                          colors.rgb_from_name(self.value_color))
示例#2
0
 def _make_text(self):
     """Make elements of a duration with label and text."""
     DynamicFancyText.add(self, self.label_fmt.format(self.label),
                          colors.rgb_from_name(self.label_color))
     val = self.value() if callable(self.value) else self.value  # pylint: disable=not-callable
     if val is None:
         color = colors.interpolate_color(self.low_val, self.low_val,
                                          self.high_val, self.cmap)
         text = 'N/A'
     else:
         color = colors.interpolate_color(val, self.low_val, self.high_val,
                                          self.cmap)
         text = self.val_fmt.format(val)
     self.last_val = val
     DynamicFancyText.add(self, text, color)