Beispiel #1
0
    def popup_created(self, popup):
        super().popup_created(popup)

        box = Box(popup)
        popup.part_swallow("main.swallow", box)
        box.show()

        en = Entry(popup, single_line=True, editable=False)
        en.text_style_user_push("DEFAULT='font_weight=Bold'")
        box.pack_end(en)
        en.show()
        popup.data["head"] = en

        li = Genlist(
            popup,
            homogeneous=True,
            mode=ELM_LIST_COMPRESS,
            select_mode=ELM_OBJECT_SELECT_MODE_NONE,
            size_hint_expand=EXPAND_BOTH,
            size_hint_fill=FILL_BOTH,
        )
        box.pack_end(li)
        li.show()
        popup.data["list"] = li

        self.popups_poller_cb()
        if self.popups_poller is None:
            self.popups_poller = ecore.Poller(16, self.popups_poller_cb)
Beispiel #2
0
    def popup_created(self, popup):
        super().popup_created(popup)

        box = Box(popup)
        popup.part_swallow('main.swallow', box)
        box.show()

        # mem
        tot = self.format_mb(psutil.virtual_memory().total)
        fr = Frame(popup, text='Memory Usage (available {})'.format(tot),
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        box.pack_end(fr)
        fr.show()

        box2 = Box(popup, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        fr.content = box2
        box2.show()

        pb1 = Progressbar(popup, text='Total used',
                          span_size=200, size_hint_align=(1.0, 0.5))
        box2.pack_end(pb1)
        pb1.show()

        pb2 = Progressbar(popup, text='active',
                          span_size=200, size_hint_align=(1.0, 0.5))
        box2.pack_end(pb2)
        pb2.show()

        pb3 = Progressbar(popup, text='buffers',
                          span_size=200, size_hint_align=(1.0, 0.5))
        box2.pack_end(pb3)
        pb3.show()

        pb4 = Progressbar(popup, text='cached',
                          span_size=200, size_hint_align=(1.0, 0.5))
        box2.pack_end(pb4)
        pb4.show()

        # swap
        tot = self.format_mb(psutil.swap_memory().total)
        fr = Frame(popup, text='Swap Usage (available {})'.format(tot),
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        box.pack_end(fr)
        fr.show()

        pb5 = Progressbar(popup)
        fr.content = pb5
        pb5.show()

        # force the popup to always recalculate it's size
        popup.update_hints = True

        # force the poller to update the popup now
        popup.data['usd_pb'] = pb1
        popup.data['act_pb'] = pb2
        popup.data['buf_pb'] = pb3
        popup.data['cac_pb'] = pb4
        popup.data['swp_pb'] = pb5
        self.poller_cb(force=True)