mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-08-04 02:16:05 -04:00
Adding reboot button on top right
Fixing drawBaseWidget bug
This commit is contained in:
parent
1c90d83f88
commit
9e49d86bd9
@ -1,10 +1,11 @@
|
|||||||
-- Import section
|
-- Import section
|
||||||
|
Computer = require("computer")
|
||||||
Unicode = require("unicode")
|
Unicode = require("unicode")
|
||||||
Event = require("event")
|
Event = require("event")
|
||||||
DoubleBuffer = require("graphics.doubleBuffering")
|
DoubleBuffer = require("graphics.doubleBuffering")
|
||||||
|
Constants = require("api.gui.constants")
|
||||||
Colors = require("graphics.colors")
|
Colors = require("graphics.colors")
|
||||||
Widget = require("api.gui.widget")
|
Widget = require("api.gui.widget")
|
||||||
Constants = require("api.gui.constants")
|
|
||||||
--
|
--
|
||||||
|
|
||||||
-- GPU resolution should be 160 x 50.
|
-- GPU resolution should be 160 x 50.
|
||||||
@ -79,14 +80,18 @@ function page.create(element)
|
|||||||
drawTitle(element.title)
|
drawTitle(element.title)
|
||||||
|
|
||||||
local panelIndex = 1
|
local panelIndex = 1
|
||||||
for _, pg in pairs(pages) do
|
for _, pg in ipairs(pages) do
|
||||||
if pg ~= element then
|
if pg ~= element then
|
||||||
elements.panelSections[panelIndex] = pg
|
elements.panelSections[panelIndex] = pg.title
|
||||||
drawPanelSection(panelIndex, pg.title)
|
drawPanelSection(panelIndex, pg.title)
|
||||||
panelIndex = panelIndex + 1
|
panelIndex = panelIndex + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elements[4.5] = {onClick = function()
|
||||||
|
Computer.shutdown(true)
|
||||||
|
end}
|
||||||
|
|
||||||
elements[6] = elements.machineWidgets[1]
|
elements[6] = elements.machineWidgets[1]
|
||||||
elements[7] = elements.machineWidgets[2]
|
elements[7] = elements.machineWidgets[2]
|
||||||
elements[8] = elements.machineWidgets[3]
|
elements[8] = elements.machineWidgets[3]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Component = require("component")
|
Component = require("component")
|
||||||
Unicode = require("unicode")
|
Unicode = require("unicode")
|
||||||
Colors = require("graphics.colors")
|
|
||||||
DoubleBuffer = require("graphics.doubleBuffering")
|
DoubleBuffer = require("graphics.doubleBuffering")
|
||||||
Constants = require("api.gui.constants")
|
Constants = require("api.gui.constants")
|
||||||
|
Colors = require("graphics.colors")
|
||||||
|
|
||||||
local widget = {}
|
local widget = {}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ function widget.drawBaseWidget(x, y, scale, title)
|
|||||||
)
|
)
|
||||||
DoubleBuffer.drawFrame(x + 1, y + 1, width - 1, height - 1, Colors.labelColor)
|
DoubleBuffer.drawFrame(x + 1, y + 1, width - 1, height - 1, Colors.labelColor)
|
||||||
DoubleBuffer.drawLine(x + 3, y + 5, x + width - 3, y + 5, Colors.machineBackground, Colors.textColor, "─")
|
DoubleBuffer.drawLine(x + 3, y + 5, x + width - 3, y + 5, Colors.machineBackground, Colors.textColor, "─")
|
||||||
DoubleBuffer.drawText(x + (width - Unicode.len(title)) / 2, y + 3, Colors.labelColor, title)
|
DoubleBuffer.drawText(x + math.floor((width - Unicode.len(title)) / 2), y + 3, Colors.labelColor, title)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function draw(self, index)
|
local function draw(self, index)
|
||||||
@ -71,7 +71,7 @@ local function draw(self, index)
|
|||||||
DoubleBuffer.drawText(x + 3 + 3 + Unicode.len("IDLE"), y + height - 3, Colors.textColor, middleInfo)
|
DoubleBuffer.drawText(x + 3 + 3 + Unicode.len("IDLE"), y + height - 3, Colors.textColor, middleInfo)
|
||||||
end
|
end
|
||||||
DoubleBuffer.drawText(
|
DoubleBuffer.drawText(
|
||||||
x + width - Unicode.len(self.progress .. "/" .. self.maxProgress .. " s") - 2,
|
x + width - Unicode.len(self.progress .. "/" .. self.maxProgress .. " s") - 3,
|
||||||
y + height - 3,
|
y + height - 3,
|
||||||
Colors.accentA,
|
Colors.accentA,
|
||||||
self.progress .. "/" .. self.maxProgress .. " s"
|
self.progress .. "/" .. self.maxProgress .. " s"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user