mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-08-03 18:06:04 -04:00
Adding reboot button
This commit is contained in:
parent
a7ef9a0002
commit
d995a8f670
@ -65,7 +65,7 @@ Event.listen(
|
||||
local function drawTitle(title)
|
||||
local x = Constants.baseWidth
|
||||
local y = 1
|
||||
local width = 3 * Constants.baseWidth
|
||||
local width = math.floor(2.5 * Constants.baseWidth)
|
||||
local height = math.floor(0.8 * Constants.baseHeight)
|
||||
Widget.drawBaseWidget(x, y, width, height, title)
|
||||
end
|
||||
@ -88,6 +88,14 @@ local function drawNavigationButton(self, index)
|
||||
end
|
||||
end
|
||||
|
||||
local function drawRebootButton()
|
||||
local width = math.floor(0.3 * Constants.baseWidth)
|
||||
local height = math.floor(0.6 * Constants.baseHeight)
|
||||
local x = math.floor(3.25 * Constants.baseWidth) + math.floor((Constants.baseWidth - width) / 2)
|
||||
local y = math.floor((Constants.baseHeight - height) / 2)
|
||||
Widget.drawBaseWidget(x, y, width, height, "Restart")
|
||||
end
|
||||
|
||||
local function clickNavigationButton(self)
|
||||
if not self.active then
|
||||
return
|
||||
@ -135,6 +143,7 @@ function page.create(element)
|
||||
for i = 1, 9 do
|
||||
elements.machineWidgets.active[i] = elements.machineWidgets[9 * (elements.machineWidgets.active.index - 1) + i]
|
||||
end
|
||||
|
||||
elements.navigationButtons[1] = {
|
||||
title = "◀",
|
||||
active = true,
|
||||
@ -154,11 +163,14 @@ function page.create(element)
|
||||
draw = drawNavigationButton
|
||||
}
|
||||
|
||||
elements[4.5] = {
|
||||
elements.rebootButton = {
|
||||
onClick = function()
|
||||
Computer.shutdown(true)
|
||||
end
|
||||
}
|
||||
drawRebootButton()
|
||||
|
||||
elements[4.5] = elements.rebootButton
|
||||
|
||||
elements[6] = elements.machineWidgets.active[1]
|
||||
elements[7] = elements.machineWidgets.active[2]
|
||||
|
@ -1,27 +0,0 @@
|
||||
-- Import section
|
||||
Page = require("api.gui.page")
|
||||
Graphics = require("graphics.graphics")
|
||||
Colors = require("colors")
|
||||
Component = require("component")
|
||||
GPU = Component.gpu
|
||||
--
|
||||
|
||||
local panel = {
|
||||
currentPage = Page.overview
|
||||
}
|
||||
|
||||
function panel.render()
|
||||
Graphics.rectangle(GPU, 0, 0, 20, 160, Colors.background)
|
||||
for index, page in ipairs(Page) do
|
||||
if page ~= panel.currentPage then
|
||||
Graphics.text(GPU, 0, 10 * (index - 1), Colors.labelColor, panel.title)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function panel.navigate(page)
|
||||
panel.findText(page.title)
|
||||
page.render()
|
||||
end
|
||||
|
||||
return panel
|
Loading…
x
Reference in New Issue
Block a user