mirror of
https://github.com/kepler155c/opus
synced 2025-01-17 02:42:52 +00:00
Added icons to diskusage
This commit is contained in:
parent
08eac79109
commit
4a089ecd85
@ -9,9 +9,9 @@ local peripheral = _G.peripheral
|
||||
|
||||
local NftImages = {
|
||||
blank = '\30\56\31\55\153\153\153\153\153\153\153\153\10\30\55\31\56\153\153\153\153\153\153\153\153\10\30\56\31\55\153\153\153\153\153\153\153\153\10\30\55\31\56\153\153\153\153\153\153\153\153\10\30\56\31\55\153\153\153\153\153\153\153\153',
|
||||
drive = '',
|
||||
rom = '',
|
||||
hdd = '',
|
||||
disk = '\30\32\31\32\32\30\98\31\98\128\30\56\31\56\128\128\30\102\149\30\98\149\31\57\139\10\30\32\31\32\32\30\98\31\98\128\128\128\128\128\128\10\30\32\31\32\32\30\98\31\98\128\30\48\31\55\95\95\95\95\30\98\31\98\128\10\30\32\31\32\32\30\98\31\98\128\30\48\31\55\95\95\95\95\30\98\31\98\128',
|
||||
rom = '\30\57\31\57\128\31\56\144\144\144\144\144\31\57\128\10\30\56\31\57\157\30\55\31\55\128\128\128\128\128\30\57\31\56\145\10\30\57\31\56\136\30\55\31\55\128\30\55\31\48\82\79\77\30\55\128\30\57\31\56\132\10\30\56\31\57\157\30\55\31\55\128\128\128\128\128\30\57\31\56\145\10\30\57\31\57\128\31\56\129\129\129\129\129\31\57\128',
|
||||
hdd = '\30\32\31\32\32\30\55\31\55\128\30\48\135\131\139\30\55\128\10\30\32\31\32\32\30\48\31\55\149\31\48\128\30\55\131\30\48\128\30\55\149\10\30\32\31\32\32\30\55\31\48\130\30\48\31\55\144\30\56\31\48\133\30\55\159\129\10\30\32\31\32\32\30\56\31\55\149\129\142\159\30\55\128\10\30\32\31\32\32\30\57\31\55\143\143\143\143\143',
|
||||
}
|
||||
|
||||
local tab = UI.Tab {
|
||||
@ -91,7 +91,6 @@ local function getDriveInfo(p)
|
||||
end
|
||||
else
|
||||
local sz = fs.getSize(path)
|
||||
|
||||
files = files + 1
|
||||
if drive == 'rom' then
|
||||
total = total + sz
|
||||
@ -117,10 +116,12 @@ end
|
||||
|
||||
function tab:updateInfo()
|
||||
local selected = self.drives:getSelected()
|
||||
_syslog(selected)
|
||||
local info, percent = getDriveInfo(selected and selected.name or self.drives.values[1].name)
|
||||
self.infos:setValues(info)
|
||||
self.progress.value = percent
|
||||
self.percentage.value = ('%#3d%%'):format(percent)
|
||||
self.icon.image = NFT.parse(NftImages[selected.name] or NftImages.blank)
|
||||
self:draw()
|
||||
end
|
||||
|
||||
@ -139,8 +140,9 @@ end
|
||||
function tab:eventHandler(event)
|
||||
if event.type == 'grid_focus_row' then
|
||||
self:updateInfo()
|
||||
else return UI.Tab.eventHandler(self, event)
|
||||
end
|
||||
return UI.Tab.eventHandler(self, event)
|
||||
return true
|
||||
end
|
||||
|
||||
Event.on({ 'disk', 'disk_eject' }, function()
|
||||
|
Loading…
Reference in New Issue
Block a user