Exemple #1
0
    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