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


Python HobButton.grab_default方法代码示例

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


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

示例1: PackageSelectionPage

# 需要导入模块: from bb.ui.crumbs.hobwidget import HobButton [as 别名]
# 或者: from bb.ui.crumbs.hobwidget.HobButton import grab_default [as 别名]

#.........这里部分代码省略.........
        # set visiable members
        self.ins = HobNotebook()
        self.tables = [] # we need to modify table when the dialog is shown
        # append the tab
        for page in self.pages:
            columns = page['columns']
            tab = HobViewTable(columns)
            filter = page['filter']
            tab.set_model(self.package_model.tree_model(filter))
            tab.connect("toggled", self.table_toggled_cb, page['name'])
            tab.connect_group_selection(self.table_selected_cb)
            if page['name'] == "Included":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            label = gtk.Label(page['name'])
            self.ins.append_page(tab, label)
            self.tables.append(tab)

        self.ins.set_entry("Search packages:")
        # set the search entry for each table
        for tab in self.tables:
            tab.set_search_entry(0, self.ins.search)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(button_box, expand=False, fill=False)

        self.build_image_button = HobButton('Build image')
        self.build_image_button.set_size_request(205, 49)
        self.build_image_button.set_tooltip_text("Build target image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        button_box.pack_end(self.build_image_button, expand=False, fill=False)

        self.back_button = HobAltButton("<< Back to image configuration")
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        button_box.pack_start(self.back_button, expand=False, fill=False)

    def button_click_cb(self, widget, event):
        path, col = widget.table_tree.get_cursor()
        tree_model = widget.table_tree.get_model()
        if path: # else activation is likely a removal
            binb = tree_model.get_value(tree_model.get_iter(path), PackageListModel.COL_BINB)
            if binb:
                self.builder.show_binb_dialog(binb)

    def build_image_clicked_cb(self, button):
        self.builder.build_image()

    def back_button_clicked_cb(self, button):
        self.builder.show_configuration()

    def _expand_all(self):
        for tab in self.tables:
            tab.table_tree.expand_all()

    def refresh_selection(self):
        self._expand_all()

        self.builder.configuration.selected_packages = self.package_model.get_selected_packages()
        self.builder.configuration.user_selected_packages = self.package_model.get_user_selected_packages()
        selected_packages_num = len(self.builder.configuration.selected_packages)
        selected_packages_size = self.package_model.get_packages_size()
开发者ID:sunfirefox,项目名称:bitbake,代码行数:70,代码来源:packageselectionpage.py

示例2: RecipeSelectionPage

# 需要导入模块: from bb.ui.crumbs.hobwidget import HobButton [as 别名]
# 或者: from bb.ui.crumbs.hobwidget.HobButton import grab_default [as 别名]

#.........这里部分代码省略.........
        self.ins = HobNotebook()
        self.tables = [] # we need modify table when the dialog is shown
        # append the tabs in order
        for page in self.pages:
            columns = page['columns']
            tab = HobViewTable(columns)
            filter = page['filter']
            tab.set_model(self.recipe_model.tree_model(filter))
            tab.connect("toggled", self.table_toggled_cb, page['name'])
            if page['name'] == "Included recipes":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            self.ins.append_page(tab, page['name'], page['tooltip'])
            self.tables.append(tab)

        self.ins.set_entry("Search recipes:")
        # set the search entry for each table
        for tab in self.tables:
            search_tip = "Enter a recipe's or task's name to find it"
            self.ins.search.set_tooltip_text(search_tip)
            self.ins.search.props.has_tooltip = True
            tab.set_search_entry(0, self.ins.search)

        # add all into the window
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_end(button_box, expand=False, fill=False)

        self.build_packages_button = HobButton('Build packages')
        #self.build_packages_button.set_size_request(205, 49)
        self.build_packages_button.set_tooltip_text("Build selected recipes into packages")
        self.build_packages_button.set_flags(gtk.CAN_DEFAULT)
        self.build_packages_button.grab_default()
        self.build_packages_button.connect("clicked", self.build_packages_clicked_cb)
        button_box.pack_end(self.build_packages_button, expand=False, fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        button_box.pack_end(self.back_button, expand=False, fill=False)

    def button_click_cb(self, widget, event):
        path, col = widget.table_tree.get_cursor()
        tree_model = widget.table_tree.get_model()
        if path: # else activation is likely a removal
            binb = tree_model.get_value(tree_model.get_iter(path), RecipeListModel.COL_BINB)
            if binb:
                self.builder.show_binb_dialog(binb)

    def build_packages_clicked_cb(self, button):
        self.builder.build_packages()

    def back_button_clicked_cb(self, button):
        self.builder.show_configuration()

    def refresh_selection(self):
        self.builder.configuration.selected_image = self.recipe_model.get_selected_image()
        _, self.builder.configuration.selected_recipes = self.recipe_model.get_selected_recipes()
        self.ins.show_indicator_icon("Included recipes", len(self.builder.configuration.selected_recipes))

    def toggle_item_idle_cb(self, path, view_tree, cell, pagename):
        if not self.recipe_model.path_included(path):
            self.recipe_model.include_item(item_path=path, binb="User Selected", image_contents=False)
        else:
            if pagename == "Included recipes":
                self.pre_fadeout_checkout_include(view_tree)
开发者ID:gosborne,项目名称:yp,代码行数:70,代码来源:recipeselectionpage.py

示例3: PackageSelectionPage

# 需要导入模块: from bb.ui.crumbs.hobwidget import HobButton [as 别名]
# 或者: from bb.ui.crumbs.hobwidget.HobButton import grab_default [as 别名]

#.........这里部分代码省略.........
        self.tables = [] # we need to modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tab
        for page in self.pages:
            columns = page['columns']
            name = page['name']
            tab = HobViewTable(columns, name)
            search_names.append(page['search'])
            search_tips.append(page['searchtip'])
            filter = page['filter']
            sort_model = self.package_model.tree_model(filter, initial=True)
            tab.set_model(sort_model)
            tab.connect("toggled", self.table_toggled_cb, name)
            tab.connect("button-release-event", self.button_click_cb)
            tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include, filter)
            self.ins.append_page(tab, page['name'], page['tooltip'])
            self.tables.append(tab)

        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        self.button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(self.button_box, expand=False, fill=False)

        self.build_image_button = HobButton('Build image')
        #self.build_image_button.set_size_request(205, 49)
        self.build_image_button.set_tooltip_text("Build target image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        self.button_box.pack_end(self.build_image_button, expand=False, fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_end(self.back_button, expand=False, fill=False)

    def search_entry_changed(self, entry):
        text = entry.get_text()
        if self.ins.search_focus:
            self.ins.search_focus = False
        elif self.ins.page_changed:
            self.ins.page_change = False
            self.filter_search(entry)
        elif text not in self.ins.search_names:
            self.filter_search(entry)

    def filter_search(self, entry):
        text = entry.get_text()
        current_tab = self.ins.get_current_page()
        filter = self.pages[current_tab]['filter']
        filter[PackageListModel.COL_NAME] = text
        self.tables[current_tab].set_model(self.package_model.tree_model(filter, search_data=text))
        if self.package_model.filtered_nb == 0:
            if not self.ins.get_nth_page(current_tab).top_bar:
                self.ins.get_nth_page(current_tab).add_no_result_bar(entry)
                self.ins.get_nth_page(current_tab).top_bar.set_no_show_all(True)
            self.ins.get_nth_page(current_tab).top_bar.show()
            self.ins.get_nth_page(current_tab).scroll.hide()
        else:
            if self.ins.get_nth_page(current_tab).top_bar:
                self.ins.get_nth_page(current_tab).top_bar.hide()
开发者ID:karfield,项目名称:bitbake,代码行数:70,代码来源:packageselectionpage.py

示例4: PackageSelectionPage

# 需要导入模块: from bb.ui.crumbs.hobwidget import HobButton [as 别名]
# 或者: from bb.ui.crumbs.hobwidget.HobButton import grab_default [as 别名]

#.........这里部分代码省略.........
        self.ins = HobNotebook()
        self.tables = []  # we need to modify table when the dialog is shown
        # append the tab
        for page in self.pages:
            columns = page["columns"]
            tab = HobViewTable(columns)
            filter = page["filter"]
            tab.set_model(self.package_model.tree_model(filter))
            tab.connect("toggled", self.table_toggled_cb, page["name"])
            if page["name"] == "Included packages":
                tab.connect("button-release-event", self.button_click_cb)
                tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
            self.ins.append_page(tab, page["name"], page["tooltip"])
            self.tables.append(tab)

        self.ins.set_entry("Search packages:")
        # set the search entry for each table
        for tab in self.tables:
            search_tip = "Enter a package name to find it"
            self.ins.search.set_tooltip_text(search_tip)
            self.ins.search.props.has_tooltip = True
            tab.set_search_entry(0, self.ins.search)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        self.button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(self.button_box, expand=False, fill=False)

        self.build_image_button = HobButton("Build image")
        # self.build_image_button.set_size_request(205, 49)
        self.build_image_button.set_tooltip_text("Build target image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        self.button_box.pack_end(self.build_image_button, expand=False, fill=False)

        self.back_button = HobAltButton("Cancel")
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_end(self.back_button, expand=False, fill=False)

    def button_click_cb(self, widget, event):
        path, col = widget.table_tree.get_cursor()
        tree_model = widget.table_tree.get_model()
        if path:  # else activation is likely a removal
            binb = tree_model.get_value(tree_model.get_iter(path), PackageListModel.COL_BINB)
            if binb:
                self.builder.show_binb_dialog(binb)

    def open_log_clicked_cb(self, button, log_file):
        if log_file:
            self.stop = False
            dialog = OpeningLogDialog(
                title="Opening Log",
                parent=None,
                flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
            )
            # create a thread to open log file
            background = OpeningLogThread(dialog, log_file, self)
            background.start()
            response = dialog.run()
            self.stop = True
            background.join()

    def show_page(self, log_file):
        children = self.button_box.get_children() or []
开发者ID:stefanbeller,项目名称:bitbake,代码行数:70,代码来源:packageselectionpage.py

示例5: RecipeSelectionPage

# 需要导入模块: from bb.ui.crumbs.hobwidget import HobButton [as 别名]
# 或者: from bb.ui.crumbs.hobwidget.HobButton import grab_default [as 别名]

#.........这里部分代码省略.........
        self.tables = [] # we need modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tabs in order
        for page in self.pages:
            columns = page['columns']
            name = page['name']
            tab = HobViewTable(columns, name)
            search_names.append(page['search'])
            search_tips.append(page['searchtip'])
            filter = page['filter']
            sort_model = self.recipe_model.tree_model(filter, initial=True)
            tab.set_model(sort_model)
            tab.connect("toggled", self.table_toggled_cb, name)
            tab.connect("button-release-event", self.button_click_cb)
            tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include, filter)
            self.ins.append_page(tab, page['name'], page['tooltip'])
            self.tables.append(tab)

        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)

        # add all into the window
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_end(button_box, expand=False, fill=False)

        self.build_packages_button = HobButton('Build packages')
        #self.build_packages_button.set_size_request(205, 49)
        self.build_packages_button.set_tooltip_text("Build selected recipes into packages")
        self.build_packages_button.set_flags(gtk.CAN_DEFAULT)
        self.build_packages_button.grab_default()
        self.build_packages_button.connect("clicked", self.build_packages_clicked_cb)
        button_box.pack_end(self.build_packages_button, expand=False, fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        button_box.pack_end(self.back_button, expand=False, fill=False)

    def search_entry_changed(self, entry):
        text = entry.get_text()
        if self.ins.search_focus:
            self.ins.search_focus = False
        elif self.ins.page_changed:
            self.ins.page_change = False
            self.filter_search(entry)
        elif text not in self.ins.search_names:
            self.filter_search(entry)

    def filter_search(self, entry):
        text = entry.get_text()
        current_tab = self.ins.get_current_page()
        filter = self.pages[current_tab]['filter']
        filter[RecipeListModel.COL_NAME] = text
        self.tables[current_tab].set_model(self.recipe_model.tree_model(filter, search_data=text))
        if self.recipe_model.filtered_nb == 0:
            if not self.ins.get_nth_page(current_tab).top_bar:
                self.ins.get_nth_page(current_tab).add_no_result_bar(entry)
                self.ins.get_nth_page(current_tab).top_bar.set_no_show_all(True)
            self.ins.get_nth_page(current_tab).top_bar.show()
            self.ins.get_nth_page(current_tab).scroll.hide()
        else:
            if self.ins.get_nth_page(current_tab).top_bar:
                self.ins.get_nth_page(current_tab).top_bar.hide()
开发者ID:alex1818,项目名称:yocto-iot,代码行数:70,代码来源:recipeselectionpage.py

示例6: PackageSelectionPage

# 需要导入模块: from bb.ui.crumbs.hobwidget import HobButton [as 别名]
# 或者: from bb.ui.crumbs.hobwidget.HobButton import grab_default [as 别名]
class PackageSelectionPage (HobPage):

    pages = [
        {
         'name'      : 'All packages',
         'tooltip'   : 'All packages that have been built',
         'filter'    : {},
         'search'    : 'Search packages by name',
         'searchtip' : 'Enter a package name to find it',
         'columns'   : [{
                       'col_name' : 'Included',
                       'col_id'   : PackageListModel.COL_INC,
                       'col_style': 'check toggle',
                       'col_min'  : 50,
                       'col_max'  : 50
                      }, {
                       'col_name' : 'Package name',
                       'col_id'   : PackageListModel.COL_NAME,
                       'col_style': 'text',
                       'col_min'  : 100,
                       'col_max'  : 200,
                       'expand'   : 'True'
                      }, {
                       'col_name' : 'Size',
                       'col_id'   : PackageListModel.COL_SIZE,
                       'col_style': 'text',
                       'col_min'  : 80,
                       'col_max'  : 80,
                       'expand'   : 'True'
                      }, {
                       'col_name' : 'Brought in by',
                       'col_id'   : PackageListModel.COL_BINB,
                       'col_style': 'binb',
                       'col_min'  : 150,
                       'col_max'  : 170,
                       'expand'   : 'True'
                      }]
        }
    ]
    
    (INCLUDED,
     ALL) = range(2)

    def __init__(self, builder):
        super(PackageSelectionPage, self).__init__(builder, "Edit packages")

        # set invisible members
        self.recipe_model = self.builder.recipe_model
        self.package_model = self.builder.package_model

        # create visual elements
        self.create_visual_elements()

    def create_visual_elements(self):
        self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
        self.eventbox = self.add_onto_top_bar(self.label, padding=15)
        self.pack_start(self.eventbox, expand=False, fill=False)
        self.pack_start(self.group_align, expand=True, fill=True)

        # set visible members
        self.ins = HobNotebook()
        self.tables = [] # we need to modify table when the dialog is shown

        search_names = []
        search_tips = []
        # append the tab
        page = self.pages[0]
        columns = page['columns']
        name = page['name']
        self.tab = HobViewTable(columns, name)
        search_names.append(page['search'])
        search_tips.append(page['searchtip'])
        self.ins.set_entry(search_names, search_tips)
        self.ins.search.connect("changed", self.search_entry_changed)
        filter = page['filter']
        sort_model = self.package_model.tree_model(filter, initial=True)
        self.tab.set_model(sort_model)
        self.tab.connect("toggled", self.table_toggled_cb, name)
        self.tab.connect("button-release-event", self.button_click_cb)
        self.tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include, filter)
        #self.tab.set_size_request(-1, 350)
        self.ins.append_page(self.tab, page['name'], page['tooltip'])
        self.tables.append(self.tab)

        # add all into the dialog
        self.box_group_area.pack_start(self.ins, expand=True, fill=True)

        self.button_box = gtk.HBox(False, 6)
        self.box_group_area.pack_start(self.button_box, expand=False, fill=False)

        self.build_image_button = HobButton('Build image')
        self.build_image_button.set_tooltip_text("Build your image")
        self.build_image_button.set_flags(gtk.CAN_DEFAULT)
        self.build_image_button.grab_default()
        self.build_image_button.connect("clicked", self.build_image_clicked_cb)
        self.button_box.pack_end(self.build_image_button, expand=False, fill=False)

        self.back_button = HobAltButton('Cancel')
        self.back_button.connect("clicked", self.back_button_clicked_cb)
        self.button_box.pack_end(self.back_button, expand=False, fill=False)
#.........这里部分代码省略.........
开发者ID:alex1818,项目名称:yocto-iot,代码行数:103,代码来源:packageselectionpage.py


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