summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-18 23:41:22 +0300
committerPaul Buetow <paul@buetow.org>2025-07-18 23:41:22 +0300
commitd8c65cd0511b558fe62aac7022c267f51d76f3f9 (patch)
tree4c490184ca6a1272f27a216d2e29cd9d666f48b7 /internal
parent8779de2c97e445acf82e8422c899fdefa4649bda (diff)
chore: bump version to 0.4.2
- 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 <noreply@anthropic.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/gui/app.go33
-rw-r--r--internal/gui/navigation.go5
-rw-r--r--internal/version.go2
3 files changed, 27 insertions, 13 deletions
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"