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

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

 



On Mon, Oct 06, 2008 at 12:04:27PM +0100, Daniel P. Berrange wrote:
> On Sat, Oct 04, 2008 at 10:29:22PM +0200, Guido G?nther wrote:
> > Color the rx and read sparclines red, the tx and write sparcline green.
> 
> Using pure red + green with same overall colour intensity isn't good
> for color-blindness, particularly since we're using a gray background
Thought so, but I hoped to delay this until we can make the color of the
graphs configurable.

> > +        self.disk_io_graph.set_property("rgb", [1.0, 0.0, 0.0,
> > +                                                0.0, 1.0, 0.0])
> 
> It'll take a little playing around to get a good colour pair which
> works on a gray background, and is also color anomoly-safe. There's
> a really neat DHTML webpage for just this purpose though
> 
>    http://www.colorjack.com/sphere/
> 
> I'd pick 'Complementary' or one of the 'Split Complementary' variants
> and then drag around the dots till you find a pair of suitable colors,
> which also look reasonably distinctive when you select the various
> color anomologies.
Nice tool. Updated patch attached. 
 -- Guido
# HG changeset patch
# User "Guido Günther <agx@xxxxxxxxxxx>"
# Date 1223384677 -7200
# Node ID fc32400ab6b329ca0ff9be6af5cb064e7d3b79c6
# Parent  b38fd7e70406ba9069626285e6a87b77507e797e
[mq]: color_graph

diff -r b38fd7e70406 -r fc32400ab6b3 src/virtManager/details.py
--- a/src/virtManager/details.py	Tue Oct 07 14:51:09 2008 +0200
+++ b/src/virtManager/details.py	Tue Oct 07 15:04:37 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 b38fd7e70406 -r fc32400ab6b3 src/vmm-details.glade
--- a/src/vmm-details.glade	Tue Oct 07 14:51:09 2008 +0200
+++ b/src/vmm-details.glade	Tue Oct 07 15:04:37 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