fix menu separators + sys dir restructure

This commit is contained in:
kepler155c@gmail.com 2019-03-31 15:16:45 -04:00
parent 19159730a4
commit 737ac095de
25 changed files with 16 additions and 13 deletions

View File

@ -24,6 +24,7 @@ function UI.DropMenu:setParent()
for _,child in ipairs(self.children) do
child.width = maxWidth + 2
if child.spacer then
child.inactive = true
child.text = string.rep('-', child.width - 2)
end
end

View File

@ -25,8 +25,6 @@ UI.MenuBar.defaults = {
showBackButton = false,
buttonClass = 'MenuItem',
}
UI.MenuBar.spacer = { spacer = true, text = 'spacer', inactive = true }
function UI.MenuBar:postInit()
self:addButtons(self.buttons)
end
@ -42,7 +40,7 @@ function UI.MenuBar:addButtons(buttons)
else
local buttonProperties = {
x = self.lastx,
width = #button.text + self.spacing,
width = #(button.text or 'button') + self.spacing,
centered = false,
}
self.lastx = self.lastx + buttonProperties.width

View File

@ -7,6 +7,7 @@ local colors = _G.colors
local fs = _G.fs
local multishell = _ENV.multishell
local os = _G.os
local pastebin = _G.pastebin
local shell = _ENV.shell
local FILE = 1
@ -45,7 +46,7 @@ local Browser = UI.Page {
{ text = 'Cloud edit c', event = 'cedit', flags = FILE },
{ text = 'Pastebin put p', event = 'cedit', flags = FILE },
{ text = 'Shell s', event = 'shell' },
UI.MenuBar.spacer,
{ spacer = true },
{ text = 'Quit q', event = 'quit' },
} },
{ text = 'Edit', dropdown = {
@ -53,10 +54,10 @@ local Browser = UI.Page {
{ text = 'Copy ^c', event = 'copy' },
{ text = 'Copy path ', event = 'copy_path' },
{ text = 'Paste ^v', event = 'paste' },
UI.MenuBar.spacer,
{ spacer = true },
{ text = 'Mark m', event = 'mark' },
{ text = 'Unmark all u', event = 'unmark' },
UI.MenuBar.spacer,
{ spacer = true },
{ text = 'Delete del', event = 'delete' },
} },
{ text = 'View', dropdown = {
@ -365,6 +366,7 @@ function Browser:eventHandler(event)
if file and not file.isDir then
local s, m = pastebin.put(file.fullName)
if s then
os.queueEvent('clipboard_copy', s)
self.notification:success(string.format('Uploaded as %s', m), 0)
else
self.notification:error(m)

View File

@ -33,7 +33,7 @@ local page = UI.Page {
{ text = 'Connect', dropdown = {
{ text = 'Telnet t', event = 'telnet' },
{ text = 'VNC v', event = 'vnc' },
UI.MenuBar.spacer,
{ spacer = true },
{ text = 'Reboot r', event = 'reboot' },
} },
{ text = 'Trust', dropdown = {
@ -44,7 +44,7 @@ local page = UI.Page {
x = -3,
dropdown = {
{ text = 'Port Status', event = 'ports', modem = true },
UI.MenuBar.spacer,
{ spacer = true },
{ text = 'Help', event = 'help', noCheck = true },
},
},

View File

@ -15,8 +15,8 @@ end
print('Net daemon starting')
for _,file in pairs(fs.list('sys/network')) do
local fn, msg = Util.run(_ENV, 'sys/network/' .. file)
for _,file in pairs(fs.list('sys/apps/network')) do
local fn, msg = Util.run(_ENV, 'sys/apps/network/' .. file)
if not fn then
printError(msg)
end

View File

@ -1,4 +1,6 @@
if fs.exists('sys/apps/shell') and fs.exists('sys/apps/shell.lua') then
fs.delete('sys/apps/shell')
end
if fs.exists('sys/etc/app.db') then fs.delete('sys/etc/app.db') end
if fs.exists('sys/etc/app.db') then fs.delete('sys/etc/app.db') end
if fs.exists('sys/extensions') then fs.delete('sys/extensions') end
if fs.exists('sys/network') then fs.delete('sys/network') end

View File

@ -58,7 +58,7 @@ else
_G.requireInjector = runUrl('sys/apis/injector.lua')
runUrl('sys/extensions/2.vfs.lua')
runUrl('sys/init/2.vfs.lua')
-- install file system
fs.mount('', 'gitfs', GIT_REPO)

View File

@ -279,7 +279,7 @@ local function init(...)
local runLevel = #args > 0 and 6 or 7
print('Starting Opus OS')
local dir = 'sys/extensions'
local dir = 'sys/init'
local files = fs.list(dir)
table.sort(files)
for _,file in ipairs(files) do