[virt-tools-list] [virt-manager PATCH 2/2] fsdetails: fix a shortkey issue when combo is invisible

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Mon Oct 20 07:38:46 UTC 2014


We use either combo or label after title in fsdetails ui.
But shortkey is meaningless to label.
This patch will disable underline shortkey
when label is visible.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 virtManager/fsdetails.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/virtManager/fsdetails.py b/virtManager/fsdetails.py
index 51aac66..b8bc527 100644
--- a/virtManager/fsdetails.py
+++ b/virtManager/fsdetails.py
@@ -70,11 +70,29 @@ class vmmFSDetails(vmmGObjectUI):
             self.storage_browser = None
 
     def show_pair_combo(self, basename, show_combo):
+        def change_fsdetails_title(basename, show):
+            combo_label_title = {
+                    "fs-type": "_Type",
+                    "fs-format": "_Format",
+                    "fs-mode": "M_ode",
+                    "fs-driver": "_Driver",
+                    "fs-wrpolicy": "_Write Policy"
+                    }
+
+            title = self.widget(basename + "-title")
+            title_text = combo_label_title.get(basename)
+            if not show:
+                title_text = title_text.replace("_", "")
+
+            title.set_text(title_text)
+            title.set_use_underline(True)
+
         combo = self.widget(basename + "-combo")
         label = self.widget(basename + "-label")
 
         combo.set_visible(show_combo)
         label.set_visible(not show_combo)
+        change_fsdetails_title(basename, show_combo)
 
     def show_check_button(self, basename, show):
         check = self.widget(basename)
-- 
1.9.3




More information about the virt-tools-list mailing list