[virt-tools-list] [virt-manager PATCH] gfxdetails: add checkbox for password visibility toggle

Chen Hanxiao chen_han_xiao at 126.com
Wed Jul 19 03:09:28 UTC 2017


From: Chen Hanxiao <chenhanxiao at gmail.com>

    This patch add a checkbox for password visibility toggle.
    As we stored password of SPICE/VNC in clear text in XML,
    it's easy to use in UI.

Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
 ui/gfxdetails.ui          | 42 ++++++++++++++++++++++++++++++++++++++++++
 virtManager/gfxdetails.py |  7 +++++++
 2 files changed, 49 insertions(+)

diff --git a/ui/gfxdetails.ui b/ui/gfxdetails.ui
index 9f85c8a..db188f7 100644
--- a/ui/gfxdetails.ui
+++ b/ui/gfxdetails.ui
@@ -500,5 +500,47 @@
         <property name="top_attach">9</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkCheckButton" id="graphics-visiblity-chk">
+        <property name="label" translatable="yes">Visi_bility</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+        <signal name="toggled" handler="on_graphics_show_password" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">2</property>
+        <property name="top_attach">5</property>
+      </packing>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/virtManager/gfxdetails.py b/virtManager/gfxdetails.py
index a76eb77..35748ab 100644
--- a/virtManager/gfxdetails.py
+++ b/virtManager/gfxdetails.py
@@ -51,6 +51,7 @@ class vmmGraphicsDetails(vmmGObjectUI):
             "on_graphics_port_auto_toggled": self._change_port_auto,
             "on_graphics_tlsport_auto_toggled": self._change_tlsport_auto,
             "on_graphics_use_password": self._change_password_chk,
+            "on_graphics_show_password": self._show_password_chk,
 
             "on_graphics_listen_type_changed": self._change_graphics_listen,
             "on_graphics_password_changed": lambda ignore: self.emit("changed-password"),
@@ -373,3 +374,9 @@ class vmmGraphicsDetails(vmmGObjectUI):
             self.widget("graphics-password").set_text("")
             self.widget("graphics-password").set_sensitive(False)
         self.emit("changed-password")
+
+    def _show_password_chk(self, ignore=None):
+        if self.widget("graphics-visiblity-chk").get_active():
+            self.widget("graphics-password").set_visibility(True)
+        else:
+            self.widget("graphics-password").set_visibility(False)
-- 
2.7.4





More information about the virt-tools-list mailing list