adapt session duration format to new style

Addresses https://gitlab.com/4w/mtimer/-/issues/16
This commit is contained in:
Dirk Sohler 2021-05-15 17:19:04 +02:00
parent e58cd1741d
commit 77b594f765
No known key found for this signature in database
GPG Key ID: B9751241BD7D4E1A

@ -8,6 +8,7 @@
local m = mtimer local m = mtimer
local S = m.translator local S = m.translator
local esc = minetest.formspec_escape local esc = minetest.formspec_escape
local line = mtimer.get_table_line
-- Formspecs are loaded and shown by individual functions. The function name -- Formspecs are loaded and shown by individual functions. The function name
@ -82,7 +83,6 @@ end
mtimer.dialog.ingame_time_format = function (player_name) mtimer.dialog.ingame_time_format = function (player_name)
local time_data = mtimer.get_times(player_name).ingame_time local time_data = mtimer.get_times(player_name).ingame_time
local line = mtimer.get_table_line
mtimer.show_formspec('mtimer:ingame_time_format', { mtimer.show_formspec('mtimer:ingame_time_format', {
title = S('Ingame Time Format'), title = S('Ingame Time Format'),
@ -138,21 +138,18 @@ mtimer.dialog.session_duration_format = function (player_name)
mtimer.show_formspec('mtimer:session_duration_format', { mtimer.show_formspec('mtimer:session_duration_format', {
title = S('Session Duration Format'), title = S('Session Duration Format'),
show_to = player_name, show_to = player_name,
height = 3.8,
formspec = { formspec = {
'field_close_on_enter[format;false]', 'field_close_on_enter[format;false]',
'field[0,0;+contentWidth,0.5;format;;'..esc(time_data.format)..']', 'field[0,0;+contentWidth,0.5;format;;'..esc(time_data.format)..']',
'container[0,0.9]', 'container[0,1.5]',
'label[2.5,0;'..S('Variable')..']', line(0, '', S('Variable'), S('Current Value')),
'label[4,0;'..S('Current Value')..']', line(1, '-'),
'box[0,0.25;+contentWidth,0.02;#ffffff]', line(2, S('Days'), '{days}', time_data.days),
'label[0,0.5;'..S('Days')..'] label[2.5,0.5;{days}] label[4,0.5;'..time_data.days..']', line(3, S('Hours'), '{hours}', time_data.hours),
'label[0,0.9;'..S('Hours')..'] label[2.5,0.9;{hours}] label[4,0.9;'..time_data.hours..']', line(4, S('Minutes'), '{minutes}', time_data.minutes),
'label[0,1.3;'..S('Minutes')..'] label[2.5,1.3;{minutes}] label[4,1.3;'..time_data.minutes..']', line(5, S('Seconds'), '{seconds}', time_data.seconds),
'label[0,1.7;'..S('Seconds')..'] label[2.5,1.7;{seconds}] label[4,1.7;'..time_data.seconds..']', line(6, '-'),
'box[0,2;+contentWidth,0.02;#ffffff]', line(7, S('Current Result'), esc(time_data.formatted), ''),
'label[0,2.25;'..S('Current Result')..']',
'label[2.5,2.25;'..esc(time_data.formatted)..']',
'container_end[]' 'container_end[]'
} }
}) })