[virt-tools-list] [PATCH 4/4] Add basic operating system inspection data to the VMM details page.

Richard W.M. Jones rjones at redhat.com
Mon Jul 18 18:53:57 UTC 2011


From: "Richard W.M. Jones" <rjones at redhat.com>

This adds hostname, product name, and list of applications.
---
 src/virtManager/details.py |   61 +++++++++++++++++++
 src/vmm-details.glade      |  137 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 196 insertions(+), 2 deletions(-)

diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 4164825..027dfeb 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -652,6 +652,34 @@ class vmmDetails(vmmGObjectUI):
         buf.connect("changed", self.enable_apply, EDIT_DESC)
         desc.set_buffer(buf)
 
+        # List of applications.
+        apps_list = self.window.get_widget("inspection-apps")
+        apps_model = gtk.ListStore(str, str, str)
+        apps_list.set_model(apps_model)
+
+        name_col = gtk.TreeViewColumn(_("Name"))
+        version_col = gtk.TreeViewColumn(_("Version"))
+        summary_col = gtk.TreeViewColumn()
+
+        apps_list.append_column(name_col)
+        apps_list.append_column(version_col)
+        apps_list.append_column(summary_col)
+
+        name_text = gtk.CellRendererText()
+        name_col.pack_start(name_text, True)
+        name_col.add_attribute(name_text, 'text', 0)
+        name_col.set_sort_column_id(0)
+
+        version_text = gtk.CellRendererText()
+        version_col.pack_start(version_text, True)
+        version_col.add_attribute(version_text, 'text', 1)
+        version_col.set_sort_column_id(1)
+
+        summary_text = gtk.CellRendererText()
+        summary_col.pack_start(summary_text, True)
+        summary_col.add_attribute(summary_text, 'text', 2)
+        summary_col.set_sort_column_id(2)
+
         # Clock combo
         clock_combo = self.widget("overview-clock-combo")
         clock_model = gtk.ListStore(str)
@@ -2293,6 +2321,39 @@ class vmmDetails(vmmGObjectUI):
         self.widget("overview-arch").set_text(arch)
         self.widget("overview-emulator").set_text(emu)
 
+        # Operating System (ie. inspection data)
+        hostname = self.vm.inspection.hostname
+        if not hostname:
+            hostname = _("unknown")
+        self.window.get_widget("inspection-hostname").set_text(hostname)
+        product_name = self.vm.inspection.product_name
+        if not product_name:
+            product_name = _("unknown")
+        self.window.get_widget("inspection-product-name").set_text(product_name)
+
+        # Applications (also inspection data)
+        apps = self.vm.inspection.applications or []
+
+        apps_list = self.window.get_widget("inspection-apps")
+        apps_model = apps_list.get_model()
+        apps_model.clear()
+        for app in apps:
+            name = ""
+            if app["app_name"]:
+                name = app["app_name"]
+            if app["app_display_name"]:
+                name = app["app_display_name"]
+            version = ""
+            if app["app_version"]:
+                version = app["app_version"]
+            if app["app_release"]:
+                version += "-" + app["app_release"]
+            summary = ""
+            if app["app_summary"]:
+                summary = app["app_summary"]
+
+            apps_model.append([name, version, summary])
+
         # Machine settings
         acpi = self.vm.get_acpi()
         apic = self.vm.get_apic()
diff --git a/src/vmm-details.glade b/src/vmm-details.glade
index 3817e7b..4934999 100644
--- a/src/vmm-details.glade
+++ b/src/vmm-details.glade
@@ -1139,6 +1139,139 @@
                                   </packing>
                                 </child>
                                 <child>
+                                  <widget class="GtkFrame" id="frame17">
+                                    <property name="visible">True</property>
+                                    <property name="label_xalign">0</property>
+                                    <property name="shadow_type">none</property>
+                                    <child>
+                                      <widget class="GtkAlignment" id="alignment43">
+                                        <property name="visible">True</property>
+                                        <property name="left_padding">12</property>
+                                        <child>
+                                          <widget class="GtkTable" id="table17">
+                                            <property name="visible">True</property>
+                                            <property name="border_width">3</property>
+                                            <property name="n_rows">2</property>
+                                            <property name="n_columns">2</property>
+                                            <property name="column_spacing">6</property>
+                                            <property name="row_spacing">6</property>
+                                            <child>
+                                              <widget class="GtkLabel" id="label71">
+                                                <property name="visible">True</property>
+                                                <property name="xalign">1</property>
+                                                <property name="label" translatable="yes">Hostname:</property>
+                                              </widget>
+                                              <packing>
+                                                <property name="x_options">GTK_FILL</property>
+                                                <property name="y_options">GTK_FILL</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <widget class="GtkLabel" id="label72">
+                                                <property name="visible">True</property>
+                                                <property name="xalign">1</property>
+                                                <property name="label" translatable="yes">Product name:</property>
+                                              </widget>
+                                              <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>
+                                              <widget class="GtkLabel" id="inspection-hostname">
+                                                <property name="visible">True</property>
+                                                <property name="xalign">0</property>
+                                                <property name="label">foo</property>
+                                                <property name="selectable">True</property>
+                                              </widget>
+                                              <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>
+                                              <widget class="GtkLabel" id="inspection-product-name">
+                                                <property name="visible">True</property>
+                                                <property name="xalign">0</property>
+                                                <property name="label">foo</property>
+                                                <property name="selectable">True</property>
+                                              </widget>
+                                              <packing>
+                                                <property name="left_attach">1</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>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkLabel" id="label70">
+                                        <property name="visible">True</property>
+                                        <property name="label" translatable="yes"><b>Operating System</b></property>
+                                        <property name="use_markup">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="type">label_item</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkExpander" id="expander7">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <child>
+                                      <widget class="GtkAlignment" id="alignment44">
+                                        <property name="visible">True</property>
+                                        <property name="top_padding">3</property>
+                                        <property name="left_padding">21</property>
+                                        <child>
+                                          <widget class="GtkScrolledWindow" id="scrolledwindow6">
+                                            <property name="height_request">150</property>
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="hscrollbar_policy">automatic</property>
+                                            <property name="vscrollbar_policy">automatic</property>
+                                            <property name="shadow_type">etched-in</property>
+                                            <child>
+                                              <widget class="GtkTreeView" id="inspection-apps">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="headers_visible">True</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkLabel" id="label73">
+                                        <property name="visible">True</property>
+                                        <property name="label" translatable="yes"><b>Applications</b></property>
+                                        <property name="use_markup">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="type">label_item</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">3</property>
+                                  </packing>
+                                </child>
+                                <child>
                                   <widget class="GtkExpander" id="expander2">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
@@ -1273,7 +1406,7 @@
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
-                                    <property name="position">2</property>
+                                    <property name="position">4</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -1467,7 +1600,7 @@
                                     </child>
                                   </widget>
                                   <packing>
-                                    <property name="position">3</property>
+                                    <property name="position">5</property>
                                   </packing>
                                 </child>
                               </widget>
-- 
1.7.5.2




More information about the virt-tools-list mailing list