本文整理汇总了Python中gi.repository.Gtk.STOCK_CLOSE属性的典型用法代码示例。如果您正苦于以下问题:Python Gtk.STOCK_CLOSE属性的具体用法?Python Gtk.STOCK_CLOSE怎么用?Python Gtk.STOCK_CLOSE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.STOCK_CLOSE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: window_deleted_cb
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def window_deleted_cb(self, widget, event, view):
if (self._gui_config.get("confirm_close", self.DEFAULT_CONFIRM_CLOSE)
and self._source_buffer.get_text(self._source_buffer.get_start_iter(),
self._source_buffer.get_end_iter(), True) != self.text):
dlg = Gtk.MessageDialog(self._window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE)
dlg.set_markup(
"<b>Do you want to close TexText without save?</b>\n\n"
"Your changes will be lost if you don't save them."
)
dlg.add_button("Continue editing", Gtk.ResponseType.CLOSE) \
.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.BUTTON))
dlg.add_button("Close without save", Gtk.ResponseType.YES) \
.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.BUTTON))
dlg.set_title("Close without save?")
res = dlg.run()
dlg.destroy()
if res in (Gtk.ResponseType.CLOSE, Gtk.ResponseType.DELETE_EVENT):
return True
Gtk.main_quit()
return False
示例2: player_lagged
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def player_lagged(self, bm, player):
if player in self.gamemodel.ficsplayers:
content = get_infobarmessage_content(
player, _(" has lagged for 30 seconds"),
self.gamemodel.ficsgame.game_type)
def response_cb(infobar, response, message):
message.dismiss()
return False
message = InfoBarMessage(Gtk.MessageType.INFO, content,
response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.showMessage(message)
return False
示例3: offerDeclined
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [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)
示例4: offerWithdrawn
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [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)
示例5: _preferences_button_clicked
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def _preferences_button_clicked(self, *args):
row = self._listbox.get_selected_row()
widget = self._get_preference_widget(row)
if not widget:
return
if self._has_headerbar:
dlg = Gtk.Dialog(use_header_bar=True, flags=Gtk.DialogFlags.MODAL)
dlg.get_header_bar().set_show_close_button(True)
else:
dlg = Gtk.Dialog(flags=Gtk.DialogFlags.MODAL)
dlg.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
dlg.props.title = row.plugin.get_name()
area = dlg.get_content_area()
area.add(widget)
dlg.set_resizable(False)
dlg.run()
dlg.destroy()
示例6: _get_notebook_label
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def _get_notebook_label(self, worksheet):
# Label from worksheet
label = worksheet.get_tab_label()
# FIXME: This should be handled by the editor, not the docviewer.
worksheet.editor.buffer.connect(
'changed', partial(self.on_buffer_changed, label))
# Close button
img = Gtk.Image.new_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
_, w, h = Gtk.IconSize.lookup(Gtk.IconSize.MENU)
btn = Gtk.Button()
btn.set_relief(Gtk.ReliefStyle.NONE)
btn.set_focus_on_click(False)
btn.add(img)
btn.connect(
'clicked', lambda b, w: self.remove_worksheet(w), worksheet)
# Put it together
hbox = Gtk.HBox()
hbox.pack_start(label, True, True, 3)
hbox.pack_end(btn, False, False, 0)
hbox.show_all()
return hbox
示例7: create_tab
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def create_tab(self, title, tab_child, icon=''):
tab_box = Gtk.HBox(False, 3)
close_button = Gtk.Button()
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
label = Gtk.Label(label=title)
if icon:
i = Gtk.Image()
i.set_from_stock(eval('Gtk.STOCK_' + icon), Gtk.IconSize.MENU)
tab_box.pack_start(i, False, False, 0)
close_button.connect("clicked", self.close_tab, tab_child)
close_button.set_image(image)
close_button.set_relief(Gtk.ReliefStyle.NONE)
tab_box.pack_start(label, True, True, 0)
tab_box.pack_end(close_button, False, False, 0)
tab_box.show_all()
if title in ['Loading dasm...', 'Code', 'Callgraph', 'Flowgraph', 'Interactive', 'Strings', "Sections", 'Hexdump', 'Bindiff', 'File info']:
close_button.hide()
return tab_box
示例8: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def __init__(self):
Gtk.InfoBar.__init__(self)
self.title_label = Gtk.Label()
self.msg_label = Gtk.Label()
self.title_label.set_alignment(0.0, 0.5)
self.msg_label.set_alignment(0.0, 0.5)
vbox = Gtk.VBox(spacing=5)
vbox.pack_start(self.title_label, False, False, 0)
vbox.pack_start(self.msg_label, False, False, 0)
self.image = Gtk.Image()
content = self.get_content_area()
content.pack_start(self.image, False, False, 0)
content.pack_start(vbox, False, False, 0)
self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.connect("close", lambda x: self.hide())
self.connect("response", self.on_response)
示例9: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def __init__(self, text, title="Epoptes", markup=True,
icon_name="dialog-information"):
super().__init__(title=title, icon_name=icon_name)
self.set_position(Gtk.WindowPosition.CENTER)
grid = Gtk.Grid(column_spacing=10, row_spacing=10, margin=10)
self.add(grid)
image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
grid.add(image)
# Always load the plain text first in case the markup parsing fails
label = Gtk.Label(
label=text, selectable=True, hexpand=True, vexpand=True,
halign=Gtk.Align.START, valign=Gtk.Align.START)
if markup:
label.set_markup(text)
grid.add(label)
button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)
button.set_hexpand(False)
button.set_halign(Gtk.Align.END)
button.connect("clicked", Gtk.main_quit)
grid.attach(button, 1, 1, 2, 1)
self.set_focus_child(button)
accelgroup = Gtk.AccelGroup()
key, modifier = Gtk.accelerator_parse('Escape')
accelgroup.connect(
key, modifier, Gtk.AccelFlags.VISIBLE, Gtk.main_quit)
self.add_accel_group(accelgroup)
示例10: nonoWhileExamine
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def nonoWhileExamine(self, bm):
label = Gtk.Label(_("You can't touch this! You are examining a game."))
def response_cb(infobar, response, message):
message.dismiss()
return False
message = InfoBarMessage(Gtk.MessageType.INFO, label, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.messages.append(message)
self.infobar.push_message(message)
示例11: matchDeclined
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def matchDeclined(self, bm, player):
text = _(" has declined your offer for a match")
content = get_infobarmessage_content(player, text)
def response_cb(infobar, response, message):
message.dismiss()
return False
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.messages.append(message)
self.infobar.push_message(message)
示例12: player_on_censor
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def player_on_censor(self, bm, player):
text = _(" is censoring you")
content = get_infobarmessage_content(player, text)
def response_cb(infobar, response, message):
message.dismiss()
return False
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.messages.append(message)
self.infobar.push_message(message)
示例13: player_on_noplay
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def player_on_noplay(self, bm, player):
text = _(" noplay listing you")
content = get_infobarmessage_content(player, text)
def response_cb(infobar, response, message):
message.dismiss()
return False
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.messages.append(message)
self.infobar.push_message(message)
示例14: req_not_fit_formula
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def req_not_fit_formula(self, bm, player, formula):
content = get_infobarmessage_content2(
player, _(" uses a formula not fitting your match request:"),
formula)
def response_cb(infobar, response, message):
message.dismiss()
return False
message = InfoBarMessage(Gtk.MessageType.INFO, content, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.messages.append(message)
self.infobar.push_message(message)
示例15: our_seeks_removed
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import STOCK_CLOSE [as 别名]
def our_seeks_removed(self, glm):
label = Gtk.Label(label=_("Your seeks have been removed"))
def response_cb(infobar, response, message):
message.dismiss()
return False
message = InfoBarMessage(Gtk.MessageType.INFO, label, response_cb)
message.add_button(InfoBarMessageButton(Gtk.STOCK_CLOSE,
Gtk.ResponseType.CANCEL))
self.messages.append(message)
self.infobar.push_message(message)