mirror of https://github.com/kepler155c/opus
cleanup
This commit is contained in:
parent
775871c548
commit
9eeec8719c
|
@ -82,12 +82,53 @@ local Browser = UI.Page {
|
||||||
},
|
},
|
||||||
sortColumn = 'name',
|
sortColumn = 'name',
|
||||||
y = 2, ey = -2,
|
y = 2, ey = -2,
|
||||||
|
sortCompare = function(self, a, b)
|
||||||
|
if self.sortColumn == 'fsize' then
|
||||||
|
return a.size < b.size
|
||||||
|
elseif self.sortColumn == 'flags' then
|
||||||
|
return a.flags < b.flags
|
||||||
|
end
|
||||||
|
if a.isDir == b.isDir then
|
||||||
|
return a.name:lower() < b.name:lower()
|
||||||
|
end
|
||||||
|
return a.isDir
|
||||||
|
end,
|
||||||
|
getRowTextColor = function(_, file)
|
||||||
|
if file.marked then
|
||||||
|
return colors.green
|
||||||
|
end
|
||||||
|
if file.isDir then
|
||||||
|
return colors.cyan
|
||||||
|
end
|
||||||
|
if file.isReadOnly then
|
||||||
|
return colors.pink
|
||||||
|
end
|
||||||
|
return colors.white
|
||||||
|
end,
|
||||||
|
eventHandler = function(self, event)
|
||||||
|
if event.type == 'copy' then -- let copy be handled by parent
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return UI.ScrollingGrid.eventHandler(self, event)
|
||||||
|
end
|
||||||
},
|
},
|
||||||
statusBar = UI.StatusBar {
|
statusBar = UI.StatusBar {
|
||||||
columns = {
|
columns = {
|
||||||
{ key = 'status' },
|
{ key = 'status' },
|
||||||
{ key = 'totalSize', width = 6 },
|
{ key = 'totalSize', width = 6 },
|
||||||
},
|
},
|
||||||
|
draw = function(self)
|
||||||
|
if self.parent.dir then
|
||||||
|
local info = '#:' .. Util.size(self.parent.dir.files)
|
||||||
|
local numMarked = Util.size(marked)
|
||||||
|
if numMarked > 0 then
|
||||||
|
info = info .. ' M:' .. numMarked
|
||||||
|
end
|
||||||
|
self:setValue('info', info)
|
||||||
|
self:setValue('totalSize', formatSize(self.parent.dir.totalSize))
|
||||||
|
UI.StatusBar.draw(self)
|
||||||
|
end
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
question = UI.Question {
|
question = UI.Question {
|
||||||
y = -2, x = -19,
|
y = -2, x = -19,
|
||||||
|
@ -181,51 +222,6 @@ function Browser.menuBar:getActive(menuItem)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function Browser.grid:sortCompare(a, b)
|
|
||||||
if self.sortColumn == 'fsize' then
|
|
||||||
return a.size < b.size
|
|
||||||
elseif self.sortColumn == 'flags' then
|
|
||||||
return a.flags < b.flags
|
|
||||||
end
|
|
||||||
if a.isDir == b.isDir then
|
|
||||||
return a.name:lower() < b.name:lower()
|
|
||||||
end
|
|
||||||
return a.isDir
|
|
||||||
end
|
|
||||||
|
|
||||||
function Browser.grid:getRowTextColor(file)
|
|
||||||
if file.marked then
|
|
||||||
return colors.green
|
|
||||||
end
|
|
||||||
if file.isDir then
|
|
||||||
return colors.cyan
|
|
||||||
end
|
|
||||||
if file.isReadOnly then
|
|
||||||
return colors.pink
|
|
||||||
end
|
|
||||||
return colors.white
|
|
||||||
end
|
|
||||||
|
|
||||||
function Browser.grid:eventHandler(event)
|
|
||||||
if event.type == 'copy' then -- let copy be handled by parent
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return UI.ScrollingGrid.eventHandler(self, event)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Browser.statusBar:draw()
|
|
||||||
if self.parent.dir then
|
|
||||||
local info = '#:' .. Util.size(self.parent.dir.files)
|
|
||||||
local numMarked = Util.size(marked)
|
|
||||||
if numMarked > 0 then
|
|
||||||
info = info .. ' M:' .. numMarked
|
|
||||||
end
|
|
||||||
self:setValue('info', info)
|
|
||||||
self:setValue('totalSize', formatSize(self.parent.dir.totalSize))
|
|
||||||
UI.StatusBar.draw(self)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Browser:setStatus(status, ...)
|
function Browser:setStatus(status, ...)
|
||||||
self.notification:info(string.format(status, ...))
|
self.notification:info(string.format(status, ...))
|
||||||
end
|
end
|
||||||
|
@ -261,7 +257,6 @@ function Browser:getDirectory(directory)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Browser:updateDirectory(dir)
|
function Browser:updateDirectory(dir)
|
||||||
|
|
||||||
dir.size = 0
|
dir.size = 0
|
||||||
dir.totalSize = 0
|
dir.totalSize = 0
|
||||||
Util.clear(dir.files)
|
Util.clear(dir.files)
|
||||||
|
|
|
@ -4,7 +4,7 @@ local colors = _G.colors
|
||||||
local peripheral = _G.peripheral
|
local peripheral = _G.peripheral
|
||||||
local settings = _G.settings
|
local settings = _G.settings
|
||||||
|
|
||||||
local tab = UI.Tab {
|
return peripheral.find('monitor') and UI.Tab {
|
||||||
tabTitle = 'Kiosk',
|
tabTitle = 'Kiosk',
|
||||||
description = 'Kiosk options',
|
description = 'Kiosk options',
|
||||||
form = UI.Form {
|
form = UI.Form {
|
||||||
|
@ -29,35 +29,29 @@ local tab = UI.Tab {
|
||||||
backgroundColor = colors.black,
|
backgroundColor = colors.black,
|
||||||
value = 'Settings apply to kiosk mode selected during startup'
|
value = 'Settings apply to kiosk mode selected during startup'
|
||||||
},
|
},
|
||||||
}
|
enable = function(self)
|
||||||
|
local choices = { }
|
||||||
|
|
||||||
function tab:enable()
|
peripheral.find('monitor', function(side)
|
||||||
local choices = { }
|
table.insert(choices, { name = side, value = side })
|
||||||
|
end)
|
||||||
|
|
||||||
peripheral.find('monitor', function(side)
|
self.form.monitor.choices = choices
|
||||||
table.insert(choices, { name = side, value = side })
|
self.form.monitor.value = settings.get('kiosk.monitor')
|
||||||
end)
|
|
||||||
|
|
||||||
self.form.monitor.choices = choices
|
self.form.textScale.value = settings.get('kiosk.textscale')
|
||||||
self.form.monitor.value = settings.get('kiosk.monitor')
|
|
||||||
|
|
||||||
self.form.textScale.value = settings.get('kiosk.textscale')
|
UI.Tab.enable(self)
|
||||||
|
end,
|
||||||
UI.Tab.enable(self)
|
eventHandler = function(self, event)
|
||||||
end
|
if event.type == 'choice_change' then
|
||||||
|
if self.form.monitor.value then
|
||||||
function tab:eventHandler(event)
|
settings.set('kiosk.monitor', self.form.monitor.value)
|
||||||
if event.type == 'choice_change' then
|
end
|
||||||
if self.form.monitor.value then
|
if self.form.textScale.value then
|
||||||
settings.set('kiosk.monitor', self.form.monitor.value)
|
settings.set('kiosk.textscale', self.form.textScale.value)
|
||||||
|
end
|
||||||
|
settings.save('.settings')
|
||||||
end
|
end
|
||||||
if self.form.textScale.value then
|
|
||||||
settings.set('kiosk.textscale', self.form.textScale.value)
|
|
||||||
end
|
|
||||||
settings.save('.settings')
|
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
|
|
||||||
if peripheral.find('monitor') then
|
|
||||||
return tab
|
|
||||||
end
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ local Util = require('opus.util')
|
||||||
local fs = _G.fs
|
local fs = _G.fs
|
||||||
local os = _G.os
|
local os = _G.os
|
||||||
|
|
||||||
local labelTab = UI.Tab {
|
return UI.Tab {
|
||||||
tabTitle = 'Label',
|
tabTitle = 'Label',
|
||||||
description = 'Set the computer label',
|
description = 'Set the computer label',
|
||||||
labelText = UI.Text {
|
labelText = UI.Text {
|
||||||
|
@ -40,14 +40,11 @@ local labelTab = UI.Tab {
|
||||||
{ key = 'value', textColor = colors.yellow },
|
{ key = 'value', textColor = colors.yellow },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
eventHandler = function(self, event)
|
||||||
|
if event.type == 'update_label' and self.label.value then
|
||||||
|
os.setComputerLabel(self.label.value)
|
||||||
|
self:emit({ type = 'success_message', message = 'Label updated' })
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
function labelTab:eventHandler(event)
|
|
||||||
if event.type == 'update_label' and self.label.value then
|
|
||||||
os.setComputerLabel(self.label.value)
|
|
||||||
self:emit({ type = 'success_message', message = 'Label updated' })
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return labelTab
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ local UI = require('opus.ui')
|
||||||
local colors = _G.colors
|
local colors = _G.colors
|
||||||
local device = _G.device
|
local device = _G.device
|
||||||
|
|
||||||
local tab = UI.Tab {
|
return UI.Tab {
|
||||||
tabTitle = 'Network',
|
tabTitle = 'Network',
|
||||||
description = 'Networking options',
|
description = 'Networking options',
|
||||||
info = UI.TextArea {
|
info = UI.TextArea {
|
||||||
|
@ -27,39 +27,35 @@ Reboot to take effect.]], Ansi.yellow, Ansi.reset)
|
||||||
x = 10, ex = -3, y = 3,
|
x = 10, ex = -3, y = 3,
|
||||||
nochoice = 'auto',
|
nochoice = 'auto',
|
||||||
},
|
},
|
||||||
}
|
enable = function(self)
|
||||||
|
local width = 7
|
||||||
|
local choices = {
|
||||||
|
{ name = 'auto', value = 'auto' },
|
||||||
|
{ name = 'disable', value = 'none' },
|
||||||
|
}
|
||||||
|
|
||||||
function tab:enable()
|
for k,v in pairs(device) do
|
||||||
local width = 7
|
if v.isWireless and v.isWireless() and k ~= 'wireless_modem' then
|
||||||
local choices = {
|
table.insert(choices, { name = k, value = v.name })
|
||||||
{ name = 'auto', value = 'auto' },
|
width = math.max(width, #k)
|
||||||
{ name = 'disable', value = 'none' },
|
end
|
||||||
}
|
end
|
||||||
|
|
||||||
for k,v in pairs(device) do
|
self.modem.choices = choices
|
||||||
if v.isWireless and v.isWireless() and k ~= 'wireless_modem' then
|
--self.modem.width = width + 4
|
||||||
table.insert(choices, { name = k, value = v.name })
|
|
||||||
width = math.max(width, #k)
|
local config = Config.load('os')
|
||||||
|
self.modem.value = config.wirelessModem or 'auto'
|
||||||
|
|
||||||
|
UI.Tab.enable(self)
|
||||||
|
end,
|
||||||
|
eventHandler = function(self, event)
|
||||||
|
if event.type == 'choice_change' then
|
||||||
|
local config = Config.load('os')
|
||||||
|
config.wirelessModem = self.modem.value
|
||||||
|
Config.update('os', config)
|
||||||
|
self:emit({ type = 'success_message', message = 'reboot to take effect' })
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
}
|
||||||
self.modem.choices = choices
|
|
||||||
--self.modem.width = width + 4
|
|
||||||
|
|
||||||
local config = Config.load('os')
|
|
||||||
self.modem.value = config.wirelessModem or 'auto'
|
|
||||||
|
|
||||||
UI.Tab.enable(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function tab:eventHandler(event)
|
|
||||||
if event.type == 'choice_change' then
|
|
||||||
local config = Config.load('os')
|
|
||||||
config.wirelessModem = self.modem.value
|
|
||||||
Config.update('os', config)
|
|
||||||
self:emit({ type = 'success_message', message = 'reboot to take effect' })
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return tab
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ local UI = require('opus.ui')
|
||||||
|
|
||||||
local colors = _G.colors
|
local colors = _G.colors
|
||||||
|
|
||||||
local passwordTab = UI.Tab {
|
return UI.Tab {
|
||||||
tabTitle = 'Password',
|
tabTitle = 'Password',
|
||||||
description = 'Wireless network password',
|
description = 'Wireless network password',
|
||||||
[1] = UI.Window {
|
[1] = UI.Window {
|
||||||
|
@ -30,19 +30,17 @@ local passwordTab = UI.Tab {
|
||||||
textColor = colors.yellow,
|
textColor = colors.yellow,
|
||||||
inactive = true,
|
inactive = true,
|
||||||
value = 'Add a password to enable other computers to connect to this one.',
|
value = 'Add a password to enable other computers to connect to this one.',
|
||||||
}
|
},
|
||||||
}
|
eventHandler = function(self, event)
|
||||||
function passwordTab:eventHandler(event)
|
if event.type == 'update_password' then
|
||||||
if event.type == 'update_password' then
|
if not self.newPass.value or #self.newPass.value == 0 then
|
||||||
if not self.newPass.value or #self.newPass.value == 0 then
|
self:emit({ type = 'error_message', message = 'Invalid password' })
|
||||||
self:emit({ type = 'error_message', message = 'Invalid password' })
|
|
||||||
|
|
||||||
else
|
else
|
||||||
Security.updatePassword(SHA.compute(self.newPass.value))
|
Security.updatePassword(SHA.compute(self.newPass.value))
|
||||||
self:emit({ type = 'success_message', message = 'Password updated' })
|
self:emit({ type = 'success_message', message = 'Password updated' })
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
|
|
||||||
return passwordTab
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ if not _colors.backgroundColor then
|
||||||
_colors.fileColor = colors.white
|
_colors.fileColor = colors.white
|
||||||
end
|
end
|
||||||
|
|
||||||
local tab = UI.Tab {
|
return UI.Tab {
|
||||||
tabTitle = 'Shell',
|
tabTitle = 'Shell',
|
||||||
description = 'Shell options',
|
description = 'Shell options',
|
||||||
grid1 = UI.ScrollingGrid {
|
grid1 = UI.ScrollingGrid {
|
||||||
|
@ -54,6 +54,13 @@ local tab = UI.Tab {
|
||||||
columns = { { key = 'name' } },
|
columns = { { key = 'name' } },
|
||||||
values = allColors,
|
values = allColors,
|
||||||
sortColumn = 'name',
|
sortColumn = 'name',
|
||||||
|
getRowTextColor = function(self, row)
|
||||||
|
local selected = self.parent.grid1:getSelected()
|
||||||
|
if _colors[selected.name] == row.value then
|
||||||
|
return colors.yellow
|
||||||
|
end
|
||||||
|
return UI.Grid.getRowTextColor(self, row)
|
||||||
|
end
|
||||||
},
|
},
|
||||||
directory = UI.Checkbox {
|
directory = UI.Checkbox {
|
||||||
x = 2, y = -2,
|
x = 2, y = -2,
|
||||||
|
@ -73,68 +80,56 @@ local tab = UI.Tab {
|
||||||
},
|
},
|
||||||
display = UI.Window {
|
display = UI.Window {
|
||||||
x = 2, ex = -2, y = -8, height = 5,
|
x = 2, ex = -2, y = -8, height = 5,
|
||||||
|
draw = function(self)
|
||||||
|
self:clear(_colors.backgroundColor)
|
||||||
|
local offset = 0
|
||||||
|
if config.displayDirectory then
|
||||||
|
self:write(1, 1,
|
||||||
|
'==' .. os.getComputerLabel() .. ':/dir/etc',
|
||||||
|
_colors.directoryBackgroundColor, _colors.directoryTextColor)
|
||||||
|
offset = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
self:write(1, 1 + offset, '$ ',
|
||||||
|
_colors.promptBackgroundColor, _colors.promptTextColor)
|
||||||
|
|
||||||
|
self:write(3, 1 + offset, 'ls /',
|
||||||
|
_colors.backgroundColor, _colors.commandTextColor)
|
||||||
|
|
||||||
|
self:write(1, 2 + offset, 'sys usr',
|
||||||
|
_colors.backgroundColor, _colors.directoryColor)
|
||||||
|
|
||||||
|
self:write(1, 3 + offset, 'startup',
|
||||||
|
_colors.backgroundColor, _colors.fileColor)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
eventHandler = function(self, event)
|
||||||
|
if event.type =='checkbox_change' then
|
||||||
|
config.displayDirectory = not not event.checked
|
||||||
|
self.display:draw()
|
||||||
|
|
||||||
|
elseif event.type == 'grid_focus_row' and event.element == self.grid1 then
|
||||||
|
self.grid2:draw()
|
||||||
|
|
||||||
|
elseif event.type == 'grid_select' and event.element == self.grid2 then
|
||||||
|
_colors[tab.grid1:getSelected().name] = event.selected.value
|
||||||
|
self.display:draw()
|
||||||
|
self.grid2:draw()
|
||||||
|
|
||||||
|
elseif event.type == 'reset' then
|
||||||
|
config.color = defaults
|
||||||
|
config.displayDirectory = true
|
||||||
|
self.directory.value = true
|
||||||
|
_colors = Util.shallowCopy(defaults)
|
||||||
|
|
||||||
|
Config.update('shellprompt', config)
|
||||||
|
self:draw()
|
||||||
|
|
||||||
|
elseif event.type == 'update' then
|
||||||
|
config.color = _colors
|
||||||
|
Config.update('shellprompt', config)
|
||||||
|
|
||||||
|
end
|
||||||
|
return UI.Tab.eventHandler(self, event)
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
function tab.grid2:getRowTextColor(row)
|
|
||||||
local selected = tab.grid1:getSelected()
|
|
||||||
if _colors[selected.name] == row.value then
|
|
||||||
return colors.yellow
|
|
||||||
end
|
|
||||||
return UI.Grid.getRowTextColor(self, row)
|
|
||||||
end
|
|
||||||
|
|
||||||
function tab.display:draw()
|
|
||||||
self:clear(_colors.backgroundColor)
|
|
||||||
local offset = 0
|
|
||||||
if config.displayDirectory then
|
|
||||||
self:write(1, 1,
|
|
||||||
'==' .. os.getComputerLabel() .. ':/dir/etc',
|
|
||||||
_colors.directoryBackgroundColor, _colors.directoryTextColor)
|
|
||||||
offset = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
self:write(1, 1 + offset, '$ ',
|
|
||||||
_colors.promptBackgroundColor, _colors.promptTextColor)
|
|
||||||
|
|
||||||
self:write(3, 1 + offset, 'ls /',
|
|
||||||
_colors.backgroundColor, _colors.commandTextColor)
|
|
||||||
|
|
||||||
self:write(1, 2 + offset, 'sys usr',
|
|
||||||
_colors.backgroundColor, _colors.directoryColor)
|
|
||||||
|
|
||||||
self:write(1, 3 + offset, 'startup',
|
|
||||||
_colors.backgroundColor, _colors.fileColor)
|
|
||||||
end
|
|
||||||
|
|
||||||
function tab:eventHandler(event)
|
|
||||||
if event.type =='checkbox_change' then
|
|
||||||
config.displayDirectory = not not event.checked
|
|
||||||
self.display:draw()
|
|
||||||
|
|
||||||
elseif event.type == 'grid_focus_row' and event.element == self.grid1 then
|
|
||||||
self.grid2:draw()
|
|
||||||
|
|
||||||
elseif event.type == 'grid_select' and event.element == self.grid2 then
|
|
||||||
_colors[tab.grid1:getSelected().name] = event.selected.value
|
|
||||||
self.display:draw()
|
|
||||||
self.grid2:draw()
|
|
||||||
|
|
||||||
elseif event.type == 'reset' then
|
|
||||||
config.color = defaults
|
|
||||||
config.displayDirectory = true
|
|
||||||
self.directory.value = true
|
|
||||||
_colors = Util.shallowCopy(defaults)
|
|
||||||
|
|
||||||
Config.update('shellprompt', config)
|
|
||||||
self:draw()
|
|
||||||
|
|
||||||
elseif event.type == 'update' then
|
|
||||||
config.color = _colors
|
|
||||||
Config.update('shellprompt', config)
|
|
||||||
|
|
||||||
end
|
|
||||||
return UI.Tab.eventHandler(self, event)
|
|
||||||
end
|
|
||||||
|
|
||||||
return tab
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ end
|
||||||
|
|
||||||
function Entry:updateScroll()
|
function Entry:updateScroll()
|
||||||
local ps = self.scroll
|
local ps = self.scroll
|
||||||
local value = _val(self.value)
|
local len = #_val(self.value)
|
||||||
if self.pos > #value then
|
if self.pos > len then
|
||||||
self.pos = #value
|
self.pos = len
|
||||||
self.scroll = 0 -- ??
|
self.scroll = 0 -- ??
|
||||||
end
|
end
|
||||||
if self.pos - self.scroll > self.width then
|
if self.pos - self.scroll > self.width then
|
||||||
|
@ -51,6 +51,11 @@ function Entry:updateScroll()
|
||||||
elseif self.pos < self.scroll then
|
elseif self.pos < self.scroll then
|
||||||
self.scroll = self.pos
|
self.scroll = self.pos
|
||||||
end
|
end
|
||||||
|
if self.scroll > 0 then
|
||||||
|
if self.scroll + self.width > len then
|
||||||
|
self.scroll = len - self.width
|
||||||
|
end
|
||||||
|
end
|
||||||
if ps ~= self.scroll then
|
if ps ~= self.scroll then
|
||||||
self.textChanged = true
|
self.textChanged = true
|
||||||
end
|
end
|
||||||
|
@ -217,6 +222,10 @@ function Entry:paste(ie)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Entry:forcePaste()
|
||||||
|
os.queueEvent('clipboard_paste')
|
||||||
|
end
|
||||||
|
|
||||||
function Entry:clearLine()
|
function Entry:clearLine()
|
||||||
if #_val(self.value) > 0 then
|
if #_val(self.value) > 0 then
|
||||||
self:reset()
|
self:reset()
|
||||||
|
@ -363,7 +372,7 @@ local mappings = {
|
||||||
--[ 'control-d' ] = Entry.cutNextWord,
|
--[ 'control-d' ] = Entry.cutNextWord,
|
||||||
[ 'control-x' ] = Entry.cut,
|
[ 'control-x' ] = Entry.cut,
|
||||||
[ 'paste' ] = Entry.paste,
|
[ 'paste' ] = Entry.paste,
|
||||||
-- [ 'control-y' ] = Entry.paste, -- well this won't work...
|
[ 'control-y' ] = Entry.forcePaste, -- well this won't work...
|
||||||
|
|
||||||
[ 'mouse_doubleclick' ] = Entry.markWord,
|
[ 'mouse_doubleclick' ] = Entry.markWord,
|
||||||
[ 'mouse_tripleclick' ] = Entry.markAll,
|
[ 'mouse_tripleclick' ] = Entry.markAll,
|
||||||
|
|
|
@ -1096,6 +1096,14 @@ function UI.Device:addTransition(effect, args, canvas)
|
||||||
effect = Transition[effect] or error('Invalid transition')
|
effect = Transition[effect] or error('Invalid transition')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- there can be only one
|
||||||
|
for k,v in pairs(self.transitions) do
|
||||||
|
if v.canvas == canvas then
|
||||||
|
table.remove(self.transitions, k)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
table.insert(self.transitions, { effect = effect, args = args or { }, canvas = canvas })
|
table.insert(self.transitions, { effect = effect, args = args or { }, canvas = canvas })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue