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 _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_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)