mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-02-19 08:42:39 +01:00
Переходим на MineOS Standalone #1
This commit is contained in:
50
Applications/Settings.app/Modules/7_Time/Main.lua
Normal file
50
Applications/Settings.app/Modules/7_Time/Main.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local paths = require("Paths")
|
||||
local system = require("System")
|
||||
|
||||
local module = {}
|
||||
|
||||
local workspace, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.time
|
||||
module.margin = 0
|
||||
module.onTouch = function()
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.timeZone))
|
||||
|
||||
local comboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
for i = -12, 12 do
|
||||
comboBox:addItem("GMT" .. (i >= 0 and "+" or "") .. i)
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.timeFormat))
|
||||
|
||||
local input = window.contentLayout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, system.properties.timeFormat or ""))
|
||||
|
||||
local switch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.timeUseRealTimestamp .. ":", system.properties.timeRealTimestamp)).switch
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.timeInfo}, 1, 0, 0, true, true))
|
||||
|
||||
comboBox.selectedItem = (system.properties.timeTimezone or 0) + 13
|
||||
comboBox.onItemSelected = function()
|
||||
system.properties.timeRealTimestamp = switch.state
|
||||
system.properties.timeTimezone = (comboBox.selectedItem - 13) * 3600
|
||||
system.properties.timeFormat = input.text
|
||||
|
||||
system.updateMenuWidgets()
|
||||
workspace:draw()
|
||||
|
||||
system.saveProperties()
|
||||
end
|
||||
|
||||
input.onInputFinished, switch.onStateChanged = comboBox.onItemSelected, comboBox.onItemSelected
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
Reference in New Issue
Block a user