I am OK with the general idea of your patches.
Two things that I missed when comparing with virt-viewer similar feature:
* If the virt-viewer window has the current focus and I insert a USB
device, it will be automatically redirected to the guest. I was not able
to reproduce this same test case with virt-manager console viewer. I
needed to manually go to the menu and select which USB device to
redirect. This can be because of some configuration with my test
environment, but I just would like to confirm if this feature is not there.
* In virt-viewer, if the VM has no Spice Redirected USB device
configured, the menu will not be activated. In your implementation, the
menu will be active, but if I try to select a USB device for
redirection, I'll get an error.
By the way, I was able to use the USB redirection without being root.
Some more comments below.
On 06/24/2013 07:11 AM, Guannan Ren wrote:
helper function: show_info_with_widget()
Widget argument has to be type of Gtk.VBox
---
virtManager/error.py | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/virtManager/error.py b/virtManager/error.py
index e30d121..cbaf51a 100644
--- a/virtManager/error.py
+++ b/virtManager/error.py
@@ -28,11 +28,15 @@ from virtManager.baseclass import vmmGObject
def _launch_dialog(dialog, primary_text, secondary_text, title,
- sync=True):
+ widget=None, sync=True):
dialog.set_property("text", primary_text)
dialog.format_secondary_text(secondary_text or None)
dialog.set_title(title)
+ if widget:
+ # widget is of type Gtk.VBox
Although this is true for the current use of this function, this is not
a restriction. So I would just remove this comment.
+ dialog.get_content_area().add(widget)
+
res = False
if sync:
res = dialog.run()
@@ -92,7 +96,7 @@ class vmmErrorDialog(vmmGObject):
###################################
def _simple_dialog(self, dialog_type, buttons, text1,
- text2, title, async=False):
+ text2, title, widget=None, async=False):
dialog = Gtk.MessageDialog(self.get_parent(),
flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
@@ -104,6 +108,7 @@ class vmmErrorDialog(vmmGObject):
return _launch_dialog(self._simple,
text1, text2 or "", title or "",
+ widget=widget,
sync=not async)
def val_err(self, text1, text2=None, title=_("Input Error"), async=True):
@@ -121,13 +126,19 @@ class vmmErrorDialog(vmmGObject):
self._simple_dialog(dtype, buttons,
str(text1),
text2 and str(text2) or "",
- str(title), async)
+ str(title), None, async)
return False
def show_info(self, text1, text2=None, title="", async=True):
dtype = Gtk.MessageType.INFO
buttons = Gtk.ButtonsType.OK
- self._simple_dialog(dtype, buttons, text1, text2, title, async)
+ self._simple_dialog(dtype, buttons, text1, text2, title, None, async)
+ return False
+
+ def show_info_with_widget(self, text1, widget, text2=None, title="", async=True):
+ dtype = Gtk.MessageType.INFO
+ buttons = Gtk.ButtonsType.OK
+ self._simple_dialog(dtype, buttons, text1, text2, title, widget, async)
return False
It seems that show_info is not being used anywhere else. So, instead of
creating two very similar functions, why not changing the original
show_info?
Best regards,
Leonardo Garcia
def yes_no(self, text1, text2=None, title=None):
_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list