Documentation
¶
Index ¶
- Variables
- func ChainTimeEntries(entries ...*TimeEntry)
- func I18n(w fyne.Window) fyne.CanvasObject
- func TransformBind[S, T any](src binding.Item[S], forward func(S) (T, error), reverse func(T) (S, error)) binding.Item[T]
- func Website(w fyne.Window) fyne.CanvasObject
- type Bias
- type HelpButton
- type LocaleName
- func (b *LocaleName) AddListener(l binding.DataListener)
- func (self *LocaleName) GetItem(key string) (binding.DataItem, error)
- func (self *LocaleName) GetValue(key string) (any, error)
- func (self *LocaleName) Keys() []string
- func (self *LocaleName) LocaleItem() binding.String
- func (self *LocaleName) LocaleValidator() func(string) error
- func (self *LocaleName) MarshalJSON() ([]byte, error)
- func (self *LocaleName) MarshalYAML() (any, error)
- func (self *LocaleName) NameItem() binding.String
- func (self *LocaleName) NameValidator() func(string) error
- func (self *LocaleName) NewLocaleFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *LocaleName) NewLocaleHelp() *HelpButton
- func (self *LocaleName) NewNameFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *LocaleName) NewNameHelp() *HelpButton
- func (self *LocaleName) Reload() error
- func (b *LocaleName) RemoveListener(l binding.DataListener)
- func (self *LocaleName) SetValue(key string, value any) error
- func (self *LocaleName) SetValueChecked(key string, value any) error
- func (self *LocaleName) UnmarshalJSON(data []byte) error
- func (self *LocaleName) UnmarshalYAML(node *yaml.Node) error
- func (self *LocaleName) Validate() error
- type Optional
- type ScheduleDay
- func (b *ScheduleDay) AddListener(l binding.DataListener)
- func (self *ScheduleDay) GetItem(key string) (binding.DataItem, error)
- func (self *ScheduleDay) GetValue(key string) (any, error)
- func (self *ScheduleDay) Keys() []string
- func (self *ScheduleDay) MarshalJSON() ([]byte, error)
- func (self *ScheduleDay) MarshalYAML() (any, error)
- func (self *ScheduleDay) NewStreamsFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *ScheduleDay) NewStreamsHelp() *HelpButton
- func (self *ScheduleDay) NewWeekdayFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *ScheduleDay) NewWeekdayHelp() *HelpButton
- func (self *ScheduleDay) Reload() error
- func (b *ScheduleDay) RemoveListener(l binding.DataListener)
- func (self *ScheduleDay) SetValue(key string, value any) error
- func (self *ScheduleDay) SetValueChecked(key string, value any) error
- func (self *ScheduleDay) UnmarshalJSON(data []byte) error
- func (self *ScheduleDay) UnmarshalYAML(node *yaml.Node) error
- func (self *ScheduleDay) Validate() error
- type ScheduleEnd
- func (b *ScheduleEnd) AddListener(l binding.DataListener)
- func (self *ScheduleEnd) EarliestItem() binding.Item[TimeOfDay]
- func (self *ScheduleEnd) EarliestOptionalItem() binding.Item[Optional[TimeOfDay]]
- func (self *ScheduleEnd) GetItem(key string) (binding.DataItem, error)
- func (self *ScheduleEnd) GetValue(key string) (any, error)
- func (self *ScheduleEnd) Keys() []string
- func (self *ScheduleEnd) LatestItem() binding.Item[TimeOfDay]
- func (self *ScheduleEnd) LatestOptionalItem() binding.Item[Optional[TimeOfDay]]
- func (self *ScheduleEnd) MarshalJSON() ([]byte, error)
- func (self *ScheduleEnd) MarshalYAML() (any, error)
- func (self *ScheduleEnd) NewEarliestEntry() *TimeEntry
- func (self *ScheduleEnd) NewEarliestFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *ScheduleEnd) NewEarliestHelp() *HelpButton
- func (self *ScheduleEnd) NewLatestEntry() *TimeEntry
- func (self *ScheduleEnd) NewLatestFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *ScheduleEnd) NewLatestHelp() *HelpButton
- func (self *ScheduleEnd) Reload() error
- func (b *ScheduleEnd) RemoveListener(l binding.DataListener)
- func (self *ScheduleEnd) SetValue(key string, value any) error
- func (self *ScheduleEnd) SetValueChecked(key string, value any) error
- func (self *ScheduleEnd) UnmarshalJSON(data []byte) error
- func (self *ScheduleEnd) UnmarshalYAML(node *yaml.Node) error
- func (self *ScheduleEnd) Validate() error
- type Site
- func (b *Site) AddListener(l binding.DataListener)
- func (self *Site) GetItem(key string) (binding.DataItem, error)
- func (self *Site) GetValue(key string) (any, error)
- func (self *Site) Keys() []string
- func (self *Site) LogoItem() binding.String
- func (self *Site) MarshalJSON() ([]byte, error)
- func (self *Site) MarshalYAML() (any, error)
- func (self *Site) NewLogoFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Site) NewLogoHelp() *HelpButton
- func (self *Site) NewStreamNameFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Site) NewStreamNameHelp() *HelpButton
- func (self *Site) NewStreamerFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Site) NewStreamerHelp() *HelpButton
- func (self *Site) NewTextFontFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Site) NewTextFontHelp() *HelpButton
- func (self *Site) NewTitleFontFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Site) NewTitleFontHelp() *HelpButton
- func (self *Site) Reload() error
- func (b *Site) RemoveListener(l binding.DataListener)
- func (self *Site) SetValue(key string, value any) error
- func (self *Site) SetValueChecked(key string, value any) error
- func (self *Site) StreamNameItem() binding.String
- func (self *Site) StreamerItem() binding.String
- func (self *Site) TextFontItem() binding.String
- func (self *Site) TitleFontItem() binding.String
- func (self *Site) UnmarshalJSON(data []byte) error
- func (self *Site) UnmarshalYAML(node *yaml.Node) error
- func (self *Site) Validate() error
- type Stream
- func (b *Stream) AddListener(l binding.DataListener)
- func (self *Stream) GameItem() binding.String
- func (self *Stream) GetItem(key string) (binding.DataItem, error)
- func (self *Stream) GetValue(key string) (any, error)
- func (self *Stream) Keys() []string
- func (self *Stream) MarshalJSON() ([]byte, error)
- func (self *Stream) MarshalYAML() (any, error)
- func (self *Stream) NewEndFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Stream) NewEndHelp() *HelpButton
- func (self *Stream) NewGameFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Stream) NewGameHelp() *HelpButton
- func (self *Stream) NewPlatformFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Stream) NewPlatformHelp() *HelpButton
- func (self *Stream) NewStartEntry() *TimeEntry
- func (self *Stream) NewStartFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Stream) NewStartHelp() *HelpButton
- func (self *Stream) NewWorldFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Stream) NewWorldHelp() *HelpButton
- func (self *Stream) PlatformItem() binding.String
- func (self *Stream) Reload() error
- func (b *Stream) RemoveListener(l binding.DataListener)
- func (self *Stream) SetValue(key string, value any) error
- func (self *Stream) SetValueChecked(key string, value any) error
- func (self *Stream) StartItem() binding.Item[TimeOfDay]
- func (self *Stream) UnmarshalJSON(data []byte) error
- func (self *Stream) UnmarshalYAML(node *yaml.Node) error
- func (self *Stream) Validate() error
- func (self *Stream) WorldItem() binding.String
- type StreamerConfig
- func (b *StreamerConfig) AddListener(l binding.DataListener)
- func (self *StreamerConfig) GetItem(key string) (binding.DataItem, error)
- func (self *StreamerConfig) GetValue(key string) (any, error)
- func (self *StreamerConfig) Keys() []string
- func (self *StreamerConfig) MarshalJSON() ([]byte, error)
- func (self *StreamerConfig) MarshalYAML() (any, error)
- func (self *StreamerConfig) NewScheduleFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *StreamerConfig) NewScheduleHelp() *HelpButton
- func (self *StreamerConfig) NewSiteFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *StreamerConfig) NewSiteHelp() *HelpButton
- func (self *StreamerConfig) NewThemeFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *StreamerConfig) NewThemeHelp() *HelpButton
- func (self *StreamerConfig) NewWorldsFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *StreamerConfig) NewWorldsHelp() *HelpButton
- func (self *StreamerConfig) Reload() error
- func (b *StreamerConfig) RemoveListener(l binding.DataListener)
- func (self *StreamerConfig) SetValue(key string, value any) error
- func (self *StreamerConfig) SetValueChecked(key string, value any) error
- func (self *StreamerConfig) UnmarshalJSON(data []byte) error
- func (self *StreamerConfig) UnmarshalYAML(node *yaml.Node) error
- func (self *StreamerConfig) Validate() error
- type Theme
- func (b *Theme) AddListener(l binding.DataListener)
- func (self *Theme) GetItem(key string) (binding.DataItem, error)
- func (self *Theme) GetValue(key string) (any, error)
- func (self *Theme) Keys() []string
- func (self *Theme) MarshalJSON() ([]byte, error)
- func (self *Theme) MarshalYAML() (any, error)
- func (self *Theme) NewDarkFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Theme) NewDarkHelp() *HelpButton
- func (self *Theme) NewLightFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *Theme) NewLightHelp() *HelpButton
- func (self *Theme) Reload() error
- func (b *Theme) RemoveListener(l binding.DataListener)
- func (self *Theme) SetValue(key string, value any) error
- func (self *Theme) SetValueChecked(key string, value any) error
- func (self *Theme) UnmarshalJSON(data []byte) error
- func (self *Theme) UnmarshalYAML(node *yaml.Node) error
- func (self *Theme) Validate() error
- type TimeEntry
- func (e *TimeEntry) Bind(item binding.Item[TimeOfDay])
- func (e *TimeEntry) BindOptional(item binding.Item[Optional[TimeOfDay]])
- func (e *TimeEntry) Display() string
- func (e *TimeEntry) FocusGained()
- func (e *TimeEntry) FocusLost()
- func (e *TimeEntry) Hint() string
- func (e *TimeEntry) Refresh()
- func (e *TimeEntry) Resolved() (TimeOfDay, bool, error)
- func (e *TimeEntry) SetBias(b Bias)
- func (e *TimeEntry) Unbind()
- type TimeOfDay
- type ValidationError
- type Weekday
- type Window
- type World
- func (b *World) AddListener(l binding.DataListener)
- func (self *World) GetItem(key string) (binding.DataItem, error)
- func (self *World) GetValue(key string) (any, error)
- func (self *World) KeyItem() binding.String
- func (self *World) KeyValidator() func(string) error
- func (self *World) Keys() []string
- func (self *World) MarshalJSON() ([]byte, error)
- func (self *World) MarshalYAML() (any, error)
- func (self *World) NewKeyFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *World) NewKeyHelp() *HelpButton
- func (self *World) NewNamesFormItem(w fyne.CanvasObject) *widget.FormItem
- func (self *World) NewNamesHelp() *HelpButton
- func (self *World) Reload() error
- func (b *World) RemoveListener(l binding.DataListener)
- func (self *World) SetValue(key string, value any) error
- func (self *World) SetValueChecked(key string, value any) error
- func (self *World) UnmarshalJSON(data []byte) error
- func (self *World) UnmarshalYAML(node *yaml.Node) error
- func (self *World) Validate() error
Constants ¶
This section is empty.
Variables ¶
var DefaultWindow = Window{From: NewTimeOfDay(9, 0, 0), To: NewTimeOfDay(21, 0, 0)}
DefaultWindow is the window used for a time field whose model declares none: a working day of 09:00 through 21:00. Under it a bare "7" reads as 7:00 PM and a bare "10" as 10:00 AM. Assign to it to retune every such field at once; a field that declares a window in the model is unaffected.
var ErrInvalidWeekday = errors.New("not a valid Weekday")
Functions ¶
func ChainTimeEntries ¶
func ChainTimeEntries(entries ...*TimeEntry)
ChainTimeEntries biases a run of time entries to read in order, each one after every filled entry before it. It is what makes a start/end pair read naturally: with entries chained, typing "7" then "9" gives 7:00 PM and 9:00 PM rather than 9:00 AM.
The reference is the running maximum of the earlier readings, so an explicit earlier value ("9am" for the first end of a window) cannot drag a later entry back before the start. A blank or unparseable entry does not advance it.
Chaining only ever sets biases; it never revises an entry's value. Each edit re-runs the pass so the entries after it read the new state, but the entries themselves keep whatever they were already read as. Editing one field of a chained run therefore leaves the other fields' values exactly as they were.
Chaining wires each entry's OnResolved, so set OnResolved before calling this -- an existing callback is kept and still runs.
func I18n ¶
func I18n(w fyne.Window) fyne.CanvasObject
I18n builds the i18n tab: a table of message keys with each locale's translation side-by-side, plus controls to choose the website folder, add and remove messages, reload from disk, and save all locale files.
func TransformBind ¶
func TransformBind[S, T any]( src binding.Item[S], forward func(S) (T, error), reverse func(T) (S, error), ) binding.Item[T]
TransformBind adapts an existing binding into one carrying a different representation of the same underlying value. Use it when a widget's text is not the model value verbatim -- for example a clock-time entry showing "7pm" backed by a "19:00" string field -- where the generated <Field>Item bindings cannot map one-to-one.
Pass the field's generated <Field>Item as src. forward converts the source value to the widget representation (S -> T); reverse converts it back (T -> S). A reverse error leaves the underlying value unchanged so a widget can hold an unparseable draft while its Validator surfaces the problem, matching the permissive behaviour of the generated <Field>Item setters.
Because binding.String, binding.Bool, binding.Int and binding.Float are aliases for binding.Item[string|bool|int|float64], the result binds directly to the matching widget: TransformBind[string, string](world.ClockItem(), ...) yields a binding.String for widget.Entry.Bind.
Types ¶
type Bias ¶
Bias steers how an ambiguous clock entry is read, from what the rest of a form already says. A field holding the end of a span sets After to the span's start, so typing "7" then "9" reads as 7:00 PM then 9:00 PM rather than 9:00 AM. Both bounds are exclusive, and a nil bound is no constraint.
type HelpButton ¶
type HelpButton struct {
widget.Button
// Help is the text shown in the popup, compiled in from the field's desc
// by the generated New<Field>Help constructors. An empty Help opens
// nothing.
Help string
// contains filtered or unexported fields
}
HelpButton is a question-mark button that reveals a field's description in a popup. Tapping it toggles the popup open or closed; tapping anywhere else closes it.
ponytail: click only, no hover. The popup sits on the canvas overlay stack, and that overlay covers the whole canvas and takes hover over from the button, so a hover-opened popup would flicker as soon as the pointer moved: open, mouse-out, close, mouse-in, open. Opening on hover needs a tooltip layer inside the window content, the way fyne-tooltip does it; add that if hover matters.
func NewHelpButton ¶
func NewHelpButton(help string) *HelpButton
NewHelpButton returns a help button showing help when tapped. The generated New<Field>Help constructors call it with the field's description.
func (*HelpButton) Open ¶
func (b *HelpButton) Open()
Open shows the description in a popup directly below the button. It does nothing for an empty Help, for an already-open popup, or for a button that is not on a canvas yet.
func (*HelpButton) Toggle ¶
func (b *HelpButton) Toggle()
Toggle opens the popup if it is closed and closes it if it is open. It is the button's OnTapped.
type LocaleName ¶
func (*LocaleName) AddListener ¶
func (b *LocaleName) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*LocaleName) Keys ¶
func (self *LocaleName) Keys() []string
func (*LocaleName) LocaleItem ¶
func (self *LocaleName) LocaleItem() binding.String
LocaleItem returns a typed two-way binding for the locale field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire LocaleValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*LocaleName) LocaleValidator ¶
func (self *LocaleName) LocaleValidator() func(string) error
LocaleValidator returns a Fyne validator enforcing the same constraints as Validate for the locale field. Assign it to a widget's Validator (for example widget.Entry.Validator).
func (*LocaleName) MarshalJSON ¶
func (self *LocaleName) MarshalJSON() ([]byte, error)
func (*LocaleName) MarshalYAML ¶
func (self *LocaleName) MarshalYAML() (any, error)
func (*LocaleName) NameItem ¶
func (self *LocaleName) NameItem() binding.String
NameItem returns a typed two-way binding for the name field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire NameValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*LocaleName) NameValidator ¶
func (self *LocaleName) NameValidator() func(string) error
NameValidator returns a Fyne validator enforcing the same constraints as Validate for the name field. Assign it to a widget's Validator (for example widget.Entry.Validator).
func (*LocaleName) NewLocaleFormItem ¶
func (self *LocaleName) NewLocaleFormItem(w fyne.CanvasObject) *widget.FormItem
NewLocaleFormItem labels w with the locale field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*LocaleName) NewLocaleHelp ¶
func (self *LocaleName) NewLocaleHelp() *HelpButton
NewLocaleHelp returns a help button carrying the locale field's description from the model, to place beside the field's widget. Tapping it shows the description; NewLocaleFormItem places one for you.
func (*LocaleName) NewNameFormItem ¶
func (self *LocaleName) NewNameFormItem(w fyne.CanvasObject) *widget.FormItem
NewNameFormItem labels w with the name field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*LocaleName) NewNameHelp ¶
func (self *LocaleName) NewNameHelp() *HelpButton
NewNameHelp returns a help button carrying the name field's description from the model, to place beside the field's widget. Tapping it shows the description; NewNameFormItem places one for you.
func (*LocaleName) Reload ¶
func (self *LocaleName) Reload() error
func (*LocaleName) RemoveListener ¶
func (b *LocaleName) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*LocaleName) SetValue ¶
func (self *LocaleName) SetValue(key string, value any) error
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*LocaleName) SetValueChecked ¶
func (self *LocaleName) SetValueChecked(key string, value any) error
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*LocaleName) UnmarshalJSON ¶
func (self *LocaleName) UnmarshalJSON(data []byte) error
func (*LocaleName) UnmarshalYAML ¶
func (self *LocaleName) UnmarshalYAML(node *yaml.Node) error
func (*LocaleName) Validate ¶
func (self *LocaleName) Validate() error
type Optional ¶
type Optional[T any] struct { // contains filtered or unexported fields }
Optional wraps a value that may be absent, keeping "not set" distinct from the zero value of T.
func (Optional[T]) Get ¶
func (o Optional[T]) Get(def T) T
Get returns the value when present, otherwise def.
func (Optional[T]) GetOrZero ¶
func (o Optional[T]) GetOrZero() T
GetOrZero returns the value when present, otherwise the zero value of T.
type ScheduleDay ¶
type ScheduleDay struct {
Weekday Weekday
Streams []Stream
// contains filtered or unexported fields
}
func (*ScheduleDay) AddListener ¶
func (b *ScheduleDay) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*ScheduleDay) GetItem ¶
func (self *ScheduleDay) GetItem(key string) (binding.DataItem, error)
func (*ScheduleDay) Keys ¶
func (self *ScheduleDay) Keys() []string
func (*ScheduleDay) MarshalJSON ¶
func (self *ScheduleDay) MarshalJSON() ([]byte, error)
func (*ScheduleDay) MarshalYAML ¶
func (self *ScheduleDay) MarshalYAML() (any, error)
func (*ScheduleDay) NewStreamsFormItem ¶
func (self *ScheduleDay) NewStreamsFormItem(w fyne.CanvasObject) *widget.FormItem
NewStreamsFormItem labels w with the streams field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*ScheduleDay) NewStreamsHelp ¶
func (self *ScheduleDay) NewStreamsHelp() *HelpButton
NewStreamsHelp returns a help button carrying the streams field's description from the model, to place beside the field's widget. Tapping it shows the description; NewStreamsFormItem places one for you.
func (*ScheduleDay) NewWeekdayFormItem ¶
func (self *ScheduleDay) NewWeekdayFormItem(w fyne.CanvasObject) *widget.FormItem
NewWeekdayFormItem labels w with the weekday field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*ScheduleDay) NewWeekdayHelp ¶
func (self *ScheduleDay) NewWeekdayHelp() *HelpButton
NewWeekdayHelp returns a help button carrying the weekday field's description from the model, to place beside the field's widget. Tapping it shows the description; NewWeekdayFormItem places one for you.
func (*ScheduleDay) Reload ¶
func (self *ScheduleDay) Reload() error
func (*ScheduleDay) RemoveListener ¶
func (b *ScheduleDay) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*ScheduleDay) SetValue ¶
func (self *ScheduleDay) SetValue(key string, value any) error
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*ScheduleDay) SetValueChecked ¶
func (self *ScheduleDay) SetValueChecked(key string, value any) error
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*ScheduleDay) UnmarshalJSON ¶
func (self *ScheduleDay) UnmarshalJSON(data []byte) error
func (*ScheduleDay) UnmarshalYAML ¶
func (self *ScheduleDay) UnmarshalYAML(node *yaml.Node) error
func (*ScheduleDay) Validate ¶
func (self *ScheduleDay) Validate() error
type ScheduleEnd ¶
type ScheduleEnd struct {
Earliest Optional[TimeOfDay]
Latest Optional[TimeOfDay]
// contains filtered or unexported fields
}
func (*ScheduleEnd) AddListener ¶
func (b *ScheduleEnd) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*ScheduleEnd) EarliestItem ¶
func (self *ScheduleEnd) EarliestItem() binding.Item[TimeOfDay]
EarliestItem returns a typed two-way binding for the earliest field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire EarliestValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*ScheduleEnd) EarliestOptionalItem ¶
func (self *ScheduleEnd) EarliestOptionalItem() binding.Item[Optional[TimeOfDay]]
EarliestOptionalItem returns a typed two-way binding for the earliest field that keeps the field's unset state, which EarliestItem does not -- that one reads an unset field as midnight. TimeEntry.BindOptional consumes this one, so a blank entry round-trips as unset, not as a time.
func (*ScheduleEnd) GetItem ¶
func (self *ScheduleEnd) GetItem(key string) (binding.DataItem, error)
func (*ScheduleEnd) Keys ¶
func (self *ScheduleEnd) Keys() []string
func (*ScheduleEnd) LatestItem ¶
func (self *ScheduleEnd) LatestItem() binding.Item[TimeOfDay]
LatestItem returns a typed two-way binding for the latest field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire LatestValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*ScheduleEnd) LatestOptionalItem ¶
func (self *ScheduleEnd) LatestOptionalItem() binding.Item[Optional[TimeOfDay]]
LatestOptionalItem returns a typed two-way binding for the latest field that keeps the field's unset state, which LatestItem does not -- that one reads an unset field as midnight. TimeEntry.BindOptional consumes this one, so a blank entry round-trips as unset, not as a time.
func (*ScheduleEnd) MarshalJSON ¶
func (self *ScheduleEnd) MarshalJSON() ([]byte, error)
func (*ScheduleEnd) MarshalYAML ¶
func (self *ScheduleEnd) MarshalYAML() (any, error)
func (*ScheduleEnd) NewEarliestEntry ¶
func (self *ScheduleEnd) NewEarliestEntry() *TimeEntry
NewEarliestEntry returns a TimeEntry bound to the earliest field, with the field's preferred hours from the model compiled in. Set the entry's Bias (or pass it to ChainTimeEntries) to have it read in step with the rest of the form.
func (*ScheduleEnd) NewEarliestFormItem ¶
func (self *ScheduleEnd) NewEarliestFormItem(w fyne.CanvasObject) *widget.FormItem
NewEarliestFormItem labels w with the earliest field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*ScheduleEnd) NewEarliestHelp ¶
func (self *ScheduleEnd) NewEarliestHelp() *HelpButton
NewEarliestHelp returns a help button carrying the earliest field's description from the model, to place beside the field's widget. Tapping it shows the description; NewEarliestFormItem places one for you.
func (*ScheduleEnd) NewLatestEntry ¶
func (self *ScheduleEnd) NewLatestEntry() *TimeEntry
NewLatestEntry returns a TimeEntry bound to the latest field, with the field's preferred hours from the model compiled in. Set the entry's Bias (or pass it to ChainTimeEntries) to have it read in step with the rest of the form.
func (*ScheduleEnd) NewLatestFormItem ¶
func (self *ScheduleEnd) NewLatestFormItem(w fyne.CanvasObject) *widget.FormItem
NewLatestFormItem labels w with the latest field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*ScheduleEnd) NewLatestHelp ¶
func (self *ScheduleEnd) NewLatestHelp() *HelpButton
NewLatestHelp returns a help button carrying the latest field's description from the model, to place beside the field's widget. Tapping it shows the description; NewLatestFormItem places one for you.
func (*ScheduleEnd) Reload ¶
func (self *ScheduleEnd) Reload() error
func (*ScheduleEnd) RemoveListener ¶
func (b *ScheduleEnd) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*ScheduleEnd) SetValue ¶
func (self *ScheduleEnd) SetValue(key string, value any) error
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*ScheduleEnd) SetValueChecked ¶
func (self *ScheduleEnd) SetValueChecked(key string, value any) error
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*ScheduleEnd) UnmarshalJSON ¶
func (self *ScheduleEnd) UnmarshalJSON(data []byte) error
func (*ScheduleEnd) UnmarshalYAML ¶
func (self *ScheduleEnd) UnmarshalYAML(node *yaml.Node) error
func (*ScheduleEnd) Validate ¶
func (self *ScheduleEnd) Validate() error
type Site ¶
type Site struct {
StreamName string
Streamer string
Logo Optional[string]
TitleFont Optional[string]
TextFont Optional[string]
// contains filtered or unexported fields
}
func (*Site) AddListener ¶
func (b *Site) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*Site) LogoItem ¶
LogoItem returns a typed two-way binding for the logo field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire LogoValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Site) MarshalJSON ¶
func (*Site) MarshalYAML ¶
func (*Site) NewLogoFormItem ¶
func (self *Site) NewLogoFormItem(w fyne.CanvasObject) *widget.FormItem
NewLogoFormItem labels w with the logo field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Site) NewLogoHelp ¶
func (self *Site) NewLogoHelp() *HelpButton
NewLogoHelp returns a help button carrying the logo field's description from the model, to place beside the field's widget. Tapping it shows the description; NewLogoFormItem places one for you.
func (*Site) NewStreamNameFormItem ¶
func (self *Site) NewStreamNameFormItem(w fyne.CanvasObject) *widget.FormItem
NewStreamNameFormItem labels w with the stream_name field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Site) NewStreamNameHelp ¶
func (self *Site) NewStreamNameHelp() *HelpButton
NewStreamNameHelp returns a help button carrying the stream_name field's description from the model, to place beside the field's widget. Tapping it shows the description; NewStreamNameFormItem places one for you.
func (*Site) NewStreamerFormItem ¶
func (self *Site) NewStreamerFormItem(w fyne.CanvasObject) *widget.FormItem
NewStreamerFormItem labels w with the streamer field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Site) NewStreamerHelp ¶
func (self *Site) NewStreamerHelp() *HelpButton
NewStreamerHelp returns a help button carrying the streamer field's description from the model, to place beside the field's widget. Tapping it shows the description; NewStreamerFormItem places one for you.
func (*Site) NewTextFontFormItem ¶
func (self *Site) NewTextFontFormItem(w fyne.CanvasObject) *widget.FormItem
NewTextFontFormItem labels w with the text_font field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Site) NewTextFontHelp ¶
func (self *Site) NewTextFontHelp() *HelpButton
NewTextFontHelp returns a help button carrying the text_font field's description from the model, to place beside the field's widget. Tapping it shows the description; NewTextFontFormItem places one for you.
func (*Site) NewTitleFontFormItem ¶
func (self *Site) NewTitleFontFormItem(w fyne.CanvasObject) *widget.FormItem
NewTitleFontFormItem labels w with the title_font field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Site) NewTitleFontHelp ¶
func (self *Site) NewTitleFontHelp() *HelpButton
NewTitleFontHelp returns a help button carrying the title_font field's description from the model, to place beside the field's widget. Tapping it shows the description; NewTitleFontFormItem places one for you.
func (*Site) RemoveListener ¶
func (b *Site) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*Site) SetValue ¶
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*Site) SetValueChecked ¶
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*Site) StreamNameItem ¶
StreamNameItem returns a typed two-way binding for the stream_name field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire StreamNameValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Site) StreamerItem ¶
StreamerItem returns a typed two-way binding for the streamer field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire StreamerValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Site) TextFontItem ¶
TextFontItem returns a typed two-way binding for the text_font field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire TextFontValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Site) TitleFontItem ¶
TitleFontItem returns a typed two-way binding for the title_font field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire TitleFontValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Site) UnmarshalJSON ¶
type Stream ¶
type Stream struct {
Start TimeOfDay
End ScheduleEnd
Game string
Platform Optional[string]
World Optional[string]
// contains filtered or unexported fields
}
func (*Stream) AddListener ¶
func (b *Stream) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*Stream) GameItem ¶
GameItem returns a typed two-way binding for the game field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire GameValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Stream) MarshalJSON ¶
func (*Stream) MarshalYAML ¶
func (*Stream) NewEndFormItem ¶
func (self *Stream) NewEndFormItem(w fyne.CanvasObject) *widget.FormItem
NewEndFormItem labels w with the end field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Stream) NewEndHelp ¶
func (self *Stream) NewEndHelp() *HelpButton
NewEndHelp returns a help button carrying the end field's description from the model, to place beside the field's widget. Tapping it shows the description; NewEndFormItem places one for you.
func (*Stream) NewGameFormItem ¶
func (self *Stream) NewGameFormItem(w fyne.CanvasObject) *widget.FormItem
NewGameFormItem labels w with the game field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Stream) NewGameHelp ¶
func (self *Stream) NewGameHelp() *HelpButton
NewGameHelp returns a help button carrying the game field's description from the model, to place beside the field's widget. Tapping it shows the description; NewGameFormItem places one for you.
func (*Stream) NewPlatformFormItem ¶
func (self *Stream) NewPlatformFormItem(w fyne.CanvasObject) *widget.FormItem
NewPlatformFormItem labels w with the platform field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Stream) NewPlatformHelp ¶
func (self *Stream) NewPlatformHelp() *HelpButton
NewPlatformHelp returns a help button carrying the platform field's description from the model, to place beside the field's widget. Tapping it shows the description; NewPlatformFormItem places one for you.
func (*Stream) NewStartEntry ¶
NewStartEntry returns a TimeEntry bound to the start field, with the field's preferred hours from the model compiled in. Set the entry's Bias (or pass it to ChainTimeEntries) to have it read in step with the rest of the form.
func (*Stream) NewStartFormItem ¶
func (self *Stream) NewStartFormItem(w fyne.CanvasObject) *widget.FormItem
NewStartFormItem labels w with the start field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Stream) NewStartHelp ¶
func (self *Stream) NewStartHelp() *HelpButton
NewStartHelp returns a help button carrying the start field's description from the model, to place beside the field's widget. Tapping it shows the description; NewStartFormItem places one for you.
func (*Stream) NewWorldFormItem ¶
func (self *Stream) NewWorldFormItem(w fyne.CanvasObject) *widget.FormItem
NewWorldFormItem labels w with the world field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Stream) NewWorldHelp ¶
func (self *Stream) NewWorldHelp() *HelpButton
NewWorldHelp returns a help button carrying the world field's description from the model, to place beside the field's widget. Tapping it shows the description; NewWorldFormItem places one for you.
func (*Stream) PlatformItem ¶
PlatformItem returns a typed two-way binding for the platform field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire PlatformValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Stream) RemoveListener ¶
func (b *Stream) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*Stream) SetValue ¶
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*Stream) SetValueChecked ¶
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*Stream) StartItem ¶
StartItem returns a typed two-way binding for the start field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire StartValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*Stream) UnmarshalJSON ¶
func (*Stream) WorldItem ¶
WorldItem returns a typed two-way binding for the world field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire WorldValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
type StreamerConfig ¶
type StreamerConfig struct {
Worlds []World
Schedule []ScheduleDay
Theme Theme
Site Site
// contains filtered or unexported fields
}
func (*StreamerConfig) AddListener ¶
func (b *StreamerConfig) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*StreamerConfig) GetItem ¶
func (self *StreamerConfig) GetItem(key string) (binding.DataItem, error)
func (*StreamerConfig) Keys ¶
func (self *StreamerConfig) Keys() []string
func (*StreamerConfig) MarshalJSON ¶
func (self *StreamerConfig) MarshalJSON() ([]byte, error)
func (*StreamerConfig) MarshalYAML ¶
func (self *StreamerConfig) MarshalYAML() (any, error)
func (*StreamerConfig) NewScheduleFormItem ¶
func (self *StreamerConfig) NewScheduleFormItem(w fyne.CanvasObject) *widget.FormItem
NewScheduleFormItem labels w with the schedule field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*StreamerConfig) NewScheduleHelp ¶
func (self *StreamerConfig) NewScheduleHelp() *HelpButton
NewScheduleHelp returns a help button carrying the schedule field's description from the model, to place beside the field's widget. Tapping it shows the description; NewScheduleFormItem places one for you.
func (*StreamerConfig) NewSiteFormItem ¶
func (self *StreamerConfig) NewSiteFormItem(w fyne.CanvasObject) *widget.FormItem
NewSiteFormItem labels w with the site field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*StreamerConfig) NewSiteHelp ¶
func (self *StreamerConfig) NewSiteHelp() *HelpButton
NewSiteHelp returns a help button carrying the site field's description from the model, to place beside the field's widget. Tapping it shows the description; NewSiteFormItem places one for you.
func (*StreamerConfig) NewThemeFormItem ¶
func (self *StreamerConfig) NewThemeFormItem(w fyne.CanvasObject) *widget.FormItem
NewThemeFormItem labels w with the theme field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*StreamerConfig) NewThemeHelp ¶
func (self *StreamerConfig) NewThemeHelp() *HelpButton
NewThemeHelp returns a help button carrying the theme field's description from the model, to place beside the field's widget. Tapping it shows the description; NewThemeFormItem places one for you.
func (*StreamerConfig) NewWorldsFormItem ¶
func (self *StreamerConfig) NewWorldsFormItem(w fyne.CanvasObject) *widget.FormItem
NewWorldsFormItem labels w with the worlds field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*StreamerConfig) NewWorldsHelp ¶
func (self *StreamerConfig) NewWorldsHelp() *HelpButton
NewWorldsHelp returns a help button carrying the worlds field's description from the model, to place beside the field's widget. Tapping it shows the description; NewWorldsFormItem places one for you.
func (*StreamerConfig) Reload ¶
func (self *StreamerConfig) Reload() error
func (*StreamerConfig) RemoveListener ¶
func (b *StreamerConfig) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*StreamerConfig) SetValue ¶
func (self *StreamerConfig) SetValue(key string, value any) error
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*StreamerConfig) SetValueChecked ¶
func (self *StreamerConfig) SetValueChecked(key string, value any) error
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*StreamerConfig) UnmarshalJSON ¶
func (self *StreamerConfig) UnmarshalJSON(data []byte) error
func (*StreamerConfig) UnmarshalYAML ¶
func (self *StreamerConfig) UnmarshalYAML(node *yaml.Node) error
func (*StreamerConfig) Validate ¶
func (self *StreamerConfig) Validate() error
type Theme ¶
type Theme struct {
Light map[string]string
Dark map[string]string
// contains filtered or unexported fields
}
func (*Theme) AddListener ¶
func (b *Theme) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*Theme) MarshalJSON ¶
func (*Theme) MarshalYAML ¶
func (*Theme) NewDarkFormItem ¶
func (self *Theme) NewDarkFormItem(w fyne.CanvasObject) *widget.FormItem
NewDarkFormItem labels w with the dark field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Theme) NewDarkHelp ¶
func (self *Theme) NewDarkHelp() *HelpButton
NewDarkHelp returns a help button carrying the dark field's description from the model, to place beside the field's widget. Tapping it shows the description; NewDarkFormItem places one for you.
func (*Theme) NewLightFormItem ¶
func (self *Theme) NewLightFormItem(w fyne.CanvasObject) *widget.FormItem
NewLightFormItem labels w with the light field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*Theme) NewLightHelp ¶
func (self *Theme) NewLightHelp() *HelpButton
NewLightHelp returns a help button carrying the light field's description from the model, to place beside the field's widget. Tapping it shows the description; NewLightFormItem places one for you.
func (*Theme) RemoveListener ¶
func (b *Theme) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*Theme) SetValue ¶
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*Theme) SetValueChecked ¶
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*Theme) UnmarshalJSON ¶
type TimeEntry ¶
type TimeEntry struct {
widget.Entry
// AllowEmpty makes a blank entry valid, meaning "unset". Set automatically
// by the generated constructor for an optional field.
AllowEmpty bool
// OnResolved is called whenever the entry's reading changes, with the
// resolved value, whether the entry was non-blank, and any parse error.
OnResolved func(value TimeOfDay, filled bool, err error)
// contains filtered or unexported fields
}
TimeEntry is a text entry for a time-of-day field. It accepts the loose clock forms ParseClock does ("7", "7:30", "7pm", "7.30p") and resolves an ambiguous bare hour against two layers of preference: the field's Window, compiled in from the model by the generated New<Field>Entry constructors, and a Bias set at runtime from whatever else the form already says.
Both layers decide how an edit is read as it is made. Neither reaches back: a bias arriving after the fact does not re-read text already resolved, so the entry's value only ever moves in response to its own field being typed in.
Every keystroke is accepted, including text that is not a time at all. While the entry has focus its text is exactly what the user typed, and the reading is shown beside it: whenever the two differ the entry states its reading at its trailing edge, so typing "9" into an evening field shows "9:00 PM" there before anything is saved. The Validator reports anything that does not parse. Only when focus leaves does the entry rewrite its text, in the canonical form of whatever it read -- at which point the text says it and the hint clears; text that does not parse is left as typed and stays flagged.
The same reading is available through Resolved, Display, Hint, and the OnResolved callback, for a caller that wants to echo it somewhere else too.
TimeEntry owns the embedded Entry's OnChanged. Use OnResolved instead; assigning OnChanged replaces the widget's own handler and stops it working.
func NewTimeEntry ¶
func NewTimeEntry() *TimeEntry
NewTimeEntry returns a time entry using DefaultWindow, for a caller wiring a time input by hand. Prefer the generated New<Field>Entry constructors, which compile in the field's own window and bind it to the model.
func (*TimeEntry) Bind ¶
Bind two-way binds the entry to a required time field's item, seeding the text from the item's current value.
func (*TimeEntry) BindOptional ¶
BindOptional two-way binds the entry to an optional time field's item. A blank entry is the unset value and vice versa, so AllowEmpty is implied.
func (*TimeEntry) Display ¶
Display renders the entry's reading on a 12-hour clock ("7:00 PM"), or "" if the entry is blank or does not parse.
func (*TimeEntry) FocusGained ¶
func (e *TimeEntry) FocusGained()
FocusGained starts an edit: from here until focus is lost the text is the user's, and neither the model nor the entry's own reading rewrites it.
func (*TimeEntry) FocusLost ¶
func (e *TimeEntry) FocusLost()
FocusLost ends the edit and settles the entry: a reading that parses is rewritten in canonical form ("7pm" becomes "7:00 PM"), and text that does not parse is kept as typed with the Validator's error still showing.
func (*TimeEntry) Hint ¶
Hint returns the reading shown at the trailing edge of the entry: the entry's Display, or "" when the text is blank, does not parse, or already says the reading itself.
func (*TimeEntry) Refresh ¶
func (e *TimeEntry) Refresh()
Refresh restates the hint before redrawing, so every path that repaints the entry -- a keystroke, a settle, a theme change -- shows the current reading.
func (*TimeEntry) Resolved ¶
Resolved returns the entry's current reading: the parsed value, whether the entry was non-blank, and any parse error. A blank entry yields the zero TimeOfDay with filled false. The reading is the one the text was given when it was last edited, so it always agrees with what was written to the bound value, whatever the bias has since become.
func (*TimeEntry) SetBias ¶
SetBias steers how an ambiguous entry is read, from what the rest of the form says: a field holding the end of a span passes Bias{After: &start}, which is what makes a bare "9" typed there land in the evening when the span starts at 7:00 PM.
It applies to the next edit only. Text already read keeps the reading it was given -- the entry's value is not revised, and its text is not rewritten -- because a field the user is not typing in should not change under them. So a start time moved to the evening after the end was already filled in leaves that end time alone; only what is typed from then on is read the new way.
type TimeOfDay ¶
type TimeOfDay struct {
// contains filtered or unexported fields
}
TimeOfDay holds a time of day with whole-second precision, stored as the number of nanoseconds since midnight. It serializes to and from "HH:MM:SS" (e.g. "12:34:56") in both JSON and YAML via MarshalText/UnmarshalText. Both "HH:MM" and "HH:MM:SS" are accepted on input; output is always the whole-second "HH:MM:SS" form.
func NewTimeOfDay ¶
NewTimeOfDay builds a TimeOfDay from a wall-clock hour, minute, and second. Out-of-range components wrap the way time.Duration arithmetic does, so NewTimeOfDay(25, 0, 0) is an hour past midnight; callers taking user input should use ParseClock instead.
func ParseClock ¶
ParseClock parses a loosely-typed clock entry into a TimeOfDay.
Accepted input is a bare hour ("7"), an hour:minute ("7:30"), or an hour:minute:second ("7:30:15"), with "." accepted in place of ":", optionally suffixed with a meridiem marker (a, am, p, pm -- case-insensitive, spacing optional). A marker is definitive, as is an explicit 24-hour value (hour 0 or 13-23); combining the two is an error.
A zero-padded two-digit hour ("07", "08") is a definitive 24-hour value and skips the meridiem inference below. That is the form String() emits, so a stored value round-trips through an editor unchanged instead of being re-read as PM.
Otherwise a bare 1-12 hour is ambiguous, and its AM and PM readings are resolved against two layers of preference:
- Readings ruled out by bias are dropped.
- Of what remains, a reading inside window wins; if both or neither are inside it, the earlier one wins.
- If bias ruled out everything, the best-effort reading is used: the later one when After is set, the earlier one when only Before is, so a typed entry still lands somewhere sensible rather than failing.
func TimeOfDayFromString ¶
TimeOfDayFromString parses an "HH:MM" or "HH:MM:SS" string into a TimeOfDay.
func (TimeOfDay) Display ¶
Display renders the time of day on a 12-hour clock, e.g. "7:30 PM". The seconds are shown only when they are set ("7:30:15 PM"). The result parses back to the same value through ParseClock.
func (TimeOfDay) Duration ¶
Duration returns the time of day as the number of nanoseconds since midnight.
func (TimeOfDay) MarshalText ¶
MarshalText implements encoding.TextMarshaler, rendering "HH:MM:SS".
func (*TimeOfDay) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler, parsing "HH:MM" or "HH:MM:SS".
type ValidationError ¶
ValidationError describes a single constraint violation found by a generated Validate method. Kind is "length" or "range"; DataPath locates the offending field within the value, and FilePath is set when the value came from a known file.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type Weekday ¶
type Weekday string
A day of the week a stream may be scheduled on. The member names are the keys used in the schedule, so a typo fails validation instead of silently producing an empty day.
func ParseWeekday ¶
func (Weekday) MarshalText ¶
func (*Weekday) UnmarshalText ¶
type Window ¶
type Window struct{ From, To TimeOfDay }
Window is the span of hours a time field's values typically fall in, used to pick between the AM and PM readings of an ambiguous clock entry. To is exclusive, and a window whose To is at or before its From wraps midnight (an evening shift, say 18:00 to 02:00).
type World ¶
type World struct {
Key string
Names []LocaleName
// contains filtered or unexported fields
}
func (*World) AddListener ¶
func (b *World) AddListener(l binding.DataListener)
AddListener registers l to be notified whenever any bound field changes. Per Fyne convention the listener also fires immediately so it can pull the current value.
func (*World) KeyItem ¶
KeyItem returns a typed two-way binding for the key field, ready to hand to a Fyne widget (for example widget.Entry.Bind). Set is permissive -- it commits and notifies without running the field's constraints -- so wire KeyValidator to the widget's Validator (and rely on Validate at save time) to enforce them.
func (*World) KeyValidator ¶
KeyValidator returns a Fyne validator enforcing the same constraints as Validate for the key field. Assign it to a widget's Validator (for example widget.Entry.Validator).
func (*World) MarshalJSON ¶
func (*World) MarshalYAML ¶
func (*World) NewKeyFormItem ¶
func (self *World) NewKeyFormItem(w fyne.CanvasObject) *widget.FormItem
NewKeyFormItem labels w with the key field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*World) NewKeyHelp ¶
func (self *World) NewKeyHelp() *HelpButton
NewKeyHelp returns a help button carrying the key field's description from the model, to place beside the field's widget. Tapping it shows the description; NewKeyFormItem places one for you.
func (*World) NewNamesFormItem ¶
func (self *World) NewNamesFormItem(w fyne.CanvasObject) *widget.FormItem
NewNamesFormItem labels w with the names field's display name from the model and puts the field's help button at w's trailing edge, ready to hand to widget.NewForm. The widget stays the caller's: which one a field wants is not something the model says.
func (*World) NewNamesHelp ¶
func (self *World) NewNamesHelp() *HelpButton
NewNamesHelp returns a help button carrying the names field's description from the model, to place beside the field's widget. Tapping it shows the description; NewNamesFormItem places one for you.
func (*World) RemoveListener ¶
func (b *World) RemoveListener(l binding.DataListener)
RemoveListener stops l from receiving change notifications.
func (*World) SetValue ¶
SetValue commits value to the field named key and notifies listeners. It does NOT run the field's constraints: under two-way binding a widget must be free to hold a transient invalid value. Enforce constraints through the per-field Validator (on the widget) and Validate at save time, or call SetValueChecked to reject invalid values before committing.
func (*World) SetValueChecked ¶
SetValueChecked is SetValue that runs the field's constraints first and returns an error (leaving the field unchanged) if they fail. Prefer plain SetValue on the binding path; use this when a caller wants to gate the write itself rather than surface the error through a widget Validator.
func (*World) UnmarshalJSON ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package legacyconfig converts a pre-merge config directory — the four files site.yaml, worlds.yaml, schedule.yaml and theme.json — into the single streamer-config.json the GUI and the website build now use.
|
Package legacyconfig converts a pre-merge config directory — the four files site.yaml, worlds.yaml, schedule.yaml and theme.json — into the single streamer-config.json the GUI and the website build now use. |