Exemple #1
0
    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()
Exemple #2
0
 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
Exemple #3
0
    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 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 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
Exemple #6
0
    def create_visual_elements(self):
        self.set_size_request(350, 350)
        self.heading_label = gtk.Label()
        self.heading_label.set_alignment(0, 0)
        self.warning_label = gtk.Label()
        self.warning_label.set_selectable(True)
        self.warning_label.set_alignment(0, 0)
        self.textWindow = gtk.ScrolledWindow()

        table = gtk.Table(1, 10, False)

        cancel_button = gtk.Button()
        cancel_button.set_label("Close")
        cancel_button.connect("clicked", self.cancel_button_cb)
        cancel_button.set_size_request(110, 30)

        self.previous_button = gtk.Button()
        image1 = gtk.image_new_from_stock(gtk.STOCK_GO_BACK, gtk.ICON_SIZE_BUTTON)
        image1.show()
        box = gtk.HBox(False, 6)
        box.show()
        self.previous_button.add(box)
        lbl = gtk.Label("Previous")
        lbl.show()
        box.pack_start(image1, expand=False, fill=False, padding=3)
        box.pack_start(lbl, expand=True, fill=True, padding=3)
        self.previous_button.connect("clicked", self.previous_button_cb)
        self.previous_button.set_size_request(110, 30)

        self.next_button = gtk.Button()
        image2 = gtk.image_new_from_stock(gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_BUTTON)
        image2.show()
        box = gtk.HBox(False, 6)
        box.show()
        self.next_button.add(box)
        lbl = gtk.Label("Next")
        lbl.show()
        box.pack_start(lbl, expand=True, fill=True, padding=3)
        box.pack_start(image2, expand=False, fill=False, padding=3)
        self.next_button.connect("clicked", self.next_button_cb)
        self.next_button.set_size_request(110, 30)

        #when there more than one warning, we need "previous" and "next" button
        if self.warn_nb>1:
            self.vbox.pack_start(self.heading_label, expand=False, fill=False)
            self.vbox.pack_start(self.warning_label, expand=False, fill=False)
            self.vbox.pack_start(self.textWindow, expand=False, fill=False)
            table.attach(cancel_button, 6, 7, 0, 1, xoptions=gtk.SHRINK)
            table.attach(self.previous_button, 7, 8, 0, 1, xoptions=gtk.SHRINK)
            table.attach(self.next_button, 8, 9, 0, 1, xoptions=gtk.SHRINK)
            self.vbox.pack_end(table, expand=False, fill=False)
        else:
            self.vbox.pack_start(self.heading_label, expand=False, fill=False)
            self.vbox.pack_start(self.warning_label, expand=False, fill=False)
            self.vbox.pack_start(self.textWindow, expand=False, fill=False)
            cancel_button = self.add_button("Close", gtk.RESPONSE_CANCEL)
            HobAltButton.style_button(cancel_button)

        self.refresh_components()
    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

        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()

        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()
Exemple #8
0
 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()
Exemple #9
0
    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 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()
Exemple #11
0
    def show_packages_property_dialog(self, properties):
        information = {}
        dialog = PropertyDialog(title = properties["name"] +' '+ "properties",
                      parent = self,
                      information = properties,
                      flags = gtk.DIALOG_DESTROY_WITH_PARENT
                          | gtk.DIALOG_NO_SEPARATOR)

        dialog.set_modal(False)

        button = dialog.add_button("Close", gtk.RESPONSE_NO)
        HobAltButton.style_button(button)
        button.connect("clicked", lambda w: dialog.destroy())

        dialog.run()
    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()
Exemple #13
0
    def show_packages_property_dialog(self, properties):
        information = {}
        dialog = PropertyDialog(title=properties["name"] + ' ' + "properties",
                                parent=self,
                                information=properties,
                                flags=gtk.DIALOG_DESTROY_WITH_PARENT
                                | gtk.DIALOG_NO_SEPARATOR)

        dialog.set_modal(False)

        button = dialog.add_button("Close", gtk.RESPONSE_NO)
        HobAltButton.style_button(button)
        button.connect("clicked", lambda w: dialog.destroy())

        dialog.run()
Exemple #14
0
    def create_visual_elements(self):
        hbox = gtk.HBox(False, 12)
        self.user_label = gtk.Label("The log will open in a text editor")
        hbox.pack_start(self.user_label, expand=False, fill=False)
        self.vbox.pack_start(hbox, expand=False, fill=False)

        hbox = gtk.HBox(False, 12)
        # Progress bar
        self.progress_bar = HobProgressBar()
        hbox.pack_start(self.progress_bar)
        self.start()
        self.vbox.pack_start(hbox, expand=False, fill=False)

        button = self.add_button("Cancel", gtk.RESPONSE_CANCEL)
        HobAltButton.style_button(button)
        self.show_all()
    def create_visual_elements(self):
        hbox = gtk.HBox(False, 12)
        self.user_label = gtk.Label("The log will open in a text editor")
        hbox.pack_start(self.user_label, expand=False, fill=False)
        self.vbox.pack_start(hbox, expand=False, fill=False)

        hbox = gtk.HBox(False, 12)
        # Progress bar
        self.progress_bar = HobProgressBar()
        hbox.pack_start(self.progress_bar)
        self.start()
        self.vbox.pack_start(hbox, expand=False, fill=False)

        button = self.add_button("Cancel", gtk.RESPONSE_CANCEL)
        HobAltButton.style_button(button)
        self.show_all()
Exemple #16
0
 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 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
Exemple #19
0
    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_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
Exemple #21
0
 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)
Exemple #22
0
 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)
Exemple #23
0
 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 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()
Exemple #25
0
    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
Exemple #26
0
    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
Exemple #27
0
    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 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()
Exemple #29
0
    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()
Exemple #30
0
 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)
Exemple #31
0
 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 create_visual_elements(self):
        if not self.devices:
            self.set_size_request(400, 200)
            first_column = gtk.HBox(spacing=6)
            first_column.set_property("border-width", 6)
            first_column.show()
            self.vbox.add(first_column)
            icon = gtk.Image()
            icon_chk = HobIconChecker()
            icon.set_from_stock(icon_chk.check_stock_icon(gtk.STOCK_DIALOG_WARNING), gtk.ICON_SIZE_DIALOG)
            icon.set_property("xalign", 0.00)
            first_column.pack_start(icon, expand=False, fill=True, padding=0)

            label = gtk.Label()
            label.set_use_markup(True)
            label.set_line_wrap(True)
            label.set_markup("<span font_desc='17' weight=\'bold\'>No external storage\ndevice found</span>")
            label.set_property("xalign", 0.00)
            first_column.add(label)

            label = gtk.Label()
            label.set_use_markup(True)
            label.set_line_wrap(True)
            label.set_markup("<span font_desc='12'>Insert an SD card or USB drive before\ndeploying your image</span>")
            label.set_property("yalign", 0.00)
            self.vbox.add(label)

            button = self.add_button("OK", gtk.RESPONSE_CANCEL)
            HobAltButton.style_button(button)

        else:
            self.set_size_request(350, 300)
            label = gtk.Label()
            label.set_alignment(0.0, 0.5)
            markup = "<span font_desc='17' weight=\'bold\'>External storage device</span>"
            label.set_markup(markup)
            self.vbox.pack_start(label, expand=False, fill=False, padding=2)

            self.device_vendor = gtk.Label()
            self.device_vendor.set_alignment(0.0, 0.5)
            vendor = self.get_vendor_info(self.devices[0])
            if vendor is None:
                vendor = "Not known"
            markup = "<span font_desc='12'>Vendor: %s</span>" % vendor
            self.device_vendor.set_markup(markup)

            self.device_model = gtk.Label()
            self.device_model.set_alignment(0.0, 0.5)
            model = self.get_model_info(self.devices[0])
            if model is None:
                model = "Not known"
            markup = "<span font_desc='12'>Model: %s</span>" % model
            self.device_model.set_markup(markup)

            self.device_size = gtk.Label()
            self.device_size.set_alignment(0.0, 0.5)
            size = float(self.get_size_info(self.devices[0])) * 512 / 1024 / 1024
            if size > 1024:
                size = size/1024
                markup = "<span font_desc='12'>Size: %.2f GB</span>" % size
            else:
                markup = "<span font_desc='12'>Size: %.2f MB</span>" % size
            self.device_size.set_markup(markup)

            if len(self.devices) == 1:
                label = gtk.Label()
                label.set_alignment(0.0, 0.5)
                markup = "<span font_desc='12'>/dev/%s</span>" % self.devices[0]
                label.set_markup(markup)
                self.vbox.pack_start(label, expand=False, fill=False, padding=2)
            else:
                self.usb_combo = gtk.combo_box_new_text()
                self.usb_combo.connect("changed", self.usb_combo_changed_cb)
                model = self.usb_combo.get_model()
                model.clear()
                for usb in self.devices:
                    self.usb_combo.append_text("/dev/" + usb)
                self.usb_combo.set_active(0)
                self.vbox.pack_start(self.usb_combo, expand=False, fill=False)

            label = gtk.Label()
            label.set_alignment(0.0, 0.5)
            markup = "<span font_desc='17' weight=\'bold\'>Device details</span>"
            label.set_markup(markup)
            self.vbox.pack_start(label, expand=False, fill=False, padding=2)

            self.vbox.pack_start(self.device_vendor, expand=False, fill=False, padding=2)
            self.vbox.pack_start(self.device_model, expand=False, fill=False, padding=2)
            self.vbox.pack_start(self.device_size, expand=False, fill=False, padding=2)

            button = self.add_button("Cancel", gtk.RESPONSE_NO)
            HobAltButton.style_button(button)
            button = self.add_button("Deploy image", gtk.RESPONSE_YES)
            tooltip = "Burn your image to an external storage device"
            button.set_tooltip_text(tooltip)
            HobButton.style_button(button)

        self.progress_bar = HobProgressBar()
        self.vbox.pack_start(self.progress_bar, expand=False, fill=False)

        self.vbox.show_all()
        self.progress_bar.hide()
    def show_builded_images_dialog(self, widget, primary_action=""):
        title = primary_action if primary_action else "Your builded images"
        dialog = CrumbsDialog(title, self.builder,
                              gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
        dialog.set_border_width(12)

        label = gtk.Label()
        label.set_use_markup(True)
        label.set_alignment(0.0, 0.5)
        label.set_padding(12,0)
        if primary_action == "Run image":
            label.set_markup("<span font_desc='12'>Select the image file you want to run:</span>")
        elif primary_action == "Deploy image":
            label.set_markup("<span font_desc='12'>Select the image file you want to deploy:</span>")
        else:
            label.set_markup("<span font_desc='12'>Select the image file you want to %s</span>" % primary_action)
        dialog.vbox.pack_start(label, expand=False, fill=False)

        # filter created images as action attribution (deploy or run)
        action_attr = ""
        action_images = []
        for fileitem in self.image_store:
            action_attr = fileitem['action_attr']
            if  (action_attr == 'run' and primary_action == "Run image") \
             or (action_attr == 'deploy' and primary_action == "Deploy image"):
                action_images.append(fileitem)

        # pack the corresponding 'runnable' or 'deploy' radio_buttons, if there has no more than one file.
        # assume that there does not both have 'deploy' and 'runnable' files in the same building result
        # in possible as design.
        curr_row = 0
        rows = (len(action_images)) if len(action_images) < 10 else 10
        table = gtk.Table(rows, 10, True)
        table.set_row_spacings(6)
        table.set_col_spacing(0, 12)
        table.set_col_spacing(5, 12)

        sel_parent_btn = None
        for fileitem in action_images:
            sel_btn = gtk.RadioButton(sel_parent_btn, fileitem['type'])
            sel_parent_btn = sel_btn if not sel_parent_btn else sel_parent_btn
            sel_btn.set_active(fileitem['is_toggled'])
            sel_btn.connect('toggled', self.table_selected_cb, fileitem)
            if curr_row < 10:
                table.attach(sel_btn, 0, 4, curr_row, curr_row + 1, xpadding=24)
            else:
                table.attach(sel_btn, 5, 9, curr_row - 10, curr_row - 9, xpadding=24)
            curr_row += 1

        dialog.vbox.pack_start(table, expand=False, fill=False, padding=6)

        button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL)
        HobAltButton.style_button(button)

        if primary_action:
            button = dialog.add_button(primary_action, gtk.RESPONSE_YES)
            HobButton.style_button(button)

        dialog.show_all()

        response = dialog.run()
        dialog.destroy()

        if response != gtk.RESPONSE_YES:
            return

        for fileitem in self.image_store:
            if fileitem['is_toggled']:
                if fileitem['action_attr'] == 'run':
                    self.builder.runqemu_image(fileitem['name'], self.sel_kernel)
                elif fileitem['action_attr'] == 'deploy':
                    self.builder.deploy_image(fileitem['name'])
Exemple #34
0
    def show_builded_images_dialog(self, widget, primary_action=""):
        title = primary_action if primary_action else "Your builded images"
        dialog = CrumbsDialog(
            title, self.builder,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
        dialog.set_border_width(12)

        label = gtk.Label()
        label.set_use_markup(True)
        label.set_alignment(0.0, 0.5)
        label.set_padding(12, 0)
        if primary_action == "Run image":
            label.set_markup(
                "<span font_desc='12'>Select the image file you want to run:</span>"
            )
        elif primary_action == "Deploy image":
            label.set_markup(
                "<span font_desc='12'>Select the image file you want to deploy:</span>"
            )
        else:
            label.set_markup(
                "<span font_desc='12'>Select the image file you want to %s</span>"
                % primary_action)
        dialog.vbox.pack_start(label, expand=False, fill=False)

        # filter created images as action attribution (deploy or run)
        action_attr = ""
        action_images = []
        for fileitem in self.image_store:
            action_attr = fileitem['action_attr']
            if  (action_attr == 'run' and primary_action == "Run image") \
             or (action_attr == 'deploy' and primary_action == "Deploy image"):
                action_images.append(fileitem)

        # pack the corresponding 'runnable' or 'deploy' radio_buttons, if there has no more than one file.
        # assume that there does not both have 'deploy' and 'runnable' files in the same building result
        # in possible as design.
        curr_row = 0
        rows = (len(action_images)) if len(action_images) < 10 else 10
        table = gtk.Table(rows, 10, True)
        table.set_row_spacings(6)
        table.set_col_spacing(0, 12)
        table.set_col_spacing(5, 12)

        sel_parent_btn = None
        for fileitem in action_images:
            sel_btn = gtk.RadioButton(sel_parent_btn, fileitem['type'])
            sel_parent_btn = sel_btn if not sel_parent_btn else sel_parent_btn
            sel_btn.set_active(fileitem['is_toggled'])
            sel_btn.connect('toggled', self.table_selected_cb, fileitem)
            if curr_row < 10:
                table.attach(sel_btn,
                             0,
                             4,
                             curr_row,
                             curr_row + 1,
                             xpadding=24)
            else:
                table.attach(sel_btn,
                             5,
                             9,
                             curr_row - 10,
                             curr_row - 9,
                             xpadding=24)
            curr_row += 1

        dialog.vbox.pack_start(table, expand=False, fill=False, padding=6)

        button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL)
        HobAltButton.style_button(button)

        if primary_action:
            button = dialog.add_button(primary_action, gtk.RESPONSE_YES)
            HobButton.style_button(button)

        dialog.show_all()

        response = dialog.run()
        dialog.destroy()

        if response != gtk.RESPONSE_YES:
            return

        for fileitem in self.image_store:
            if fileitem['is_toggled']:
                if fileitem['action_attr'] == 'run':
                    self.builder.runqemu_image(fileitem['name'],
                                               self.sel_kernel)
                elif fileitem['action_attr'] == 'deploy':
                    self.builder.deploy_image(fileitem['name'])