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
Create a booklet from multiple pages #500
Conversation
Codecov Report
@@ Coverage Diff @@
## main #500 +/- ##
==========================================
- Coverage 73.58% 72.06% -1.53%
==========================================
Files 10 10
Lines 2828 2935 +107
==========================================
+ Hits 2081 2115 +34
- Misses 747 820 +73
Continue to review full report at Codecov.
|
Thank you !
Not top priority IMHO, this can be done in an other PR.
"cancel" ? Do you mean "undo" ? If yes this deserve to be fixed in this PR. Your action should start with As
Not top priority IMHO. This could be fixed in an other PR.
Yes and yes. Could you rebase your branch on
They are not. You are almost there. |
Could you rebase your branch on origin/main and squash/reorganize your commits so your PR show what you modify in the end and not your whole development history (It's a bit difficult to read as is). |
Sorry I wasn't finished, I didn't think you'd get notified by my push. I still had to handle the pikepdf version issue. About my commits, I tend to commit very often and I'm used to Gitlab where we usually squash all the commits into one when the code is merged. Can you do that ? About the readability, the "files changed" tab looks like it should allow you to review my code easily. If it really doesn't work for you then that's ok, I'll squash all my commits. |
Ok that sounds good. |
Any idea when you'll merge this ? |
@nicos68 Sorry that nobody has responded to your PR for so long. I think I also speak on behalf of the others when I say that it was not clear that you consider the feature complete. Unless someone else is faster, I will have a look at the code tomorrow. |
I do consider it complete. |
Hello nicos68, Thank you for your PR. I feel really sorry that you had to wait for so long. Could you please check one more time that the result is correct when you have 6 pages? I have never used booklets and don't know what is correct. However, I expected that the content is consecutive when folded. In that case, when you fold the 6 pages, don't you need two blank pages in the booklet? [b | 1] [2 | b] [6 | 3] [4 | 5] I ask you to change two things:
If this is included, I would merge the PR in. |
You are absolutely right, my algorithm was flawed, I fixed it. I also made the changes you requested. |
@nicos68 Great work! Thank you very much. |
I've just tested this interesting new feature (checked out from master branch) and noticed a few issues:
From looking at the code, this is because self.model_lock()
for _ in range(blank_page_count):
self._insert_pages(model, file, selection)
added_page_index = selection[-1].get_indices()[-1] + 1
# Fetch the additional blank pages and remove them from the model.
added_page = model.get_value(model.get_iter(added_page_index), 0)
pages.append(added_page)
model.remove(model.get_iter(added_page_index))
self.model_unlock() However, with the code modified as shown above, the UI sometimes freezes and never unlocks again when triggering "generate booklet". |
Same for me. I've never had any problems before adding the lock. I'm okay to remove it but if more experienced maintainers of the project could give their feedback on this I'd feel more comfortable doing it. Also, I used the context manager because
|
It is correct that a context manager would be possible/appropriate. However, you certainly cannot use a method like a context manager. You would have to create a class that implements
Yes, good point. Introcucing a context manager for lock/unlock would make sense, in my opinion. |
Thank you for pointing out the problem with the rendering. That as well as the missing cases with cropped pages and rotations should be taken up. An updated TODO-list can be found in #438 - if something is missing, please add it. |
Primary points:
After this visuals can be dealt with, like positioning the new booklet pages correctly. |
The idea with the model lock is that if python interpreter decides to switch to the other thread between "path" and "ref" lines in core.py, (see below, at read arrow) and then a page is removed from the model in main thread, then path and ref will not point to the same page. I am not sure if that could lead to a problem. If you think it can not cause a problem, feel free to remove the lock. |
I am not experienced in threading, but would vote for keeping the lock to be safe. |
Note that there are 2
I agree with mara004, that |
I'm on it. |
Merge and rearrange pages for booklet printing.
Issue: #438
The action is available through a new entry in the edit dialog. The generated pages are sized using the source pages (adding widths and using max of height of the two pages) and cannot be sized manually (as this would involve rescaling the source pages).
Note that
This PR might be a bit premature, however there already is some working code and it doesn't break anything else, so I created it anyway, also because I would be happy to have feedback on my code. It's my very first time sending some (more or less) serious amount of code to an open source project, so sorry if things are a bit clumsy.