host: Remove some redudant conn details

And some minor UI spacing fixes
This commit is contained in:
Cole Robinson 2015-04-11 11:29:03 -04:00
parent 7c3f9dfcc2
commit 8c107f87f9
3 changed files with 120 additions and 214 deletions

View File

@ -117,7 +117,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="spacing">3</property>
<property name="spacing">18</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
@ -134,7 +134,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="n_rows">7</property>
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">3</property>
@ -166,48 +166,6 @@
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Memory:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Logical CPUs:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Architecture:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="overview-hostname">
<property name="visible">True</property>
@ -240,56 +198,12 @@
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="overview-memory">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">2000 MiB</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="overview-cpus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">4</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="overview-arch">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">x86_64</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label71">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Connection:</property>
<property name="label" translatable="yes">Connection URI:</property>
<property name="lines">1</property>
<property name="xalign">1</property>
</object>
<packing>
@ -320,11 +234,11 @@
<property name="label" translatable="yes">A_utoconnect:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">config-autoconnect</property>
<property name="xalign">0</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@ -342,8 +256,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@ -368,132 +282,144 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkAlignment" id="alignment5">
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<property name="vexpand">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkBox" id="box2">
<object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<property name="left_padding">12</property>
<child>
<object class="GtkAlignment" id="performance-cpu-align">
<property name="height_request">75</property>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<placeholder/>
<object class="GtkAlignment" id="performance-cpu-align">
<property name="height_request">75</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="performance-cpu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">60%</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="performance-cpu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">60%</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;CPU usage&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child type="label">
<object class="GtkLabel" id="label22">
<child>
<object class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;CPU usage&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkAlignment" id="performance-memory-align">
<property name="height_request">75</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="performance-memory">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">1.59 GiB of 2.2 GiB</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Memory usage&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkAlignment" id="performance-memory-align">
<property name="height_request">75</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="performance-memory">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">1.59 GiB of 2.2 GiB</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Memory usage&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">1</property>
</packing>
</child>
</object>

View File

@ -267,9 +267,6 @@ class vmmConnection(vmmGObject):
return self._backend.invalidate_caps()
caps = property(lambda self: getattr(self, "_backend").caps)
def get_host_info(self):
return self.hostinfo
def pretty_host_memory_size(self):
if not self._backend.is_open():
return ""
@ -280,22 +277,11 @@ class vmmConnection(vmmGObject):
return 0
return self.hostinfo[1] * 1024
def host_architecture(self):
if not self._backend.is_open():
return ""
return self.hostinfo[0]
def host_active_processor_count(self):
if not self._backend.is_open():
return 0
return self.hostinfo[2]
def host_maximum_processor_count(self):
if not self._backend.is_open():
return 0
return (self.hostinfo[4] * self.hostinfo[5] *
self.hostinfo[6] * self.hostinfo[7])
def connect(self, name, callback, *args):
handle_id = vmmGObject.connect(self, name, callback, *args)

View File

@ -223,17 +223,11 @@ class vmmHost(vmmGObjectUI):
uri = self.conn.get_uri()
host = self.conn.get_hostname()
drv = self.conn.get_driver()
memory = self.conn.pretty_host_memory_size()
proc = self.conn.host_active_processor_count()
arch = self.conn.host_architecture()
auto = self.conn.get_autoconnect()
self.widget("overview-uri").set_text(uri)
self.widget("overview-hostname").set_text(host)
self.widget("overview-hypervisor").set_text(drv)
self.widget("overview-memory").set_text(memory)
self.widget("overview-cpus").set_text(str(proc))
self.widget("overview-arch").set_text(arch)
self.widget("config-autoconnect").set_active(auto)
self.cpu_usage_graph = Sparkline()