From d8c65cd0511b558fe62aac7022c267f51d76f3f9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 18 Jul 2025 23:41:22 +0300 Subject: chore: bump version to 0.4.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix Fyne tooltip layer error by deferring tooltip setup after layer creation - Add phonetic information generation to batch mode processing - Fix GUI not displaying phonetic info for batch-generated cards - Add debug logging for phonetic file loading - Fix checkForMissingFiles to handle placeholder text in phonetic display 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- internal/gui/app.go | 33 ++++++++++++++++++++++----------- internal/gui/navigation.go | 5 ++++- internal/version.go | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) (limited to 'internal') diff --git a/internal/gui/app.go b/internal/gui/app.go index da66287..6949a8f 100644 --- a/internal/gui/app.go +++ b/internal/gui/app.go @@ -209,18 +209,15 @@ func (a *Application) setupUI() { a.window.Canvas().Unfocus() } - // Create navigation buttons with tooltips + // Create navigation buttons (tooltips will be set after tooltip layer is created) a.submitButton = ttwidget.NewButton("", a.onSubmit) a.submitButton.Icon = theme.ConfirmIcon() - a.submitButton.SetToolTip("Generate word (G)") a.prevWordBtn = ttwidget.NewButton("", a.onPrevWord) a.prevWordBtn.Icon = theme.NavigateBackIcon() - a.prevWordBtn.SetToolTip("Previous word (←)") a.nextWordBtn = ttwidget.NewButton("", a.onNextWord) a.nextWordBtn.Icon = theme.NavigateNextIcon() - a.nextWordBtn.SetToolTip("Next word (→)") // Create a grid layout for inputs inputGrid := container.New(layout.NewGridLayout(2), @@ -295,25 +292,19 @@ func (a *Application) setupUI() { imageSection, ) - // Create action buttons with tooltips + // Create action buttons (tooltips will be set after tooltip layer is created) a.keepButton = ttwidget.NewButtonWithIcon("", theme.DocumentCreateIcon(), a.onKeepAndContinue) - a.keepButton.SetToolTip("Keep card and new word (N)") a.regenerateImageBtn = ttwidget.NewButtonWithIcon("", theme.ViewRefreshIcon(), a.onRegenerateImage) - a.regenerateImageBtn.SetToolTip("Regenerate image (I)") a.regenerateRandomImageBtn = ttwidget.NewButtonWithIcon("", theme.MediaPhotoIcon(), a.onRegenerateRandomImage) - a.regenerateRandomImageBtn.SetToolTip("Random image (M)") a.regenerateAudioBtn = ttwidget.NewButtonWithIcon("", theme.MediaRecordIcon(), a.onRegenerateAudio) - a.regenerateAudioBtn.SetToolTip("Regenerate audio (A)") a.regenerateAllBtn = ttwidget.NewButtonWithIcon("", theme.ViewFullScreenIcon(), a.onRegenerateAll) - a.regenerateAllBtn.SetToolTip("Regenerate all (R)") a.deleteButton = ttwidget.NewButtonWithIcon("", theme.DeleteIcon(), a.onDelete) a.deleteButton.Importance = widget.DangerImportance - a.deleteButton.SetToolTip("Delete word (D)") // Initially disable action buttons a.setActionButtonsEnabled(false) @@ -369,6 +360,10 @@ func (a *Application) setupUI() { // Add the tooltip layer to enable tooltips a.window.SetContent(fynetooltip.AddWindowToolTipLayer(content, a.window.Canvas())) + + // Now that tooltip layer is created, set all tooltips + a.setupTooltips() + a.window.SetOnClosed(func() { // Stop file check ticker if a.fileCheckTicker != nil { @@ -1098,6 +1093,22 @@ func (a *Application) clearUI() { a.setActionButtonsEnabled(false) } +// setupTooltips sets up all tooltips after the tooltip layer has been created +func (a *Application) setupTooltips() { + // Navigation button tooltips + a.submitButton.SetToolTip("Generate word (G)") + a.prevWordBtn.SetToolTip("Previous word (←)") + a.nextWordBtn.SetToolTip("Next word (→)") + + // Action button tooltips + a.keepButton.SetToolTip("Keep card and new word (N)") + a.regenerateImageBtn.SetToolTip("Regenerate image (I)") + a.regenerateRandomImageBtn.SetToolTip("Random image (M)") + a.regenerateAudioBtn.SetToolTip("Regenerate audio (A)") + a.regenerateAllBtn.SetToolTip("Regenerate all (R)") + a.deleteButton.SetToolTip("Delete word (D)") +} + // processNextInQueue processes the next word in the queue func (a *Application) processNextInQueue() { // Check if we're already processing diff --git a/internal/gui/navigation.go b/internal/gui/navigation.go index a73e4d0..e166283 100644 --- a/internal/gui/navigation.go +++ b/internal/gui/navigation.go @@ -390,9 +390,12 @@ func (a *Application) loadExistingFiles(word string) { phoneticFile := filepath.Join(wordDir, "phonetic.txt") if data, err := os.ReadFile(phoneticFile); err == nil { phoneticInfo := string(data) + fmt.Printf("Loaded phonetic info from file: %s\n", phoneticFile) fyne.Do(func() { a.phoneticDisplay.SetText(phoneticInfo) }) + } else { + fmt.Printf("No phonetic file found at: %s (error: %v)\n", phoneticFile, err) } // Load audio file @@ -539,7 +542,7 @@ func (a *Application) checkForMissingFiles(word string) { // Check for missing phonetic info currentPhonetic := a.phoneticDisplay.Text - if currentPhonetic == "" { + if currentPhonetic == "" || currentPhonetic == "Phonetic information will appear here..." { phoneticFile := filepath.Join(wordDir, "phonetic.txt") if data, err := os.ReadFile(phoneticFile); err == nil { phoneticInfo := string(data) diff --git a/internal/version.go b/internal/version.go index 60cb1f5..40069bf 100644 --- a/internal/version.go +++ b/internal/version.go @@ -1,3 +1,3 @@ package internal -const Version = "0.4.1" +const Version = "0.4.2" -- cgit v1.2.3