mirror of
https://github.com/kepler155c/opus
synced 2024-12-24 23:50:26 +00:00
grid setSelected, update tron url/icon
This commit is contained in:
parent
beae4e6eaf
commit
1fb5379b11
@ -1424,6 +1424,18 @@ function UI.Grid:getSelected()
|
||||
end
|
||||
end
|
||||
|
||||
function UI.Grid:setSelected(name, value)
|
||||
if self.sorted then
|
||||
for k,v in pairs(self.sorted) do
|
||||
if self.values[v][name] == value then
|
||||
self:setIndex(k)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
self:setIndex(1)
|
||||
end
|
||||
|
||||
function UI.Grid:focus()
|
||||
self:drawRows()
|
||||
end
|
||||
@ -1465,14 +1477,7 @@ function UI.Grid:update()
|
||||
end
|
||||
end
|
||||
|
||||
self.sorted = { }
|
||||
for k,v in pairs(self.values) do
|
||||
if self:isRowValid(k, v) then
|
||||
table.insert(self.sorted, k)
|
||||
end
|
||||
end
|
||||
|
||||
--self.sorted = Util.keys(self.values)
|
||||
self.sorted = Util.keys(self.values)
|
||||
if order then
|
||||
table.sort(self.sorted, function(a,b)
|
||||
return order(self.values[a], self.values[b])
|
||||
@ -1558,12 +1563,6 @@ function UI.Grid:drawRows()
|
||||
end
|
||||
end
|
||||
|
||||
-- Non-intuitive: update must be called if the table was specified
|
||||
-- in the shortcut definition (as this callback was not yet overridden)
|
||||
function UI.Grid:isRowValid(--[[ key, value ]])
|
||||
return true
|
||||
end
|
||||
|
||||
function UI.Grid:getRowTextColor(row, selected)
|
||||
if selected then
|
||||
if self.focused then
|
||||
|
@ -137,7 +137,7 @@ function Canvas:writeBlit(x, y, text, bg, fg)
|
||||
if bg then
|
||||
bg = _sub(bg, 2 - x)
|
||||
end
|
||||
if bg then
|
||||
if fg then
|
||||
fg = _sub(fg, 2 - x)
|
||||
end
|
||||
width = width + x - 1
|
||||
@ -149,7 +149,7 @@ function Canvas:writeBlit(x, y, text, bg, fg)
|
||||
if bg then
|
||||
bg = _sub(bg, 1, self.width - x + 1)
|
||||
end
|
||||
if bg then
|
||||
if fg then
|
||||
fg = _sub(fg, 1, self.width - x + 1)
|
||||
end
|
||||
width = #text
|
||||
|
@ -203,9 +203,9 @@
|
||||
[ "76b849f460640bc789c433894382fb5acbac42a2" ] = {
|
||||
title = "Tron",
|
||||
category = "Games",
|
||||
iconExt = "\030 \031f\0305\031f\151\030f\0315\135\131\0305\031f\146\
|
||||
\030 \031f\030f\0315\130\141\0305\031f\139\030f\0315\130\
|
||||
\030 \031f\0305\031f\146\143\030f\0315\158\031e\130",
|
||||
run = "https://raw.githubusercontent.com/LDDestroier/CC/master/tron",
|
||||
iconExt = "\030 \031f\030b\031f\143\030f\128\128\030b\143\143\143\030f\128\128\
|
||||
\030 \031f\0309\031b\140\030b\031f\151\030f\031b\131\0307\148\0317\128\030b\151\030f\031b\131\148\
|
||||
\030 \031f\030f\031b\131\031f\128\031b\131\0317\131\031f\128\0317\131\031b\131\031f\128",
|
||||
run = "https://raw.githubusercontent.com/LDDestroier/CC/master/tron.lua",
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user