Skip to content

Chart export: add the extension when the name has none - #341

Merged
danyill merged 2 commits into
mainfrom
fix/chart-export-extension
Nov 19, 2026
Merged

danyill merged 2 commits into
mainfrom
fix/chart-export-extension

Conversation

@danyill

@danyill danyill commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #340.

The save dialog returns the name exactly as typed. The PNG export takes its image format from the extension, so a name without one wrote no file at all. Both chart menus now add the chosen type's extension (.png, .svg, .pdf or .csv): the Charts page's Export and the chart's own right-click menu. The dialog only checked the name as typed, so if a file with the extended name already exists, the user is asked before it is replaced.

The GUI's other save dialogs (reports, tables, models) already add their extension or start with a name that includes it. They write text, so they were not affected.

Tests. tests/unit/test_chart_export_extension.py:

  • For each type, a name with no extension produces a real file of that type with the extension added.
  • An existing file is kept unless the user agrees to replace it.
  • The Charts page path adds the extension too.

Also: the asciidoctor.svg console line. Opening a folder that holds an AsciiDoc file logged qt.svg: Cannot open file '<folder>/asciidoctor.svg'. Qt's ready-made QFileDialog.getSaveFileName and getOpenFileName functions build their own dialog, which asks the desktop for an icon for each file type. That dialog is out of reach of the plain icon provider in filedialogs.py. The chart save menus and the Part Library's open and export dialogs used these functions; they now use the filedialogs wrappers. A new test in test_file_dialog_icons.py fails if any GUI code calls these Qt functions directly again.

The save dialog returns the name as typed, and a chart saved as PNG under
a name with no extension wrote nothing: the image format comes from the
extension. Both chart menus (the Charts page's Export and the chart's own
right-click menu) now add the chosen type's extension, and ask before
replacing an existing file of that name, which the dialog did not check.
QFileDialog.getSaveFileName(...) and getOpenFileName(...) build their own
dialog with the desktop's icon provider, which asks for an icon per file
type; for an AsciiDoc file that is 'asciidoctor', missing from the theme,
and Qt logged "qt.svg: Cannot open file '<cwd>/asciidoctor.svg'". The
chart save menus and the Part Library's open/export still called them;
they now use the filedialogs wrappers (plain icons, themed), and a test
fails on any static helper in the GUI.
@danyill
danyill merged commit c1372a1 into main Nov 19, 2026
24 checks passed
@danyill
danyill deleted the fix/chart-export-extension branch November 19, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart export: no file when the name has no extension

1 participant