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()
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()
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()
def create_visual_elements(self): self.eventbox = self.add_onto_top_bar(None, 73) 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 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) if name == "Included recipes": tab.connect("button-release-event", self.button_click_cb) tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) if name == "Package Groups": tab.connect("button-release-event", self.button_click_cb) tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) if name == "All recipes": tab.connect("button-release-event", self.button_click_cb) tab.connect("cell-fadeinout-stopped", self.button_click_cb) 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 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()
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()
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
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
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()
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()
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()
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
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()
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
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()
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()
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()
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
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()
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()
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)
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(True)
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()
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, 73) 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 # 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 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
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()
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()
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
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.failure_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
def entry_widget_select_path_cb(self, action, parent, entry): dialog = gtk.FileChooserDialog("", parent, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) text = entry.get_text() dialog.set_current_folder(text if len(text) > 0 else os.getcwd()) 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()
def just_bake(self): selected_image = self.recipe_model.get_selected_image() selected_packages = self.package_model.get_selected_packages() or [] # If no base image and no selected packages don't build anything if not (selected_packages or selected_image != self.recipe_model.__dummy_image__): 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.fast_generate_image_async()
def select_path_cb(self, action, parent, entry): dialog = gtk.FileChooserDialog("", parent, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) text = entry.get_text() dialog.set_current_folder(text if len(text) > 0 else os.getcwd()) 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) self.image_folder = path self.fill_image_store() dialog.destroy()
def destroy_window_cb(self, widget, event): if not self.sensitive: return True lbl = "<b>Do you really want to exit the Hob image creator?</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Cancel", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Exit Hob", gtk.RESPONSE_YES) HobButton.style_button(button) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: gtk.main_quit() return False else: return True
def just_bake(self): selected_image = self.recipe_model.get_selected_image() selected_packages = self.package_model.get_selected_packages() or [] # If no base image and no selected packages don't build anything if not (selected_packages or selected_image != self.recipe_model.__custom_image__): 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.fast_generate_image_async(True)
def show_load_template_dialog(self): dialog = gtk.FileChooserDialog("Load Template Files", self, gtk.FILE_CHOOSER_ACTION_OPEN) button = dialog.add_button("Cancel", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Open", gtk.RESPONSE_YES) HobButton.style_button(button) filter = gtk.FileFilter() filter.set_name("Hob Files") filter.add_pattern("*.hob") dialog.add_filter(filter) response = dialog.run() path = None if response == gtk.RESPONSE_YES: path = dialog.get_filename() dialog.destroy() return response == gtk.RESPONSE_YES, path
def destroy_window_cb(self, widget, event): if not self.sensitive: return True lbl = "<b>Do you really want to exit the Hob image creator?</b>" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("Cancel", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Exit Hob", gtk.RESPONSE_YES) HobButton.style_button(button) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: gtk.main_quit() return False else: return True
def show_load_template_dialog(self): dialog = gtk.FileChooserDialog("Load Template Files", self, gtk.FILE_CHOOSER_ACTION_OPEN) button = dialog.add_button("Cancel", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Open", gtk.RESPONSE_YES) HobButton.style_button(button) filter = gtk.FileFilter() filter.set_name("Hob Files") filter.add_pattern("*.hob") dialog.add_filter(filter) response = dialog.run() path = None if response == gtk.RESPONSE_YES: path = dialog.get_filename() dialog.destroy() return response == gtk.RESPONSE_YES, path
def show_packages(self, ask=True): _, selected_recipes = self.recipe_model.get_selected_recipes() if selected_recipes and ask: lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes" lbl = lbl + " to get a full list or just view the existing packages?" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("View packages", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Build packages", gtk.RESPONSE_YES) HobButton.style_button(button) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: self.generate_packages_async() else: self.switch_page(self.PACKAGE_SELECTION) else: self.switch_page(self.PACKAGE_SELECTION)
def deploy_image(self, image_name): if not image_name: lbl = "<b>Please select an image to deploy.</b>" 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 dialog = DeployImageDialog(self, title="Hob IoT", image=image_name, parent=self, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) response = dialog.run() dialog.destroy()
def deploy_image(self, image_name): if not image_name: lbl = "<b>Please select an image to deploy.</b>" 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 dialog = DeployImageDialog(self, title = "Hob IoT", image = image_name, parent = self, flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) response = dialog.run() dialog.destroy()
def show_packages(self, ask=True): _, selected_recipes = self.recipe_model.get_selected_recipes() if selected_recipes and ask: lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes" lbl = lbl + " to get a full list or just view the existing packages?" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) button = dialog.add_button("View packages", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Build packages", gtk.RESPONSE_YES) HobButton.style_button(button) dialog.set_default_response(gtk.RESPONSE_YES) response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_YES: self.generate_packages_async(True) else: self.switch_page(self.PACKAGE_SELECTION) else: self.switch_page(self.PACKAGE_SELECTION)
def response_cb(self, dialog, response_id): if response_id == gtk.RESPONSE_YES: # Check that all proxy entries have a corresponding port for proxy, port in zip(self.all_proxy_addresses, self.all_proxy_ports): if proxy.get_text() and not port.get_text(): lbl = "<b>Enter all port numbers</b>\n\n" msg = "Proxy servers require a port number. Please make sure you have entered a port number for each proxy server." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run() dialog.destroy() self.emit_stop_by_name("response") return self.configuration.dldir = self.dldir_text.get_text() self.configuration.sstatedir = self.sstatedir_text.get_text() self.configuration.sstatemirror = "" for mirror in self.sstatemirrors_list: if mirror[1] != "" and mirror[2].startswith("file://"): if mirror[1].endswith("\\1"): smirror = mirror[2] + " " + mirror[1] + " \\n " else: smirror = mirror[2] + " " + mirror[1] + "\\1 \\n " self.configuration.sstatemirror += smirror self.configuration.bbthread = self.bb_spinner.get_value_as_int() self.configuration.pmake = self.pmake_spinner.get_value_as_int() self.save_proxy_data() self.configuration.extra_setting = {} it = self.setting_store.get_iter_first() while it: key = self.setting_store.get_value(it, 0) value = self.setting_store.get_value(it, 1) self.configuration.extra_setting[key] = value it = self.setting_store.iter_next(it) md5 = self.config_md5() self.settings_changed = (self.md5 != md5) self.proxy_settings_changed = (self.proxy_md5 != self.config_proxy_md5())
def show_layer_selection_dialog(self): dialog = LayerSelectionDialog( title="Layers", layers=copy.deepcopy(self.configuration.layers), all_layers=self.parameters.all_layers, 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("OK", gtk.RESPONSE_YES) HobButton.style_button(button) response = dialog.run() if response == gtk.RESPONSE_YES: self.configuration.layers = dialog.layers self.save_defaults() # remember layers # DO refresh layers if dialog.layers_changed: self.update_config_async() dialog.destroy()
def create_visual_elements(self): self.eventbox = self.add_onto_top_bar(None, 73) 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 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) if name == "Included recipes": tab.connect("button-release-event", self.button_click_cb) tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) if name == "Package Groups": tab.connect("button-release-event", self.button_click_cb) tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) if name == "All recipes": tab.connect("button-release-event", self.button_click_cb) tab.connect("cell-fadeinout-stopped", self.button_click_cb) 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 create_config_build_button(self): # Create the "Build packages" and "Build image" buttons at the bottom button_box = gtk.HBox(False, 6) # create button "Build image" self.just_bake_button = HobButton("Build image") self.just_bake_button.set_tooltip_text( "Build the image recipe as it is") self.just_bake_button.connect("clicked", self.just_bake_button_clicked_cb) button_box.pack_end(self.just_bake_button, expand=False, fill=False) # create button "Edit image recipe" self.edit_image_button = HobAltButton("Edit image recipe") self.edit_image_button.set_tooltip_text( "Customize the recipes and packages to be included in your image") self.edit_image_button.connect("clicked", self.edit_image_button_clicked_cb) button_box.pack_end(self.edit_image_button, expand=False, fill=False) return button_box
def create_config_build_button(self): # Create the "Build packages" and "Build image" buttons at the bottom button_box = gtk.HBox(False, 6) # create button "Build image" self.just_bake_button = HobButton("Build image") #self.just_bake_button.set_size_request(205, 49) self.just_bake_button.set_tooltip_text("Build target image") self.just_bake_button.connect("clicked", self.just_bake_button_clicked_cb) button_box.pack_end(self.just_bake_button, expand=False, fill=False) # create button "Edit Image" self.edit_image_button = HobAltButton("Edit image") #self.edit_image_button.set_size_request(205, 49) self.edit_image_button.set_tooltip_text("Edit target image") self.edit_image_button.connect("clicked", self.edit_image_button_clicked_cb) button_box.pack_end(self.edit_image_button, expand=False, fill=False) return button_box
def show_layer_selection_dialog(self): dialog = LayerSelectionDialog(title="Layers", layers=copy.deepcopy( self.configuration.layers), all_layers=self.parameters.all_layers, 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("OK", gtk.RESPONSE_YES) HobButton.style_button(button) response = dialog.run() if response == gtk.RESPONSE_YES: self.configuration.layers = dialog.layers self.save_defaults() # remember layers # DO refresh layers if dialog.layers_changed: self.update_config_async() dialog.destroy()
def runqemu_image(self, image_name): if not image_name: lbl = "<b>Please select an image to launch in QEMU.</b>" 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 kernel_name, kernels_number = self.get_kernel_file_name(self.parameters.image_addr) if not kernel_name or kernels_number > 1: dialog = gtk.FileChooserDialog("Load Kernel Files", 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) filter = gtk.FileFilter() filter.set_name("Kernel Files") filter.add_pattern("*.bin") dialog.add_filter(filter) dialog.set_current_folder(self.parameters.image_addr) response = dialog.run() if response == gtk.RESPONSE_YES: kernel_path = dialog.get_filename() image_path = os.path.join(self.parameters.image_addr, image_name) dialog.destroy() elif kernel_name: kernel_path = os.path.join(self.parameters.image_addr, kernel_name) image_path = os.path.join(self.parameters.image_addr, image_name) response = gtk.RESPONSE_YES if response == gtk.RESPONSE_YES: source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env") tmp_path = self.parameters.tmpdir cmdline = bb.ui.crumbs.utils.which_terminal() if os.path.exists(image_path) and os.path.exists(kernel_path) \ and os.path.exists(source_env_path) and os.path.exists(tmp_path) \ and cmdline: cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; " cmdline += "source " + source_env_path + " " + os.getcwd() + "; " cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'" subprocess.Popen(shlex.split(cmdline)) else: lbl = "<b>Path error</b>\nOne of your paths is wrong," lbl = lbl + " please make sure the following paths exist:\n" lbl = lbl + "image path:" + image_path + "\n" lbl = lbl + "kernel path:" + kernel_path + "\n" lbl = lbl + "source environment path:" + source_env_path + "\n" lbl = lbl + "tmp path: " + tmp_path + "." lbl = lbl + "You may be missing either xterm or vte for terminal services." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy()
def response_cb(self, dialog, response_id): if response_id == gtk.RESPONSE_YES: if self.proxy_checkbox.get_active(): # Check that all proxy entries have a corresponding port for proxy, port in zip(self.all_proxy_addresses, self.all_proxy_ports): if proxy.get_text() and not port.get_text(): lbl = "<b>Enter all port numbers</b>" msg = "Proxy servers require a port number. Please make sure you have entered a port number for each proxy server." dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run() dialog.destroy() self.emit_stop_by_name("response") return self.configuration.dldir = self.dldir_text.get_text() self.configuration.sstatedir = self.sstatedir_text.get_text() self.configuration.sstatemirror = "" for mirror in self.sstatemirrors_list: if mirror[1] != "" and mirror[2].startswith("file://"): if mirror[1].endswith("\\1"): smirror = mirror[2] + " " + mirror[1] + " \\n " else: smirror = mirror[2] + " " + mirror[1] + "\\1 \\n " self.configuration.sstatemirror += smirror self.configuration.bbthread = self.bb_spinner.get_value_as_int() self.configuration.pmake = self.pmake_spinner.get_value_as_int() self.save_proxy_data() self.configuration.extra_setting = {} it = self.setting_store.get_iter_first() while it: key = self.setting_store.get_value(it, 0) value = self.setting_store.get_value(it, 1) self.configuration.extra_setting[key] = value it = self.setting_store.iter_next(it) md5 = self.config_md5() self.settings_changed = self.md5 != md5 self.proxy_settings_changed = self.proxy_md5 != self.config_proxy_md5()
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, 73) 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 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) if name == "Included packages": tab.connect("button-release-event", self.button_click_cb) tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) if name == "All 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_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 stop_build(self): if self.stopping: lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once," lbl = lbl + " would you like to 'Force Stop' the build?\n\n" lbl = lbl + "This will stop the build as quickly as possible but may" lbl = lbl + " well leave your build directory in an unusable state" lbl = lbl + " that requires manual steps to fix.\n" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Force Stop", gtk.RESPONSE_YES) HobButton.style_button(button) else: lbl = "<b>Stop build?</b>\n\nAre you sure you want to stop this" lbl = lbl + " build?\n\n'Stop' will stop the build as soon as all in" lbl = lbl + " progress build tasks are finished. However if a" lbl = lbl + " lengthy compilation phase is in progress this may take" lbl = lbl + " some time.\n\n" lbl = lbl + "'Force Stop' will stop the build as quickly as" lbl = lbl + " possible but may well leave your build directory in an" lbl = lbl + " unusable state that requires manual steps to fix." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Force stop", gtk.RESPONSE_YES) HobAltButton.style_button(button) button = dialog.add_button("Stop", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_CANCEL: self.stopping = True if response == gtk.RESPONSE_OK: self.build_details_page.progress_bar.set_stop_title( "Stopping the build....") self.build_details_page.progress_bar.set_rcstyle("stop") self.cancel_build_sync() elif response == gtk.RESPONSE_YES: self.cancel_build_sync(True)
def show_load_kernel_dialog(self): dialog = gtk.FileChooserDialog("Load Kernel Files", 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) filter = gtk.FileFilter() filter.set_name("Kernel Files") filter.add_pattern("*.bin") dialog.add_filter(filter) dialog.set_current_folder(self.parameters.image_addr) response = dialog.run() kernel_path = "" if response == gtk.RESPONSE_YES: kernel_path = dialog.get_filename() dialog.destroy() return kernel_path
def show_load_kernel_dialog(self): dialog = gtk.FileChooserDialog("Load Kernel Files", 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) filter = gtk.FileFilter() filter.set_name("Kernel Files") filter.add_pattern("*.bin") dialog.add_filter(filter) dialog.set_current_folder(self.parameters.image_addr) response = dialog.run() kernel_path = "" if response == gtk.RESPONSE_YES: kernel_path = dialog.get_filename() dialog.destroy() return kernel_path
def runqemu_image(self, image_name, kernel_name): if not image_name or not kernel_name: lbl = "<b>Please select an %s to launch in QEMU.</b>" % ( "kernel" if image_name else "image") 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 kernel_path = os.path.join(self.parameters.image_addr, kernel_name) image_path = os.path.join(self.parameters.image_addr, image_name) source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env") tmp_path = self.parameters.tmpdir cmdline = bb.ui.crumbs.utils.which_terminal() if os.path.exists(image_path) and os.path.exists(kernel_path) \ and os.path.exists(source_env_path) and os.path.exists(tmp_path) \ and cmdline: cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; " cmdline += "source " + source_env_path + " " + os.getcwd() + "; " cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'" subprocess.Popen(shlex.split(cmdline)) else: lbl = "<b>Path error</b>\nOne of your paths is wrong," lbl = lbl + " please make sure the following paths exist:\n" lbl = lbl + "image path:" + image_path + "\n" lbl = lbl + "kernel path:" + kernel_path + "\n" lbl = lbl + "source environment path:" + source_env_path + "\n" lbl = lbl + "tmp path: " + tmp_path + "." lbl = lbl + "You may be missing either xterm or vte for terminal services." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run() dialog.destroy()
def layer_widget_add_clicked_cb(self, action, layer_store, parent): dialog = gtk.FileChooserDialog("Add new layer", 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) label = gtk.Label("Select the layer you wish to add") label.show() dialog.set_extra_widget(label) response = dialog.run() path = dialog.get_filename() dialog.destroy() lbl = "<b>Error</b>" msg = "Unable to load layer <i>%s</i> because " % path if response == gtk.RESPONSE_YES: import os import os.path layers = [] it = layer_store.get_iter_first() while it: layers.append(layer_store.get_value(it, 0)) it = layer_store.iter_next(it) if not path: msg += "it is an invalid path." elif not os.path.exists(path+"/conf/layer.conf"): msg += "there is no layer.conf inside the directory." elif path in layers: msg += "it is already in loaded layers." else: layer_store.append([path]) return dialog = CrumbsMessageDialog(parent, lbl, gtk.MESSAGE_ERROR, msg) dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_OK) response = dialog.run() dialog.destroy()
def stop_build(self): if self.stopping: lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once," lbl = lbl + " would you like to 'Force Stop' the build?\n\n" lbl = lbl + "This will stop the build as quickly as possible but may" lbl = lbl + " well leave your build directory in an unusable state" lbl = lbl + " that requires manual steps to fix.\n" dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Force Stop", gtk.RESPONSE_YES) HobButton.style_button(button) else: lbl = "<b>Stop build?</b>\n\nAre you sure you want to stop this" lbl = lbl + " build?\n\n'Stop' will stop the build as soon as all in" lbl = lbl + " progress build tasks are finished. However if a" lbl = lbl + " lengthy compilation phase is in progress this may take" lbl = lbl + " some time.\n\n" lbl = lbl + "'Force Stop' will stop the build as quickly as" lbl = lbl + " possible but may well leave your build directory in an" lbl = lbl + " unusable state that requires manual steps to fix." dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Force stop", gtk.RESPONSE_YES) HobAltButton.style_button(button) button = dialog.add_button("Stop", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_CANCEL: self.stopping = True if response == gtk.RESPONSE_OK: self.build_details_page.progress_bar.set_stop_title("Stopping the build....") self.build_details_page.progress_bar.set_rcstyle("stop") self.cancel_build_sync() elif response == gtk.RESPONSE_YES: self.cancel_build_sync(True)
def deploy_image(self, image_name): if not image_name: lbl = "<b>Please select an image to deploy.</b>" 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 image_path = os.path.join(self.parameters.image_addr, image_name) dialog = DeployImageDialog( title="Usb Image Maker", image_path=image_path, parent=self, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR, ) button = dialog.add_button("Close", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Make usb image", gtk.RESPONSE_YES) HobButton.style_button(button) response = dialog.run() dialog.destroy()
def deploy_image(self, image_name): if not image_name: lbl = "<b>Please select an image to deploy.</b>" 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 image_path = os.path.join(self.parameters.image_addr, image_name) dialog = DeployImageDialog(title="Usb Image Maker", image_path=image_path, parent=self, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) button = dialog.add_button("Close", gtk.RESPONSE_NO) HobAltButton.style_button(button) button = dialog.add_button("Make usb image", gtk.RESPONSE_YES) HobButton.style_button(button) response = dialog.run() dialog.destroy()