mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-16 04:38:50 -04:00
fix(launcher): truncate download status labels to stop progress dialog blowout (#10357)
fix(launcher): truncate download status labels to stop dialog blowout The download progress windows place a ProgressBar and a status Label in the same VBox. On failure the status label is set to "Download failed: <error>", and the error commonly contains a long, unbreakable URL/path. A Fyne label with default settings reports its MinSize as the full single-line text width, so a long message stretches the window — and the progress bar sharing the VBox — arbitrarily wide (fixes #10355). Set Truncation = fyne.TextTruncateEllipsis on the four affected status labels (the main-window status label plus the status label in each of the three showDownloadProgress implementations). Truncation collapses the label's MinSize to roughly one character plus the ellipsis regardless of content, so the window keeps its intended size. TextWrapWord is not enough because it cannot break a spaceless URL. The full error text remains visible via the dialog.ShowError call already present in each path. Assisted-by: Claude:claude-opus-4-8 [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
@@ -635,8 +635,11 @@ func (l *Launcher) showDownloadProgress(version, title string) {
|
||||
progressBar := widget.NewProgressBar()
|
||||
progressBar.SetValue(0)
|
||||
|
||||
// Status label
|
||||
// Status label. Truncate with an ellipsis so a long "Download failed:
|
||||
// <url>" message can't stretch the window (and progress bar) to fit the
|
||||
// whole error on one line; the full error is shown in the dialog below.
|
||||
statusLabel := widget.NewLabel("Preparing download...")
|
||||
statusLabel.Truncation = fyne.TextTruncateEllipsis
|
||||
|
||||
// Release notes button
|
||||
releaseNotesButton := widget.NewButton("View Release Notes", func() {
|
||||
|
||||
@@ -454,8 +454,11 @@ func (sm *SystrayManager) showDownloadProgress(version string) {
|
||||
progressBar := widget.NewProgressBar()
|
||||
progressBar.SetValue(0)
|
||||
|
||||
// Status label
|
||||
// Status label. Truncate with an ellipsis so a long "Download failed:
|
||||
// <url>" message can't stretch the window (and progress bar) to fit the
|
||||
// whole error on one line; the full error is shown in the dialog below.
|
||||
statusLabel := widget.NewLabel("Preparing download...")
|
||||
statusLabel.Truncation = fyne.TextTruncateEllipsis
|
||||
|
||||
// Release notes button
|
||||
releaseNotesButton := widget.NewButton("View Release Notes", func() {
|
||||
|
||||
@@ -57,8 +57,16 @@ type LauncherUI struct {
|
||||
|
||||
// NewLauncherUI creates a new UI instance
|
||||
func NewLauncherUI() *LauncherUI {
|
||||
// Truncate the status text with an ellipsis. Status messages can carry a
|
||||
// download error containing a long, unbreakable URL/path; without this the
|
||||
// label demands the full single-line width and stretches the window (and
|
||||
// the progress bar) arbitrarily wide. The full error is still shown in the
|
||||
// error dialog.
|
||||
statusLabel := widget.NewLabel("Initializing...")
|
||||
statusLabel.Truncation = fyne.TextTruncateEllipsis
|
||||
|
||||
return &LauncherUI{
|
||||
statusLabel: widget.NewLabel("Initializing..."),
|
||||
statusLabel: statusLabel,
|
||||
versionLabel: widget.NewLabel("Version: Unknown"),
|
||||
startStopButton: widget.NewButton("Start LocalAI", nil),
|
||||
webUIButton: widget.NewButton("Open WebUI", nil),
|
||||
@@ -602,8 +610,11 @@ func (ui *LauncherUI) showDownloadProgress(version, title string) {
|
||||
progressBar := widget.NewProgressBar()
|
||||
progressBar.SetValue(0)
|
||||
|
||||
// Status label
|
||||
// Status label. Truncate with an ellipsis so a long "Download failed:
|
||||
// <url>" message can't stretch the window (and progress bar) to fit the
|
||||
// whole error on one line; the full error is shown in the dialog below.
|
||||
statusLabel := widget.NewLabel("Preparing download...")
|
||||
statusLabel.Truncation = fyne.TextTruncateEllipsis
|
||||
|
||||
// Release notes button
|
||||
releaseNotesButton := widget.NewButton("View Release Notes", func() {
|
||||
|
||||
Reference in New Issue
Block a user