Пример #1
0
 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())
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
    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()
Пример #7
0
    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()
Пример #8
0
 def _install_complete_thread(self):
     gui.idle_add(self._install_complete)
Пример #9
0
 def _install_fail_thread(self):
     gui.idle_add(self._install_fail)
Пример #10
0
 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)
Пример #11
0
 def _update_content_text_lib(self):
     menu = partition_lib.get_layout_menu()
     gui.idle_add(self._update_content_text_from_menu, menu)