本文整理汇总了Python中gi.repository.Gtk.InfoBar方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.InfoBar方法的具体用法?Python Gtk.InfoBar怎么用?Python Gtk.InfoBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.InfoBar方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def __init__(self, gamemodel, boardcontrol, annotation_panel):
Gtk.InfoBar.__init__(self)
self.connect("realize", add_provider)
self.content_area = self.get_content_area()
self.action_area = self.get_action_area()
self.gamemodel = gamemodel
self.boardcontrol = boardcontrol
self.boardview = boardcontrol.view
self.annotation_panel = annotation_panel
self.gamemodel.connect("game_changed", self.on_game_changed)
self.gamemodel.connect("goal_checked", self.on_goal_checked)
self.connect("response", self.on_response)
self.your_turn()
示例2: add_button
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def add_button(self, button):
"""
All buttons must be added before doing InfoBarNotebook.push_message()
"""
if not isinstance(button, InfoBarMessageButton):
raise TypeError("Not an InfoBarMessageButton: %s" % repr(button))
self.buttons.append(button)
button._button = Gtk.InfoBar.add_button(self, button.text,
button.response_id)
def set_sensitive(button, property):
if self.get_children():
self.set_response_sensitive(button.response_id,
button.sensitive)
button.connect("notify::sensitive", set_sensitive)
def set_tooltip_text(button, property):
button._button.set_property("tooltip-text", button.tooltip_text)
button.connect("notify::tooltip-text", set_tooltip_text)
示例3: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [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: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [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)
示例5: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def __init__(self, application):
"""
:param application: The application instance.
:type application: :py:class:`.KingPhisherClientApplication`
"""
self.label = Gtk.Label(label='Preview')
"""The :py:class:`Gtk.Label` representing this tabs name."""
self.application = application
self.config = application.config
self.box = Gtk.Box()
self.box.set_property('orientation', Gtk.Orientation.VERTICAL)
self.box.show()
self.webview = extras.WebKitHTMLView()
"""The :py:class:`~.extras.WebKitHTMLView` object used to render the message HTML."""
self.webview.show()
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(self.webview)
scrolled_window.show()
self.info_bar = Gtk.InfoBar()
self.info_bar.set_no_show_all(True)
self.info_bar_label = Gtk.Label('Template Error!')
self.info_bar_label.show()
image = Gtk.Image.new_from_stock('gtk-dialog-error', Gtk.IconSize.DIALOG)
image.show()
self.info_bar.get_content_area().add(image)
self.info_bar.get_content_area().add(self.info_bar_label)
self.info_bar.add_button('OK', Gtk.ResponseType.OK)
self.info_bar.connect('response', lambda x, y: self.info_bar.hide())
self.box.pack_start(self.info_bar, False, True, 0)
self.box.pack_start(scrolled_window, True, True, 0)
self.file_monitor = None
示例6: get_backend_id
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def get_backend_id(self):
"""
Getter function to return the id of the backend for which this
Gtk.InfoBar was created
"""
return self.backend_id
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def __init__(self):
View.__init__(self)
self['notification_bar'] = self.notification_bar = Gtk.Revealer()
self.notification_bar.set_transition_type(Gtk.RevealerTransitionType.SLIDE_UP)
self.notification_bar.set_transition_duration(400)
self.info_bar = Gtk.InfoBar()
self.info_bar.set_show_close_button(True)
self.notification_bar.add(self.info_bar)
self._message_label = Gtk.Label(label="test")
content_area = self.info_bar.get_content_area()
content_area.add(self._message_label)
label.ellipsize_labels_recursively(content_area)
示例8: _build_widget
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def _build_widget(self):
container = Gtk.InfoBar()
container.set_show_close_button(True)
container.get_content_area().pack_start(self._message_label, False,
False, 0)
container.connect("response", self._on_infobar_response)
self.add(container)
示例9: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def __init__(self, parent, app, path):
super().__init__(_('New Folder'), app.window, Gtk.DialogFlags.MODAL,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK))
self.set_default_response(Gtk.ResponseType.OK)
self.connect('show', self.on_show)
self.set_default_size(550, 200)
self.app = app
self.path = path
self.set_border_width(10)
box = self.get_content_area()
folder_name = _('New Folder')
abspath = os.path.join(path, folder_name)
self.entry = Gtk.Entry()
self.entry.set_text(abspath)
self.entry.connect('changed', self.on_entry_changed)
self.entry.connect('activate', self.on_entry_activated)
box.pack_start(self.entry, True, True, 10)
self.infobar = Gtk.InfoBar()
self.infobar.timestamp = 0
self.infobar.set_message_type(Gtk.MessageType.ERROR)
box.pack_start(self.infobar, False, False, 0)
self.info_label= Gtk.Label()
self.infobar.get_content_area().pack_start(self.info_label, False,
False, 0)
box.show_all()
self.infobar.hide()
示例10: localeWarningBar
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def localeWarningBar(enc):
bar = Gtk.InfoBar()
bar.set_message_type(Gtk.MessageType.WARNING)
label = Gtk.Label(_(
'Your system encoding is set to %s, if you want support for special characters\n'
'or see errors due to encoding, please ensure to configure your system to use "UTF-8"') % enc)
# T: warning message, %s is the current locale - e.g. "NL_nl"
label.set_line_wrap(True)
label.set_xalign(0)
bar.get_content_area().pack_start(label, False, False, 0)
return bar
示例11: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def __init__(self):
self.connection = None
self.helperconn = None
self.connection_task = None
self.helperconn_task = None
self.lounge = None
self.canceled = False
self.cids = defaultdict(list)
self.widgets = uistuff.GladeWidgets("fics_logon.glade")
uistuff.keepWindowSize("fics_logon",
self.widgets["fics_logon"],
defaultPosition=uistuff.POSITION_GOLDEN)
self.widgets["fics_logon"].connect(
'key-press-event',
lambda w, e: e.keyval == Gdk.KEY_Escape and w.hide())
self.ics = "FICS"
self.as_guest = self.widgets["logOnAsGuest"]
self.widgets["logOnAsGuest"].connect("toggled", self.on_logOnAsGuest_toggled)
def on_username_changed(widget):
conf.set("usernameEntry", self.user_name_get_value(widget), section=self.ics)
self.widgets["nameEntry"].connect("changed", on_username_changed)
def on_password_changed(widget):
conf.set("passwordEntry", widget.get_text(), section=self.ics)
self.widgets["passEntry"].connect("changed", on_password_changed)
def on_host_changed(widget):
conf.set("hostEntry", self.host_get_value(widget), section=self.ics)
self.widgets["hostEntry"].connect("changed", on_host_changed)
self.widgets["timesealCheck"].connect("toggled", self.on_timeseal_toggled)
self.infobar = Gtk.InfoBar()
self.infobar.set_message_type(Gtk.MessageType.WARNING)
# self.widgets["messagePanelHBox"].pack_start(self.infobar,
# expand=False, fill=False)
self.widgets["messagePanelHBox"].pack_start(self.infobar, False, False,
0)
self.widgets["cancelButton"].connect("clicked", self.onCancel, True)
self.widgets["stopButton"].connect("clicked", self.onCancel, False)
self.widgets["createNewButton"].connect("clicked", self.onCreateNew)
self.widgets["connectButton"].connect("clicked", self.onConnectClicked)
self.widgets["progressbar"].set_show_text(True)
示例12: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def __init__(self, label, message_type=Gtk.MessageType.INFO, *buttons):
"""
... where label can be Gtk.Widget or str and buttons are tuples
of (Gtk.Button, response_id)
"""
# Init
RevealerClass.__init__(self)
self._infobar = Gtk.InfoBar()
self._values = {}
self._label = None
# Icon
icon_name = "dialog-information"
if message_type == Gtk.MessageType.ERROR:
icon_name = "dialog-error"
elif message_type == Gtk.MessageType.WARNING:
icon_name = "dialog-warning"
icon = Gtk.Image()
icon.set_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
self._infobar.get_content_area().pack_start(icon, False, False, 1)
# Label
if isinstance(label, Gtk.Widget):
self._infobar.get_content_area().pack_start(label, True, True, 0)
self._label = label
else:
self._label = Gtk.Label()
self._label.set_size_request(300, -1)
self._label.set_markup(label)
self._label.set_alignment(0, 0.5)
self._label.set_line_wrap(True)
self._infobar.get_content_area().add(self._label)
# Buttons
for button, response_id in buttons:
self.add_button(button, response_id)
# Signals
self._infobar.connect("close", self._cb_close)
self._infobar.connect("response", self._cb_response)
# Settings
self._infobar.set_message_type(message_type)
if hasattr(self._infobar, "set_show_close_button"):
# GTK >3.8
self._infobar.set_show_close_button(True)
else:
self.add_button(Gtk.Button("X"), 0)
self.set_reveal_child(False)
# Packing
self.add(self._infobar)
self.show_all()
示例13: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import InfoBar [as 别名]
def __init__(self, app, path_list):
super().__init__(_('Rename files'), app.window, Gtk.DialogFlags.MODAL,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK))
self.set_border_width(10)
self.set_default_size(640, 480)
self.set_default_response(Gtk.ResponseType.OK)
self.app = app
box = self.get_content_area()
scrolled_win = Gtk.ScrolledWindow()
box.pack_start(scrolled_win, True, True, 0)
grid = Gtk.Grid()
scrolled_win.add(grid)
grid.set_column_spacing(10)
grid.set_row_spacing(5)
grid.set_column_homogeneous(True)
grid.props.margin_bottom = 20
grid.attach(Gtk.Label.new(_('Old Name:')), 0, 0, 1, 1)
grid.attach(Gtk.Label.new(_('New Name:')), 1, 0, 1, 1)
self.rows = []
i = 1
for path in path_list:
dir_name, name = os.path.split(path)
old_entry = Gtk.Entry(text=name)
old_entry.props.editable = False
old_entry.props.can_focus = False
old_entry.set_tooltip_text(path)
grid.attach(old_entry, 0, i, 1, 1)
new_entry = Gtk.Entry(text=name)
new_entry.set_tooltip_text(path)
new_entry.connect('changed', self.on_entry_changed)
grid.attach(new_entry, 1, i, 1, 1)
i = i + 1
self.rows.append((path, old_entry, new_entry))
self.infobar = Gtk.InfoBar()
self.infobar.timestamp = 0
self.infobar.set_message_type(Gtk.MessageType.ERROR)
box.pack_start(self.infobar, False, False, 0)
self.info_label= Gtk.Label()
self.infobar.get_content_area().pack_start(self.info_label, False,
False, 0)
box.show_all()
self.infobar.hide()