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

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

 



Hi,
Color the rx and read sparclines redish, the tx and write sparcline
greenish - same for the labels. Colors adjusted as to Daniel's
suggestion.
-- Guido
# HG changeset patch
# User "Guido Günther <agx@xxxxxxxxxxx>"
# Date 1224357916 -7200
# Node ID 8c2c1c5856c0a7de4eb81c5b8e77738ee90608fd
# Parent  ad0c6107ca6b124a6ccac210c9e4ce4d264cff2d
color graph and graph lables

so rx/tx, read/write are distinguishable

diff -r ad0c6107ca6b -r 8c2c1c5856c0 src/virtManager/details.py
--- a/src/virtManager/details.py	Sat Oct 18 21:24:19 2008 +0200
+++ b/src/virtManager/details.py	Sat Oct 18 21:25:16 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", map(lambda x: x/255.0,
+                                        [0x82, 0x00, 0x3B, 0x29, 0x5C, 0x45]))
         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", map(lambda x: x/255.0,
+                                                [0x82, 0x00, 0x3B, 0x29, 0x5C, 0x45]))
         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="#82003B">%(rx)d %(unit)s in</span>\n<span color="#295C45">%(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 ad0c6107ca6b -r 8c2c1c5856c0 src/vmm-details.glade
--- a/src/vmm-details.glade	Sat Oct 18 21:24:19 2008 +0200
+++ b/src/vmm-details.glade	Sat Oct 18 21:25:16 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