Repository navigation
Chart export: add the extension when the name has none - #341
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,.pdfor.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:Also: the
asciidoctor.svgconsole line. Opening a folder that holds an AsciiDoc file loggedqt.svg: Cannot open file '<folder>/asciidoctor.svg'. Qt's ready-madeQFileDialog.getSaveFileNameandgetOpenFileNamefunctions 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 infiledialogs.py. The chart save menus and the Part Library's open and export dialogs used these functions; they now use thefiledialogswrappers. A new test intest_file_dialog_icons.pyfails if any GUI code calls these Qt functions directly again.