How to use the toast.ToastMessage.strings.offset function in toast

To help you get started, we’ve selected a few toast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github klange / toaruos / userspace / py / bin / toastd.py View on Github external
def __init__(self, raw):
        self.ttl = time.time() + raw.ttl
        strings = ctypes.addressof(raw) + toast.ToastMessage.strings.offset
        self.title = ctypes.cast(strings, ctypes.c_char_p).value
        self.content = ctypes.cast(strings+1+len(self.title), ctypes.c_char_p).value
        flags = yutani.WindowFlag.FLAG_NO_STEAL_FOCUS | yutani.WindowFlag.FLAG_DISALLOW_DRAG | yutani.WindowFlag.FLAG_DISALLOW_RESIZE
        super(Notification, self).__init__(self.base_width, self.base_height, flags=flags, doublebuffer=True)
        self.update_location(len(notifications) * (self.base_height + 8))

        self.title_tr = text_region.TextRegion(10,10,self.width-20,15,font=title_font)
        self.title_tr.set_text(self.title.decode('utf-8'))

        self.content_tr = text_region.TextRegion(10,30,self.width-20,self.height-40-5,font=content_font)
        self.content_tr.set_line_height(16)
        self.content_tr.set_richtext(self.content.decode('utf-8'))
        self.draw()