[virt-tools-list] [virt-manager PATCH 2/2] engine: add methods for showing config window

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Tue Jun 24 05:56:18 UTC 2014


Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 virtManager/config.py  | 4 ++++
 virtManager/engine.py  | 9 +++++++++
 virtManager/manager.py | 6 +++++-
 virtManager/systray.py | 1 +
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/virtManager/config.py b/virtManager/config.py
index b24fee5..7426bb4 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -308,6 +308,8 @@ class vmmConfig(object):
         return self.conf.get("/confirm/unapplied-dev")
     def get_confirm_delstorage(self):
         return self.conf.get("/confirm/delete-storage")
+    def get_confirm_opendetails(self):
+        return self.conf.get("/confirm/open-details")
 
 
     def set_confirm_forcepoweroff(self, val):
@@ -324,6 +326,8 @@ class vmmConfig(object):
         self.conf.set("/confirm/unapplied-dev", val)
     def set_confirm_delstorage(self, val):
         self.conf.set("/confirm/delete-storage", val)
+    def set_confirm_opendetails(self, val):
+        self.conf.set("/confirm/open-details", val)
 
 
     # System tray visibility
diff --git a/virtManager/engine.py b/virtManager/engine.py
index d3a49d7..2f17618 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -159,6 +159,7 @@ class vmmEngine(vmmGObject):
         self.systray.connect("action-reset-domain", self._do_reset_domain)
         self.systray.connect("action-save-domain", self._do_save_domain)
         self.systray.connect("action-show-domain", self._do_show_vm)
+        self.systray.connect("action-show-details", self._do_show_details)
         self.systray.connect("action-migrate-domain", self._do_show_migrate)
         self.systray.connect("action-delete-domain", self._do_delete_domain)
         self.systray.connect("action-clone-domain", self._do_show_clone)
@@ -769,6 +770,13 @@ class vmmEngine(vmmGObject):
             if self._can_exit():
                 self.idle_add(self.exit_app, src)
 
+    def _do_show_details(self, src, uri, connkey):
+        conn = self._lookup_conn(uri)
+        vm = conn.get_vm(connkey)
+        self._show_vm_helper(src, uri, vm, DETAILS_CONFIG, False)
+        details = self._get_details_dialog(uri, vm.get_connkey())
+        details.widget("control-vm-details").set_active(True)
+
     def _do_show_vm(self, src, uri, connkey):
         conn = self._lookup_conn(uri)
         vm = conn.get_vm(connkey)
@@ -791,6 +799,7 @@ class vmmEngine(vmmGObject):
         obj.connect("action-delete-domain", self._do_delete_domain)
         obj.connect("action-clone-domain", self._do_show_clone)
         obj.connect("action-show-domain", self._do_show_vm)
+        obj.connect("action-show-details", self._do_show_details)
         obj.connect("action-show-preferences", self._do_show_preferences)
         obj.connect("action-show-create", self._do_show_create)
         obj.connect("action-show-about", self._do_show_about)
diff --git a/virtManager/manager.py b/virtManager/manager.py
index 1ca84e4..3c2ad18 100644
--- a/virtManager/manager.py
+++ b/virtManager/manager.py
@@ -89,6 +89,7 @@ class vmmManager(vmmGObjectUI):
     __gsignals__ = {
         "action-show-connect": (GObject.SignalFlags.RUN_FIRST, None, []),
         "action-show-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
+        "action-show-details": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
         "action-show-about": (GObject.SignalFlags.RUN_FIRST, None, []),
         "action-show-host": (GObject.SignalFlags.RUN_FIRST, None, [str]),
         "action-show-preferences": (GObject.SignalFlags.RUN_FIRST, None, []),
@@ -494,10 +495,13 @@ class vmmManager(vmmGObjectUI):
     def show_vm(self, ignore, ignore2=None, ignore3=None):
         conn = self.current_conn()
         vm = self.current_vm()
+        open_details = self.config.get_confirm_opendetails()
         if conn is None:
             return
 
-        if vm:
+        if open_details:
+            self.emit("action-show-details", conn.get_uri(), vm.get_connkey())
+        elif vm:
             self.emit("action-show-domain", conn.get_uri(), vm.get_connkey())
         else:
             if not self.open_conn():
diff --git a/virtManager/systray.py b/virtManager/systray.py
index 03e018c..a36c366 100644
--- a/virtManager/systray.py
+++ b/virtManager/systray.py
@@ -50,6 +50,7 @@ class vmmSystray(vmmGObject):
         "action-clone-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
         "action-show-host": (GObject.SignalFlags.RUN_FIRST, None, [str]),
         "action-show-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
+        "action-show-details": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
         "action-exit-app": (GObject.SignalFlags.RUN_FIRST, None, []),
     }
 
-- 
1.9.0




More information about the virt-tools-list mailing list