mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
asyncjob: Add enable/update details methods
Add virtual terminal emulator (Vte) in which could be shown details of background running process. Usage example: - To enable details: > asyncjob.details_enable() - To show text inside the Vte: > asyncjob.details_update("Some text here")
This commit is contained in:
parent
10799edd76
commit
c29cce2673
@ -89,7 +89,6 @@
|
||||
<property name="width_request">400</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label">some warning</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
@ -166,6 +165,38 @@
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander" id="details">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="resize_toplevel">True</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="details-box">
|
||||
<property name="width_request">380</property>
|
||||
<property name="height_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_Details</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="track_visited_links">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -23,6 +23,7 @@ import traceback
|
||||
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Vte
|
||||
|
||||
import libvirt
|
||||
|
||||
@ -182,6 +183,9 @@ class vmmAsyncJob(vmmGObjectUI):
|
||||
self._error_info = None
|
||||
self._data = None
|
||||
|
||||
self._details_widget = None
|
||||
self._details_update_cb = None
|
||||
|
||||
self._is_pulsing = True
|
||||
self._meter = None
|
||||
|
||||
@ -345,3 +349,14 @@ class vmmAsyncJob(vmmGObjectUI):
|
||||
self._set_stage_text(stage or _("Completed"))
|
||||
self.widget("pbar").set_text(progress)
|
||||
self.widget("pbar").set_fraction(1)
|
||||
|
||||
@idle_wrapper
|
||||
def details_enable(self):
|
||||
self._details_widget = Vte.Terminal()
|
||||
self.widget("details-box").add(self._details_widget)
|
||||
self._details_widget.set_visible(True)
|
||||
self.widget("details").set_visible(True)
|
||||
|
||||
@idle_wrapper
|
||||
def details_update(self, data):
|
||||
self._details_widget.feed(data.replace("\n", "\r\n").encode())
|
||||
|
Loading…
Reference in New Issue
Block a user