本文整理汇总了Python中gi.repository.Gtk.STOCK_DIALOG_INFO属性的典型用法代码示例。如果您正苦于以下问题:Python Gtk.STOCK_DIALOG_INFO属性的具体用法?Python Gtk.STOCK_DIALOG_INFO怎么用?Python Gtk.STOCK_DIALOG_INFO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.STOCK_DIALOG_INFO属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: offerDeclined
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def offerDeclined(self, offer):
log.debug("Human.offerDeclined: self=%s %s" % (self, offer))
assert offer.type in ACTION_NAMES
heading = _("%s was declined by your opponent") % ACTION_NAMES[
offer.type]
text = _("Resend %s?" % ACTION_NAMES[offer.type].lower())
content = InfoBar.get_message_content(heading, text,
Gtk.STOCK_DIALOG_INFO)
def response_cb(infobar, response, message):
if response == Gtk.ResponseType.ACCEPT:
self.emit("offer", offer)
message.dismiss()
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
message.add_button(InfoBarMessageButton(
_("Resend"), Gtk.ResponseType.ACCEPT))
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.gmwidg.replaceMessages(message)
示例2: offerWithdrawn
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def offerWithdrawn(self, offer):
log.debug("Human.offerWithdrawn: self=%s %s" % (self, offer))
assert offer.type in ACTION_NAMES
heading = _("%s was withdrawn by your opponent") % ACTION_NAMES[
offer.type]
text = _("Your opponent seems to have changed their mind.")
content = InfoBar.get_message_content(heading, text,
Gtk.STOCK_DIALOG_INFO)
def response_cb(infobar, response, message):
message.dismiss()
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.gmwidg.showMessage(message)
示例3: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def __init__(self):
Gtk.InfoBar.__init__(self)
self.set_message_type(Gtk.MessageType.INFO)
title_label = Gtk.Label()
title_label.set_markup("<b>{}</b>".format(_("Template mode")))
title_label.set_alignment(0.0, 0.5)
msg_label = Gtk.Label()
msg_label.set_markup(_("You are currently editing a template."))
msg_label.set_alignment(0.0, 0.5)
vbox = Gtk.VBox(spacing=5)
vbox.pack_start(title_label, False, False, 0)
vbox.pack_start(msg_label, False, False, 0)
image = Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.DIALOG)
content = self.get_content_area()
content.pack_start(image, False, False, 0)
content.pack_start(vbox, False, False, 0)
self.show_all()
示例4: offer_callback
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def offer_callback(self, player, offer, gamemodel, gmwidg):
if gamemodel.status != RUNNING:
# If the offer has already been handled by Gamemodel and the game was
# drawn, we need to do nothing
return
message = ""
if offer.type == ABORT_OFFER:
message = _("You sent an abort offer")
elif offer.type == ADJOURN_OFFER:
message = _("You sent an adjournment offer")
elif offer.type == DRAW_OFFER:
message = _("You sent a draw offer")
elif offer.type == PAUSE_OFFER:
message = _("You sent a pause offer")
elif offer.type == RESUME_OFFER:
message = _("You sent a resume offer")
elif offer.type == TAKEBACK_OFFER:
message = _("You sent an undo offer")
elif offer.type == HURRY_ACTION:
message = _("You asked your opponent to move")
elif offer.type == FLAG_CALL:
message = _("You sent flag call")
else:
return
def response_cb(infobar, response, message):
message.dismiss()
return False
content = InfoBar.get_message_content("", message, Gtk.STOCK_DIALOG_INFO)
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
gmwidg.replaceMessages(message)
return False
# ===============================================================================
# Subfunctions
# ===============================================================================
示例5: hurry
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def hurry(self):
title = _("Your opponent asks you to hurry!")
text = _(
"Generally this means nothing, as the game is time-based, but if you want to \
please your opponent, perhaps you should get going.")
content = InfoBar.get_message_content(title, text,
Gtk.STOCK_DIALOG_INFO)
def response_cb(infobar, response, message):
message.dismiss()
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.gmwidg.showMessage(message)
示例6: create_complete_page
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def create_complete_page(self):
label = Gtk.Label(label="Congratulations!")
button = Gtk.Button.new_with_label("Edit Setup")
button.connect("clicked", self.on_edit_setup_clicked)
dummy_box_left = Gtk.VBox(spacing=6)
dummy_box_right = Gtk.VBox(spacing=6)
dummy_box_right.pack_start(button, False, False, 0)
dummy_container_box = Gtk.HBox(spacing=6)
dummy_container_box.pack_start(dummy_box_left, True, True, 0)
dummy_container_box.pack_start(dummy_box_right, False, False, 0)
page_box = Gtk.VBox(spacing=6)
page_box.pack_start(label, True, True, 0)
page_box.pack_start(dummy_container_box, False, False, 0)
page_box.show_all()
self.assistant.append_page(page_box)
self.assistant.set_page_complete(page_box, True)
self.assistant.set_page_title(page_box, "Done")
self.assistant.set_page_type(page_box, Gtk.AssistantPageType.CONFIRM)
pixbuf = self.assistant.render_icon(
Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.DIALOG, None)
self.assistant.set_page_header_image(page_box, pixbuf)
示例7: show_message
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def show_message(self, title, msg, msg_type):
if not title:
title = msg
msg = ""
self.title_label.set_markup("<b>%s</b>" % title)
self.msg_label.set_markup(msg)
self.set_message_type(msg_type)
self.image.set_from_stock(
self.icons.get(msg_type, Gtk.STOCK_DIALOG_INFO), Gtk.IconSize.DIALOG
)
self.show_all()
# ------------------------- Assistant Pages ------------------------------------
示例8: create_setup_page
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_DIALOG_INFO [as 别名]
def create_setup_page(self, configs):
# Create IP Address box
ip_address_box = Gtk.HBox(homogeneous=False, spacing=12)
ip_address_label = Gtk.Label(label="Pi Address: ")
ip_address_box.pack_start(ip_address_label, False, False, 12)
ip_address_entry = Gtk.Entry()
ip_address_entry.set_text("http://pi.hole/admin/")
ip_address_box.pack_start(ip_address_entry, False, False, 4)
if "ip_address" in configs:
ip_address_entry.set_text(configs["ip_address"])
# Create Password explanation box
key_code_explanation_box = Gtk.VBox(homogeneous=False, spacing=12)
key_code_explanation_box.set_border_width(12)
key_code_explanation_label = Gtk.Label(
label="Details for your Pi-hole admin console")
key_code_explanation_box.pack_start(
key_code_explanation_label, False, False, 12)
# Create Password box
key_code_box = Gtk.HBox(homogeneous=False, spacing=12)
key_code_label = Gtk.Label(label="Password: ")
key_code_box.pack_start(key_code_label, False, False, 12)
key_code_entry = Gtk.Entry()
key_code_entry.set_visibility(False)
key_code_box.pack_start(key_code_entry, False, False, 0)
if "key_code" in configs:
key_code_entry.set_text(configs["key_code"])
# Add above boxes to single box
page_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
page_box.pack_start(key_code_explanation_box, False, False, 0)
page_box.pack_start(ip_address_box, False, False, 0)
page_box.pack_start(key_code_box, False, False, 0)
page_box.show_all()
self.assistant.append_page(page_box)
# Set other page properties
self.assistant.set_page_title(page_box, "Setup")
self.assistant.set_page_type(page_box, Gtk.AssistantPageType.INTRO)
self.assistant.set_page_complete(page_box, True)
pixbuf = self.assistant.render_icon(
Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.DIALOG, None)
self.assistant.set_page_header_image(page_box, pixbuf)
self.assistant.set_forward_page_func(
self.on_page_one_next, ip_address_entry, key_code_entry)