Verified Commit fb51c1ee authored by Dirk's avatar Dirk

update formspecs to version 2

parent 76115d9e
This diff is collapsed.
......@@ -80,33 +80,34 @@ mtimer.show_formspec = function (name, def)
local buttons = not add_buttons and '' or table.concat({
'container[0,+buttons]',
'box[0,0;+linewidth,0.04;#ffffff]',
'button[+defbutton,0.2;2,1;default;'..S('Default')..']',
'button[+mainbutton,0.2;2,1;main_menu;'..S('Main Menu')..']',
'button_exit[+exitbutton,0.2;2,1;exit;'..S('Exit')..']',
'box[0.25,0;+linewidth,0.04;#ffffff]',
'button[+defbutton,0.2;2,0.5;default;'..S('Default')..']',
'button[+mainbutton,0.2;2,0.5;main_menu;'..S('Main Menu')..']',
'button_exit[+exitbutton,0.2;2,0.5;exit;'..S('Exit')..']',
'container_end[]'
}, ' ')
local formspec = table.concat({
'formspec_version[2]',
'size[+width,+height]',
'label[0,-0.1;+title]',
'box[0,0.5;+linewidth,0.04;#ffffff]',
'container[0,+content]',
'label[0.25,0.35;+title]',
'box[0.25,0.6;+linewidth,0.04;#ffffff]',
'container[0.25,+content]',
table.concat(def.formspec, ' '),
'container_end[]',
buttons
}, ' ')
formspec = formspec:gsub('%+%a+', {
['+width'] = width,
['+width'] = width+0.25,
['+height'] = height,
['+linewidth'] = width-0.215,
['+linewidth'] = width-0.25,
['+title'] = minetest.formspec_escape(prefix..def.title),
['+content'] = 0.7 + content_offset,
['+buttons'] = height-0.8,
['+defbutton'] = 0,
['+mainbutton'] = width-4,
['+exitbutton'] = width-2,
['+content'] = 0.9 + content_offset,
['+buttons'] = height-1,
['+defbutton'] = 0.25,
['+mainbutton'] = width-4.4+0.25,
['+exitbutton'] = width-2.25+0.25,
})
......
......@@ -28,31 +28,30 @@ mtimer.dialog.real_time_universal = function (player_name, config)
mtimer.show_formspec(config.formspec_name, {
title = config.title,
show_to = player_name,
height = 7,
content_offset = 0.275,
height = 7.5,
formspec = {
'field_close_on_enter[format;false]',
'field[0.3,0;+width,1;format;;'..fe(time_data.format)..']',
'container[0,0.65]',
'field[0,0;+linewidth,0.5;format;;'..fe(time_data.format)..']',
'container[0,0.9]',
'label[2.8,0;'..S('Variable')..']',
'label[4.6,0;'..S('Current Value')..']',
'box[0,0.45;+linewidth,0.02;#ffffff]',
'box[0,0.25;+linewidth,0.02;#ffffff]',
'label[0,0.5;'..S('Hours (24h)')..'] label[2.8,0.5;{24h}] label[4.6,0.5;'..time_data.variables.hours_24..']',
'label[0,0.9;'..S('Hours (12h)')..'] label[2.8,0.9;{12h}] label[4.6,0.9;'..time_data.variables.hours_12..']',
'label[0,1.3;'..S('Minutes')..'] label[2.8,1.3;{min}] label[4.6,1.3;'..time_data.variables.minutes..']',
'label[0,1.7;'..S('Seconds')..'] label[2.8,1.7;{sec}] label[4.6,1.7;'..time_data.variables.seconds..']',
'box[0,2.18;+linewidth,0.02;#ffffff]',
'box[0,1.98;+linewidth,0.02;#ffffff]',
'label[0,2.2;'..S('Day Name')..'] label[2.8,2.2;{dname}] label[4.6,2.2;'..time_data.variables.dayname..']',
'label[0,2.6;'..S('Month Name')..'] label[2.8,2.6;{mname}] label[4.6,2.6;'..time_data.variables.monthname..']',
'box[0,3.05;+linewidth,0.02;#ffffff]',
'box[0,2.85;+linewidth,0.02;#ffffff]',
'label[0,3.1;'..S('Year')..'] label[2.8,3.1;{year}] label[4.6,3.1;'..time_data.variables.year..']',
'label[0,3.5;'..S('Month')..'] label[2.8,3.5;{month}] label[4.6,3.5;'..time_data.variables.month..']',
'label[0,3.9;'..S('Day')..'] label[2.8,3.9;{day}] label[4.6,3.9;'..time_data.variables.day..']',
'box[0,4.4;+linewidth,0.02;#ffffff]',
'box[0,4.2;+linewidth,0.02;#ffffff]',
'label[0,4.45;'..S('ISO 8601 Date')..'] label[2.8,4.45;{isodate}] label[4.6,4.45;'..time_data.variables.iso8601_date..']',
'label[0,4.85;'..S('ISO 8601 Time')..'] label[2.8,4.85;{isotime}] label[4.6,4.85;'..time_data.variables.iso8601_time..']',
'label[0,5.25;'..S('Timestamp')..'] label[2.8,5.25;{timestamp}] label[4.6,5.25;'..time_data.variables.timestamp..']',
'box[0,5.75;+linewidth,0.02;#ffffff]',
'box[0,5.55;+linewidth,0.02;#ffffff]',
'label[0,5.8;'..S('Current Result')..']',
'label[2.8,5.8;'..fe(time_data.formatted)..']',
'container_end[]'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment