[PATCH 8/9]: virt-manager: color sparkline for rx/tx, read/write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Color the rx and read sparclines red, the tx and write sparcline green.
Needs the sparkline color patch.
 -- Guido
Color the rx and read sparclines red, the tx and write sparcline green 

diff -r 3fdb1d74c3ad src/virtManager/details.py
--- a/src/virtManager/details.py	Sat Oct 04 20:36:41 2008 +0200
+++ b/src/virtManager/details.py	Sat Oct 04 20:40:33 2008 +0200
@@ -193,12 +193,16 @@
         self.disk_io_graph.set_property("reversed", True)
         self.disk_io_graph.set_property("filled", False)
         self.disk_io_graph.set_property("num_sets", 2)
+        self.disk_io_graph.set_property("rgb", [1.0, 0.0, 0.0,
+                                                0.0, 1.0, 0.0])
         self.window.get_widget("graph-table").attach(self.disk_io_graph, 1, 2, 2, 3)
  
         self.network_traffic_graph = sparkline.Sparkline()
         self.network_traffic_graph.set_property("reversed", True)
         self.network_traffic_graph.set_property("filled", False)
         self.network_traffic_graph.set_property("num_sets", 2)
+        self.network_traffic_graph.set_property("rgb", [1.0, 0.0, 0.0,
+                                                        0.0, 1.0, 0.0])
         self.window.get_widget("graph-table").attach(self.network_traffic_graph, 1, 2, 3, 4)
 
         self.accel_groups = gtk.accel_groups_from_object(topwin)
@@ -801,16 +805,23 @@
                     self.refresh_char_page()
 
     def refresh_summary(self):
+        def _rx_tx_text(rx, tx, unit):
+            return '<span color="#FF0000">%(rx)d %(unit)s in</span>\n<span color="#00FF00">%(tx)d %(unit)s out</span>' % locals()
+
         self.window.get_widget("overview-cpu-usage-text").set_text("%d %%" % self.vm.cpu_time_percentage())
         vm_memory = self.vm.current_memory()
         host_memory = self.vm.get_connection().host_memory_size()
         self.window.get_widget("overview-memory-usage-text").set_text("%d MB of %d MB" % \
                                                                       (int(round(vm_memory/1024.0)), \
                                                                        int(round(host_memory/1024.0))))
-        self.window.get_widget("overview-network-traffic-text").set_text("%d KBytes/s in\n%d KBytes/s out" %
-                                                                   (self.vm.network_rx_rate(), self.vm.network_tx_rate()))
-        self.window.get_widget("overview-disk-usage-text").set_text("%d KBytes/s in\n%d KBytes/s out" %
-                                                                   (self.vm.disk_read_rate(), self.vm.disk_write_rate()))
+        self.window.get_widget("overview-network-traffic-text").set_markup(_rx_tx_text(
+                                                                    self.vm.network_rx_rate(), 
+                                                                    self.vm.network_tx_rate(), 
+                                                                    "KBytes/s"))
+        self.window.get_widget("overview-disk-usage-text").set_markup(_rx_tx_text(
+                                                                   self.vm.disk_read_rate(),
+                                                                   self.vm.disk_write_rate(),
+                                                                   "KBytes/s"))
 
         history_len = self.config.get_stats_history_length()
         self.cpu_usage_graph.set_property("data_array", self.vm.cpu_time_vector())
diff -r 3fdb1d74c3ad src/vmm-details.glade
--- a/src/vmm-details.glade	Sat Oct 04 20:36:41 2008 +0200
+++ b/src/vmm-details.glade	Sat Oct 04 20:40:33 2008 +0200
@@ -1418,9 +1418,9 @@
 				  <child>
 				    <widget class="GtkLabel" id="overview-disk-usage-text">
 				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">20 KBytes/s</property>
-				      <property name="use_underline">False</property>
-				      <property name="use_markup">False</property>
+				      <property name="label" translatable="yes">0 KBytes/s\n0KBytes/s</property>
+				      <property name="use_underline">False</property>
+				      <property name="use_markup">True</property>
 				      <property name="justify">GTK_JUSTIFY_LEFT</property>
 				      <property name="wrap">False</property>
 				      <property name="selectable">False</property>
@@ -1446,9 +1446,9 @@
 				  <child>
 				    <widget class="GtkLabel" id="overview-network-traffic-text">
 				      <property name="visible">True</property>
-				      <property name="label">80 MB of 1 GB</property>
-				      <property name="use_underline">False</property>
-				      <property name="use_markup">False</property>
+				      <property name="label">0 KBytes/s\n0KBytes/s</property>
+				      <property name="use_underline">False</property>
+				      <property name="use_markup">True</property>
 				      <property name="justify">GTK_JUSTIFY_LEFT</property>
 				      <property name="wrap">False</property>
 				      <property name="selectable">False</property>
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux