mirror of
https://github.com/kepler155c/opus
synced 2025-11-07 11:03:02 +00:00
Ui enhancements 2.0 (#31)
* canvas overhaul * minor tweaks * list mode for overview * bugfixes + tweaks for editor 2.0 * minor tweaks * more editor work * refactor + new transitions * use layout() where appropriate and cleanup * mouse triple click + textEntry scroll ind * cleanup * cleanup + theme editor * color rework + cleanup * changes for deprecated ui methods * can now use named colors
This commit is contained in:
39
sys/apps/fileui.lua
Normal file
39
sys/apps/fileui.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
local UI = require('opus.ui')
|
||||
local Util = require('opus.util')
|
||||
|
||||
local shell = _ENV.shell
|
||||
local multishell = _ENV.multishell
|
||||
|
||||
-- fileui [--path=path] [--exec=filename] [--title=title]
|
||||
|
||||
local page = UI.Page {
|
||||
fileselect = UI.FileSelect { },
|
||||
eventHandler = function(self, event)
|
||||
if event.type == 'select_file' then
|
||||
self.selected = event.file
|
||||
UI:quit()
|
||||
|
||||
elseif event.type == 'select_cancel' then
|
||||
UI:quit()
|
||||
end
|
||||
|
||||
return UI.FileSelect.eventHandler(self, event)
|
||||
end,
|
||||
}
|
||||
|
||||
local _, args = Util.parse(...)
|
||||
|
||||
if args.title and multishell then
|
||||
multishell.setTitle(multishell.getCurrent(), args.title)
|
||||
end
|
||||
|
||||
UI:setPage(page, args.path)
|
||||
UI:start()
|
||||
UI.term:setCursorBlink(false)
|
||||
|
||||
if args.exec and page.selected then
|
||||
shell.openForegroundTab(string.format('%s %s', args.exec, page.selected))
|
||||
return
|
||||
end
|
||||
|
||||
return page.selected
|
||||
Reference in New Issue
Block a user