From 4baa0e6f5c32bbb535bdb0932949619ed2aaeb11 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Tue, 12 Apr 2016 08:17:34 +0200 Subject: [PATCH] Add alternative text for icons/flags --- display.py | 2 +- plugins/display/browsers.py | 12 ++++++------ plugins/display/ip_to_geo.py | 10 +++++----- plugins/display/operating_systems.py | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/display.py b/display.py index b5a5bc0..2eaab86 100644 --- a/display.py +++ b/display.py @@ -364,7 +364,7 @@ class DisplayHTMLPage(object): for block in self.blocks: block.build(f, filters=filters) if displayVersion: - f.write(u'
Generated by IWLA %s
' % + f.write(u'Generated by IWLA %s' % ("http://indefero.soutade.fr/p/iwla", self.iwla.getVersion())) f.write(u'') f.close() diff --git a/plugins/display/browsers.py b/plugins/display/browsers.py index 3d1202d..cfe15a3 100644 --- a/plugins/display/browsers.py +++ b/plugins/display/browsers.py @@ -83,11 +83,11 @@ class IWLADisplayBrowsers(IPlugin): for (browser, entrance) in new_list: if browser != 'unknown': try: - icon = '' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]]) + icon = 'Browser icon' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]]) except: - icon = '' % (self.icon_path) + icon = 'Browser icon' % (self.icon_path) else: - icon = '' % (self.icon_path) + icon = 'Browser icon' % (self.icon_path) browser = 'Unknown' table.appendRow([icon, browser, entrance]) total_browsers[2] += entrance @@ -115,11 +115,11 @@ class IWLADisplayBrowsers(IPlugin): for (browser, entrance) in browsers[:10]: if browser != 'unknown': try: - icon = '' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]]) + icon = 'Browser icon' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]]) except: - icon = '' % (self.icon_path) + icon = 'Browser icon' % (self.icon_path) else: - icon = '' % (self.icon_path) + icon = 'Browser icon' % (self.icon_path) browser = self.iwla._(u'Unknown') table.appendRow([icon, browser, entrance]) total_browsers[2] -= entrance diff --git a/plugins/display/ip_to_geo.py b/plugins/display/ip_to_geo.py index 97433a3..d104a64 100644 --- a/plugins/display/ip_to_geo.py +++ b/plugins/display/ip_to_geo.py @@ -54,7 +54,7 @@ class IWLADisplayTopGeo(IPlugin): def __init__(self, iwla): super(IWLADisplayTopGeo, self).__init__(iwla) self.API_VERSION = 1 - self.requires = ['IWLAPostAnalysisIPToGeo'] + #self.requires = ['IWLAPostAnalysisIPToGeo'] def load(self): self.icon_path = self.iwla.getConfValue('icon_path', '/') @@ -65,7 +65,7 @@ class IWLADisplayTopGeo(IPlugin): return True - @staticmethod # Needed to have unbound methd + @staticmethod # Needed to have unbound method def FlagFilter(host, self): cc = None host_name = host.split(' ')[0] # hostname or ip @@ -77,7 +77,7 @@ class IWLADisplayTopGeo(IPlugin): cc = visitor.get('country_code', None) break if not cc or cc == 'ip': return None - icon = '' % (self.icon_path, cc) + icon = 'Country flag' % (self.icon_path, cc) return '%s %s' % (icon ,host) def hook(self): @@ -96,7 +96,7 @@ class IWLADisplayTopGeo(IPlugin): table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Countries'), ['', self.iwla._(u'Country'), self.iwla._(u'Visitors')]) table.setColsCSSClass(['', '', 'iwla_hit']) for (cc, visitors) in geo: - icon = '' % (self.icon_path, cc) + icon = 'Country flag' % (self.icon_path, cc) table.appendRow([icon, cc, visitors]) table.computeRatio(2) page.appendBlock(table) @@ -114,7 +114,7 @@ class IWLADisplayTopGeo(IPlugin): table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Countries'), self.iwla._(u'Visitors')]) table.setColsCSSClass(['', '', 'iwla_hit']) for (cc, visitors) in geo[:10]: - icon = '' % (self.icon_path, cc) + icon = 'Country flag' % (self.icon_path, cc) table.appendRow([icon, cc, visitors]) table.computeRatio(2) index.appendBlock(table) diff --git a/plugins/display/operating_systems.py b/plugins/display/operating_systems.py index 0b4324f..dfb88c3 100644 --- a/plugins/display/operating_systems.py +++ b/plugins/display/operating_systems.py @@ -78,7 +78,7 @@ class IWLADisplayTopOperatingSystems(IPlugin): table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Operating Systems'), ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')]) table.setColsCSSClass(['', '', 'iwla_hit']) for (os_name, entrance) in operating_systems: - icon = '' % (self.icon_path, os_name) + icon = 'Operating system icon' % (self.icon_path, os_name) table.appendRow([icon, os_name, entrance]) page.appendBlock(table) @@ -95,7 +95,7 @@ class IWLADisplayTopOperatingSystems(IPlugin): table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')]) table.setColsCSSClass(['', '', 'iwla_hit']) for (family, entrance) in os_families: - icon = '' % (self.icon_path, self.icon_names[family]) + icon = 'Operating system icon' % (self.icon_path, self.icon_names[family]) table.appendRow([icon, family, entrance]) table.computeRatio(2) index.appendBlock(table)