Beispiel #1
0
    def _set_problem(self, problem):
        def destroy_links(widget, _):
            if widget != self._builder.lbl_reported_value:
                widget.destroy()

        self.selected_problem = problem

        sensitive_btn = problem is not None
        self._builder.btn_delete.set_sensitive(sensitive_btn)
        self._builder.btn_report.set_sensitive(
                sensitive_btn and not problem['not-reportable'])
        self._builder.vbx_links.foreach(
                destroy_links, None)
        self._builder.vbx_problem_messages.foreach(
                lambda w, u: w.destroy(), None)

        if problem:
            self._builder.nb_problem_layout.set_current_page(0)
            app = problem['application']
            if problem['type'] == 'Kerneloops':
                self._builder.lbl_reason.set_text(
            _("Unexpected system error"))
                self._builder.lbl_summary.set_text(
            _("The system has encountered a problem and recovered."))
            elif problem['type'] == 'vmcore':
                self._builder.lbl_reason.set_text(
            _("Fatal system failure"))
                self._builder.lbl_summary.set_text(
            _("The system has encountered a problem and could not continue."))
            else:
                if not app.name:
                    self._builder.lbl_reason.set_text(
                            # Translators: If Application's name is unknown,
                            # display neutral header
                            # "'Type' problem has been detected". Examples:
                            #  Kerneloops problem has been detected
                            #  C/C++ problem has been detected
                            #  Python problem has been detected
                            #  Ruby problem has been detected
                            #  VMCore problem has been detected
                            #  AVC problem has been detected
                            #  Java problem has been detected
                            _("{0} problem has been detected").format(
                                    problem['human_type']))
                else:
                    self._builder.lbl_reason.set_text(
                            _("{0} quit unexpectedly").format(app.name))

                self._builder.lbl_summary.set_text(
            _("The application encountered a problem and could not continue."))

            self._builder.lbl_app_name_value.set_text(
                        # Translators: package name not available
                        problem['package_name'] or _("N/A"))
            self._builder.lbl_app_version_value.set_text(
                        # Translators: package version not available
                        problem['package_version'] or _("N/A"))
            self._builder.lbl_detected_value.set_text(
                humanize.naturaltime(datetime.datetime.now()-problem['date']))
            self._builder.lbl_detected_value.set_tooltip_text(
                problem['date'].strftime(config.get_configuration()['D_T_FMT']))

            icon_buf = None
            scale = self._builder.img_app_icon.get_scale_factor()
            if app.icon:
                icon_buf = load_icon(gicon=app.icon, scale=scale)

            if icon_buf is None:
                icon_buf = load_icon(name="system-run-symbolic", scale=scale)
                self._builder.img_app_icon.get_style_context().add_class(
                                                                    'dim-label')
            else:
                self._builder.img_app_icon.get_style_context().remove_class(
                                                                    'dim-label')

            # icon_buf can be None and if it is None, no icon will be displayed
            set_icon_from_pixbuf_with_scale(self._builder.img_app_icon,
                                            icon_buf, scale)

            self._builder.lbl_reported_value.show()
            self._builder.lbl_reported.set_text(_("Reported"))
            if problem['not-reportable']:
                self._builder.lbl_reported_value.set_text(
                        _('cannot be reported'))
                self._show_problem_links(problem['submission'])
                self._show_problem_message(problem['not-reportable'])
            elif problem['is_reported']:
                if self._show_problem_links(problem['submission']):
                    self._builder.lbl_reported.set_text(_("Reports"))
                    self._builder.lbl_reported_value.hide()

                    if (not any((s.name == "Bugzilla"
                                for s in problem['submission']))):
                        self._show_problem_message(
_("This problem has been reported, but a <i>Bugzilla</i> ticket has not"
" been opened. Our developers may need more information to fix the problem.\n"
"Please consider also <b>reporting it</b> to Bugzilla in"
" order to provide that. Thank you."))
                else:
                    # Translators: Displayed after 'Reported' if a problem
                    # has been reported but we don't know where and when.
                    # Probably a rare situation, usually if a problem is
                    # reported we display a list of reports here.
                    self._builder.lbl_reported_value.set_text(_('yes'))
            else:
                # Translators: Displayed after 'Reported' if a problem
                # has not been reported.
                self._builder.lbl_reported_value.set_text(_('no'))
        else:
            if self._source is not None:
                self._builder.nb_problem_layout.set_current_page(1)
            else:
                self._builder.nb_problem_layout.set_current_page(2)
Beispiel #2
0
    def _set_problem(self, problem):
        def destroy_links(widget, _):
            if widget != self.lbl_reported_value:
                widget.destroy()

        self.selected_problem = problem

        sensitive_btn = problem is not None
        self.btn_delete.set_sensitive(sensitive_btn)
        self.btn_report.set_sensitive(sensitive_btn
                                      and not problem['not-reportable'])
        self.vbx_links.foreach(destroy_links, None)
        self.vbx_problem_messages.foreach(lambda w, u: w.destroy(), None)

        if problem:
            self.nb_problem_layout.set_current_page(0)
            app = problem['application']
            if problem['type'] == 'Kerneloops':
                self.lbl_reason.set_text(_("Unexpected system error"))
                self.lbl_summary.set_text(
                    _("The system has encountered a problem and recovered."))
            elif problem['type'] == 'vmcore':
                self.lbl_reason.set_text(_("Fatal system failure"))
                self.lbl_summary.set_text(
                    _("The system has encountered a problem and could not continue."
                      ))
            else:
                if not app.name:
                    self.lbl_reason.set_text(
                        # Translators: If Application's name is unknown,
                        # display neutral header
                        # "'Type' problem has been detected". Examples:
                        #  Kerneloops problem has been detected
                        #  C/C++ problem has been detected
                        #  Python problem has been detected
                        #  Ruby problem has been detected
                        #  VMCore problem has been detected
                        #  AVC problem has been detected
                        #  Java problem has been detected
                        _("{0} problem has been detected").format(
                            problem['human_type']))
                else:
                    self.lbl_reason.set_text(
                        _("{0} quit unexpectedly").format(app.name))

                self.lbl_summary.set_text(
                    _("The application encountered a problem and could not continue."
                      ))

            self.lbl_app_name_value.set_text(
                # Translators: package name not available
                problem['package_name'] or _("N/A"))
            self.lbl_app_version_value.set_text(
                # Translators: package version not available
                problem['package_version'] or _("N/A"))
            self.lbl_detected_value.set_text(
                humanize.naturaltime(datetime.datetime.now() -
                                     problem['date']))
            self.lbl_detected_value.set_tooltip_text(problem['date'].strftime(
                config.get_configuration()['D_T_FMT']))

            icon_buf = None
            scale = self.img_app_icon.get_scale_factor()
            if app.icon:
                icon_buf = load_icon(gicon=app.icon, scale=scale)

            if icon_buf is None:
                icon_buf = load_icon(name="system-run-symbolic", scale=scale)
                self.img_app_icon.get_style_context().add_class('dim-label')
            else:
                self.img_app_icon.get_style_context().remove_class('dim-label')

            # icon_buf can be None and if it is None, no icon will be displayed
            set_icon_from_pixbuf_with_scale(self.img_app_icon, icon_buf, scale)

            self.lbl_reported_value.show()
            self.lbl_reported.set_text(_("Reported"))
            if problem['not-reportable']:
                self.lbl_reported_value.set_text(_('cannot be reported'))
                self._show_problem_links(problem['submission'])
                self._show_problem_message(problem['not-reportable'])
            elif problem['is_reported']:
                if self._show_problem_links(problem['submission']):
                    self.lbl_reported.set_text(_("Reports"))
                    self.lbl_reported_value.hide()

                    if (not any((s.name == "Bugzilla"
                                 for s in problem['submission']))):
                        self._show_problem_message(
                            _("This problem has been reported, but a <i>Bugzilla</i> ticket has not"
                              " been opened. Our developers may need more information to fix the problem.\n"
                              "Please consider also <b>reporting it</b> to Bugzilla in"
                              " order to provide that. Thank you."))
                else:
                    # Translators: Displayed after 'Reported' if a problem
                    # has been reported but we don't know where and when.
                    # Probably a rare situation, usually if a problem is
                    # reported we display a list of reports here.
                    self.lbl_reported_value.set_text(_('yes'))
            else:
                # Translators: Displayed after 'Reported' if a problem
                # has not been reported.
                self.lbl_reported_value.set_text(_('no'))
        else:
            if self._source is not None:
                self.nb_problem_layout.set_current_page(1)
            else:
                self.nb_problem_layout.set_current_page(2)
Beispiel #3
0
    def _set_problem(self, problem):
        def destroy_links(widget, _):
            if widget != self._builder.lbl_reported_value:
                widget.destroy()

        self.selected_problem = problem

        sensitive_btn = problem is not None
        self._builder.btn_delete.set_sensitive(sensitive_btn)
        self._builder.btn_report.set_sensitive(sensitive_btn and not problem["not-reportable"])
        self._builder.vbx_links.foreach(destroy_links, None)
        self._builder.vbx_problem_messages.foreach(lambda w, u: w.destroy(), None)

        if problem:
            self._builder.nb_problem_layout.set_current_page(0)
            app = problem["application"]
            if problem["type"] == "Kerneloops":
                self._builder.lbl_reason.set_text(_("Unexpected system error"))
                self._builder.lbl_summary.set_text(_("The system has encountered a problem and recovered."))
            elif problem["type"] == "vmcore":
                self._builder.lbl_reason.set_text(_("Fatal system failure"))
                self._builder.lbl_summary.set_text(_("The system has encountered a problem and could not continue."))
            else:
                if not app.name:
                    # If Application's name is unknown, display neutral
                    # header "'Type' problem has been detected":
                    #  Kerneloops problem has been detected
                    #  C/C++ problem has been detected
                    #  Python problem has been detected
                    #  Ruby problem has been detected
                    #  VMCore problem has been detected
                    #  AVC problem has been detected
                    #  Java problem has been detected
                    self._builder.lbl_reason.set_text(_("{0} problem has been detected").format(problem["human_type"]))
                else:
                    self._builder.lbl_reason.set_text(_("{0} quit unexpectedly").format(app.name))

                self._builder.lbl_summary.set_text(_("The application encountered a problem and could not continue."))

            self._builder.lbl_app_name_value.set_text(problem["package_name"] or _("N/A"))
            self._builder.lbl_app_version_value.set_text(problem["package_version"] or _("N/A"))
            self._builder.lbl_detected_value.set_text(humanize.naturaltime(datetime.datetime.now() - problem["date"]))
            self._builder.lbl_detected_value.set_tooltip_text(
                problem["date"].strftime(config.get_configuration()["D_T_FMT"])
            )

            icon_buf = None
            scale = self._builder.img_app_icon.get_scale_factor()
            if app.icon:
                icon_buf = load_icon(gicon=app.icon, scale=scale)

            if icon_buf is None:
                icon_buf = load_icon(name="system-run-symbolic", scale=scale)

            # icon_buf can be None and if it is None, no icon will be displayed
            set_icon_from_pixbuf_with_scale(self._builder.img_app_icon, icon_buf, scale)

            self._builder.lbl_reported_value.show()
            self._builder.lbl_reported.set_text(_("Reported"))
            if problem["not-reportable"]:
                self._builder.lbl_reported_value.set_text(_("cannot be reported"))
                self._show_problem_links(problem["submission"])
                self._show_problem_message(problem["not-reportable"])
            elif problem["is_reported"]:
                if self._show_problem_links(problem["submission"]):
                    self._builder.lbl_reported.set_text(_("Reports"))
                    self._builder.lbl_reported_value.hide()

                    if not any((s.name == "Bugzilla" for s in problem["submission"])):
                        self._show_problem_message(
                            _(
                                "This problem has been reported, but a <i>Bugzilla</i> ticket has not"
                                " been opened. Our developers may need more information to fix the problem.\n"
                                "Please consider also <b>reporting it</b> to Bugzilla in"
                                " order to provide that. Thank you."
                            )
                        )
                else:
                    self._builder.lbl_reported_value.set_text(_("yes"))
            else:
                self._builder.lbl_reported_value.set_text(_("no"))
        else:
            if self._source is not None:
                self._builder.nb_problem_layout.set_current_page(1)
            else:
                self._builder.nb_problem_layout.set_current_page(2)