From 3c2e5839e40db29951ee6db37e55cb2e094e4ce4 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 13 Apr 2026 12:44:07 +0300 Subject: Release v0.29.0: display card counter (Card X / N) in the GUI status bar Co-Authored-By: Claude Sonnet 4.6 --- internal/gui/app.go | 33 +++++++++++++++++++++++++++++---- internal/gui/navigation_handler.go | 7 ++++++- internal/version.go | 2 +- 3 files changed, 36 insertions(+), 6 deletions(-) (limited to 'internal') diff --git a/internal/gui/app.go b/internal/gui/app.go index ff23acf..40c7dd7 100644 --- a/internal/gui/app.go +++ b/internal/gui/app.go @@ -54,8 +54,9 @@ type Application struct { logViewer *LogViewer // Navigation buttons - prevWordBtn *ttwidget.Button - nextWordBtn *ttwidget.Button + prevWordBtn *ttwidget.Button + nextWordBtn *ttwidget.Button + cardCounterLabel *widget.Label // displays "Card X / N" // Action buttons keepButton *ttwidget.Button @@ -616,22 +617,46 @@ func (a *Application) buildToolbar() (exportButton, archiveButton, helpButton *t } // buildStatusSection constructs and returns the status bar at the bottom of -// the window. +// the window. It contains the status label, queue status, a card counter +// ("Card X / N") and the version string. func (a *Application) buildStatusSection() fyne.CanvasObject { a.statusLabel = widget.NewLabel("Ready") a.queueStatusLabel = widget.NewLabel("Queue: Empty") a.queueStatusLabel.TextStyle = fyne.TextStyle{Italic: true} + // Card counter — updated by updateCardCounter whenever navigation changes. + a.cardCounterLabel = widget.NewLabel("") + a.cardCounterLabel.TextStyle = fyne.TextStyle{Italic: true} + a.cardCounterLabel.Alignment = fyne.TextAlignTrailing + versionLabel := widget.NewLabel(fmt.Sprintf("v%s", internal.Version)) versionLabel.TextStyle = fyne.TextStyle{Italic: true} versionLabel.Alignment = fyne.TextAlignTrailing + // Right-side column: card counter above version string. + rightCol := container.NewVBox(a.cardCounterLabel, versionLabel) + return container.NewBorder( - nil, nil, nil, versionLabel, + nil, nil, nil, rightCol, container.NewVBox(a.statusLabel, widget.NewSeparator(), a.queueStatusLabel), ) } +// updateCardCounter refreshes the card-counter label to "Card X / N" where X +// is the 1-based position of the current word in the combined word list and N +// is the total number of available words. When no words are present the label +// is cleared. +func (a *Application) updateCardCounter(currentIndex, total int) { + if a.cardCounterLabel == nil { + return + } + if total == 0 { + a.cardCounterLabel.SetText("") + return + } + a.cardCounterLabel.SetText(fmt.Sprintf("Card %d / %d", currentIndex+1, total)) +} + // onWindowClosed is called when the window is closed. It stops background // goroutines, cancels ongoing operations, and shuts down the application. func (a *Application) onWindowClosed() { diff --git a/internal/gui/navigation_handler.go b/internal/gui/navigation_handler.go index 7bc3976..5d79cd6 100644 --- a/internal/gui/navigation_handler.go +++ b/internal/gui/navigation_handler.go @@ -39,7 +39,9 @@ func (n *NavigationHandler) scanExistingWords() { } // updateNavigation updates the navigation button states based on the current -// combined word list (existing words on disk + completed queue jobs). +// combined word list (existing words on disk + completed queue jobs). It also +// refreshes the card counter label ("Card X / N") so it stays in sync with the +// current position. func (n *NavigationHandler) updateNavigation() { allWords := n.getAllAvailableWords() @@ -61,6 +63,9 @@ func (n *NavigationHandler) updateNavigation() { n.app.prevWordBtn.Disable() n.app.nextWordBtn.Disable() } + + // Keep the counter label in sync with the updated index and total. + n.app.updateCardCounter(n.app.currentWordIndex, len(allWords)) } // getAllAvailableWords returns all words from disk and completed queue jobs, diff --git a/internal/version.go b/internal/version.go index d0c1d3a..409abe0 100644 --- a/internal/version.go +++ b/internal/version.go @@ -1,3 +1,3 @@ package internal -const Version = "0.28.2" +const Version = "0.29.0" -- cgit v1.2.3