本文整理汇总了Python中bb.ui.crumbs.hobwidget.HobButton类的典型用法代码示例。如果您正苦于以下问题:Python HobButton类的具体用法?Python HobButton怎么用?Python HobButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HobButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_warnings_bar
def add_warnings_bar(self):
#create the warnings bar shown when recipes parsing generates warnings
color = HobColors.KHAKI
warnings_bar = gtk.EventBox()
warnings_bar.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
warnings_bar.set_flags(gtk.CAN_DEFAULT)
warnings_bar.grab_default()
build_stop_tab = gtk.Table(10, 20, True)
warnings_bar.add(build_stop_tab)
icon = gtk.Image()
icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INDI_ALERT_FILE)
icon.set_from_pixbuf(icon_pix_buffer)
build_stop_tab.attach(icon, 0, 2, 0, 10)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
warnings_nb = len(self.builder.parsing_warnings)
if warnings_nb == 1:
label.set_markup("<span size='x-large'><b>1 recipe parsing warning</b></span>")
else:
label.set_markup("<span size='x-large'><b>%s recipe parsing warnings</b></span>" % warnings_nb)
build_stop_tab.attach(label, 2, 12, 0, 10)
view_warnings_button = HobButton("View warnings")
view_warnings_button.connect('clicked', self.view_warnings_button_clicked_cb)
build_stop_tab.attach(view_warnings_button, 15, 19, 1, 9)
return warnings_bar
示例2: handler_no_provider_cb
def handler_no_provider_cb(self, running_build, msg):
dialog = CrumbsMessageDialog(self, msg, gtk.STOCK_DIALOG_INFO)
button = dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
dialog.run()
dialog.destroy()
self.build_failed()
示例3: build_image_clicked_cb
def build_image_clicked_cb(self, button):
selected_pkgs = self.package_model.get_selected_packages()
show_missing_pkg_dialog = False
lbl = "<b>Missing important packages</b>\n\nYour list of included "
lbl = lbl + " packages is missing:\n\n"
if not ('eglibc' in selected_pkgs or 'uclibc' in selected_pkgs):
show_missing_pkg_dialog = True
lbl = lbl + "-A C library (choose eglibc or uclibc)\n\n"
if not ('bash' in selected_pkgs or 'busybox' in selected_pkgs):
show_missing_pkg_dialog = True
lbl = lbl + "-A shell provider (choose bash or busybox)\n\n"
if 'initscripts' not in selected_pkgs:
show_missing_pkg_dialog = True
lbl = lbl + "-Initialization scripts (choose initscripts)\n\n"
if show_missing_pkg_dialog:
dialog = CrumbsMessageDialog(None, lbl, gtk.STOCK_DIALOG_INFO)
button = dialog.add_button("Build anyway", gtk.RESPONSE_OK)
tooltip = "Build the image without changing the included packages"
button.set_tooltip_text(tooltip)
HobButton.style_button(button)
button = dialog.add_button("Edit packages", gtk.RESPONSE_CANCEL)
tooltip = "Change the list of included packages"
button.set_tooltip_text(tooltip)
HobButton.style_button(button)
response = dialog.run()
dialog.destroy()
if response == gtk.RESPONSE_CANCEL:
return
self.builder.build_image()
示例4: show_load_my_images_dialog
def show_load_my_images_dialog(self):
dialog = ImageSelectionDialog(
self.parameters.image_addr,
self.parameters.image_types,
"Open My Images",
self,
gtk.FILE_CHOOSER_ACTION_SAVE,
)
button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
HobAltButton.style_button(button)
button = dialog.add_button("Open", gtk.RESPONSE_YES)
HobButton.style_button(button)
response = dialog.run()
if response == gtk.RESPONSE_YES:
if not dialog.image_names:
lbl = "<b>No selections made</b>\nYou have not made any selections"
crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
crumbs_dialog.run()
crumbs_dialog.destroy()
dialog.destroy()
return
self.parameters.image_addr = dialog.image_folder
self.parameters.image_names = dialog.image_names[:]
self.switch_page(self.MY_IMAGE_OPENED)
dialog.destroy()
示例5: show_adv_settings_dialog
def show_adv_settings_dialog(self):
dialog = AdvancedSettingDialog(
title="Settings",
configuration=copy.deepcopy(self.configuration),
all_image_types=self.parameters.image_types,
all_package_formats=self.parameters.all_package_formats,
all_distros=self.parameters.all_distros,
all_sdk_machines=self.parameters.all_sdk_machines,
max_threads=self.parameters.max_threads,
enable_proxy=self.parameters.enable_proxy,
parent=self,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
)
button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
HobAltButton.style_button(button)
button = dialog.add_button("Save", gtk.RESPONSE_YES)
HobButton.style_button(button)
response = dialog.run()
settings_changed = False
if response == gtk.RESPONSE_YES:
self.parameters.enable_proxy = dialog.enable_proxy
self.configuration = dialog.configuration
self.save_defaults() # remember settings
settings_changed = dialog.settings_changed
dialog.destroy()
return response == gtk.RESPONSE_YES, settings_changed
示例6: response_cb
def response_cb(self, dialog, response_id):
if response_id == gtk.RESPONSE_YES:
lbl = ''
msg = ''
combo_item = self.usb_combo.get_active_text()
if combo_item and combo_item != self.__dummy_usb__ and self.image_path:
cmdline = bb.ui.crumbs.utils.which_terminal()
if cmdline:
tmpfile = tempfile.NamedTemporaryFile()
cmdline += "\"sudo dd if=" + self.image_path + \
" of=" + combo_item + " && sync; echo $? > " + tmpfile.name + "\""
subprocess.call(shlex.split(cmdline))
if int(tmpfile.readline().strip()) == 0:
lbl = "<b>Deploy image successfully.</b>"
else:
lbl = "<b>Failed to deploy image.</b>"
msg = "Please check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (self.image_path, combo_item)
tmpfile.close()
else:
if not self.image_path:
lbl = "<b>No selection made.</b>"
msg = "You have not selected an image to deploy."
else:
lbl = "<b>No selection made.</b>"
msg = "You have not selected a USB device."
if len(lbl):
crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg)
button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
crumbs_dialog.run()
crumbs_dialog.destroy()
示例7: show_error_dialog
def show_error_dialog(self, msg):
lbl = "<b>Hob found an error</b>\n"
dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR, msg)
button = dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
response = dialog.run()
dialog.destroy()
示例8: image_type_checkbutton_clicked_cb
def image_type_checkbutton_clicked_cb(self, button):
self.set_save_button_state()
if self.get_num_checked_image_types() == 0:
# Show an error dialog
lbl = "<b>Select an image type</b>\n\nYou need to select at least one image type."
dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
button = dialog.add_button("OK", gtk.RESPONSE_OK)
HobButton.style_button(button)
response = dialog.run()
dialog.destroy()
示例9: show_invalid_input_error_dialog
def show_invalid_input_error_dialog(self):
lbl = "<b>Invalid characters in image recipe name</b>"
msg = "Image recipe names should be all lowercase and\n"
msg += "include only alphanumeric characters. The only\n"
msg += "special character you can use is the ASCII hyphen (-)."
dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg)
button = dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
res = dialog.run()
self.name_entry.grab_focus()
dialog.destroy()
示例10: build_image
def build_image(self):
selected_packages = self.package_model.get_selected_packages()
if not selected_packages:
lbl = "<b>No selections made</b>\nYou have not made any selections"
lbl = lbl + " so there isn't anything to bake at this time."
dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
button = dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
dialog.run()
dialog.destroy()
return
self.generate_image_async()
示例11: show_save_template_dialog
def show_save_template_dialog(self):
dialog = gtk.FileChooserDialog("Save Template Files", self, gtk.FILE_CHOOSER_ACTION_SAVE)
button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
HobAltButton.style_button(button)
button = dialog.add_button("Save", gtk.RESPONSE_YES)
HobButton.style_button(button)
dialog.set_current_name("hob")
response = dialog.run()
if response == gtk.RESPONSE_YES:
path = dialog.get_filename()
self.save_template(path)
dialog.destroy()
示例12: add_build_fail_top_bar
def add_build_fail_top_bar(self, actions):
mainly_action = "Edit %s" % actions
if 'image' in actions:
next_action = ""
else:
next_action = "Create new image"
#set to issue page
self.notebook.set_page("Issues")
color = HobColors.ERROR
build_fail_top = gtk.EventBox()
build_fail_top.set_size_request(-1, 260)
build_fail_top.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
build_fail_tab = gtk.Table(7, 40, True)
build_fail_top.add(build_fail_tab)
icon = gtk.Image()
icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INDI_ERROR_FILE)
icon.set_from_pixbuf(icon_pix_buffer)
build_fail_tab.attach(icon, 1, 4, 0, 3)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
label.set_markup("<span size='x-large'>%s</span>" % self.title)
build_fail_tab.attach(label, 4, 20, 0, 3)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
num_of_fails = self.update_failures_sum_display()
current_fail, recipe_task_status = self.task_status.get_text().split('\n')
label.set_markup(" %d tasks failed, %s, %s" % (num_of_fails, current_fail, recipe_task_status))
build_fail_tab.attach(label, 4, 40, 2, 4)
# create button 'Edit packages'
action_button = HobButton(mainly_action)
action_button.set_size_request(-1, 49)
action_button.connect('clicked', self.failure_main_action_button_clicked_cb, mainly_action)
build_fail_tab.attach(action_button, 4, 16, 4, 6)
if next_action:
next_button = HobAltButton(next_action)
next_button.set_alignment(0.0, 0.5)
next_button.connect('clicked', self.failure_next_action_button_clicked_cb, next_action)
build_fail_tab.attach(next_button, 17, 24, 4, 5)
file_bug_button = HobAltButton('File a bug')
file_bug_button.set_alignment(0.0, 0.5)
file_bug_button.connect('clicked', self.failure_file_bug_activate_link_cb)
build_fail_tab.attach(file_bug_button, 17, 24, 4 + abs(next_action != ""), 6)
return build_fail_top
示例13: add_build_fail_top_bar
def add_build_fail_top_bar(self, actions, log_file=None):
primary_action = "Edit %s" % actions
color = HobColors.ERROR
build_fail_top = gtk.EventBox()
#build_fail_top.set_size_request(-1, 200)
build_fail_top.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
build_fail_tab = gtk.Table(14, 46, True)
build_fail_top.add(build_fail_tab)
icon = gtk.Image()
icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INDI_ERROR_FILE)
icon.set_from_pixbuf(icon_pix_buffer)
build_fail_tab.attach(icon, 1, 4, 0, 6)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
label.set_markup("<span size='x-large'><b>%s</b></span>" % self.title)
build_fail_tab.attach(label, 4, 40, 0, 6)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
# Ensure variable disk_full is defined
if not hasattr(self.builder, 'disk_full'):
self.builder.disk_full = False
if self.builder.disk_full:
markup = "<span size='medium'>There is no disk space left, so Hob cannot finish building your image. Free up some disk space\n"
markup += "and restart the build."
label.set_markup(markup)
build_fail_tab.attach(label, 4, 40, 4, 9)
# create button 'Edit packages'
action_button = HobButton(primary_action)
#action_button.set_size_request(-1, 40)
action_button.set_tooltip_text("Edit the %s parameters" % actions)
action_button.connect('clicked', self.failure_primary_action_button_clicked_cb, primary_action)
if not self.builder.disk_full:
build_fail_tab.attach(action_button, 4, 19, 9, 12)
else:
restart_build = HobButton("Restart the build")
restart_build.set_tooltip_text("Restart the build")
restart_build.connect('clicked', self.restart_build_button_clicked_cb)
build_fail_tab.attach(restart_build, 4, 13, 9, 12)
build_fail_tab.attach(action_button, 14, 23, 9, 12)
self.builder.disk_full = False
return build_fail_top
示例14: entry_widget_select_path_cb
def entry_widget_select_path_cb(self, action, parent, entry):
dialog = gtk.FileChooserDialog("", parent,
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
HobAltButton.style_button(button)
button = dialog.add_button("Open", gtk.RESPONSE_YES)
HobButton.style_button(button)
response = dialog.run()
if response == gtk.RESPONSE_YES:
path = dialog.get_filename()
entry.set_text(path)
dialog.destroy()
示例15: add_build_fail_top_bar
def add_build_fail_top_bar(self, actions, log_file=None):
primary_action = "Edit %s" % actions
self.notebook.set_page("Issues")
color = HobColors.ERROR
build_fail_top = gtk.EventBox()
#build_fail_top.set_size_request(-1, 200)
build_fail_top.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
build_fail_tab = gtk.Table(14, 46, True)
build_fail_top.add(build_fail_tab)
icon = gtk.Image()
icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INDI_ERROR_FILE)
icon.set_from_pixbuf(icon_pix_buffer)
build_fail_tab.attach(icon, 1, 4, 0, 6)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
label.set_markup("<span size='x-large'><b>%s</b></span>" % self.title)
build_fail_tab.attach(label, 4, 26, 0, 6)
label = gtk.Label()
label.set_alignment(0.0, 0.5)
label.set_markup("<span size='medium'>Check the \"Issues\" information for more details</span>")
build_fail_tab.attach(label, 4, 40, 4, 9)
# create button 'Edit packages'
action_button = HobButton(primary_action)
#action_button.set_size_request(-1, 40)
action_button.set_tooltip_text("Edit the %s parameters" % actions)
action_button.connect('clicked', self.failure_primary_action_button_clicked_cb, primary_action)
build_fail_tab.attach(action_button, 4, 13, 9, 12)
if log_file:
open_log_button = HobAltButton("Open log")
open_log_button.set_relief(gtk.RELIEF_HALF)
open_log_button.set_tooltip_text("Open the build's log file")
open_log_button.connect('clicked', self.open_log_button_clicked_cb, log_file)
build_fail_tab.attach(open_log_button, 14, 23, 9, 12)
attach_pos = (24 if log_file else 14)
file_bug_button = HobAltButton('File a bug')
file_bug_button.set_relief(gtk.RELIEF_HALF)
file_bug_button.set_tooltip_text("Open the Yocto Project bug tracking website")
file_bug_button.connect('clicked', self.failure_activate_file_bug_link_cb)
build_fail_tab.attach(file_bug_button, attach_pos, attach_pos + 9, 9, 12)
return build_fail_top