Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New error message when opening unsupported formats #143

Merged
merged 7 commits into from
Aug 28, 2020
Merged

New error message when opening unsupported formats #143

merged 7 commits into from
Aug 28, 2020

Conversation

thekolian1996
Copy link
Contributor

Report bug window is not useful for the users when they open files with unsupported formats, so I wrote another type of dialog window. Changes made based on info from tickets #1856821 and duplicate #1432606.

Copy link
Member

@cameronwhite cameronwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for working on this!
Just had a couple minor notes in the comments.

string markup = "<span weight=\"bold\" size=\"larger\">{0}</span>\n\n{1}";

string secondaryText = string.Format(Catalog.GetString("Could not open file: {0}"), filename);
secondaryText += $"{Environment.NewLine}{Environment.NewLine}Pinta supports the following file formats:{Environment.NewLine}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Pinta supports ..." string also needs to be translatable like the line above (i.e. using Catalog.GetString()).
https://github.com/PintaProject/Pinta/wiki/Translations has more details on how translations work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll change it.

string secondaryText = string.Format(Catalog.GetString("Could not open file: {0}"), filename);
secondaryText += $"{Environment.NewLine}{Environment.NewLine}Pinta supports the following file formats:{Environment.NewLine}";
var extensions = from format in PintaCore.System.ImageFormats.Formats
from extension in format.Extensions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should also check whether an exporter exists for the format? I'm not sure if there are any write-only formats, though.

Copy link
Contributor Author

@thekolian1996 thekolian1996 Aug 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked available formats for existing of exporter and found that around the half of the formats are available only for import. So I see two possible solutions:

  1. Show formats only available in both ways (Import/Export).
  2. Show import and export formats separately. More sophisticated way for a user, I'm not sure is it worth it.
    I like simple way more, though.
    For now, I changed LINQ with additional where statement:
    where format.Exporter != null
    But can change it without any problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Should it be the other way around, though? (checking format.Importer != null) since this error is show when a file fails to import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -54,8 +54,8 @@
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being used for anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. It's useless.

@cameronwhite
Copy link
Member

Looks good, thank you!

@cameronwhite cameronwhite merged commit b6154bd into PintaProject:master Aug 28, 2020
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.

2 participants