def _on_infobar_response(self, infobar: Gtk.InfoBar, response): if response == Gtk.ResponseType.YES and not self.spices.processing_jobs: self.spices.refresh_cache() pass infobar.set_revealed(False) self.search_entry.grab_focus()
def on_info_bar_response(self, info_bar: Gtk.InfoBar, response: int): """React to the user responding to a Gtk.InfoBar. Args: info_bar (Gtk.InfoBar): The Gtk.InfoBar that received the response response (int): The response id (Gtk.ResponseType) """ if response == Gtk.ResponseType.CLOSE: info_bar.set_revealed(False) GLib.timeout_add(250, info_bar.set_visible, False)
def _refill_info_bar(info_bar: Gtk.InfoBar, message_type: Gtk.MessageType, text: str): info_bar.set_message_type(message_type) content: Gtk.Box = info_bar.get_content_area() for c in content.get_children(): content.remove(c) lbl: Gtk.Label = Gtk.Label.new(text) lbl.set_line_wrap(True) content.add(lbl) info_bar.set_revealed(True) info_bar.show_all()
def close_infobar(self, infobar: Gtk.InfoBar, response=None): infobar.set_revealed(False)