From 3cad0178d50dbed05e21bdda6c4c095a3d446b11 Mon Sep 17 00:00:00 2001 From: petrucci4prez Date: Mon, 17 Jul 2017 02:21:22 -0400 Subject: [PATCH] clean up Pacman.lua --- module/Pacman.lua | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/module/Pacman.lua b/module/Pacman.lua index 872cff3..d2bda1f 100644 --- a/module/Pacman.lua +++ b/module/Pacman.lua @@ -6,20 +6,19 @@ local TextColumn = require 'TextColumn' local util = require 'util' local schema = require 'default_patterns' ---construction params -local TEXT_SPACING = 20 +local _TEXT_SPACING_ = 20 local header = Widget.Header{ x = _G_INIT_DATA_.RIGHT_X, y = _G_INIT_DATA_.TOP_Y, width = _G_INIT_DATA_.SECTION_WIDTH, - header = "PACMAN" + header = 'PACMAN' } local labels = Widget.TextColumn{ x = _G_INIT_DATA_.RIGHT_X, y = header.bottom_y, - spacing = TEXT_SPACING, + spacing = _TEXT_SPACING_, 'Total', 'Explicit', 'Outdated', @@ -29,7 +28,7 @@ local labels = Widget.TextColumn{ local info = Widget.TextColumn{ x = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH, y = header.bottom_y, - spacing = TEXT_SPACING, + spacing = _TEXT_SPACING_, x_align = 'right', text_color = schema.blue, num_rows = 5, @@ -37,25 +36,25 @@ local info = Widget.TextColumn{ Widget = nil schema = nil -TEXT_SPACING = nil +_TEXT_SPACING_ = nil -local __update = function(cr) - local execute_cmd = util.execute_cmd - local line_count = util.line_count +local update = function(cr) + local _execute_cmd = util.execute_cmd + local _line_count = util.line_count - TextColumn.set(info, cr, 1, line_count(execute_cmd('pacman -Q'))) - TextColumn.set(info, cr, 2, line_count(execute_cmd('pacman -Qe'))) - TextColumn.set(info, cr, 3, line_count(execute_cmd('pacman -Qu'))) - TextColumn.set(info, cr, 4, line_count(execute_cmd('pacman -Qdt'))) - TextColumn.set(info, cr, 5, line_count(execute_cmd('pacman -Qm'))) + TextColumn.set(info, cr, 1, _line_count(_execute_cmd('pacman -Q'))) + TextColumn.set(info, cr, 2, _line_count(_execute_cmd('pacman -Qe'))) + TextColumn.set(info, cr, 3, _line_count(_execute_cmd('pacman -Qu'))) + TextColumn.set(info, cr, 4, _line_count(_execute_cmd('pacman -Qdt'))) + TextColumn.set(info, cr, 5, _line_count(_execute_cmd('pacman -Qm'))) end -__update(_CR) +update(_CR) _CR = nil local draw = function(cr, current_interface, trigger) - if trigger == 0 then __update(cr) end + if trigger == 0 then update(cr) end if current_interface == 0 then Text.draw(header.text, cr)