Exemplo n.º 1
0
                # Do unfocus stuff here
            else:
                changed = False

            if changed or redraw:
                self.draw()

    def keyboard_event(self, msg):
        if msg.event.action == yutani.KeyAction.ACTION_DOWN:
            if not self.input.is_focused:
                self.input.focus_enter()
            self.input.keyboard_event(msg)
            # Do keyboard stuff here


if __name__ == '__main__':
    yutani.Yutani()
    d = yutani.Decor()

    title = "Input Box" if len(sys.argv) < 2 else sys.argv[1]
    icon = "default" if len(sys.argv) < 3 else sys.argv[2]

    def print_text(text_box):
        print(text_box.text())
        sys.exit(0)

    window = TextInputWindow(d, title, icon, callback=print_text)
    window.draw()

    yutani_mainloop.mainloop()
Exemplo n.º 2
0
    with open('/proc/netif','r') as f:
        lines = f.readlines()
        if len(lines) < 4 or "no network" in lines[0]:
            print("No network available, can't check for updates.")
            sys.exit(1)

    # Check for updates...
    try:
        current = list(map(int,version().split(".")))
        latest_str = subprocess.check_output(['fetch','http://toaruos.org/latest']).decode('utf-8').strip()
        latest = list(map(int,latest_str.split(".")))
    except:
        print("Unable to parse latest version.")
        sys.exit(1)

    if compare_version(latest,current):
        yutani.Yutani()
        d = yutani.Decor()
        def derp():
            sys.exit(0)
        def updates():
            subprocess.Popen(['help-browser.py','http://toaruos.org/update.trt'])
            sys.exit(0)

        DialogWindow(d,"Update Available",f"A new release of ToaruOS (v{latest_str}) is available.\nPlease visit <link target=\"#\">https://github.com/klange/toaruos</link> to upgrade.",callback=derp,cancel_callback=updates,icon='star',cancel_label="What's New?",close_is_cancel=False)

        yutani_mainloop.mainloop()