]> git.lizzy.rs Git - lmz_opening_hours.git/commitdiff
split out common layout values, reorder from top to bottom
authorIsidor Zeuner <minetest@quidecco.de>
Fri, 2 Apr 2021 23:14:17 +0000 (01:14 +0200)
committerIsidor Zeuner <minetest@quidecco.de>
Fri, 2 Apr 2021 23:14:17 +0000 (01:14 +0200)
init.lua

index f5fbea3d1146c56a67595ea2d8071711cebcc45f..66887c854eae216a29656369f847c951fde05ba3 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -87,20 +87,45 @@ local function on_join(name)
 end
 
 local function show_gui(name)
+       local fld_w = 1.0
+       local fld_h = 0.82429501084599
+       local fld_sz = fld_w .. "," .. fld_h
+       local lab_close_y = 6.3935847420893
+       local fld_close_y = lab_close_y + 0.2427394885132
+       local lab_day1_x = 0.1
+       local fld_day1_f_x = 0.64
+       local fld_day1_t_x = 1.6
+       local time_off = 1.1530125704378
+       local lab_b_y = 0.28175119202427
+       local fld_b_y = lab_b_y + time_off
+       local lab_w_y = 2.0156046814044
+       local fld_w_y = lab_w_y + time_off
+       local lab_e_y = 3.7494581707846
+       local fld_e_y = lab_e_y + time_off
        local o = opening_hours
-       local formspec = "size[10.01,7.9267895878525]label[-0.14,-0.23840485478977;Öffnungszeiten]label[0.1,0.28175119202427;Mo.-Fr.]label[0.1,2.0156046814044;Sa.-So.]label[0.1,3.7494581707846;Heute]label[0.1,5.4833116601647;Einstellungen]label[0.34,6.3935847420893;Spieler ]label[2.18,6.3935847420893;Minuten vor Ablauf der Zeit alle]label[6.6,6.3935847420893;Minuten warnen.]image_button_exit[7.62,7.6072821846554;2.605,0.7835;;close;Schließen]image_button[5.14,7.6072821846554;2.605,0.7835;;save;Speichern]"
-       .. "field[0.64,1.4347637624621;1.0,0.82429501084599;fld_weekday_start;von;" .. o.weekday_start .. "]"
-       .. "field[1.6,1.4347637624621;1.0,0.82429501084599;fld_weekday_end;bis;" .. o.weekday_end .. "]"
-       .. "field[0.64,3.1686172518422;1.0,0.82429501084599;fld_weekend_start;von;" .. o.weekend_start .. "]"
-       .. "field[1.6,3.1686172518422;1.0,0.82429501084599;fld_weekend_end;bis;" .. o.weekend_end .. "]"
-       .. "field[1.6,6.6363242306025;1.0,0.82429501084599;fld_warn_offset;;" .. o.warn_offset .. "]"
-       .. "field[6.0,6.6363242306025;1.0,0.82429501084599;fld_warn_interval;;" .. o.warn_interval .. "]"
+       local formspec = "size[10.01,7.9267895878525]"
+       .. "label[-0.14,-0.23840485478977;Öffnungszeiten]"
+       .. "label[" .. lab_day1_x .. "," .. lab_b_y .. ";Mo.-Fr.]"
+       .. "field[" .. fld_day1_f_x .. "," .. fld_b_y .. ";" .. fld_sz .. ";fld_weekday_start;von;" .. o.weekday_start .. "]"
+       .. "field[" .. fld_day1_t_x .. "," .. fld_b_y .. ";" .. fld_sz .. ";fld_weekday_end;bis;" .. o.weekday_end .. "]"
+       .. "label[" .. lab_day1_x .. "," .. lab_w_y .. ";Sa.-So.]"
+       .. "field[" .. fld_day1_f_x .. "," .. fld_w_y .. ";" .. fld_sz .. ";fld_weekend_start;von;" .. o.weekend_start .. "]"
+       .. "field[" .. fld_day1_t_x .. "," .. fld_w_y .. ";" .. fld_sz .. ";fld_weekend_end;bis;" .. o.weekend_end .. "]"
+       .. "label[" .. lab_day1_x .. "," .. lab_e_y .. ";Heute]"
        .. (o.today
                        and ""
-                               .. "field[0.64,4.9024707412224;1.0,0.82429501084599;fld_today_start;von;" .. o.today_start .. "]"
-                               .. "field[1.6,4.9024707412224;1.0,0.82429501084599;fld_today_end;bis;" .. o.today_end .. "]"
+                               .. "field[" .. fld_day1_f_x .. "," .. fld_e_y .. ";" .. fld_sz .. ";fld_today_start;von;" .. o.today_start .. "]"
+                               .. "field[" .. fld_day1_t_x .. "," .. fld_e_y .. ";" .. fld_sz .. ";fld_today_end;bis;" .. o.today_end .. "]"
                        or "image_button[0.34,4.5296922410056;4.205,0.7835;;add_exception;Ausnahmeregelung hinzufügen]"
                )
+       .. "label[" .. lab_day1_x .. ",5.4833116601647;Einstellungen]"
+       .. "label[0.34," .. lab_close_y .. ";Spieler ]"
+       .. "field[" .. fld_day1_t_x .. "," .. fld_close_y .. ";" .. fld_sz .. ";fld_warn_offset;;" .. o.warn_offset .. "]"
+       .. "label[2.18," .. lab_close_y .. ";Minuten vor Ablauf der Zeit alle]"
+       .. "field[6.0," .. fld_close_y .. ";" .. fld_sz .. ";fld_warn_interval;;" .. o.warn_interval .. "]"
+       .. "label[6.6," .. lab_close_y .. ";Minuten warnen.]"
+       .. "image_button[5.14,7.6072821846554;2.605,0.7835;;save;Speichern]"
+       .. "image_button_exit[7.62,7.6072821846554;2.605,0.7835;;close;Schließen]"
        minetest.show_formspec(name, "lmz_opening_hours:gui", formspec)
 end