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_infobar_response(self, infobar: Gtk.InfoBar, response=Gtk.ResponseType): self.infolabel.set_label('') self.infoimage.set_from_icon_name('image-missing', Gtk.IconSize.DIALOG) infobar.hide() assert isinstance(self.widget, Gtk.Window) self.widget.resize(1, 1) # shrink the window back. return False
def thread_error(self, thread: Any, errno: int, errname: str, trace: str, threadbox: Gtk.InfoBar): threadbox.get_action_area().get_children()[1].hide() # Pause button pb = threadbox.get_content_area().get_children()[0].get_children()[1] pb.set_text(_('Error: %s') % errname) b = threadbox.add_button(_('Details'), 11) b.connect('clicked', self.show_traceback, errno, errname, trace) b.show() self.to_remove.append(threadbox)
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 add(self, notif: Gtk.InfoBar): """Add a new notification widget to self. Automatically handles the CLOSE reponse. Args: notif (Gtk.InfoBar): The widget """ def callback(widget, resp): if resp == Gtk.ResponseType.CLOSE: notif.unparent() notif.connect('response', callback) self.append(notif)
def _delete_event_dialog_response_cb(info_bar: Gtk.InfoBar, response: int): GLib.source_remove(source_id) info_bar.disconnect(self._delete_event_dialog_response_handler_id) self._info_bar.props.revealed = False if response == Gtk.ResponseType.CANCEL: return elif response == Gtk.ResponseType.OK: if self._download_manager.props.running: self._download_manager.disconnect( self._download_manager_finished_changed_handler_id) # hookup signal to downloadmanager running property self._download_manager.connect("notify::running", self._delete_event_killer) # stop it manually self._download_manager.stop()
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 thread_stopped(self, thread: Any, threadbox: Gtk.InfoBar): threadbox.hide()
def thread_resume(self, thread: Any, threadbox: Gtk.InfoBar): pb = threadbox.get_content_area().get_children()[0].get_children()[1] txt = pb.get_text() if txt.find(self.paused_text): txt = txt[:-len(self.paused_text)] pb.set_text(txt)
def thread_pause(self, thread: Any, threadbox: Gtk.InfoBar): pb = threadbox.get_content_area().get_children()[0].get_children()[1] txt = pb.get_text() txt += self.paused_text pb.set_text(txt)
def on_info_bar_response(self, infobar: Gtk.InfoBar, response_id: int): infobar.set_visible(False)
def close_infobar(self, infobar: Gtk.InfoBar, response=None): infobar.set_revealed(False)