Example #1
0
    def __init__(self, display, page, label, value, items=None):

        """
        :type items: list
        """
        if not items:
            items = []

        super(SpinnerBox, self).__init__(display, page)
        self.label = label
        self.value = value
        self.label_block = TextBlock(display, page, label)
        self.value_block = TextBlock(display, page, value)
        self.panel = StackPanel(display, page, is_horizontal=True)
        self.panel.children = [self.label_block, self.value_block]
        self.items = items
Example #2
0
 def get_label(self, text):
     """
     Builds a label with the specified text. This is a conveinence method since labels are extremely common
     :param text: The text for the label
     :return: The TextBlock
     """
     return TextBlock(self.display, self, text)
Example #3
0
    def __init__(self,
                 display,
                 page,
                 title,
                 weather=None,
                 forecast=None,
                 is_forecast=True):
        super(WeatherForecastDashboardWidget,
              self).__init__(display, page, DashboardStatus.Inactive)

        self.title = title
        self.forecast = forecast
        self.weather = weather
        self.is_forecast = is_forecast
        self.minutes_to_clean_frost = None

        self.panel = StackPanel(display, page)

        self.lbl_title = TextBlock(display, page, title, is_highlighted=True)
        self.lbl_title.font = display.fonts.list
        self.panel.children.append(self.lbl_title)

        pnl_value = StackPanel(display, page, is_horizontal=True)
        pnl_value.center_align = True

        self.lbl_condition = TextBlock(display, page, "{}")
        self.lbl_condition.font = display.fonts.weather

        self.lbl_value = TextBlock(display, page, "Offline")
        self.lbl_value.font = display.fonts.list

        pnl_value.children = [self.lbl_value, self.lbl_condition]

        self.panel.children.append(pnl_value)

        self.chart = BoxChart(display, page)
        self.chart.width = 150
        self.chart.range_low = -20
        self.chart.range_high = 120
        self.chart.is_highlighted = False
        self.chart.box_width = 0
        self.chart.ticks = (0, 32, 100)
        self.panel.children.append(self.chart)

        self.lbl_frost = TextBlock(display, page, None)
        self.lbl_frost.font = display.fonts.list
        self.panel.children.append(self.lbl_frost)
Example #4
0
    def __init__(self, display, page, title, value, status=DashboardStatus.Passive):
        super(TextDashboardWidget, self).__init__(display, page, status)

        self.title = title
        self.value = value
        self.width = 150
        self.value_font = display.fonts.list

        self.panel = StackPanel(display, page)

        self.lbl_title = TextBlock(display, page, title, is_highlighted=True)
        self.lbl_title.font = display.fonts.list
        self.panel.children.append(self.lbl_title)

        self.lbl_value = TextBlock(display, page, value)
        self.lbl_value.font = display.fonts.list
        self.panel.children.append(self.lbl_value)
Example #5
0
    def __init__(self, display, page, text):

        """
        :type text: str
        """
        self.text = text
        self.font = display.fonts.normal
        self.label = TextBlock(display, page, text)
        super(TextMenuItem, self).__init__(display, page, content=self.label)
Example #6
0
    def __init__(self, display, page, label):
        super(CheckBox, self).__init__(display, page)

        self.text = label
        self.label = TextBlock(display, page, label)
        self.glyph = CheckBoxGlyph(display, page)

        self.panel = StackPanel(display, page, is_horizontal=True)
        self.panel.center_align = True
        self.panel.children = [self.label, self.glyph]
Example #7
0
    def __init__(self, display, page, label=None, text=None, text_width=100):
        super(TextBox, self).__init__(display, page)

        if text:
            text = str(text)
            
        self.text = text
        self.label_text = label
        self.label = TextBlock(display, page, label)
        self.glyph = TextGlyph(display, page)
        self.text_width = text_width

        self.panel = StackPanel(display, page, is_horizontal=True)
        self.panel.center_align = True
        self.panel.children = [self.label, self.glyph]
Example #8
0
    def __init__(self, display, page, title, value=0, range_low=0, range_high=100, status=DashboardStatus.Passive):
        super(BarChartDashboardWidget, self).__init__(display, page, status)

        self.width = 150

        self.title = title
        self.value = value

        self.panel = StackPanel(display, page)

        self.lbl_title = TextBlock(display, page, title, is_highlighted=True)
        self.lbl_title.font = display.fonts.list
        self.panel.children.append(self.lbl_title)

        self.chart = BarChart(display, page, value=value, range_low=range_low, range_high=range_high)
        self.chart.width = self.width
        self.chart.height = 15
        self.panel.children.append(self.chart)
Example #9
0
    def __init__(self,
                 display,
                 page,
                 title="CPU",
                 values=None,
                 status=DashboardStatus.Passive):
        super(CpuDashboardWidget, self).__init__(display, page, status)

        self.title = title
        self.values = values

        self.panel = StackPanel(display, page)

        self.lbl_title = TextBlock(display, page, title, is_highlighted=True)
        self.lbl_title.font = display.fonts.list
        self.panel.children.append(self.lbl_title)

        self.pnl_charts = StackPanel(display, page, is_horizontal=True)
        self.pnl_charts.padding = 2, 0
        self.panel.children.append(self.pnl_charts)