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


Python runningbuild.RunningBuild类代码示例

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


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

示例1: init

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,代码行数:33,代码来源:puccho.py

示例2: main

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,代码行数:55,代码来源:goggle.py

示例3: __init__

    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
开发者ID:sanyaade-embedded-systems,项目名称:bitbake,代码行数:25,代码来源:hob.py

示例4: main

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,代码行数:45,代码来源:goggle.py

示例5: __init__

    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)
开发者ID:ack3000,项目名称:poky,代码行数:50,代码来源:hob.py

示例6: __init__

    def __init__(self, server, recipe_model, package_model):
        super(HobHandler, self).__init__()

        self.build = RunningBuild(sequential=True)

        self.recipe_model = recipe_model
        self.package_model = package_model

        self.commands_async = []
        self.generating = False
        self.current_phase = None
        self.building = False
        self.recipe_queue = []
        self.package_queue = []

        self.server = server
        self.error_msg = ""
        self.initcmd = None
开发者ID:MentorEmbedded,项目名称:bitbake,代码行数:18,代码来源:hobeventhandler.py

示例7: __init__

    def __init__(self, server, server_addr, client_addr, recipe_model, package_model):
        super(HobHandler, self).__init__()

        self.build = RunningBuild(sequential=True)

        self.recipe_model = recipe_model
        self.package_model = package_model

        self.commands_async = []
        self.generating = False
        self.current_phase = None
        self.building = False
        self.recipe_queue = []
        self.package_queue = []

        self.server = server
        self.error_msg = ""
        self.initcmd = None

        self.split_model = False
        if server_addr and client_addr:
            self.split_model = (server_addr != client_addr)
            self.reset_server() # reset server if server was found just now
        self.server_addr = server_addr
开发者ID:izzetaykutkocak,项目名称:poky-e100,代码行数:24,代码来源:hobeventhandler.py

示例8: HobHandler

class HobHandler(gobject.GObject):

    """
    This object does BitBake event handling for the hob gui.
    """
    __gsignals__ = {
         "package-formats-updated" : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "config-updated"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT,)),
         "command-succeeded"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_INT,)),
         "command-failed"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING,)),
         "sanity-failed"           : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING, gobject.TYPE_INT)),
         "generating-data"         : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "data-generated"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "parsing-started"         : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "parsing"                 : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "parsing-completed"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "recipe-populated"        : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "package-populated"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "network-passed"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "network-failed"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
    }

    (GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO, SANITY_CHECK, NETWORK_TEST) = range(7)
    (SUB_PATH_LAYERS, SUB_FILES_DISTRO, SUB_FILES_MACH, SUB_FILES_SDKMACH, SUB_MATCH_CLASS, SUB_PARSE_CONFIG, SUB_SANITY_CHECK,
     SUB_GNERATE_TGTS, SUB_GENERATE_PKGINFO, SUB_BUILD_RECIPES, SUB_BUILD_IMAGE, SUB_NETWORK_TEST) = range(12)

    def __init__(self, server, recipe_model, package_model):
        super(HobHandler, self).__init__()

        self.build = RunningBuild(sequential=True)

        self.recipe_model = recipe_model
        self.package_model = package_model

        self.commands_async = []
        self.generating = False
        self.current_phase = None
        self.building = False
        self.recipe_queue = []
        self.package_queue = []

        self.server = server
        self.error_msg = ""
        self.initcmd = None

    def set_busy(self):
        if not self.generating:
            self.emit("generating-data")
            self.generating = True

    def clear_busy(self):
        if self.generating:
            self.emit("data-generated")
            self.generating = False

    def runCommand(self, commandline):
        try:
            result, error = self.server.runCommand(commandline)
            if error:
                raise Exception("Error running command '%s': %s" % (commandline, error))
            return result
        except Exception as e:
            self.commands_async = []
            self.clear_busy()
            self.emit("command-failed", "Hob Exception - %s" % (str(e)))
            return None

    def run_next_command(self, initcmd=None):
        if initcmd != None:
            self.initcmd = initcmd

        if self.commands_async:
#.........这里部分代码省略.........
开发者ID:MentorEmbedded,项目名称:bitbake,代码行数:101,代码来源:hobeventhandler.py

示例9: HobHandler

class HobHandler(gobject.GObject):

    """
    This object does BitBake event handling for the hob gui.
    """
    __gsignals__ = {
         "layers-updated"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "package-formats-updated" : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "config-updated"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT,)),
         "command-succeeded"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_INT,)),
         "command-failed"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING,)),
         "generating-data"         : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "data-generated"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "parsing-started"         : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "parsing"                 : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "parsing-completed"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
    }

    (CFG_AVAIL_LAYERS, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDKMACH, FILES_MATCH_CLASS, PARSE_CONFIG, PARSE_BBFILES, GENERATE_TGTS, GENERATE_PACKAGEINFO, BUILD_TARGET_RECIPES, BUILD_TARGET_IMAGE, CMD_END) = range(13)
    (LAYERS_REFRESH, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5)

    def __init__(self, server, server_addr, client_addr, recipe_model, package_model):
        super(HobHandler, self).__init__()

        self.build = RunningBuild(sequential=True)

        self.recipe_model = recipe_model
        self.package_model = package_model

        self.commands_async = []
        self.generating = False
        self.current_phase = None
        self.building = False
        self.recipe_queue = []
        self.package_queue = []

        self.server = server
        self.error_msg = ""
        self.initcmd = None

        self.split_model = False
        if server_addr and client_addr:
            self.split_model = (server_addr != client_addr)
            self.reset_server() # reset server if server was found just now
        self.server_addr = server_addr

    def kick(self):
        import xmlrpclib
        try:
            # kick the while thing off
            if self.split_model:
                self.commands_async.append(self.CFG_AVAIL_LAYERS)
            else:
                self.commands_async.append(self.CFG_PATH_LAYERS)
            self.commands_async.append(self.CFG_FILES_DISTRO)
            self.commands_async.append(self.CFG_FILES_MACH)
            self.commands_async.append(self.CFG_FILES_SDKMACH)
            self.commands_async.append(self.FILES_MATCH_CLASS)
            self.run_next_command()
            return True
        except xmlrpclib.Fault as x:
            print("XMLRPC Fault getting commandline:\n %s" % x)
            return False
 
    def set_busy(self):
        if not self.generating:
            self.emit("generating-data")
            self.generating = True

    def clear_busy(self):
        if self.generating:
            self.emit("data-generated")
            self.generating = False

    def run_next_command(self, initcmd=None):
        if initcmd:
            self.initcmd = initcmd

        if self.commands_async:
            self.set_busy()
#.........这里部分代码省略.........
开发者ID:izzetaykutkocak,项目名称:poky-e100,代码行数:101,代码来源:hobeventhandler.py

示例10: MainWindow

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,代码行数:101,代码来源:hob.py

示例11: HobHandler

class HobHandler(gobject.GObject):

    """
    This object does BitBake event handling for the hob gui.
    """
    __gsignals__ = {
         "package-formats-updated" : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "config-updated"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT,)),
         "command-succeeded"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_INT,)),
         "command-failed"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING,)),
         "parsing-warning"         : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING,)),
         "sanity-failed"           : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_STRING,)),
         "generating-data"         : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "data-generated"          : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "parsing-started"         : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "parsing"                 : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "parsing-completed"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     (gobject.TYPE_PYOBJECT,)),
         "recipe-populated"        : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
         "package-populated"       : (gobject.SIGNAL_RUN_LAST,
                                      gobject.TYPE_NONE,
                                     ()),
    }

    (GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO, SANITY_CHECK) = range(6)
    (SUB_FILES_MACH, SUB_PARSE_CONFIG, SUB_SANITY_CHECK, SUB_GNERATE_TGTS, SUB_GENERATE_PKGINFO, SUB_BUILD_RECIPES, SUB_BUILD_IMAGE) = range(7)

    def __init__(self, server, recipe_model, package_model):
        super(HobHandler, self).__init__()

        self.build = RunningBuild(sequential=True)

        self.recipe_model = recipe_model
        self.package_model = package_model

        self.commands_async = []
        self.generating = False
        self.current_phase = None
        self.building = False
        self.recipe_queue = []
        self.package_queue = []

        self.server = server
        self.error_msg = ""
        self.initcmd = None
        self.parsing = False

    def set_busy(self):
        if not self.generating:
            self.emit("generating-data")
            self.generating = True

    def clear_busy(self):
        if self.generating:
            self.emit("data-generated")
            self.generating = False

    def runCommand(self, commandline):
        try:
            result, error = self.server.runCommand(commandline)
            if error:
                raise Exception("Error running command '%s': %s" % (commandline, error))
            return result
        except Exception as e:
            self.commands_async = []
            self.clear_busy()
            self.emit("command-failed", "Hob Exception - %s" % (str(e)))
            return None

    def run_next_command(self, initcmd=None):
        if initcmd != None:
            self.initcmd = initcmd

        if self.commands_async:
            self.set_busy()
            next_command = self.commands_async.pop(0)
        else:
#.........这里部分代码省略.........
开发者ID:alex1818,项目名称:yocto-iot,代码行数:101,代码来源:hobeventhandler.py

示例12: MainWindow

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,代码行数:101,代码来源:hob.py

示例13: MainWindow

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,代码行数:101,代码来源:hob.py


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