This commit is contained in:
Igor Timofeev 2018-05-19 22:14:43 +03:00
parent 7523cab658
commit f8e7cf3f3b
5 changed files with 24 additions and 50 deletions

View File

@ -154,21 +154,9 @@
inCurrentDirectory = "In current directory",
settings = "Preferences",
months = {
Jan = "Jan",
Feb = "Feb",
Mar = "Mar",
Apr = "Apr",
May = "May",
Jun = "Jun",
Jul = "Jul",
Aug = "Aug",
Sep = "Sep",
Oct = "Oct",
Nov = "Nov",
Dec = "Dec",
},
dateAndTime = "Date and time",
timezone = "Timezone",
dateFormat = "Date format",
errorWhileRunningProgram = "Error while running ",
sendedFeedback = "Feedback was sent",

View File

@ -154,21 +154,9 @@
inCurrentDirectory = "Dans le répertoire actuel",
settings = "Préférences",
months = {
Jan = "Jan",
Feb = "Fev",
Mar = "Mar",
Apr = "Avr",
May = "Mai",
Jun = "Jui",
Jul = "Juil",
Aug = "Aou",
Sep = "Sep",
Oct = "Oct",
Nov = "Nov",
Dec = "Dec",
},
dateAndTime = "Date et heure",
timezone = "Fuseau horaire",
dateFormat = "Format de date",
errorWhileRunningProgram = "Erreur lors de l'exécution ",
sendedFeedback = "Votre commantaire a bien été envoyé",

View File

@ -154,21 +154,9 @@
inCurrentDirectory = "В текущей директории",
settings = "Настройки",
months = {
Jan = "Января",
Feb = "Февраля",
Mar = "Марта",
Apr = "Апреля",
May = "Мая",
Jun = "Июня",
Jul = "Июля",
Aug = "Августа",
Sep = "Сентября",
Oct = "Октября",
Nov = "Ноября",
Dec = "Декабря",
},
dateAndTime = "Дата и время",
timezone = "Часовой пояс",
dateFormat = "Формат даты",
errorWhileRunningProgram = "Ошибка при выполнении ",
sendedFeedback = "Отчет отправлен",

25
OS.lua
View File

@ -942,20 +942,31 @@ local function createOSWidgets()
showHiddenFilesSwitch.onStateChanged, showApplicationIconsSwitch.onStateChanged = showExtensionSwitch.onStateChanged, showExtensionSwitch.onStateChanged
end
menu:addItem(MineOSCore.localization.timezone).onTouch = function()
menu:addItem(MineOSCore.localization.dateAndTime).onTouch = function()
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.timezone)
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
comboBox.dropDownMenu.itemHeight = 1
local label = container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.dateFormat):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, MineOSCore.properties.dateFormat or ""))
input.onInputFinished = function()
MineOSCore.properties.dateFormat = input.text
MineOSCore.OSUpdateDate()
MineOSInterface.mainContainer:drawOnScreen()
MineOSCore.saveProperties()
end
for i = -12, 12 do
comboBox:addItem("GMT" .. (i >= 0 and "+" or "") .. i).onTouch = function()
MineOSCore.properties.timezone = i
MineOSCore.saveProperties()
MineOSCore.OSUpdateTimezone(i)
MineOSCore.OSUpdateDate()
MineOSInterface.mainContainer:drawOnScreen()
MineOSCore.saveProperties()
end
end
@ -1026,12 +1037,10 @@ local function createOSWidgets()
fs.remove(name)
end
local firstPart, month, secondPart = os.date(
"%d %b %Y %T",
dateWidgetText = os.date(
MineOSCore.properties.dateFormat,
realTimestamp + computerDateUptime - computerUptimeOnBoot + timezoneCorrection
):match("(%d+%s)(%a+)(.+)")
dateWidgetText = firstPart .. (MineOSCore.localization.months[month] or "monthNotAvailable:" .. month) .. secondPart
)
dateWidget.width = unicode.len(dateWidgetText)
batteryWidgetPercent = computer.energy() / computer.maxEnergy()

View File

@ -85,6 +85,7 @@ function MineOSCore.loadPropeties()
end
local defaultValues = {
dateFormat = "%d %b% %Y %H:%M:%S",
packageUnloading = true,
transparencyEnabled = true,
showApplicationIcons = true,