def _scan_lib(self): try: partition_lib.scan() menu = partition_lib.get_layout_menu() gui.idle_add(self._refresh_content_text_from_menu, menu) except Exception: self.add_log_lib(traceback.format_exc())
def _set_progress_thread(self, text): with self._progress_lock: self._progress = text def update(): label = gui.builder.get_object('label_install_progress') with self._progress_lock: label.set_label(self._progress) gui.idle_add(update)
def _add_log_thread(self, log): with self._log_lock: self._log += log + '\n' def update(): textbuffer = gui.builder.get_object('textbuffer_install_log') with self._log_lock: textbuffer.set_text(self._log) gui.idle_add(update)
def add_log_lib(self, log): with self._log_lock: self._log += log + '\n' def update(): textbuffer = gui.builder.get_object('textbuffer_partition_log') with self._log_lock: textbuffer.set_text(self._log) gui.idle_add(update)
def _set_percent_thread(self, percent): if percent < 0 or percent > 100: return with self._percent_lock: self._percent = percent def update(): progressbar = gui.builder.get_object('progressbar_install') with self._percent_lock: progressbar.set_fraction(self._percent / 100) gui.idle_add(update)
def _lib_loop(self): while True: f, working_ui = self._queue.get() if working_ui: event = threading.Event() def func(): treeview = gui.builder.get_object('treeview_partitions') listbox = gui.builder.get_object( 'listbox_partition_actions') label = gui.builder.get_object('label_partition_working') spinner = gui.builder.get_object( 'spinner_partition_working') if gui.stack_main.get_visible_child_name() == 'partition': expander = gui.builder.get_object( 'expander_partition_log') expander.grab_focus() treeview.set_sensitive(False) listbox.set_sensitive(False) label.set_label(_('Working')) spinner.start() event.set() gui.idle_add(func) event.wait() try: f() except Exception: self.add_log_lib(traceback.format_exc()) if working_ui: event = threading.Event() def func2(): treeview = gui.builder.get_object('treeview_partitions') listbox = gui.builder.get_object( 'listbox_partition_actions') label = gui.builder.get_object('label_partition_working') spinner = gui.builder.get_object( 'spinner_partition_working') treeview.set_sensitive(True) listbox.set_sensitive(True) label.set_label('') spinner.stop() event.set() gui.idle_add(func2) event.wait() self._queue.task_done()
def _msgbox(self, text): if not gui.started: dialog.msgbox(text) else: event = threading.Event() def show(): from gi.repository import Gtk dialog2 = Gtk.MessageDialog( gui.window, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.INFO, Gtk.ButtonsType.CLOSE, text) dialog2.run() dialog2.destroy() event.set() gui.idle_add(show) event.wait()
def _install_complete_thread(self): gui.idle_add(self._install_complete)
def _install_fail_thread(self): gui.idle_add(self._install_fail)
def _update_actions_lib(self, item): actions = [] for x in item.ops: actions.append(partition_lib.get_text_for_op(x)) gui.idle_add(self._update_actions, item, actions)
def _update_content_text_lib(self): menu = partition_lib.get_layout_menu() gui.idle_add(self._update_content_text_from_menu, menu)