Update widget visibility

This commit is contained in:
Adam Riley 2024-03-07 11:00:21 +00:00
parent 7c68bf170d
commit 2e2db37b48
3 changed files with 6 additions and 4 deletions

View File

@ -109,7 +109,7 @@ type File_Format
default_widget =
all_types = [Auto_Detect] + format_types
make_name type_obj = type_obj.to_text.replace "_Format" "" . replace "_" " "
Single_Choice display=Display.Always values=(all_types.map n->(Option (make_name n) (File_Format.constructor_code n)))
Single_Choice values=(all_types.map n->(Option (make_name n) (File_Format.constructor_code n)))
## A file format for plain text files.
type Plain_Text_Format

View File

@ -5,6 +5,7 @@ import project.Data.Time.Date_Time.Date_Time
import project.Data.Time.Date_Time_Formatter.Date_Time_Formatter
import project.Data.Time.Time_Of_Day.Time_Of_Day
import project.Meta
import project.Metadata.Display
import project.Metadata.Widget
from project.Data.Boolean import Boolean, False, True
from project.Metadata import make_single_choice
@ -111,4 +112,4 @@ make_format_chooser include_number:Boolean=True include_date:Boolean=True includ
time = if include_time.not then [] else
['HH:mm[:ss]', 'h:mm[:ss] a'].map f-> [f + " (e.g. " + (Time_Of_Day.new 13 30 55 123).format f + ")", f.pretty]
boolean = if include_boolean.not then [] else ['Yes|No', '1|0'].map f-> [f + " (Boolean)", f.pretty]
make_single_choice (numeric + date + date_time + time + custom_locale_format + boolean)
make_single_choice (numeric + date + date_time + time + custom_locale_format + boolean) display=Display.When_Modified

View File

@ -188,7 +188,8 @@ parse_type_selector include_auto=True =
choice = names.map n-> if n=='Auto' then (Meta.get_qualified_type_name Auto) else fqn+'.'+n
options = names.zip choice . map pair-> Option pair.first pair.second
Single_Choice display=Display.Always values=options
display = if include_auto then Display.Always else Display.When_Modified
Single_Choice display=display values=options
## PRIVATE
Selector for writing a table to a file.
@ -198,7 +199,7 @@ write_table_selector =
Meta.meta type . methods . contains "write_table"
all_types = [Auto_Detect] + (format_types.filter can_write)
make_name type_obj = type_obj.to_text.replace "_Format" "" . replace "_" " "
Single_Choice display=Display.Always values=(all_types.map n->(Option (make_name n) (File_Format.constructor_code n)))
Single_Choice display=Display.When_Modified values=(all_types.map n->(Option (make_name n) (File_Format.constructor_code n)))
## PRIVATE
Make format selector based off value type