Exemplo n.º 1
0
 def _submit_fail():
     box = NotificationBox(
         _("Comment submit error: <i>%s</i>") % (err_msg,),
         message_type=Gtk.MessageType.ERROR,
         context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)
     box.add_destroy_button(_("Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 2
0
 def _submit_fail():
     box = NotificationBox(
         _("Comment submit error: <i>%s</i>") % (err_msg, ),
         message_type=Gtk.MessageType.ERROR,
         context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)
     box.add_destroy_button(_("Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 3
0
    def _on_applications_managed(self, widget, success, local_activity):
        """
        Emitted by RigoServiceController telling us that
        enqueue application actions have been completed.
        """
        msg = "N/A"
        if not success:
            if local_activity == LocalActivityStates.MANAGING_APPLICATIONS:
                msg = "<b>%s</b>: %s" % (
                    _("Application Management Error"),
                    _("please check the management log"),)
            elif local_activity == LocalActivityStates.UPGRADING_SYSTEM:
                msg = "<b>%s</b>: %s" % (
                    _("System Upgrade Error"),
                    _("please check the upgrade log"),)
            message_type = Gtk.MessageType.ERROR
        else:
            if local_activity == LocalActivityStates.MANAGING_APPLICATIONS:
                msg = _("Applications managed <b>successfully</b>!")
            elif local_activity == LocalActivityStates.UPGRADING_SYSTEM:
                msg = _("System Upgraded <b>successfully</b>!")
            message_type = Gtk.MessageType.INFO

        box = NotificationBox(
            msg, message_type=message_type,
            context_id=RigoServiceController.NOTIFICATION_CONTEXT_ID)
        box.add_destroy_button(_("Ok, thanks"))
        box.add_button(_("Show me"), self._on_show_work_view)
        self._nc.append(box)
        self._work_view_c.deactivate_app_box()
Exemplo n.º 4
0
 def _submit_success():
     nbox = NotificationBox(
         _("Your vote has been added!"),
         message_type=Gtk.MessageType.INFO,
         context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)
     nbox.add_destroy_button(_("Ok, great!"))
     self._nc.append(nbox, timeout=10)
     self._on_redraw_request(None, app.get_details().pkg)
Exemplo n.º 5
0
 def _submit_success():
     nbox = NotificationBox(
         _("Your vote has been added!"),
         message_type=Gtk.MessageType.INFO,
         context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)
     nbox.add_destroy_button(_("Ok, great!"))
     self._nc.append(nbox, timeout=10)
     self._on_redraw_request(None, app.get_details().pkg)
Exemplo n.º 6
0
 def _on_comment_login_failed(self, widget, app):
     """
     Entropy Web Services Login failed message.
     """
     box = NotificationBox(
         _("Login failed. Your <b>comment</b> hasn't been added"),
         message_type=Gtk.MessageType.ERROR,
         context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)
     box.add_destroy_button(_("_Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 7
0
 def _on_comment_login_failed(self, widget, app):
     """
     Entropy Web Services Login failed message.
     """
     box = NotificationBox(
         _("Login failed. Your <b>comment</b> hasn't been added"),
         message_type=Gtk.MessageType.ERROR,
         context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)
     box.add_destroy_button(_("_Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 8
0
 def _notify_webservice_na(self, app, context_id):
     """
     Notify Web Service unavailability for given Application object.
     """
     box = NotificationBox(
         "%s: <b>%s</b>" % (
             _("Entropy Web Services not available for repository"),
             app.get_details().channelname),
         message_type=Gtk.MessageType.ERROR,
         context_id=context_id)
     box.add_destroy_button(_("Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 9
0
 def _notify_webservice_na(self, app, context_id):
     """
     Notify Web Service unavailability for given Application object.
     """
     box = NotificationBox(
         "%s: <b>%s</b>" %
         (_("Entropy Web Services not available for repository"),
          app.get_details().channelname),
         message_type=Gtk.MessageType.ERROR,
         context_id=context_id)
     box.add_destroy_button(_("Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 10
0
 def _submit_fail(err_msg):
     if err_msg is None:
         box = NotificationBox(
             _("You already voted this <b>Application</b>"),
             message_type=Gtk.MessageType.ERROR,
             context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)
     else:
         box = NotificationBox(
             _("Vote error: <i>%s</i>") % (err_msg,),
             message_type=Gtk.MessageType.ERROR,
             context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)
     box.add_destroy_button(_("Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 11
0
    def _notify_vote_submit(self, app, username, vote):
        """
        Notify User about Comment submission with current credentials.
        """
        msg = ngettext("Rate <b>%s</b> as <b>%s</b>, with <b>%d</b> star?",
                       "Rate <b>%s</b> as <b>%s</b>, with <b>%d</b> stars?",
                       vote)
        msg = msg % (
            app.name,
            escape_markup(username),
            vote,
        )
        box = NotificationBox(msg,
                              message_type=Gtk.MessageType.INFO,
                              context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)

        def _vote_submit(widget):
            self._vote_submit(app, username, vote)

        box.add_button(_("_Ok, cool!"), _vote_submit)

        def _send_vote():
            self._on_stars_clicked(self._stars, app=app)

        def _logout_webservice(widget):
            self._logout_webservice(app, _send_vote)

        box.add_button(_("_No, logout!"), _logout_webservice)

        box.add_destroy_button(_("_Later"))
        self._nc.append(box)
Exemplo n.º 12
0
    def _show_removal_error(self, err):
        """
        During Comment removal, the WebService raised an auth error
        """
        msg = "<b>%s</b>: %s" % (escape_markup(
            _("Cannot remove comment")), err)
        box = NotificationBox(
            msg,
            message_type=Gtk.MessageType.ERROR,
            context_id=self.COMMENT_REMOVE_NOTIFICATION_CONTEXT)

        box.add_destroy_button(_("_Ok, thanks"))
        self._nc.append(box)
        self.show()
Exemplo n.º 13
0
 def _on_comment_login_success(self, widget, username, app):
     """
     Notify user that we successfully logged in!
     """
     box = NotificationBox(
         _("Logged in as <b>%s</b>! How about your <b>comment</b>?") \
             % (escape_markup(username),),
         message_type=Gtk.MessageType.INFO,
         context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)
     def _send_comment(widget):
         self._on_send_comment(widget, app=app)
     box.add_button(_("_Send now"), _send_comment)
     box.add_destroy_button(_("_Later"))
     self._nc.append(box)
Exemplo n.º 14
0
    def _notify_comment_submit(self, app, username, text):
        """
        Notify User about Comment submission with current credentials.
        """
        box = NotificationBox(
            _("You are about to add a <b>comment</b> as <b>%s</b>.") \
                % (escape_markup(username),),
            message_type=Gtk.MessageType.INFO,
            context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)

        def _comment_submit(widget):
            self._comment_submit(app, username, text)

        box.add_button(_("_Ok, cool!"), _comment_submit)

        def _send_comment():
            self._on_send_comment(None, app=app)

        def _logout_webservice(widget):
            self._logout_webservice(app, _send_comment)

        box.add_button(_("_No, logout!"), _logout_webservice)

        box.add_destroy_button(_("_Later"))
        self._nc.append(box)
Exemplo n.º 15
0
    def _show_removal_error(self, err):
        """
        During Comment removal, the WebService raised an auth error
        """
        msg = "<b>%s</b>: %s" % (
            escape_markup(_("Cannot remove comment")),
            err)
        box = NotificationBox(
            msg,
            message_type=Gtk.MessageType.ERROR,
            context_id=self.COMMENT_REMOVE_NOTIFICATION_CONTEXT)

        box.add_destroy_button(_("_Ok, thanks"))
        self._nc.append(box)
        self.show()
Exemplo n.º 16
0
 def _notify():
     msg = _("Application <b>%s</b> not found")
     msg = msg % (dependency, )
     box = NotificationBox(prepare_markup(msg),
                           message_type=Gtk.MessageType.ERROR,
                           context_id="AppRemoveNotFoundContextId")
     self._nc.append(box, timeout=10)
Exemplo n.º 17
0
    def _on_stars_login_success(self, widget, username, app):
        """
        Notify user that we successfully logged in!
        """
        box = NotificationBox(
            _("Logged in as <b>%s</b>! How about your <b>vote</b>?") \
                % (escape_markup(username),),
            message_type=Gtk.MessageType.INFO,
            context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)

        def _send_vote(widget):
            self._on_stars_clicked(self._stars, app=app)
        box.add_button(_("_Vote now"), _send_vote)

        box.add_destroy_button(_("_Later"))
        self._nc.append(box)
Exemplo n.º 18
0
        def _submit_success(doc):
            box = CommentBox(self._nc, self._avc, webserv, doc, is_last=True)
            box.connect("destroy", self._on_comment_box_destroy)

            self.__clean_my_non_comment_boxes()
            box.render()
            self._app_my_comments_box.pack_start(box, False, False, 2)
            box.show()
            self._app_my_comments_box.show()

            nbox = NotificationBox(
                _("Your comment has been submitted!"),
                message_type=Gtk.MessageType.INFO,
                context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)
            nbox.add_destroy_button(_("Ok, great!"))
            self._app_comment_text_buffer.set_text("")
            self._nc.append(nbox, timeout=10)
Exemplo n.º 19
0
        def _submit_success(doc):
            box = CommentBox(self._nc, self._avc, webserv, doc, is_last=True)
            box.connect("destroy", self._on_comment_box_destroy)

            self.__clean_my_non_comment_boxes()
            box.render()
            self._app_my_comments_box.pack_start(box, False, False, 2)
            box.show()
            self._app_my_comments_box.show()

            nbox = NotificationBox(
                _("Your comment has been submitted!"),
                message_type=Gtk.MessageType.INFO,
                context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)
            nbox.add_destroy_button(_("Ok, great!"))
            self._app_comment_text_buffer.set_text("")
            self._nc.append(nbox, timeout=10)
Exemplo n.º 20
0
 def _notify():
     msg = "%s: %s" % (
         _("Cannot save configuration file"),
         self.source(),
     )
     box = NotificationBox(escape_markup(msg),
                           message_type=Gtk.MessageType.ERROR,
                           context_id="ConfigUpdateErrorContextId")
     self._nc.append(box)
Exemplo n.º 21
0
 def _notify_error(self, message):
     """
     Notify a generic configuration management action error.
     """
     box = NotificationBox(
         prepare_markup(message),
         message_type=Gtk.MessageType.ERROR,
         context_id="ConfigUpdateErrorContextId")
     self._nc.append(box, timeout=10)
Exemplo n.º 22
0
 def _easter_eggs(self):
     """
     Moo!
     """
     msg = None
     if entropy.tools.is_st_valentine():
         msg = escape_markup(_("Happy St. Valentine <3 <3 !"))
     elif entropy.tools.is_xmas():
         msg = escape_markup(_("Merry Xmas \o/ !"))
     elif entropy.tools.is_author_bday():
         msg = escape_markup(_("Happy birthday to my authoooooor!"))
     elif entropy.tools.is_april_first():
         msg = escape_markup(_("<=|=< (this is optimistically a fish)"))
     if msg is not None:
         box = NotificationBox(
             msg, message_type=Gtk.MessageType.INFO,
             context_id="EasterEggs")
         box.add_destroy_button(_("Woot, thanks"))
         self._nc.append(box)
Exemplo n.º 23
0
 def _easter_eggs(self):
     """
     Moo!
     """
     msg = None
     if entropy.tools.is_st_valentine():
         msg = escape_markup(_("Happy St. Valentine <3 <3 !"))
     elif entropy.tools.is_xmas():
         msg = escape_markup(_("Merry Xmas \o/ !"))
     elif entropy.tools.is_author_bday():
         msg = escape_markup(_("Happy birthday to my authoooooor!"))
     elif entropy.tools.is_april_first():
         msg = escape_markup(_("<=|=< (this is optimistically a fish)"))
     if msg is not None:
         box = NotificationBox(msg,
                               message_type=Gtk.MessageType.INFO,
                               context_id="EasterEggs")
         box.add_destroy_button(_("Woot, thanks"))
         self._nc.append(box)
Exemplo n.º 24
0
    def _on_applications_managed(self, widget, success, local_activity):
        """
        Emitted by RigoServiceController telling us that
        enqueue application actions have been completed.
        """
        msg = "N/A"
        if not success:
            if local_activity == LocalActivityStates.MANAGING_APPLICATIONS:
                msg = "<b>%s</b>: %s" % (
                    _("Application Management Error"),
                    _("please check the management log"),
                )
            elif local_activity == LocalActivityStates.UPGRADING_SYSTEM:
                msg = "<b>%s</b>: %s" % (
                    _("System Upgrade Error"),
                    _("please check the upgrade log"),
                )
            message_type = Gtk.MessageType.ERROR
        else:
            if local_activity == LocalActivityStates.MANAGING_APPLICATIONS:
                msg = _("Applications managed <b>successfully</b>!")
            elif local_activity == LocalActivityStates.UPGRADING_SYSTEM:
                msg = _("System Upgraded <b>successfully</b>!")
            message_type = Gtk.MessageType.INFO

        box = NotificationBox(
            msg,
            message_type=message_type,
            context_id=RigoServiceController.NOTIFICATION_CONTEXT_ID)
        box.add_destroy_button(_("Ok, thanks"))
        box.add_button(_("Show me"), self._on_show_work_view)
        self._nc.append(box)
        self._work_view_c.deactivate_app_box()
Exemplo n.º 25
0
    def _on_repo_updated(self, widget, result, message):
        """
        Emitted by RigoServiceController telling us that
        repositories have been updated.
        """
        with self._state_mutex:
            self._current_state_lock = False
        self._search_entry.set_sensitive(True)
        if result != 0:
            msg = "<b>%s</b>: %s" % (
                _("Repositories update error"),
                message,)
            message_type = Gtk.MessageType.ERROR
        else:
            msg = _("Repositories updated <b>successfully</b>!")
            message_type = Gtk.MessageType.INFO

        box = NotificationBox(
            msg, message_type=message_type,
            context_id=RigoServiceController.NOTIFICATION_CONTEXT_ID)
        box.add_destroy_button(_("Ok, thanks"))
        self._nc.append(box)
Exemplo n.º 26
0
    def _on_repository_toggle(self, widget, path, repo):
        """
        Enable/Disable Repository event from View
        """
        enabled = repo.enabled()
        repository = repo.repository()

        if enabled:
            outcome = self._service.disable_repository(repository)
        else:
            outcome = self._service.enable_repository(repository)
        if not outcome and self._nc is not None:
            if enabled:
                msg = _("Cannot disable <b>%s</b>. Sorry!")
            else:
                msg = _("Cannot enable <b>%s</b>. Sorry!")

            box = NotificationBox(
                prepare_markup(msg % (repository,)),
                message_type=Gtk.MessageType.WARNING,
                context_id=self._service.REPOSITORY_SETTINGS_CONTEXT_ID)
            box.add_destroy_button(_("_Ok"))
            self._nc.append(box)
Exemplo n.º 27
0
    def _on_repository_toggle(self, widget, path, repo):
        """
        Enable/Disable Repository event from View
        """
        enabled = repo.enabled()
        repository = repo.repository()

        if enabled:
            outcome = self._service.disable_repository(repository)
        else:
            outcome = self._service.enable_repository(repository)
        if not outcome and self._nc is not None:
            if enabled:
                msg = _("Cannot disable <b>%s</b>. Sorry!")
            else:
                msg = _("Cannot enable <b>%s</b>. Sorry!")

            box = NotificationBox(
                prepare_markup(msg % (repository, )),
                message_type=Gtk.MessageType.WARNING,
                context_id=self._service.REPOSITORY_SETTINGS_CONTEXT_ID)
            box.add_destroy_button(_("_Ok"))
            self._nc.append(box)
Exemplo n.º 28
0
    def _on_repo_updated(self, widget, result, message):
        """
        Emitted by RigoServiceController telling us that
        repositories have been updated.
        """
        with self._state_mutex:
            self._current_state_lock = False
        self._search_entry.set_sensitive(True)
        if result != 0:
            msg = "<b>%s</b>: %s" % (
                _("Repositories update error"),
                message,
            )
            message_type = Gtk.MessageType.ERROR
        else:
            msg = _("Repositories updated <b>successfully</b>!")
            message_type = Gtk.MessageType.INFO

        box = NotificationBox(
            msg,
            message_type=message_type,
            context_id=RigoServiceController.NOTIFICATION_CONTEXT_ID)
        box.add_destroy_button(_("Ok, thanks"))
        self._nc.append(box)
Exemplo n.º 29
0
 def _submit_fail(err_msg):
     if err_msg is None:
         box = NotificationBox(
             _("You already voted this <b>Application</b>"),
             message_type=Gtk.MessageType.ERROR,
             context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)
     else:
         box = NotificationBox(
             _("Vote error: <i>%s</i>") % (err_msg, ),
             message_type=Gtk.MessageType.ERROR,
             context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)
     box.add_destroy_button(_("Ok, thanks"))
     self._nc.append(box)
Exemplo n.º 30
0
    def _on_comment_login_success(self, widget, username, app):
        """
        Notify user that we successfully logged in!
        """
        box = NotificationBox(
            _("Logged in as <b>%s</b>! How about your <b>comment</b>?") \
                % (escape_markup(username),),
            message_type=Gtk.MessageType.INFO,
            context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)

        def _send_comment(widget):
            self._on_send_comment(widget, app=app)

        box.add_button(_("_Send now"), _send_comment)
        box.add_destroy_button(_("_Later"))
        self._nc.append(box)
Exemplo n.º 31
0
    def _on_stars_login_success(self, widget, username, app):
        """
        Notify user that we successfully logged in!
        """
        box = NotificationBox(
            _("Logged in as <b>%s</b>! How about your <b>vote</b>?") \
                % (escape_markup(username),),
            message_type=Gtk.MessageType.INFO,
            context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)

        def _send_vote(widget):
            self._on_stars_clicked(self._stars, app=app)

        box.add_button(_("_Vote now"), _send_vote)

        box.add_destroy_button(_("_Later"))
        self._nc.append(box)
Exemplo n.º 32
0
    def _notify_comment_submit(self, app, username, text):
        """
        Notify User about Comment submission with current credentials.
        """
        box = NotificationBox(
            _("You are about to add a <b>comment</b> as <b>%s</b>.") \
                % (escape_markup(username),),
            message_type=Gtk.MessageType.INFO,
            context_id=self.COMMENT_NOTIFICATION_CONTEXT_ID)

        def _comment_submit(widget):
            self._comment_submit(app, username, text)
        box.add_button(_("_Ok, cool!"), _comment_submit)

        def _send_comment():
            self._on_send_comment(None, app=app)
        def _logout_webservice(widget):
            self._logout_webservice(app, _send_comment)
        box.add_button(_("_No, logout!"), _logout_webservice)

        box.add_destroy_button(_("_Later"))
        self._nc.append(box)
Exemplo n.º 33
0
    def _notify_vote_submit(self, app, username, vote):
        """
        Notify User about Comment submission with current credentials.
        """
        msg = ngettext("Rate <b>%s</b> as <b>%s</b>, with <b>%d</b> star?",
                       "Rate <b>%s</b> as <b>%s</b>, with <b>%d</b> stars?",
                       vote)
        msg = msg % (app.name, escape_markup(username), vote,)
        box = NotificationBox(msg,
            message_type=Gtk.MessageType.INFO,
            context_id=self.VOTE_NOTIFICATION_CONTEXT_ID)

        def _vote_submit(widget):
            self._vote_submit(app, username, vote)
        box.add_button(_("_Ok, cool!"), _vote_submit)

        def _send_vote():
            self._on_stars_clicked(self._stars, app=app)
        def _logout_webservice(widget):
            self._logout_webservice(app, _send_vote)
        box.add_button(_("_No, logout!"), _logout_webservice)

        box.add_destroy_button(_("_Later"))
        self._nc.append(box)