示例#1
0
 def busy(self, handler):
     self.generating = True
     pbar = ProgressBar(self)
     pbar.connect("delete-event", gtk.main_quit) # NOTE: questionable...
     pbar.pulse()
     gobject.timeout_add (200,
                          self.spin_idle_func,
                          pbar)
示例#2
0
文件: goggle.py 项目: 117111302/poky
def main (server, eventHandler, params):
    gobject.threads_init()
    gtk.gdk.threads_init()

    window = MainWindow ()
    window.show_all ()
    pbar = ProgressBar(window)
    pbar.connect("delete-event", gtk.main_quit)

    # Create the object for the current build
    running_build = RunningBuild ()
    window.cur_build_tv.set_model (running_build.model)
    running_build.model.connect("row-inserted", scroll_tv_cb, window.cur_build_tv)
    running_build.connect ("build-succeeded", running_build_succeeded_cb)
    running_build.connect ("build-failed", running_build_failed_cb)

    try:
        params.updateFromServer(server)
        cmdline = params.parseActions()
        if not cmdline:
            print("Nothing to do.  Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
            return 1
        if 'msg' in cmdline and cmdline['msg']:
            logger.error(cmdline['msg'])
            return 1
        cmdline = cmdline['action']
        ret, error = server.runCommand(cmdline)
        if error:
            print("Error running command '%s': %s" % (cmdline, error))
            return 1
        elif ret != True:
            print("Error running command '%s': returned %s" % (cmdline, ret))
            return 1
    except xmlrpclib.Fault as x:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # Use a timeout function for probing the event queue to find out if we
    # have a message waiting for us.
    gobject.timeout_add (100,
                         event_handle_idle_func,
                         eventHandler,
                         running_build,
                         pbar)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    except KeyboardInterrupt:
        pass
    finally:
        server.runCommand(["stateForceShutdown"])
示例#3
0
def main(server, eventHandler, params):
    gobject.threads_init()
    gtk.gdk.threads_init()

    window = MainWindow()
    window.show_all()
    pbar = ProgressBar(window)
    pbar.connect("delete-event", gtk.main_quit)

    # Create the object for the current build
    running_build = RunningBuild()
    window.cur_build_tv.set_model(running_build.model)
    running_build.model.connect("row-inserted", scroll_tv_cb,
                                window.cur_build_tv)
    running_build.connect("build-succeeded", running_build_succeeded_cb)
    running_build.connect("build-failed", running_build_failed_cb)

    try:
        params.updateFromServer(server)
        cmdline = params.parseActions()
        if not cmdline:
            print(
                "Nothing to do.  Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information."
            )
            return 1
        if 'msg' in cmdline and cmdline['msg']:
            logger.error(cmdline['msg'])
            return 1
        cmdline = cmdline['action']
        ret, error = server.runCommand(cmdline)
        if error:
            print("Error running command '%s': %s" % (cmdline, error))
            return 1
        elif ret != True:
            print("Error running command '%s': returned %s" % (cmdline, ret))
            return 1
    except xmlrpclib.Fault as x:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # Use a timeout function for probing the event queue to find out if we
    # have a message waiting for us.
    gobject.timeout_add(100, event_handle_idle_func, eventHandler,
                        running_build, pbar)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    except KeyboardInterrupt:
        pass
    finally:
        server.runCommand(["stateForceShutdown"])
示例#4
0
def main (server, eventHandler):
    gobject.threads_init()
    gtk.gdk.threads_init()

    window = MainWindow ()
    window.show_all ()
    pbar = ProgressBar(window)
    pbar.connect("delete-event", gtk.main_quit)

    # Create the object for the current build
    running_build = RunningBuild ()
    window.cur_build_tv.set_model (running_build.model)
    running_build.model.connect("row-inserted", scroll_tv_cb, window.cur_build_tv)
    running_build.connect ("build-succeeded", running_build_succeeded_cb)
    running_build.connect ("build-failed", running_build_failed_cb)

    try:
        cmdline = server.runCommand(["getCmdLineAction"])
        if not cmdline:
            return 1
        ret = server.runCommand(cmdline)
        if ret != True:
            print("Couldn't get default commandline! %s" % ret)
            return 1
    except xmlrpclib.Fault as x:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # Use a timeout function for probing the event queue to find out if we
    # have a message waiting for us.
    gobject.timeout_add (100,
                         event_handle_idle_func,
                         eventHandler,
                         running_build,
                         pbar)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    finally:
        server.runCommand(["stateStop"])
示例#5
0
def main (server, eventHandler):
    gobject.threads_init()
    gtk.gdk.threads_init()

    taskmodel = TaskListModel()
    handler = HobHandler(taskmodel, server)
    mach = server.runCommand(["getVariable", "MACHINE"])
    distro = server.runCommand(["getVariable", "DISTRO"])

    window = MainWindow(taskmodel, handler, mach, distro)
    window.show_all ()
    handler.connect("machines-updated", window.update_machines)
    handler.connect("distros-updated", window.update_distros)
    handler.connect("generating-data", window.busy)
    handler.connect("data-generated", window.data_generated)
    pbar = ProgressBar(window)
    pbar.connect("delete-event", gtk.main_quit)

    try:
        # kick the while thing off
        handler.current_command = "findConfigFilesDistro"
        server.runCommand(["findConfigFiles", "DISTRO"])
    except xmlrpclib.Fault:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # This timeout function regularly probes the event queue to find out if we
    # have any messages waiting for us.
    gobject.timeout_add (100,
                         handler.event_handle_idle_func,
                         eventHandler,
                         window.build,
                         pbar)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    finally:
        server.runCommand(["stateStop"])
示例#6
0
def main (server, eventHandler):
    gobject.threads_init()
    gtk.gdk.threads_init()

    window = MainWindow ()
    window.show_all ()
    pbar = ProgressBar(window)

    # Create the object for the current build
    running_build = RunningBuild ()
    window.cur_build_tv.set_model (running_build.model)
    running_build.model.connect("row-inserted", scroll_tv_cb, window.cur_build_tv)
    running_build.connect ("build-succeeded", running_build_succeeded_cb)
    running_build.connect ("build-failed", running_build_failed_cb)

    try:
        cmdline = server.runCommand(["getCmdLineAction"])
        if not cmdline:
            return 1
        ret = server.runCommand(cmdline)
        if ret != True:
            print("Couldn't get default commandline! %s" % ret)
            return 1
    except xmlrpclib.Fault as x:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # Use a timeout function for probing the event queue to find out if we
    # have a message waiting for us.
    gobject.timeout_add (100,
                         event_handle_idle_func,
                         eventHandler,
                         running_build,
                         pbar)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    finally:
        server.runCommand(["stateStop"])
def main(server, eventHandler):
    try:
        cmdline = server.runCommand(["getCmdLineAction"])
        if not cmdline or cmdline[0] != "generateDotGraph":
            print("This UI is only compatible with the -g option")
            return
        ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]])
        if ret != True:
            print("Couldn't run command! %s" % ret)
            return
    except xmlrpclib.Fault as x:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return

    shutdown = 0

    gtkgui = gtkthread(shutdown)
    gtkgui.start()

    gtk.gdk.threads_enter()
    dep = DepExplorer()
    pbar = ProgressBar(dep)
    gtk.gdk.threads_leave()

    progress_total = 0
    while True:
        try:
            try:
                # We must get nonblocking here, else we'll never check the
                # quit signal
                event = eventHandler.get(False, 0.25)
            except Queue.Empty:
                pass
            
            if gtkthread.quit.isSet():
                server.runCommand(["stateStop"])
                break

            if event is None:
                continue

            if isinstance(event, bb.event.CacheLoadStarted):
                progress_total = event.total
                gtk.gdk.threads_enter()
                pbar.set_title("Loading Cache")
                pbar.update(0, progress_total)
                gtk.gdk.threads_leave()

            if isinstance(event, bb.event.CacheLoadProgress):
                x = event.current
                gtk.gdk.threads_enter()
                pbar.update(x, progress_total)
                gtk.gdk.threads_leave()
                continue

            if isinstance(event, bb.event.CacheLoadCompleted):
                gtk.gdk.threads_enter()
                pbar.update(progress_total, progress_total)
                gtk.gdk.threads_leave()
                continue

            if isinstance(event, bb.event.ParseStarted):
                progress_total = event.total
                gtk.gdk.threads_enter()
                pbar.set_title("Processing recipes")
                pbar.update(0, progress_total)
                gtk.gdk.threads_leave()

            if isinstance(event, bb.event.ParseProgress):
                x = event.current
                gtk.gdk.threads_enter()
                pbar.update(x, progress_total)
                gtk.gdk.threads_leave()
                continue

            if isinstance(event, bb.event.ParseCompleted):
                pbar.hide()
                continue

            if isinstance(event, bb.event.DepTreeGenerated):
                gtk.gdk.threads_enter()
                parse(event._depgraph, dep.pkg_model, dep.depends_model)
                gtk.gdk.threads_leave()

            if isinstance(event, bb.command.CommandCompleted):
                continue

            if isinstance(event, bb.command.CommandFailed):
                print("Command execution failed: %s" % event.error)
                return event.exitcode

            if isinstance(event, bb.command.CommandExit):
                return event.exitcode

            if isinstance(event, bb.cooker.CookerExit):
                break

            continue
        except EnvironmentError as ioerror:
            # ignore interrupted io
            if ioerror.args[0] == 4:
                pass
        except KeyboardInterrupt:
            if shutdown == 2:
                print("\nThird Keyboard Interrupt, exit.\n")
                break
            if shutdown == 1:
                print("\nSecond Keyboard Interrupt, stopping...\n")
                server.runCommand(["stateStop"])
            if shutdown == 0:
                print("\nKeyboard Interrupt, closing down...\n")
                server.runCommand(["stateShutdown"])
            shutdown = shutdown + 1
            pass
def main(server, eventHandler):
    try:
        cmdline = server.runCommand(["getCmdLineAction"])
        if cmdline and not cmdline['action']:
            print(cmdline['msg'])
            return
        elif not cmdline or (cmdline['action']
                             and cmdline['action'][0] != "generateDotGraph"):
            print("This UI is only compatible with the -g option")
            return
        ret = server.runCommand([
            "generateDepTreeEvent", cmdline['action'][1], cmdline['action'][2]
        ])
        if ret != True:
            print("Couldn't run command! %s" % ret)
            return
    except xmlrpclib.Fault as x:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return

    shutdown = 0

    gtkgui = gtkthread(shutdown)
    gtkgui.start()

    gtk.gdk.threads_enter()
    dep = DepExplorer()
    pbar = ProgressBar(dep)
    pbar.connect("delete-event", gtk.main_quit)
    gtk.gdk.threads_leave()

    progress_total = 0
    while True:
        try:
            event = eventHandler.waitEvent(0.25)
            if gtkthread.quit.isSet():
                server.runCommand(["stateStop"])
                break

            if event is None:
                continue

            if isinstance(event, bb.event.CacheLoadStarted):
                progress_total = event.total
                gtk.gdk.threads_enter()
                pbar.set_title("Loading Cache")
                pbar.update(0, progress_total)
                gtk.gdk.threads_leave()

            if isinstance(event, bb.event.CacheLoadProgress):
                x = event.current
                gtk.gdk.threads_enter()
                pbar.update(x, progress_total)
                gtk.gdk.threads_leave()
                continue

            if isinstance(event, bb.event.CacheLoadCompleted):
                pbar.hide()
                continue

            if isinstance(event, bb.event.ParseStarted):
                progress_total = event.total
                if progress_total == 0:
                    continue
                gtk.gdk.threads_enter()
                pbar.set_title("Processing recipes")
                pbar.update(0, progress_total)
                gtk.gdk.threads_leave()

            if isinstance(event, bb.event.ParseProgress):
                x = event.current
                gtk.gdk.threads_enter()
                pbar.update(x, progress_total)
                gtk.gdk.threads_leave()
                continue

            if isinstance(event, bb.event.ParseCompleted):
                pbar.hide()
                continue

            if isinstance(event, bb.event.DepTreeGenerated):
                gtk.gdk.threads_enter()
                parse(event._depgraph, dep.pkg_model, dep.depends_model)
                gtk.gdk.threads_leave()

            if isinstance(event, bb.command.CommandCompleted):
                continue

            if isinstance(event, bb.command.CommandFailed):
                print("Command execution failed: %s" % event.error)
                return event.exitcode

            if isinstance(event, bb.command.CommandExit):
                return event.exitcode

            if isinstance(event, bb.cooker.CookerExit):
                break

            continue
        except EnvironmentError as ioerror:
            # ignore interrupted io
            if ioerror.args[0] == 4:
                pass
        except KeyboardInterrupt:
            if shutdown == 2:
                print("\nThird Keyboard Interrupt, exit.\n")
                break
            if shutdown == 1:
                print("\nSecond Keyboard Interrupt, stopping...\n")
                server.runCommand(["stateStop"])
            if shutdown == 0:
                print("\nKeyboard Interrupt, closing down...\n")
                server.runCommand(["stateShutdown"])
            shutdown = shutdown + 1
            pass
示例#9
0
def main(server, eventHandler):

    try:
        cmdline = server.runCommand(["getCmdLineAction"])
        if not cmdline or cmdline[0] != "generateDotGraph":
            print("This UI is only compatible with the -g option")
            return
        ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]])
        if ret != True:
            print("Couldn't run command! %s" % ret)
            return
    except xmlrpclib.Fault as x:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return

    shutdown = 0

    gtkgui = gtkthread(shutdown)
    gtkgui.start()

    gtk.gdk.threads_enter()
    dep = DepExplorer()
    pbar = ProgressBar(dep)
    gtk.gdk.threads_leave()

    while True:
        try:
            event = eventHandler.waitEvent(0.25)
            if gtkthread.quit.isSet():
                break

            if event is None:
                continue
            if isinstance(event, bb.event.ParseProgress):
                x = event.sofar
                y = event.total
                if x == y:
                    print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors."
                        % ( event.cached, event.parsed, event.skipped, event.masked, event.errors)))
                    pbar.hide()
                    return
                gtk.gdk.threads_enter()
                pbar.update(x, y)
                gtk.gdk.threads_leave()
                continue

            if isinstance(event, bb.event.DepTreeGenerated):
                gtk.gdk.threads_enter()
                parse(event._depgraph, dep.pkg_model, dep.depends_model)
                gtk.gdk.threads_leave()

            if isinstance(event, bb.command.CookerCommandCompleted):
                continue
            if isinstance(event, bb.command.CookerCommandFailed):
                print("Command execution failed: %s" % event.error)
                break
            if isinstance(event, bb.cooker.CookerExit):
                break

            continue

        except KeyboardInterrupt:
            if shutdown == 2:
                print("\nThird Keyboard Interrupt, exit.\n")
                break
            if shutdown == 1:
                print("\nSecond Keyboard Interrupt, stopping...\n")
                server.runCommand(["stateStop"])
            if shutdown == 0:
                print("\nKeyboard Interrupt, closing down...\n")
                server.runCommand(["stateShutdown"])
            shutdown = shutdown + 1
            pass