[virt-tools-list] [virt-manager PATCH 2/4] inspection: show OS type in Inspection page

Pino Toscano ptoscano at redhat.com
Wed Feb 8 15:55:34 UTC 2017


Show also a pretty label for the OS of the guest, in addition to
hostname and product name.
---
 ui/details.ui          | 50 ++++++++++++++++++++++++++++++++++++++------------
 virtManager/details.py | 21 +++++++++++++++++++++
 2 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/ui/details.ui b/ui/details.ui
index 4159f1d..c85e0e4 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -1468,11 +1468,40 @@ if you know what you are doing.</small></property>
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="border_width">3</property>
-                                            <property name="n_rows">2</property>
+                                            <property name="n_rows">3</property>
                                             <property name="n_columns">2</property>
                                             <property name="column_spacing">6</property>
                                             <property name="row_spacing">6</property>
                                             <child>
+                                              <object class="GtkLabel" id="label72">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="label" translatable="yes">Product name:</property>
+                                                <property name="xalign">1</property>
+                                              </object>
+                                              <packing>
+                                                <property name="top_attach">2</property>
+                                                <property name="bottom_attach">3</property>
+                                                <property name="x_options">GTK_FILL</property>
+                                                <property name="y_options">GTK_FILL</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="inspection-hostname">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="label">foo</property>
+                                                <property name="selectable">True</property>
+                                                <property name="xalign">0</property>
+                                              </object>
+                                              <packing>
+                                                <property name="left_attach">1</property>
+                                                <property name="right_attach">2</property>
+                                                <property name="x_options">GTK_FILL</property>
+                                                <property name="y_options">GTK_FILL</property>
+                                              </packing>
+                                            </child>
+                                            <child>
                                               <object class="GtkLabel" id="label71">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
@@ -1485,21 +1514,19 @@ if you know what you are doing.</small></property>
                                               </packing>
                                             </child>
                                             <child>
-                                              <object class="GtkLabel" id="label72">
+                                              <object class="GtkLabel" id="label">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="label" translatable="yes">Product name:</property>
+                                                <property name="label" translatable="yes">Operating system:</property>
                                                 <property name="xalign">1</property>
                                               </object>
                                               <packing>
                                                 <property name="top_attach">1</property>
                                                 <property name="bottom_attach">2</property>
-                                                <property name="x_options">GTK_FILL</property>
-                                                <property name="y_options">GTK_FILL</property>
                                               </packing>
                                             </child>
                                             <child>
-                                              <object class="GtkLabel" id="inspection-hostname">
+                                              <object class="GtkLabel" id="inspection-product-name">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="label">foo</property>
@@ -1509,16 +1536,17 @@ if you know what you are doing.</small></property>
                                               <packing>
                                                 <property name="left_attach">1</property>
                                                 <property name="right_attach">2</property>
+                                                <property name="top_attach">2</property>
+                                                <property name="bottom_attach">3</property>
                                                 <property name="x_options">GTK_FILL</property>
                                                 <property name="y_options">GTK_FILL</property>
                                               </packing>
                                             </child>
                                             <child>
-                                              <object class="GtkLabel" id="inspection-product-name">
+                                              <object class="GtkLabel" id="inspection-type">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="label">foo</property>
-                                                <property name="selectable">True</property>
+                                                <property name="label" translatable="yes">foo</property>
                                                 <property name="xalign">0</property>
                                               </object>
                                               <packing>
@@ -1526,8 +1554,6 @@ if you know what you are doing.</small></property>
                                                 <property name="right_attach">2</property>
                                                 <property name="top_attach">1</property>
                                                 <property name="bottom_attach">2</property>
-                                                <property name="x_options">GTK_FILL</property>
-                                                <property name="y_options">GTK_FILL</property>
                                               </packing>
                                             </child>
                                           </object>
@@ -5906,8 +5932,8 @@ if you know what you are doing.</small></property>
                         <property name="label" translatable="yes">_Save this password in your keyring</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="tooltip_text" translatable="yes">Check to save password, uncheck to forget password.</property>
                         <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Check to save password, uncheck to forget password.</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
diff --git a/virtManager/details.py b/virtManager/details.py
index 089f578..20a61f7 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -310,6 +310,23 @@ def _warn_cpu_thread_topo(threads, cpu_model):
     return False
 
 
+def _label_for_os_type(os_type):
+    typemap = {
+        "dos": _("MS-DOS/FreeDOS"),
+        "freebsd": _("FreeBSD"),
+        "hurd": _("GNU/Hurd"),
+        "linux": _("Linux"),
+        "minix": _("MINIX"),
+        "netbsd": _("NetBSD"),
+        "openbsd": _("OpenBSD"),
+        "windows": _("Microsoft Windows"),
+    }
+    try:
+        return typemap[os_type]
+    except KeyError:
+        return _("unknown")
+
+
 class vmmDetails(vmmGObjectUI):
     __gsignals__ = {
         "action-save-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
@@ -2379,6 +2396,10 @@ class vmmDetails(vmmGObjectUI):
             if not hostname:
                 hostname = _("unknown")
             self.widget("inspection-hostname").set_text(hostname)
+            os_type = self.vm.inspection.os_type
+            if not os_type:
+                os_type = "unknown"
+            self.widget("inspection-type").set_text(_label_for_os_type(os_type))
             product_name = self.vm.inspection.product_name
             if not product_name:
                 product_name = _("unknown")
-- 
2.9.3




More information about the virt-tools-list mailing list