From ed8dfc8ed9c5f6f4459949695136d8eacd295844 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 20 Sep 2020 14:32:56 +0000 Subject: [PATCH] colours: Fix importing functions Signed-off-by: Michael Tremer --- src/collecty/plugins/contextswitches.py | 2 +- src/collecty/plugins/df.py | 10 +++++----- src/collecty/plugins/interface.py | 16 ++++++++-------- src/collecty/plugins/interrupts.py | 2 +- src/collecty/plugins/ipfrag.py | 8 ++++---- src/collecty/plugins/memory.py | 7 +++---- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/collecty/plugins/contextswitches.py b/src/collecty/plugins/contextswitches.py index a7f7840..8242de0 100644 --- a/src/collecty/plugins/contextswitches.py +++ b/src/collecty/plugins/contextswitches.py @@ -35,7 +35,7 @@ class GraphTemplateContextSwitches(base.GraphTemplate): return [ "AREA:ctxt%s:%-15s" % ( - util.lighten(PRIMARY, AREA_OPACITY), + lighten(PRIMARY, AREA_OPACITY), _("Context Switches"), ), "GPRINT:ctxt_max:%12s\:" % _("Maximum") + " %6.2lf" , diff --git a/src/collecty/plugins/df.py b/src/collecty/plugins/df.py index f376c57..46fc057 100644 --- a/src/collecty/plugins/df.py +++ b/src/collecty/plugins/df.py @@ -23,7 +23,7 @@ from collecty import _collecty import os from ..constants import * -from .. import util +from ..colours import * from . import base from ..i18n import _ @@ -46,14 +46,14 @@ class GraphTemplateDiskUsage(base.GraphTemplate): "VDEF:percentage_left_now=percentage_left,LAST", # Area for the used space - "AREA:used%s:%s" % (util.lighten(LIGHT_RED, .66), _("Used")), + "AREA:used%s:%s" % (lighten(LIGHT_RED, .66), _("Used")), "GPRINT:percentage_used_now: (%6.2lf%%)", "GPRINT:used_cur:%12s\:" % _("Current") + " %9.2lf%s", "GPRINT:used_min:%12s\:" % _("Minimum") + " %9.2lf%s", "GPRINT:used_max:%12s\:" % _("Maximum") + " %9.2lf%s\\n", # Stacked area of unused space - "AREA:free%s:%s:STACK" % (util.lighten(LIGHT_GREEN, .66), _("Free")), + "AREA:free%s:%s:STACK" % (lighten(LIGHT_GREEN, .66), _("Free")), "GPRINT:percentage_left_now: (%6.2lf%%)", "GPRINT:free_cur:%12s\:" % _("Current") + " %9.2lf%s", "GPRINT:free_min:%12s\:" % _("Minimum") + " %9.2lf%s", @@ -91,14 +91,14 @@ class GraphTemplateInodeUsage(base.GraphTemplate): "CDEF:percentage_left=100,percentage_used,-", # Area for the used inodes - "AREA:inodes_used%s:%s" % (util.lighten(LIGHT_RED, .66), _("Used")), + "AREA:inodes_used%s:%s" % (lighten(LIGHT_RED, .66), _("Used")), "GPRINT:percentage_used_now: (%6.2lf%%)", "GPRINT:inodes_used_cur:%12s\:" % _("Current") + " %9.2lf%s", "GPRINT:inodes_used_min:%12s\:" % _("Minimum") + " %9.2lf%s", "GPRINT:inodes_used_max:%12s\:" % _("Maximum") + " %9.2lf%s\\n", # Stacked area of unused inodes - "AREA:inodes_free%s:%s:STACK" % (util.lighten(LIGHT_GREEN, .66), _("Free")), + "AREA:inodes_free%s:%s:STACK" % (lighten(LIGHT_GREEN, .66), _("Free")), "GPRINT:percentage_left_now: (%6.2lf%%)", "GPRINT:inodes_free_cur:%12s\:" % _("Current") + " %9.2lf%s", "GPRINT:inodes_free_min:%12s\:" % _("Minimum") + " %9.2lf%s", diff --git a/src/collecty/plugins/interface.py b/src/collecty/plugins/interface.py index 7b45d09..8be11cb 100644 --- a/src/collecty/plugins/interface.py +++ b/src/collecty/plugins/interface.py @@ -50,13 +50,13 @@ class GraphTemplateInterfaceBits(GraphTemplateInterfaceBase): "VDEF:bits_tx_95p=bits_tx,95,PERCENT", # Draw the received area. - "AREA:bits_rx%s:%-15s" % (util.lighten(COLOUR_RX, AREA_OPACITY), _("Received")), + "AREA:bits_rx%s:%-15s" % (lighten(COLOUR_RX, AREA_OPACITY), _("Received")), "GPRINT:bits_rx_max:%12s\: " % _("Maximum") + _("%8.2lf %sbps"), "GPRINT:bits_rx_min:%12s\: " % _("Minimum") + _("%8.2lf %sbps"), "GPRINT:bits_rx_avg:%12s\: " % _("Average") + _("%8.2lf %sbps") + "\\n", # Draw the transmitted area. - "AREA:bits_tx%s:%-15s" % (util.lighten(COLOUR_TX, AREA_OPACITY), _("Transmitted")), + "AREA:bits_tx%s:%-15s" % (lighten(COLOUR_TX, AREA_OPACITY), _("Transmitted")), "GPRINT:bits_tx_max:%12s\: " % _("Maximum") + _("%8.2lf %sbps"), "GPRINT:bits_tx_min:%12s\: " % _("Minimum") + _("%8.2lf %sbps"), "GPRINT:bits_tx_avg:%12s\: " % _("Average") + _("%8.2lf %sbps") + "\\n", @@ -94,7 +94,7 @@ class GraphTemplateInterfacePackets(GraphTemplateInterfaceBase): return [ # Draw the received area. "AREA:packets_rx%s:%-15s" % ( - util.lighten(COLOUR_RX, AREA_OPACITY), _("Received"), + lighten(COLOUR_RX, AREA_OPACITY), _("Received"), ), "GPRINT:packets_rx_max:%12s\: " % _("Maximum") + _("%8.0lf %spps"), "GPRINT:packets_rx_min:%12s\: " % _("Minimum") + _("%8.0lf %spps"), @@ -102,7 +102,7 @@ class GraphTemplateInterfacePackets(GraphTemplateInterfaceBase): # Draw the transmitted area. "AREA:packets_tx%s:%-15s" % ( - util.lighten(COLOUR_TX, AREA_OPACITY), _("Transmitted"), + lighten(COLOUR_TX, AREA_OPACITY), _("Transmitted"), ), "GPRINT:packets_tx_max:%12s\: " % _("Maximum") + _("%8.0lf %spps"), "GPRINT:packets_tx_min:%12s\: " % _("Minimum") + _("%8.0lf %spps"), @@ -138,7 +138,7 @@ class GraphTemplateInterfaceErrors(GraphTemplateInterfaceBase): # Draw the receive errors. "AREA:errors_rx%s:%-15s" % ( - util.lighten(COLOUR_RX, AREA_OPACITY), _("Receive errors"), + lighten(COLOUR_RX, AREA_OPACITY), _("Receive errors"), ), "GPRINT:errors_rx_max:%12s\: " % _("Maximum") + _("%8.0lf %spps"), "GPRINT:errors_rx_min:%12s\: " % _("Minimum") + _("%8.0lf %spps"), @@ -147,7 +147,7 @@ class GraphTemplateInterfaceErrors(GraphTemplateInterfaceBase): # Draw the transmit errors. "AREA:errors_tx_inv%s:%-15s" % ( - util.lighten(COLOUR_TX, AREA_OPACITY), _("Transmit errors"), + lighten(COLOUR_TX, AREA_OPACITY), _("Transmit errors"), ), "GPRINT:errors_tx_max:%12s\: " % _("Maximum") + _("%8.0lf %spps"), "GPRINT:errors_tx_min:%12s\: " % _("Minimum") + _("%8.0lf %spps"), @@ -156,7 +156,7 @@ class GraphTemplateInterfaceErrors(GraphTemplateInterfaceBase): # Draw the receive drops. "LINE2:dropped_rx%s:%-15s" % ( - util.lighten(AMBER, AREA_OPACITY), _("Receive drops"), + lighten(AMBER, AREA_OPACITY), _("Receive drops"), ), "GPRINT:dropped_rx_max:%12s\: " % _("Maximum") + _("%8.0lf %spps"), "GPRINT:dropped_rx_min:%12s\: " % _("Minimum") + _("%8.0lf %spps"), @@ -165,7 +165,7 @@ class GraphTemplateInterfaceErrors(GraphTemplateInterfaceBase): # Draw the transmit drops. "LINE2:dropped_tx%s:%-15s" % ( - util.lighten(TEAL, AREA_OPACITY), _("Transmit drops"), + lighten(TEAL, AREA_OPACITY), _("Transmit drops"), ), "GPRINT:dropped_tx_max:%12s\: " % _("Maximum") + _("%8.0lf %spps"), "GPRINT:dropped_tx_min:%12s\: " % _("Minimum") + _("%8.0lf %spps"), diff --git a/src/collecty/plugins/interrupts.py b/src/collecty/plugins/interrupts.py index 668ac37..54da102 100644 --- a/src/collecty/plugins/interrupts.py +++ b/src/collecty/plugins/interrupts.py @@ -35,7 +35,7 @@ class GraphTemplateSystemInterrupts(base.GraphTemplate): return [ "AREA:intr%s:%-15s" % ( - util.lighten(PRIMARY, AREA_OPACITY), _("System Interrupts"), + lighten(PRIMARY, AREA_OPACITY), _("System Interrupts"), ), "GPRINT:intr_max:%12s\:" % _("Maximum") + " %6.2lf" , "GPRINT:intr_min:%12s\:" % _("Minimum") + " %6.2lf" , diff --git a/src/collecty/plugins/ipfrag.py b/src/collecty/plugins/ipfrag.py index 941ca52..a70d8fb 100644 --- a/src/collecty/plugins/ipfrag.py +++ b/src/collecty/plugins/ipfrag.py @@ -40,14 +40,14 @@ class GraphTemplateIPv6Fragmentation(base.GraphTemplate): # Reassembly "AREA:ip6_reasm_real_fails%s:%-24s" % \ - (util.lighten(COLOUR_ERROR), _("Failed Reassemblies")), + (lighten(COLOUR_ERROR), _("Failed Reassemblies")), "GPRINT:ip6_reasm_fails_cur:%s %%5.0lf%%s" % _("Now"), "GPRINT:ip6_reasm_fails_avg:%s %%5.0lf%%s" % _("Avg"), "GPRINT:ip6_reasm_fails_max:%s %%5.0lf%%s" % _("Max"), "GPRINT:ip6_reasm_fails_min:%s %%5.0lf%%s\\j" % _("Min"), "AREA:ip6_reasm_timeout%s:%-24s:STACK" % \ - (util.lighten(COLOUR_WARN), _("Reassembly Timeouts")), + (lighten(COLOUR_WARN), _("Reassembly Timeouts")), "GPRINT:ip6_reasm_timeout_cur:%s %%5.0lf%%s" % _("Now"), "GPRINT:ip6_reasm_timeout_avg:%s %%5.0lf%%s" % _("Avg"), "GPRINT:ip6_reasm_timeout_max:%s %%5.0lf%%s" % _("Max"), @@ -109,14 +109,14 @@ class GraphTemplateIPv4Fragmentation(base.GraphTemplate): # Reassembly "AREA:ip4_reasm_real_fails%s:%-24s" % \ - (util.lighten(COLOUR_ERROR), _("Failed Reassemblies")), + (lighten(COLOUR_ERROR), _("Failed Reassemblies")), "GPRINT:ip4_reasm_fails_cur:%s %%5.0lf%%s" % _("Now"), "GPRINT:ip4_reasm_fails_avg:%s %%5.0lf%%s" % _("Avg"), "GPRINT:ip4_reasm_fails_max:%s %%5.0lf%%s" % _("Max"), "GPRINT:ip4_reasm_fails_min:%s %%5.0lf%%s\\j" % _("Min"), "AREA:ip4_reasm_timeout%s:%-24s:STACK" % \ - (util.lighten(COLOUR_WARN), _("Reassembly Timeouts")), + (lighten(COLOUR_WARN), _("Reassembly Timeouts")), "GPRINT:ip4_reasm_timeout_cur:%s %%5.0lf%%s" % _("Now"), "GPRINT:ip4_reasm_timeout_avg:%s %%5.0lf%%s" % _("Avg"), "GPRINT:ip4_reasm_timeout_max:%s %%5.0lf%%s" % _("Max"), diff --git a/src/collecty/plugins/memory.py b/src/collecty/plugins/memory.py index bc04918..65b56de 100644 --- a/src/collecty/plugins/memory.py +++ b/src/collecty/plugins/memory.py @@ -22,7 +22,6 @@ from . import base from ..i18n import _ -from .. import util from ..colours import * class GraphTemplateMemory(base.GraphTemplate): @@ -36,17 +35,17 @@ class GraphTemplateMemory(base.GraphTemplate): _ = self.locale.translate return [ - "AREA:used%s:%-15s" % (util.lighten(MEMORY_USED, AREA_OPACITY), _("Used memory")), + "AREA:used%s:%-15s" % (lighten(MEMORY_USED, AREA_OPACITY), _("Used memory")), "GPRINT:used_max:%12s\:" % _("Maximum") + " %6.2lf" , "GPRINT:used_min:%12s\:" % _("Minimum") + " %6.2lf", "GPRINT:used_avg:%12s\:" % _("Average") + " %6.2lf\\n", - "STACK:buffered%s:%-15s" % (util.lighten(MEMORY_BUFFERED, AREA_OPACITY), _("Buffered data")), + "STACK:buffered%s:%-15s" % (lighten(MEMORY_BUFFERED, AREA_OPACITY), _("Buffered data")), "GPRINT:buffered_max:%12s\:" % _("Maximum") + " %6.2lf" , "GPRINT:buffered_min:%12s\:" % _("Minimum") + " %6.2lf", "GPRINT:buffered_avg:%12s\:" % _("Average") + " %6.2lf\\n", - "STACK:cached%s:%-15s" % (util.lighten(MEMORY_CACHED, AREA_OPACITY), _("Cached data")), + "STACK:cached%s:%-15s" % (lighten(MEMORY_CACHED, AREA_OPACITY), _("Cached data")), "GPRINT:cached_max:%12s\:" % _("Maximum") + " %6.2lf" , "GPRINT:cached_min:%12s\:" % _("Minimum") + " %6.2lf", "GPRINT:cached_avg:%12s\:" % _("Average") + " %6.2lf\\n", -- 2.39.2