mirror of
https://github.com/kepler155c/opus
synced 2025-01-17 10:52:53 +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 = {
|
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',
|
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 = '',
|
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 = '',
|
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 = '',
|
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 {
|
local tab = UI.Tab {
|
||||||
@ -91,7 +91,6 @@ local function getDriveInfo(p)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local sz = fs.getSize(path)
|
local sz = fs.getSize(path)
|
||||||
|
|
||||||
files = files + 1
|
files = files + 1
|
||||||
if drive == 'rom' then
|
if drive == 'rom' then
|
||||||
total = total + sz
|
total = total + sz
|
||||||
@ -117,10 +116,12 @@ end
|
|||||||
|
|
||||||
function tab:updateInfo()
|
function tab:updateInfo()
|
||||||
local selected = self.drives:getSelected()
|
local selected = self.drives:getSelected()
|
||||||
|
_syslog(selected)
|
||||||
local info, percent = getDriveInfo(selected and selected.name or self.drives.values[1].name)
|
local info, percent = getDriveInfo(selected and selected.name or self.drives.values[1].name)
|
||||||
self.infos:setValues(info)
|
self.infos:setValues(info)
|
||||||
self.progress.value = percent
|
self.progress.value = percent
|
||||||
self.percentage.value = ('%#3d%%'):format(percent)
|
self.percentage.value = ('%#3d%%'):format(percent)
|
||||||
|
self.icon.image = NFT.parse(NftImages[selected.name] or NftImages.blank)
|
||||||
self:draw()
|
self:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -139,8 +140,9 @@ end
|
|||||||
function tab:eventHandler(event)
|
function tab:eventHandler(event)
|
||||||
if event.type == 'grid_focus_row' then
|
if event.type == 'grid_focus_row' then
|
||||||
self:updateInfo()
|
self:updateInfo()
|
||||||
|
else return UI.Tab.eventHandler(self, event)
|
||||||
end
|
end
|
||||||
return UI.Tab.eventHandler(self, event)
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
Event.on({ 'disk', 'disk_eject' }, function()
|
Event.on({ 'disk', 'disk_eject' }, function()
|
||||||
|
Loading…
Reference in New Issue
Block a user