示例#1
0
文件: __init__.py 项目: kervi/kervi
 def __init__(self, name, **kwargs):
     KerviValue.__init__(self, name, "string-value", **kwargs)
     #self.spine = Spine()
     self._value = ""
     self._default_value = ""
     self._ui_parameters["type"] = "text"
     self._ui_parameters["input_size"] = "5rem"
示例#2
0
文件: __init__.py 项目: kervi/kervi
 def __init__(self, name, **kwargs):
     KerviValue.__init__(self, name, "color-value", **kwargs)
     self._value = (255, 255, 255)
     self._default_value = (255, 255, 255)
     self._type = None
     self._ui_parameters["type"] = "button"
     self._ui_parameters["button_icon"] = None
     self._ui_parameters["button_text"] = self.name,
     self._ui_parameters["button_width"] = None
     self._ui_parameters["button_height"] = None,
     self._ui_parameters["input_size"] = 0
示例#3
0
文件: __init__.py 项目: kervi/kervi
 def __init__(self, name, **kwargs):
     KerviValue.__init__(self, name, "boolean-value", **kwargs)
     self._value = False
     self._default_value = False
     self._ui_parameters["type"] = "switch"
     self._ui_parameters["on_text"] = "On"
     self._ui_parameters["off_text"] = "Off"
     self._ui_parameters["on_icon"] = None
     self._ui_parameters["off_icon"] = None
     self._ui_parameters["button_icon"] = None
     self._ui_parameters["button_text"] = self.name,
     self._ui_parameters["button_width"] = None
     self._ui_parameters["button_height"] = None,
     self._ui_parameters["input_size"] = 0
示例#4
0
文件: __init__.py 项目: kervi/kervi
 def _set_value(self, new_value):
     if isinstance(new_value, str) and new_value[0]=="#":
         #self._set_value(new_value)
         KerviValue._set_value(self, new_value)
     elif isinstance(new_value, list) and len(new_value)==3:
         value = '#%02x%02x%02x' % (new_value[0], new_value[1], new_value[2])
         KerviValue._set_value(self, value)
         #self._set_value(value)
     elif isinstance(new_value, tuple) and len(new_value):
         value = '#%02x%02x%02x' % new_value
         KerviValue._set_value(self, value)
     else:
         raise ValueError("invalid color value:" + str(new_value))
示例#5
0
文件: __init__.py 项目: kervi/kervi
 def __init__(self, name, **kwargs):
     KerviValue.__init__(self, name, "enum-value", **kwargs)
     self._value = []
     self.options = []
     self.selected_options = []
     self._ui_parameters["type"] = "dropdown"
示例#6
0
文件: __init__.py 项目: kervi/kervi
 def __init__(self, name, input_type="datetime", **kwargs):
     KerviValue.__init__(self, name, "datetime-value", **kwargs)
     #self.spine = Spine()
     self._value = ""
     self._default_value = ""
     self._ui_parameters["type"] = input_type
示例#7
0
文件: __init__.py 项目: kervi/kervi
    def __init__(self, name, **kwargs):
        self._q_unit = None
        self._q_display = None
        self._min_value = -100
        self._max_value = 100
        
        try:
            from pint import UnitRegistry
            self._ureg = UnitRegistry()
            self._ureg.autoconvert_offset_to_baseunit = True
            self._Q = self._ureg.Quantity
        except ImportError:
            self._Q = None

        KerviValue.__init__(self, name, "number-value", **kwargs)
        #self.spine = Spine()
        

        self._type = None
        #self._display_unit = None
        self._value = 0
        self._default_value = 0
        self._delta = None
        self._ui_parameters["type"] = ""
        self._ui_parameters["value_icon"] = None
        self._ui_parameters["min_integer_digits"] = 1
        self._ui_parameters["min_fraction_digits"] = 1
        self._ui_parameters["max_fraction_digits"] = 1
        self._ui_parameters["show_sparkline"] = False
        self._ui_parameters["show_value"] = True
        self._ui_parameters["pad_auto_center"] = False
        self._ui_parameters["chart_buttons"] = True
        self._ui_parameters["chart_grid"] = True
        self._ui_parameters["chart_x_axis"] = True
        self._ui_parameters["chart_y_axis"] = True
        self._ui_parameters["chart_title"] = self.name
        self._ui_parameters["chart_interval"] = "5min"
        #self._ui_parameters["chart_fill"] = True
        self._ui_parameters["chart_point"] = 0
        self._ui_parameters["chart_type"] = "area"
        self._ui_parameters["gauge_size"] = 250
        if Configuration:
            unit_system = Configuration.unit_system
            chart_time_format = Configuration.display.unit_systems.systems[unit_system].datetime.chart
            self._ui_parameters["chart_time_format"] = chart_time_format
        else:
            self._ui_parameters["chart_time_format"] = {
                "millisecond": "h:mm:ss.SSS",
                "second": "h:mm:ss",
                "minute": "h:mm",
                "hour":   "h",
                "day":    "MMM D",
                "week":   "ll",
                "month":  "MMM YYYY",
                "quarter":"[Q]Q - YYYY",
                "year":   "YYYY",
            }

        self._ui_parameters["tick"] = 1.0
        self._ui_parameters["display_unit"] = True

        self._last_reading = None