本文整理汇总了Python中rigo.ui.gtk3.widgets.notifications.NotificationBox类的典型用法代码示例。如果您正苦于以下问题:Python NotificationBox类的具体用法?Python NotificationBox怎么用?Python NotificationBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NotificationBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _submit_fail
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)
示例2: _on_applications_managed
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()
示例3: _submit_success
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)
示例4: _on_comment_login_failed
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)
示例5: _notify_webservice_na
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)
示例6: _append_repositories_update
def _append_repositories_update(self):
"""
Add a NotificationBox related to Repositories Update
Activity in progress.
"""
msg = _("Repositories Update in <b>progress</b>...")
box = NotificationBox(
msg, message_type=Gtk.MessageType.INFO,
context_id=self.UNIQUE_CONTEXT_ID)
box.add_button(_("Show me"), self._on_work_view_show)
self.append(box)
示例7: _on_comment_login_success
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)
示例8: _show_removal_error
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()
示例9: _on_stars_login_success
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)
示例10: _easter_eggs
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_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)
示例11: _notify_vote_submit
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)
示例12: _notify_comment_submit
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)
示例13: _on_repo_updated
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)
示例14: _on_repository_toggle
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)
示例15: _append_upgrading_system
def _append_upgrading_system(self):
"""
Add a NotificationBox related to System Upgrade
Activity in progress.
"""
msg = _("<b>System Upgrade</b> in progress...")
box = NotificationBox(
msg, message_type=Gtk.MessageType.INFO,
context_id=self.UNIQUE_CONTEXT_ID)
def _show_me(widget):
self._on_work_view_show(widget)
w, h = self._window.get_size()
self._window.resize(w, 1)
box.add_button(_("Show me"), _show_me)
box.add_button(_("Activity"), self._on_show_activity)
box.add_button(_("Interrupt"), self._on_work_interrupt)
self.append(box)