auto upgrade packages on base opus update - github actions wip
This commit is contained in:
@@ -47,13 +47,13 @@ function Entry:updateScroll()
|
||||
self.scroll = 0 -- ??
|
||||
end
|
||||
if self.pos - self.scroll > self.width then
|
||||
self.scroll = self.pos - self.width
|
||||
self.scroll = math.max(0, self.pos - self.width)
|
||||
elseif self.pos < self.scroll then
|
||||
self.scroll = self.pos
|
||||
end
|
||||
if self.scroll > 0 then
|
||||
if self.scroll + self.width > len then
|
||||
self.scroll = len - self.width
|
||||
self.scroll = math.max(0, len - self.width)
|
||||
end
|
||||
end
|
||||
if ps ~= self.scroll then
|
||||
|
||||
@@ -37,13 +37,14 @@ local textutils = _G.textutils
|
||||
local UI = { }
|
||||
function UI:init()
|
||||
self.devices = { }
|
||||
self.theme = { }
|
||||
self.extChars = Util.getVersion() >= 1.76
|
||||
self.colors = {
|
||||
primary = colors.green,
|
||||
secondary = colors.lightGray,
|
||||
tertiary = colors.gray,
|
||||
self.theme = {
|
||||
colors = {
|
||||
primary = colors.green,
|
||||
secondary = colors.lightGray,
|
||||
tertiary = colors.gray,
|
||||
}
|
||||
}
|
||||
self.extChars = Util.getVersion() >= 1.76
|
||||
|
||||
local function keyFunction(event, code, held)
|
||||
local ie = Input:translate(event, code, held)
|
||||
@@ -206,6 +207,10 @@ function UI:loadTheme(filename)
|
||||
end
|
||||
Util.deepMerge(self.theme, theme)
|
||||
end
|
||||
for k,v in pairs(self.theme.colors) do
|
||||
Canvas.colorPalette[k] = Canvas.colorPalette[v]
|
||||
Canvas.grayscalePalette[k] = Canvas.grayscalePalette[v]
|
||||
end
|
||||
end
|
||||
|
||||
function UI:generateTheme(filename)
|
||||
@@ -920,6 +925,13 @@ function UI.Window:addTransition(effect, args, canvas)
|
||||
self.parent:addTransition(effect, args, canvas or self)
|
||||
end
|
||||
|
||||
UI.Window.docs.emit = [[emit(TABLE event)
|
||||
Send an event to the element. The event handler for the element is called.
|
||||
If the event handler returns true, then no further processing is done.
|
||||
If the event handler does not return true, then the event is sent to the parent element
|
||||
and continues up the element tree.
|
||||
If an accelerator is defined, the accelerated event is processed in the same manner.
|
||||
Accelerators are useful for making events unique.]]
|
||||
function UI.Window:emit(event)
|
||||
local parent = self
|
||||
while parent do
|
||||
@@ -1118,13 +1130,6 @@ end
|
||||
|
||||
loadComponents()
|
||||
UI:loadTheme('usr/config/ui.theme')
|
||||
Util.merge(UI.Window.defaults, UI.theme.Window)
|
||||
Util.merge(UI.colors, UI.theme.colors)
|
||||
UI:setDefaultDevice(UI.Device())
|
||||
|
||||
for k,v in pairs(UI.colors) do
|
||||
Canvas.colorPalette[k] = Canvas.colorPalette[v]
|
||||
Canvas.grayscalePalette[k] = Canvas.grayscalePalette[v]
|
||||
end
|
||||
|
||||
return UI
|
||||
|
||||
@@ -40,7 +40,7 @@ function UI.Chooser:draw()
|
||||
local value = choice and choice.name or self.nochoice
|
||||
|
||||
self:write(1, 1, self.leftIndicator, self.backgroundColor, colors.black)
|
||||
self:write(2, 1, ' ' .. Util.widthify(tostring(value), self.width-4) .. ' ', bg, fg)
|
||||
self:write(2, 1, ' ' .. Util.widthify(tostring(value), self.width - 4) .. ' ', bg, fg)
|
||||
self:write(self.width, 1, self.rightIndicator, self.backgroundColor, colors.black)
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ function UI.Chooser:eventHandler(event)
|
||||
local choice
|
||||
if not k then k = 0 end
|
||||
if k and k < #self.choices then
|
||||
choice = self.choices[k+1]
|
||||
choice = self.choices[k + 1]
|
||||
else
|
||||
choice = self.choices[1]
|
||||
end
|
||||
@@ -62,11 +62,12 @@ function UI.Chooser:eventHandler(event)
|
||||
self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice })
|
||||
self:draw()
|
||||
return true
|
||||
|
||||
elseif event.type == 'choice_prev' then
|
||||
local _,k = Util.find(self.choices, 'value', self.value)
|
||||
local choice
|
||||
if k and k > 1 then
|
||||
choice = self.choices[k-1]
|
||||
choice = self.choices[k - 1]
|
||||
else
|
||||
choice = self.choices[#self.choices]
|
||||
end
|
||||
@@ -74,6 +75,7 @@ function UI.Chooser:eventHandler(event)
|
||||
self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice })
|
||||
self:draw()
|
||||
return true
|
||||
|
||||
elseif event.type == 'mouse_click' or event.type == 'mouse_doubleclick' then
|
||||
if event.x == 1 then
|
||||
self:emit({ type = 'choice_prev' })
|
||||
|
||||
Reference in New Issue
Block a user