diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-21 14:46:25 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-21 14:46:25 +0300 |
| commit | b562f3b57f8e4f106aad8856e55b51f1d9d9a367 (patch) | |
| tree | b8730261a43c94d5225d95fea19d4151d73d4ca7 /internal/gui/custom_multiline_entry.go | |
| parent | 6e8f1ffb85cddd841614a156b291b881a1f6a875 (diff) | |
Release v0.7.0: Add auto-play feature and improve keyboard navigationv0.7.0
New Features:
- Added auto-play feature for audio with 'u'/'у' hotkey toggle
- Auto-play is enabled by default on app startup
- Automatically plays audio when new files are generated
- Automatically plays audio when navigating between cards
- Added Escape key support to unfocus all input fields
- Works for Bulgarian word input
- Works for English translation input
- Works for image prompt multi-line input
Improvements:
- Increased default window size by 10% (800x700 → 880x770)
- Fixed duplicate hotkey handling for 'u', 'h', and 'l' keys
- Fixed tooltip initialization error by deferring audio player tooltips
Bug Fixes:
- Fixed Fyne threading errors in audio playback
- Fixed tooltip layer initialization order issue
- Removed duplicate keyboard shortcut handlers
The auto-play feature enhances the learning experience by automatically
playing pronunciation audio when cards are generated or when navigating
through existing cards. Users can toggle this feature on/off at any time
using the 'u' or 'у' hotkey.
Diffstat (limited to 'internal/gui/custom_multiline_entry.go')
| -rw-r--r-- | internal/gui/custom_multiline_entry.go | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/internal/gui/custom_multiline_entry.go b/internal/gui/custom_multiline_entry.go new file mode 100644 index 0000000..58473db --- /dev/null +++ b/internal/gui/custom_multiline_entry.go @@ -0,0 +1,61 @@ +package gui + +import ( + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/widget" +) + +// CustomMultiLineEntry extends widget.Entry to handle Escape key +type CustomMultiLineEntry struct { + widget.Entry + onEscape func() +} + +// NewCustomMultiLineEntry creates a new custom multi-line entry +func NewCustomMultiLineEntry() *CustomMultiLineEntry { + entry := &CustomMultiLineEntry{} + entry.MultiLine = true + entry.ExtendBaseWidget(entry) + return entry +} + +// TypedKey handles key events +func (e *CustomMultiLineEntry) TypedKey(key *fyne.KeyEvent) { + if key.Name == fyne.KeyEscape && e.onEscape != nil { + e.onEscape() + return + } + e.Entry.TypedKey(key) +} + +// SetOnEscape sets the callback for when Escape is pressed +func (e *CustomMultiLineEntry) SetOnEscape(f func()) { + e.onEscape = f +} + +// CustomEntry extends widget.Entry to handle Escape key (single-line version) +type CustomEntry struct { + widget.Entry + onEscape func() +} + +// NewCustomEntry creates a new custom single-line entry +func NewCustomEntry() *CustomEntry { + entry := &CustomEntry{} + entry.ExtendBaseWidget(entry) + return entry +} + +// TypedKey handles key events +func (e *CustomEntry) TypedKey(key *fyne.KeyEvent) { + if key.Name == fyne.KeyEscape && e.onEscape != nil { + e.onEscape() + return + } + e.Entry.TypedKey(key) +} + +// SetOnEscape sets the callback for when Escape is pressed +func (e *CustomEntry) SetOnEscape(f func()) { + e.onEscape = f +} |
