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

PDF-Export in German not working #362

Closed
jens4Dev opened this issue Jul 7, 2021 · 5 comments · Fixed by #363
Closed

PDF-Export in German not working #362

jens4Dev opened this issue Jul 7, 2021 · 5 comments · Fixed by #363

Comments

@jens4Dev
Copy link

jens4Dev commented Jul 7, 2021

Exporting to PDF fails when language is set to German (de_DE.UTF-8).

Steps to Reproduce

  1. LANG=de_DE.UTF-8
  2. Start Gourmet
  3. Select Export all recipes in File menu
  4. Select PDF as export format, use default file-location (user's home) and default file name recipes.pdf
  5. Leave PDF option as they are & Ok

Expected Behavior

PDF-file is successfully exported and note is shown at top of recipes' list.

Current Behavior

No message is shown in the UI, in terminal a couple of messages are printed:

 Traceback (most recent call last):
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py", line 934, in change_cb
    args = self.get_args_from_opts(self.opts)
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py", line 919, in get_args_from_opts
    args['pagemode'] = self.page_modes[opts[self.OPT_PO][1]] # PAGE MODE
KeyError: None
Traceback (most recent call last):
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/GourmetRecipeManager.py", line 1038, in <lambda>
    '<Control><Shift>T',_('Export all recipes to file'),lambda *args: self.do_export(export_all=True)),
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/GourmetRecipeManager.py", line 698, in do_export
    self.exportManager.offer_multiple_export(
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/exporters/exportManager.py", line 114, in offer_multiple_export
    instance = self.do_multiple_export(recs, fn, exp_type)
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/exporters/exportManager.py", line 155, in do_multiple_export
    myexp, exporterInstance = self.get_multiple_exporter(recs,fn,exp_type,setup_gui,extra_prefs)
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/exporters/exportManager.py", line 140, in get_multiple_exporter
    extra_prefs = self.get_extra_prefs(myexp,extra_prefs)
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/exporters/exportManager.py", line 127, in get_extra_prefs
    extra_prefs = myexp.run_extra_prefs_dialog() or {}
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/plugins/import_export/pdf_plugin/pdf_exporter_plugin.py", line 35, in run_extra_prefs_dialog
    return pdf_exporter.get_pdf_prefs()
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py", line 1029, in get_pdf_prefs
    return pdf_pref_getter.run()
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py", line 912, in run
    return self.get_args_from_opts(self.opts)
  File "/tmp/.mount_GourmeieaQKI/opt/python3.8/lib/python3.8/site-packages/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py", line 919, in get_args_from_opts
    args['pagemode'] = self.page_modes[opts[self.OPT_PO][1]] # PAGE MODE
KeyError: None

Environment

@cydanil
Copy link
Collaborator

cydanil commented Jul 8, 2021

Interesting, thanks for reporting the issue!
I will look into it this weekend 👍

@cydanil
Copy link
Collaborator

cydanil commented Jul 11, 2021

Thanks,
This happens when changing from one locale (language) to another.
I suppose this is manifesting now because Gourmet used to be in English until we fixed localization in the last release.

Among others, PDF export preferences are stored in the ~/.gourmet/preferences.toml file in the language in which Gourmet was running.
I will do a fix for the preferences to be agnostic. Meanwhile, you may consider deleting the above file (there's nothing crucial in it) or editing it to remove the PDF_EXP section.

1 similar comment
@cydanil
Copy link
Collaborator

cydanil commented Jul 11, 2021

Thanks,
This happens when changing from one locale (language) to another.
I suppose this is manifesting now because Gourmet used to be in English until we fixed localization in the last release.

Among others, PDF export preferences are stored in the ~/.gourmet/preferences.toml file in the language in which Gourmet was running.
I will do a fix for the preferences to be agnostic. Meanwhile, you may consider deleting the above file (there's nothing crucial in it) or editing it to remove the PDF_EXP section.

@cydanil
Copy link
Collaborator

cydanil commented Jul 12, 2021

I was able to make a fix for this.

Working on this highlighted other issues arising when using any of the Index Cards formats.
Once I will have resolved them, I will make a new release.

@jens4Dev
Copy link
Author

Deleting the PDF-section in preferences fixed the issue for me - I will test the new release asap.

Thanks a lot!

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 a pull request may close this issue.

2 participants