Exemplo n.º 1
0
 def execute(self, desktop):
     """
     このダイアログを実行する
     desktop: ダイアログを実行する gui.DesktopWindow
     return value: 選択されたボタンのID
     """
     with desktop.openDialog(self):
         return gui.eventLoop(self)
Exemplo n.º 2
0
 def execute(self, desktop):
     """
     このダイアログを実行する
     desktop: ダイアログを実行する gui.DesktopWindow
     return value: 選択されたボタンのID
     """
     with desktop.openDialog(self):
         return gui.eventLoop(self)
Exemplo n.º 3
0
def main():
    refresh()
    while True:
    	if gui.eventLoop(window) == None: break
	if window.getSelectedIndex() == 0:
	    if create(): refresh()
	else:
	    if operate_app(window.getSelected().getData()):
	    	refresh()
Exemplo n.º 4
0
 def execute(self, desktop, threadToWatch):
     """
     使用非推奨
     """
     self.threadToWatch = threadToWatch
     self.stopArg = None
     desktop.setDialog(self)
     result = gui.eventLoop(self)
     desktop.setDialog(None)
     return result
Exemplo n.º 5
0
def main():
    refresh()
    while True:
        set_marquee()
        if gui.eventLoop(domainList) == None: break
        if domainList.getSelectedIndex() == 0:
            if create.main(window): refresh()
        else:
            if operate.run(domainList.getSelected().getDomain()):
                refresh()
Exemplo n.º 6
0
 def execute(self, desktop, threadToWatch):
     """
     使用非推奨
     """
     self.threadToWatch = threadToWatch
     self.stopArg = None
     desktop.setDialog(self)
     result = gui.eventLoop(self)
     desktop.setDialog(None)
     return result
Exemplo n.º 7
0
def main(stackPanel):
    try:
        with dialogbox.messagebox.open(gui.res.string_catalog):
            rst = http_client.nonblockHttpGet(catalog.getURL())
    except http_client.Cancelled:
        dialogbox.messagebox.execute(string_cancelled)
        return False
    except http_client.CurlException as e:
        dialogbox.messagebox.execute(
            gui.res.string_comm_error % (e.getError(), e.getURL()), None,
            gui.res.caution_sign)
        return False

    try:
        items = catalog.parse(io.BytesIO(rst))
    except xml.etree.ElementTree.ParseError:
        dialogbox.messagebox.execute(gui.res.string_incorrect_format, None,
                                     gui.res.caution_sign)
        return False

    valist = gui.list.List(stackPanel.getSize())
    font = gui.res.font_system.getFont(20)
    valist.addItem(gui.list.TextListItem(gui.res.string_enter_code, font))
    for item in items:
        valist.addItem(
            gui.list.TextListItem(item["title"], font, None, None, item))
    stackPanel.push(valist)
    try:
        while True:
            rst = gui.eventLoop(valist)
            if rst == 0:
                va = getVirtualApplianceByCode()
            elif rst != None:
                va = valist.getSelected().getData()
                if "image" in va: va["images"] = [{"url": va["image"]}]
                if "minimum_hd" in va: va["minimum_hd"] = int(va["minimum_hd"])
                if "minimum_ram" in va:
                    va["minimum_ram"] = int(va["minimum_ram"])
            else:
                break
            if va == None: continue

            title = va["title"]
            images = va["images"] if "images" in va else None
            description = va["description"] if "description" in va else None
            tarball = va["tarball"] if "tarball" in va else None
            minimum_hd = va["minimum_hd"] if "minimum_hd" in va else None
            minimum_ram = va["minimum_ram"] if "minimum_ram" in va else None
            if showVirtualApplianceDialog(title, images, description, tarball,
                                          minimum_hd, minimum_ram):
                if download_va(va["id"], tarball, minimum_hd, minimum_ram):
                    return True
    finally:
        stackPanel.pop()
    return False
Exemplo n.º 8
0
 def execute(self, desktop):
     """
     このダイアログを実行する
     desktop: ダイアログを実行する gui.DesktopWindow
     return value: 選択されたアイテムのID
     """
     with desktop.openDialog(self):
         while True:
             result = gui.eventLoop(self.list)
             if result == None or self.options[self.list.getSelectedIndex()] != None: break
     return self.options[self.list.getSelectedIndex()] if result is not None else None
Exemplo n.º 9
0
def main():
    refresh()
    while True:
        set_marquee()
        if gui.eventLoop(domainList) == None:
            break
        if domainList.getSelectedIndex() == 0:
            if create.main(window):
                refresh()
        else:
            if operate.run(domainList.getSelected().getDomain()):
                refresh()
Exemplo n.º 10
0
def main():
    while True:
        rst = gui.eventLoop(window)
        if rst == None: break
        if rst == 0 and dialogbox.messagebox.execute(
                gui.res.string_turnoff_desc,
                dialogbox.DialogBox.OKCANCEL()) == "ok":
            poweroff()
        elif rst == 1 and dialogbox.messagebox.execute(
                gui.res.string_restart_desc,
                dialogbox.DialogBox.OKCANCEL()) == "ok":
            reboot()
Exemplo n.º 11
0
def main(stackPanel):
    try:
        with dialogbox.messagebox.open(gui.res.string_catalog):
            rst = http_client.nonblockHttpGet(catalog.getURL())
    except http_client.Cancelled:
        dialogbox.messagebox.execute(string_cancelled)
        return False
    except http_client.CurlException as e:
        dialogbox.messagebox.execute(gui.res.string_comm_error % (e.getError(), e.getURL()), None, gui.res.caution_sign)
        return False

    try:
        items = catalog.parse(io.BytesIO(rst))
    except xml.etree.ElementTree.ParseError:
        dialogbox.messagebox.execute(gui.res.string_incorrect_format, None, gui.res.caution_sign)
        return False

    valist = gui.list.List(stackPanel.getSize())
    font = gui.res.font_system.getFont(20)
    valist.addItem(gui.list.TextListItem(gui.res.string_enter_code, font))
    for item in items:
        valist.addItem(gui.list.TextListItem(item["title"], font, None, None, item))
    stackPanel.push(valist)
    try:
        while True:
            rst =  gui.eventLoop(valist)
            if rst == 0:
                va = getVirtualApplianceByCode()
            elif rst != None:
                va = valist.getSelected().getData()
                if "image" in va: va["images"] = [{"url":va["image"]}]
                if "minimum_hd" in va: va["minimum_hd"] = int(va["minimum_hd"])
                if "minimum_ram" in va: va["minimum_ram"] = int(va["minimum_ram"])
            else: break
            if va == None: continue

            title = va["title"]
            images = va["images"] if "images" in va else None
            description = va["description"] if "description" in va else None
            tarball = va["tarball"] if "tarball" in va else None
            minimum_hd = va["minimum_hd"] if "minimum_hd" in va else None
            minimum_ram = va["minimum_ram"] if "minimum_ram" in va else None
            if showVirtualApplianceDialog(title, images, description, tarball, minimum_hd, minimum_ram):
                if download_va(va["id"], tarball, minimum_hd, minimum_ram):
                    return True
    finally:
        stackPanel.pop()
    return False
Exemplo n.º 12
0
def main():
    while True:
        rst = gui.eventLoop(window)
        if rst == None: break
        if rst == 0 and dialogbox.messagebox.execute(gui.res.string_turnoff_desc, dialogbox.DialogBox.OKCANCEL()) == "ok": poweroff()
        elif rst == 1 and dialogbox.messagebox.execute(gui.res.string_restart_desc, dialogbox.DialogBox.OKCANCEL()) == "ok": reboot()
Exemplo n.º 13
0
    
    s = system.getSystem()
    mainmenu.window.addItem(mainmenu.SmallListItem(gui.res.icon_back, gui.res.string_back if s.isRunningAsGetty() else gui.res.string_end, (back,gui.res.string_back_description if s.isRunningAsGetty() else gui.res.string_back_home_)))

    mainmenu.window.addItem(mainmenu.SmallListItem(gui.res.icon_shutdown,gui.res.string_shutdown , (shutdown,gui.res.string_shutdown_description)))

    desktop.addChild("header", header.window, (0, 0), -1, CoordTransition((0, -header.window.getHeight())) )
    desktop.addChild("footer", footer.window, (0, desktop.getHeight()-footer.window.getHeight()), -1, CoordTransition((0, desktop.getHeight()) ))
    desktop.addChild("mainmenu", mainmenu.window, (0, header.window.getHeight()), 1,  CoordTransition((-mainmenu.window.getWidth(), header.window.getHeight())))

    mmeh = MainMenuEventHandler(desktop)
    mainmenu.window.setEventHandler(mmeh)
    mmeh.onChange(mainmenu.window)
    desktop.setTransition("contents", CoordTransition((desktop.getWidth(), header.window.getHeight())))

    gui.setDesktop(desktop)

    while True:
        set_marquee()
        selected = gui.eventLoop(mainmenu.window)
        if selected != None: selected = mainmenu.window.getSelected().getData()[0]
        if hasattr(selected, "main"):
            mainmenu.window.keepShowingCursor()
            selected.main()
        elif hasattr(selected, "activate") and selected.activate():
            play_sound("click")
            gui.eventLoop(SelectedEventHandler(selected))

    pygame.quit()
    exit(0)
Exemplo n.º 14
0
 def execute(self, desktop=None):
     if desktop == None: desktop = gui.getDesktop()
     with desktop.openDialog(self):
         return gui.eventLoop(self)
Exemplo n.º 15
0
def start(install_image=None):
    desktop = gui.DesktopWindow(gui.getScreen().get_size(), gui.res.background)
    gui.setDesktop(desktop)

    global header, marquee
    header = Header()
    marquee = Marquee()

    with dialogbox.messagebox.open(u"使用可能なディスクを調査中..."):
        q = multiprocessing.Queue()
        p = multiprocessing.Process(target=get_usable_disks,
                                    args=(install_image, q))
        p.start()
        while p.is_alive():
            gui.yieldFrame()
        p.join()
        rst = q.get_nowait()
        if isinstance(rst, Exception): raise rst
        disks, install_image = rst

    mainmenu = MainMenu()
    mme = MainMenuEventHandler()
    mainmenu.setEventHandler(mme)
    install.window = Install()
    tools.window = Tools()

    mainmenu_items = []

    if len(disks) > 0:
        mainmenu_items.append(
            MainMenu.ListItem(gui.res.icon_install,
                              gui.res.string_inst_inatall, install.window))
    mainmenu_items.append(
        MainMenu.ListItem(gui.res.icon_tools, gui.res.string_inst_tool,
                          tools.window))

    mainmenu.addItems(mainmenu_items)
    items_height = sum(map(lambda x: x.getHeight(), mainmenu_items))

    mainmenu.addItem(
        gui.list.Separator(332 - mainmenu.getMarginTop() - items_height))
    mainmenu.addItem(
        MainMenu.SmallListItem(gui.res.icon_shutdown,
                               gui.res.string_inst_end_))

    for disk in disks:
        install.window.addItem(
            gui.list.TextListItem(
                "%s %s(%s)" %
                (disk["vendor"], disk["model"], disk["size_str"]),
                gui.res.font_select_option, None, None,
                ("install", disk, u"%s %s(%s, %s)に Walbrixをインストールします" %
                 (disk["vendor"], disk["model"], disk["name"],
                  disk["size_str"]))))

    tools.window.addItem(
        gui.list.TextListItem(gui.res.string_inst_gui_benchmark,
                              gui.res.font_select_option, None, None,
                              ("benchmark", gui.res.string_inst_speed_desc)))
    tools.window.addItem(
        gui.list.TextListItem(gui.res.string_inst_console,
                              gui.res.font_select_option, None, None,
                              ("console", gui.res.string_linux_console_exit)))

    desktop.addChild("header", header, (0, 0), -1)
    desktop.addChild("marquee", marquee,
                     (0, gui.getScreen().get_height() - marquee.getHeight()),
                     -1)
    desktop.addChild("mainmenu", mainmenu, (0, header.getHeight()), 1)

    while True:
        mme.onChange(mainmenu)
        while gui.eventLoop(mainmenu) == None:
            pass
        selected = mainmenu.getSelected().getWindow()
        if selected == None: return False
        mainmenu.keepShowingCursor()
        while True:
            if gui.eventLoop(selected) == None: break
            action = selected.getSelected().getData()
            if action[0] == "install":
                install.run(action[1], install_image)
            elif action[0] == "benchmark":
                if not tools.benchmark_gui(): continue
            elif action[0] == "console":
                if not tools.console(): continue
Exemplo n.º 16
0
                     (0, desktop.getHeight() - footer.window.getHeight()), -1,
                     CoordTransition((0, desktop.getHeight())))
    desktop.addChild(
        "mainmenu", mainmenu.window, (0, header.window.getHeight()), 1,
        CoordTransition(
            (-mainmenu.window.getWidth(), header.window.getHeight())))

    mmeh = MainMenuEventHandler(desktop)
    mainmenu.window.setEventHandler(mmeh)
    mmeh.onChange(mainmenu.window)
    desktop.setTransition(
        "contents",
        CoordTransition((desktop.getWidth(), header.window.getHeight())))

    gui.setDesktop(desktop)

    while True:
        set_marquee()
        selected = gui.eventLoop(mainmenu.window)
        if selected != None:
            selected = mainmenu.window.getSelected().getData()[0]
        if hasattr(selected, "main"):
            mainmenu.window.keepShowingCursor()
            selected.main()
        elif hasattr(selected, "activate") and selected.activate():
            play_sound("click")
            gui.eventLoop(SelectedEventHandler(selected))

    pygame.quit()
    exit(0)
Exemplo n.º 17
0
 def execute(self, desktop = None):
     if desktop == None: desktop = gui.getDesktop()
     with desktop.openDialog(self): return gui.eventLoop(self)