当前位置: 首页>>代码示例>>Python>>正文


Python RunningBuild.connect方法代码示例

本文整理汇总了Python中bb.ui.crumbs.runningbuild.RunningBuild.connect方法的典型用法代码示例。如果您正苦于以下问题:Python RunningBuild.connect方法的具体用法?Python RunningBuild.connect怎么用?Python RunningBuild.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bb.ui.crumbs.runningbuild.RunningBuild的用法示例。


在下文中一共展示了RunningBuild.connect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: from bb.ui.crumbs.runningbuild import RunningBuild [as 别名]
# 或者: from bb.ui.crumbs.runningbuild.RunningBuild import connect [as 别名]
def init (server, eventHandler):
    # Initialise threading...
    gobject.threads_init()
    gtk.gdk.threads_init()

    main_window = MainWindow ()
    main_window.show_all ()

    # Set up the build manager stuff in general
    builds_dir = os.path.join (os.getcwd(),  "results")
    manager = BuildManager (server, builds_dir)
    main_window.build_manager_view.set_model (manager.model)

    # Do the running build setup
    running_build = RunningBuild ()
    main_window.running_build_view.set_model (running_build.model)
    running_build.connect ("build-succeeded", running_build_succeeded_cb,
        manager)
    running_build.connect ("build-failed", running_build_failed_cb, manager)

    # We need to save the manager into the MainWindow so that the toolbar
    # button can use it.
    # FIXME: Refactor ?
    main_window.manager = manager

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

    gtk.main()
开发者ID:SamyGO,项目名称:oe-b-series,代码行数:35,代码来源:puccho.py

示例2: main

# 需要导入模块: from bb.ui.crumbs.runningbuild import RunningBuild [as 别名]
# 或者: from bb.ui.crumbs.runningbuild.RunningBuild import connect [as 别名]
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"])
开发者ID:117111302,项目名称:poky,代码行数:57,代码来源:goggle.py

示例3: main

# 需要导入模块: from bb.ui.crumbs.runningbuild import RunningBuild [as 别名]
# 或者: from bb.ui.crumbs.runningbuild.RunningBuild import connect [as 别名]
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
    except KeyboardInterrupt:
        pass
    finally:
        server.runCommand(["stateStop"])
开发者ID:sanyaade-embedded-systems,项目名称:bitbake,代码行数:47,代码来源:goggle.py

示例4: MainWindow

# 需要导入模块: from bb.ui.crumbs.runningbuild import RunningBuild [as 别名]
# 或者: from bb.ui.crumbs.runningbuild.RunningBuild import connect [as 别名]
class MainWindow (gtk.Window):
            
    def __init__(self, taskmodel, handler, configurator, prefs, layers, mach):
        gtk.Window.__init__(self)
        # global state
        self.curr_mach = mach
        self.machine_handler_id = None
        self.image_combo_id = None
        self.generating = False
        self.files_to_clean = []
        self.selected_image = None
        self.selected_packages = None

        self.model = taskmodel
        self.model.connect("tasklist-populated", self.update_model)
        self.model.connect("image-changed", self.image_changed_string_cb)
        self.handler = handler
        self.configurator = configurator
        self.prefs = prefs
        self.layers = layers
        self.save_path = None
        self.dirty = False

        self.connect("delete-event", self.destroy_window)
        self.set_title("Image Creator")
        self.set_icon_name("applications-development")
        self.set_default_size(1000, 650)

        self.build = RunningBuild()
        self.build.connect("build-failed", self.running_build_failed_cb)
        self.build.connect("build-complete", self.handler.build_complete_cb)
        self.build.connect("build-started", self.build_started_cb)

        self.handler.connect("build-complete", self.build_complete_cb)

        vbox = gtk.VBox(False, 0)
        vbox.set_border_width(0)
        vbox.show()
        self.add(vbox)
        self.menu = self.create_menu()
        vbox.pack_start(self.menu, False)
        createview = self.create_build_gui()
        self.back = None
        self.cancel = None
        buildview = self.view_build_gui()
        self.nb = gtk.Notebook()
        self.nb.append_page(createview)
        self.nb.append_page(buildview)
        self.nb.set_current_page(0)
        self.nb.set_show_tabs(False)
        vbox.pack_start(self.nb, expand=True, fill=True)

    def destroy_window(self, widget, event):
        self.quit()

    def menu_quit(self, action):
        self.quit()

    def quit(self):
        if self.dirty and len(self.model.contents):
            question = "Would you like to save your customisations?"
            dialog = CrumbsDialog(self, question, gtk.STOCK_DIALOG_WARNING)
            dialog.add_buttons(gtk.STOCK_NO, gtk.RESPONSE_NO,
                               gtk.STOCK_YES, gtk.RESPONSE_YES)
            resp = dialog.run()
            dialog.destroy()
            if resp == gtk.RESPONSE_YES:
                if not self.save_path:
                    self.get_save_path()

                if self.save_path:
                    self.save_recipe_file()
                    rep = self.model.get_build_rep()
                    rep.writeRecipe(self.save_path, self.model)

        gtk.main_quit()

    def scroll_tv_cb(self, model, path, it, view):
        view.scroll_to_cell(path)

    def running_build_failed_cb(self, running_build):
        # FIXME: handle this
        print("Build failed")

    def image_changed_string_cb(self, model, new_image):
        cnt = 0
        it = self.model.images.get_iter_first()
        while it:
            path = self.model.images.get_path(it)
            if self.model.images[path][self.model.COL_NAME] == new_image:
                self.image_combo.set_active(cnt)
                break
            it = self.model.images.iter_next(it)
            cnt = cnt + 1

    def image_changed_cb(self, combo):
        model = self.image_combo.get_model()
        it = self.image_combo.get_active_iter()
        if it:
            path = model.get_path(it)
#.........这里部分代码省略.........
开发者ID:opencalc,项目名称:poky,代码行数:103,代码来源:hob.py

示例5: MainWindow

# 需要导入模块: from bb.ui.crumbs.runningbuild import RunningBuild [as 别名]
# 或者: from bb.ui.crumbs.runningbuild.RunningBuild import connect [as 别名]
class MainWindow (gtk.Window):
            
    def __init__(self, taskmodel, handler, curr_mach=None, curr_distro=None):
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.model = taskmodel
	self.model.connect("tasklist-populated", self.update_model)
	self.curr_mach = curr_mach
	self.curr_distro = curr_distro
        self.handler = handler
        self.set_border_width(10)
        self.connect("delete-event", gtk.main_quit)
        self.set_title("BitBake Image Creator")
        self.set_default_size(700, 600)

        self.build = RunningBuild()
        self.build.connect("build-succeeded", self.running_build_succeeded_cb)
        self.build.connect("build-failed", self.running_build_failed_cb)

	createview = self.create_build_gui()
        buildview = self.view_build_gui()
	self.nb = gtk.Notebook()
	self.nb.append_page(createview)
	self.nb.append_page(buildview)
	self.nb.set_current_page(0)
	self.nb.set_show_tabs(False)
        self.add(self.nb)
        self.generating = False

    def scroll_tv_cb(self, model, path, it, view):
        view.scroll_to_cell(path)

    def running_build_failed_cb(self, running_build):
        # FIXME: handle this
        return

    def running_build_succeeded_cb(self, running_build):
        label = gtk.Label("Build completed, start another build?")
        dialog = gtk.Dialog("Build complete",
                            self,
                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_NO, gtk.RESPONSE_NO,
                             gtk.STOCK_YES, gtk.RESPONSE_YES))
        dialog.vbox.pack_start(label)
        label.show()
        response = dialog.run()
        dialog.destroy()
        if not response == gtk.RESPONSE_YES:
            self.model.reset() # NOTE: really?
            self.nb.set_current_page(0)
        return

    def machine_combo_changed_cb(self, combo, handler):
        mach = combo.get_active_text()
	if mach != self.curr_mach:
	    self.curr_mach = mach
            handler.set_machine(mach)

    def update_machines(self, handler, machines):
	active = 0
	for machine in machines:
	    self.machine_combo.append_text(machine)
	    if machine == self.curr_mach:
                self.machine_combo.set_active(active)
	    active = active + 1
	self.machine_combo.connect("changed", self.machine_combo_changed_cb, handler)

    def update_distros(self, handler, distros):
        # FIXME: when we add UI for changing distro this will be used
        return

    def data_generated(self, handler):
        self.generating = False

    def spin_idle_func(self, pbar):
        if self.generating:
            pbar.pulse()
            return True
        else:
            pbar.hide()
            return False

    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)

    def update_model(self, model):
	pkgsaz_model = gtk.TreeModelSort(self.model.packages_model())
        pkgsaz_model.set_sort_column_id(self.model.COL_NAME, gtk.SORT_ASCENDING)
        self.pkgsaz_tree.set_model(pkgsaz_model)

        # FIXME: need to implement a custom sort function, as otherwise the column
        # is re-ordered when toggling the inclusion state (COL_INC)
	pkgsgrp_model = gtk.TreeModelSort(self.model.packages_model())
	pkgsgrp_model.set_sort_column_id(self.model.COL_GROUP, gtk.SORT_ASCENDING)
	self.pkgsgrp_tree.set_model(pkgsgrp_model)
#.........这里部分代码省略.........
开发者ID:sanyaade-embedded-systems,项目名称:bitbake,代码行数:103,代码来源:hob.py

示例6: MainWindow

# 需要导入模块: from bb.ui.crumbs.runningbuild import RunningBuild [as 别名]
# 或者: from bb.ui.crumbs.runningbuild.RunningBuild import connect [as 别名]
class MainWindow(gtk.Window):
    def __init__(self, taskmodel, handler, configurator, prefs, layers, mach):
        gtk.Window.__init__(self)
        # global state
        self.curr_mach = mach
        self.machine_handler_id = None
        self.image_combo_id = None
        self.generating = False
        self.files_to_clean = []
        self.selected_image = None
        self.selected_packages = None
        self.stopping = False

        self.model = taskmodel
        self.model.connect("tasklist-populated", self.update_model)
        self.model.connect("image-changed", self.image_changed_string_cb)
        self.handler = handler
        self.configurator = configurator
        self.prefs = prefs
        self.layers = layers
        self.save_path = None
        self.dirty = False
        self.build_succeeded = False

        self.connect("delete-event", self.destroy_window)
        self.set_title("Image Creator")
        self.set_icon_name("applications-development")
        self.set_default_size(1000, 650)

        self.build = RunningBuild(sequential=True)
        self.build.connect("build-failed", self.running_build_failed_cb)
        self.build.connect("build-succeeded", self.running_build_succeeded_cb)
        self.build.connect("build-started", self.build_started_cb)
        self.build.connect("build-complete", self.build_complete_cb)

        vbox = gtk.VBox(False, 0)
        vbox.set_border_width(0)
        vbox.show()
        self.add(vbox)
        self.menu = self.create_menu()
        vbox.pack_start(self.menu, False)
        createview = self.create_build_gui()
        self.back = None
        self.cancel = None
        buildview = self.view_build_gui()
        self.nb = gtk.Notebook()
        self.nb.append_page(createview)
        self.nb.append_page(buildview)
        self.nb.set_current_page(0)
        self.nb.set_show_tabs(False)
        vbox.pack_start(self.nb, expand=True, fill=True)

    def destroy_window(self, widget, event):
        self.quit()

    def menu_quit(self, action):
        self.quit()

    def quit(self):
        if self.dirty and len(self.model.contents):
            question = "Would you like to save your customisations?"
            dialog = CrumbsDialog(self, question, gtk.STOCK_DIALOG_WARNING)
            dialog.add_buttons(gtk.STOCK_NO, gtk.RESPONSE_NO, gtk.STOCK_YES, gtk.RESPONSE_YES)
            resp = dialog.run()
            dialog.destroy()
            if resp == gtk.RESPONSE_YES:
                if not self.save_path:
                    self.get_save_path()

                if self.save_path:
                    self.save_recipe_file()
                    rep = self.model.get_build_rep()
                    rep.writeRecipe(self.save_path, self.model)

        # Prevent the busy cursor being shown after hob exits if quit is called
        # whilst the busy cursor is set
        self.set_busy_cursor(False)

        self.handler.remove_temp_dir()

        gtk.main_quit()

    """
    In the case of a fatal error give the user as much information as possible
    and then exit.
    """

    def fatal_error_cb(self, handler, errormsg, phase):
        lbl = "<b>Error!</b>\nThere was an unrecoverable error during the"
        lbl = lbl + " <i>%s</i> phase of BitBake. This must be" % phase
        lbl = lbl + " rectified before the GUI will function. The error"
        lbl = lbl + ' message which which caused this is:\n\n"%s"' % errormsg
        dialog = CrumbsDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
        dialog.add_button("Exit", gtk.RESPONSE_OK)
        response = dialog.run()
        dialog.destroy()
        self.set_busy_cursor(False)
        gtk.main_quit()

    def scroll_tv_cb(self, model, path, it, view):
#.........这里部分代码省略.........
开发者ID:djewargi,项目名称:poky-debian,代码行数:103,代码来源:hob.py


注:本文中的bb.ui.crumbs.runningbuild.RunningBuild.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。