예제 #1
0
    def _make_service_row(self, svc: ConnmanService) -> urwid.Widget:
        waiting = self._svc_waits.setdefault(svc.path, widget.Waiting(4))
        strength_wdg = StrengthBar(svc.strength, align=urwid.RIGHT)

        cols = urwid.Columns(
            [
                ("fixed", 6, strength_wdg),
                ("fixed", 1, urwid.Text("*" if svc.favorite else " ")),
                ("weight", 3, urwid.Text(svc.name)),
                ("fixed", 4, waiting),
                ("weight", 1, urwid.Text(svc.state.value)),
            ],
            dividechars=1,
        )
        item = widget.SelectableItem(cols)
        urwid.connect_signal(
            item, "click", self._handle_service_clicked, user_args=[svc]
        )
        return urwid.AttrMap(
            item,
            {},
            {
                "progress": "li focus",
                "str good": "li focus",
                "str weak": "li focus",
                "str average": "li focus",
            },
        )
예제 #2
0
    def _make_service_row(self, svc: ConnmanService) -> urwid.Widget:
        waiting = self._svc_waits.setdefault(svc.path, widget.Waiting(4))

        cols = urwid.Columns([
            ("fixed", 2, urwid.Text("*" if svc.favorite else " ")),
            ("weight", 3, urwid.Text(svc.name)),
            ("fixed", 4, waiting),
            ("weight", 1, urwid.Text(str(svc.strength))),
            ("weight", 1, urwid.Text(str(svc.state))),
            # ("weight", 1, urwid.Text(svc.type)),
        ])
        item = widget.SelectableItem(cols)
        urwid.connect_signal(item,
                             "click",
                             self._handle_service_clicked,
                             user_args=[svc])
        return urwid.AttrMap(item, {}, {"progress": "li focus"})
예제 #3
0
 def _make_scan_button(self) -> urwid.Widget:
     btn = widget.PlainButton("Scan")
     urwid.connect_signal(btn, "click", self._handle_scan)
     self.scan_waiting = widget.Waiting(6)
     return urwid.Columns([(8, btn), ("pack", self.scan_waiting)], dividechars=1)