1
0
mirror of https://github.com/kepler155c/opus synced 2025-01-01 03:10:28 +00:00

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 for _,child in ipairs(self.children) do
child.width = maxWidth + 2 child.width = maxWidth + 2
if child.spacer then if child.spacer then
child.inactive = true
child.text = string.rep('-', child.width - 2) child.text = string.rep('-', child.width - 2)
end end
end end

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,6 @@
if fs.exists('sys/apps/shell') and fs.exists('sys/apps/shell.lua') then if fs.exists('sys/apps/shell') and fs.exists('sys/apps/shell.lua') then
fs.delete('sys/apps/shell') fs.delete('sys/apps/shell')
end 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') _G.requireInjector = runUrl('sys/apis/injector.lua')
runUrl('sys/extensions/2.vfs.lua') runUrl('sys/init/2.vfs.lua')
-- install file system -- install file system
fs.mount('', 'gitfs', GIT_REPO) fs.mount('', 'gitfs', GIT_REPO)

View File

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