improved aligment of UI and indentation of Python code

This commit is contained in:
angelopoerio 2016-08-20 17:49:13 +02:00
parent 5ae130e386
commit 8b0247e97f
5 changed files with 44 additions and 44 deletions

View File

@ -1,8 +1,10 @@
<div class="table-row">
<div class="table-cell text-left title">IRQ</div>
<div class="table-cell"></div>
<div class="table-cell">Rate/s</div>
</div>
<div class="table-row" ng-repeat="irq in statsIrq.irqs">
<div class="table-cell text-left">{{irq.irq_line}}</div>
<div class="table-cell">{{irq.irq_rate}}</div>
<div class="table-cell"></div>
<div class="table-cell"><span>{{irq.irq_rate}}</span></div>
</div>

View File

@ -49,9 +49,8 @@
<section id="ports" class="plugin table-row-group" ng-show="!arguments.disable_ports" ng-include src="'plugins/ports.html'"></section>
<section id="diskio" class="plugin table-row-group" ng-show="!arguments.disable_diskio && statsDiskio.disks.length > 0" ng-include src="'plugins/diskio.html'"></section>
<section id="irq" class="plugin table-row-group" ng-show="!arguments.disable_irq" ng-include src="'plugins/irq.html'"></section>
<section id="fs" class="plugin table-row-group" ng-show="!arguments.disable_fs" ng-include src="'plugins/fs.html'"></section>
<section id="irq" class="plugin table-row-group" ng-show="!arguments.disable_irq" ng-include src="'plugins/irq.html'"></section>
<section id="folders" class="plugin table-row-group" ng-show="!arguments.disable_fs && statsFolders.folders.length > 0" ng-include src="'plugins/folders.html'"></section>
<section id="raid" class="plugin table-row-group" ng-show="statsRaid.hasDisks()" ng-include src="'plugins/raid.html'"></section>
<section id="sensors" class="plugin table-row-group" ng-show="!arguments.disable_sensors && statsSensors.sensors.length > 0" ng-include src="'plugins/sensors.html'"></section>

View File

@ -50,16 +50,16 @@ class Plugin(GlancesPlugin):
pass
def generate_view_data(self):
self.view_data['version'] = '{} {}'.format(__appname__.title(), __version__)
self.view_data['psutil_version'] = ' with PSutil {}'.format(psutil_version)
self.view_data['version'] = '{0} {1}'.format(__appname__.title(), __version__)
self.view_data['psutil_version'] = ' with PSutil {0}'.format(psutil_version)
try:
self.view_data['configuration_file'] = 'Configuration file: {}'.format(self.config.loaded_config_file)
self.view_data['configuration_file'] = 'Configuration file: {0}'.format(self.config.loaded_config_file)
except AttributeError:
pass
msg_col = ' {:1} {:35}'
msg_col2 = ' {:1} {:35}'
msg_col = ' {0:1} {1:35}'
msg_col2 = ' {0:1} {1:35}'
self.view_data['sort_auto'] = msg_col.format('a', 'Sort processes automatically')
self.view_data['sort_network'] = msg_col2.format('b', 'Bytes or bits for network I/O')
self.view_data['sort_cpu'] = msg_col.format('c', 'Sort processes by CPU%')
@ -94,8 +94,6 @@ class Plugin(GlancesPlugin):
self.view_data['show_hide_ip'] = msg_col2.format('I', 'Show/hide IP module')
self.view_data['diskio_iops'] = msg_col2.format('B', 'Count/rate for Disk I/O')
self.view_data['show_hide_top_menu'] = msg_col2.format('5', 'Show/hide top menu (QL, CPU, MEM, SWAP and LOAD)')
self.view_data['show_hide_amp'] = msg_col2.format('A', 'Show/hide AMP plugin')
self.view_data['enable_disable_ports'] = msg_col.format('P', 'Enable/disable ports plugin')
self.view_data['edit_pattern_filter'] = 'ENTER: Edit the process filter pattern'
def get_view_data(self, args=None):
@ -167,14 +165,11 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_add_line(self.view_data['show_hide_top_menu']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_short_processname']))
ret.append(self.curse_add_line(self.view_data['show_hide_amp']))
ret.append(self.curse_add_line(self.view_data['show_hide_irq']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_irix']))
ret.append(self.curse_add_line(self.view_data['quit']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_ports']))
ret.append(self.curse_add_line(self.view_data['show_hide_irq']))
ret.append(self.curse_new_line())
ret.append(self.curse_new_line())

View File

@ -64,9 +64,13 @@ class Plugin(GlancesPlugin):
irq_proc.readline() # skip header line
for irq_line in irq_proc.readlines():
splitted_line = irq_line.split()
irq_line = splitted_line[0].replace(':','')
current_irqs = sum([int(count) for count in splitted_line[1:] if count.isdigit()]) # sum interrupts on all CPUs
irq_rate = int(current_irqs - self.lasts.get(irq_line) if self.lasts.get(irq_line) else 0 // time_since_update)
irq_line = splitted_line[0].replace(':', '')
current_irqs = sum([int(count) for count in splitted_line[
1:] if count.isdigit()]) # sum interrupts on all CPUs
irq_rate = int(
current_irqs -
self.lasts.get(irq_line) if self.lasts.get(irq_line) else 0 //
time_since_update)
irq_current = {
'irq_line': irq_line,
'irq_rate': irq_rate,
@ -83,7 +87,8 @@ class Plugin(GlancesPlugin):
# Update the view
self.update_views()
self.stats = sorted(self.stats, key=operator.itemgetter('irq_rate'), reverse=True)[:5] # top 5 IRQ by rate/s
self.stats = sorted(self.stats, key=operator.itemgetter(
'irq_rate'), reverse=True)[:5] # top 5 IRQ by rate/s
return self.stats
def update_views(self):
@ -91,7 +96,6 @@ class Plugin(GlancesPlugin):
# Call the father's method
super(Plugin, self).update_views()
def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
@ -110,14 +114,14 @@ class Plugin(GlancesPlugin):
# Header
msg = '{:{width}}'.format('IRQ', width=irq_max_width)
ret.append(self.curse_add_line(msg, "TITLE"))
msg = '{:>7}'.format('Rate/s')
msg = '{:>14}'.format('Rate/s')
ret.append(self.curse_add_line(msg))
for i in self.stats:
ret.append(self.curse_new_line())
msg = '{:>3}'.format(i['irq_line'])
ret.append(self.curse_add_line(msg))
msg = '{:>12}'.format(str(i['irq_rate']))
msg = '{:>20}'.format(str(i['irq_rate']))
ret.append(self.curse_add_line(msg))
return ret