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

[MediaReport]: New image DPI option #285

Draft
wants to merge 3 commits into
base: maintenance/gramps51
Choose a base branch
from

Conversation

Mattkmmr
Copy link
Member

A possible solution to fix issue #11492. It requires #1007. A more detailed description can be found there.

@Mattkmmr Mattkmmr changed the title MediaReport: new image DPI option [MediaReport]: New image DPI option Apr 10, 2020
@lordemannd
Copy link

lordemannd commented Jul 11, 2021

I tried to test this from CLI on Windows and got the following, what am I doing wrong?
Failed to write report.
Traceback (most recent call last):
File "C:\Program Files\GrampsAIO64-5.1.4-prelim\gramps\cli\plug_init_.py", line 699, in cl_report
my_report = report_class(database, clr.option_class, User())
File "C:\Users\dave\AppData\Roaming\gramps\gramps51\plugins\MediaReport\media_report.py", line 64, in init
self.window = self.user.uistate.window
AttributeError: 'NoneType' object has no attribute 'window'
Cleaning up.

(my idea is to be able to generate reports from a script file)

@Mattkmmr
Copy link
Member Author

@lordemannd The report does not work for CLI in the current state, because it's using dialog windows which require a GUI.

@prculley
Copy link
Contributor

The report is coded as if can run in CLI mode (in the .gpr.py file), but the original author did not take that into account when he created the dialogs; he assumes that they will be run in GUI mode. The dialogs should be using some user type agnostic code, that would work equally well in GUI or CLI mode.

@lordemannd
Copy link

A little more testing:
CLI: MediaReport does respond to the show options command, so the CLI user can see how to enter options.
(not thoroughly tested)

Books: I added the Book report mode to media_report.gpr.py
report_modes = [REPORT_MODE_CLI, REPORT_MODE_GUI, REPORT_MODE_BKI],

By this 1 line change, the book report seems working and was able to produce a pdf with MediaReport for 3 separate images.

@prculley
Copy link
Contributor

The dialogs in question occur after the initial options dialog; they occur during actual processing. So yes, it will appear to work unless you actually run the report.

@Mattkmmr Mattkmmr marked this pull request as draft August 27, 2021 13:15
@Mattkmmr
Copy link
Member Author

Mattkmmr commented Sep 6, 2021

@lordemannd I updated the report and it should no longer rely on the Gramps GUI window when in CLI. Please test if it is working now.

I have to fix more of my report and tool addons also using dialogs, since I only test in GUI mode and didn't thought enough about CLI related issues. I also didn't knew I forgot to add the REPORT_MODE_BKI to all of them, so people can also use them in books. 😅

@lordemannd
Copy link

@Mattkmmr, oops I guess I didn't see your change in Sep 2021, I will take a look now at your recent changes.

@lordemannd
Copy link

@Mattkmmr, sorry for the delay, I have left some notes on bug report 11492.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants