Fixed Variable dialog erroneously saying that a valid type was invalid, removed old states and renamed NewEditor to Editor, updated dialogs with 2 side-by-side buttons to use 0.5 instead of 0.475 dynamic width, removed manual newlines in dialogs since TextBlock now supports word wrap.

This commit is contained in:
2021-06-18 03:35:57 +00:00
parent 64d4f08410
commit 2969e3df9e
14 changed files with 181 additions and 815 deletions

View File

@@ -16,11 +16,11 @@ module TAC
@comment = edit_line @options[:action] ? @options[:action].comment : "", width: 1.0
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
button "Cancel", width: 0.5 do
close
end
button @options[:action] ? @options[:accept_label] ? @options[:accept_label] : "Update" : "Add", width: 0.475 do |b|
button @options[:action] ? @options[:accept_label] ? @options[:accept_label] : "Update" : "Add", width: 0.5 do |b|
try_commit
end
end

View File

@@ -15,11 +15,11 @@ module TAC
label @options[:message]
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
button "Cancel", width: 0.5 do
close
end
button "Proceed", width: 0.475, **TAC::THEME_DANGER_BUTTON do
button "Proceed", width: 0.5, **TAC::THEME_DANGER_BUTTON do
try_commit(true)
end
end

View File

@@ -15,14 +15,14 @@ module TAC
end
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
button "Cancel", width: 0.5 do
close
end
accept_label = @options[:renaming] ? "Update" : "Add"
accept_label = @options[:accept_label] if @options[:accept_label]
button accept_label, width: 0.475 do
button accept_label, width: 0.5 do
try_commit
end
end
@@ -44,7 +44,7 @@ module TAC
name = @name.value.strip
if @name.value.strip.empty?
@name_error.value = "Name cannot be blank.\nName cannot only be whitespace."
@name_error.value = "Name cannot be blank. Name cannot only be whitespace."
@name_error.show
return false

View File

@@ -19,7 +19,8 @@ module TAC
@type_error.hide
@var_type = list_box items: [:float, :double, :integer, :long, :string, :boolean], choose: @type ? @type : :double, width: 1.0 do |item|
@type = item
@type = item.value.to_sym
if @type == :boolean
@value.hide
@value_boolean.show
@@ -52,11 +53,11 @@ module TAC
end
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
button "Cancel", width: 0.5 do
close
end
button @options[:variable] ? "Update" : "Add", width: 0.475 do |b|
button @options[:variable] ? "Update" : "Add", width: 0.5 do |b|
try_commit
end
end
@@ -80,7 +81,7 @@ module TAC
valid = true
if @name.value.strip.empty?
@name_error.value = "Error: Name cannot be blank\n or only whitespace."
@name_error.value = "Error: Name cannot be blank or only whitespace."
@name_error.show
valid = false
else
@@ -99,7 +100,7 @@ module TAC
if [:integer, :float, :double, :long].include?(@type)
if @value.value.strip.empty?
@value_error.value = "Error: Numeric value cannot be\nblank or only whitespace."
@value_error.value = "Error: Numeric value cannot be blank or only whitespace."
@value_error.show
valid = false
@@ -107,7 +108,7 @@ module TAC
begin
Integer(@value.value.strip)
rescue
@value_error.value = "Error: Invalid value,\nexpected whole number."
@value_error.value = "Error: Invalid value, expected whole number."
@value_error.show
valid = false
end
@@ -116,7 +117,7 @@ module TAC
begin
Float(@value.value.strip)
rescue
@value_error.value = "Error: Invalid value,\nexpected decimal number."
@value_error.value = "Error: Invalid value, expected decimal number."
@value_error.show
valid = false
end
@@ -127,7 +128,7 @@ module TAC
elsif @type == :string
if @value.value.strip.empty?
@value_error.value = "Error: Value cannot be blank\n or only whitespace."
@value_error.value = "Error: Value cannot be blank or only whitespace."
@value_error.show
valid = false
end
@@ -135,7 +136,7 @@ module TAC
elsif @type == :boolean
else
@value_error.value = "Error: Type not set or\ntype #{@var_type.value.inspect} is not valid."
@value_error.value = "Error: Type not set or type #{@type.inspect} is not valid."
@value_error.show
valid = false
end