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

Added Pycups print module and added a print trigger gpio button event #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oelegeirnaert
Copy link

Hello Mr B,

I've added PyCups to support CUPS printing.
In this pull request you'll also find a print trigger button on GPIO25.
But this is configurable in the GUI Settings.
Another thing I've added is the ability to show a "Please wait while printing" screen.
Something I forgot to delete was in: photobooth/camera/init.py
I've added some lines to get two times the same copy on one print.

So in short:

  1. Added PyCups printer module
  2. Did some changes in GUI Settings
  3. Added wait screen during printing
  4. Added a print button via GPIO25

Enjoy!

@qwertyFrank
Copy link

Hi Oele,
Sounds good. How can I patch an exisiting installation accordingly?
Do I have to install PyCubs in addition? How?
Thanks
Frank

@oelegeirnaert
Copy link
Author

oelegeirnaert commented Mar 27, 2019

Hi Frank,
Never did a merge from another fork into a local one, but I guess you'll find the way to do so on: http://www.bartread.com/2014/02/12/git-basics-how-to-merge-changes-from-a-different-fork-into-your-own-branch/

You have to install CUPS if you don't have it yet: sudo apt-get install cups
and PyCups by using PIP: pip3 install pycups

After sleeping, I noticed some things can be improved in the printer class.

@qwertyFrank
Copy link

Hi Oele,
I rephrase my question: How can I install your fork?
Sorry, did that not ever before.
Thanks
Frank

@reuterbal
Copy link
Owner

Hi Oele,

thank you so much for this addition! Sorry for taking so long before having time to look at it - I have very little spare time at the moment.
There are a number of things that I did not like the way you solved them, and I modified this and added it a little differently in e8bbfaa and a038f3d to make the pycups-printer available asap:

  1. I changed the temporary storage of the print file to match the way it is done in the Gphoto2CommandLine Class (i.e., avoid writing to the SD card for performance reasons).
  2. I changed the behavior to match that of the PyQt5-Printer: take the system default printer, and the system default settings
  3. Have you tested the GPIO-Pin? I don't see how this should work. Nonetheless, triggering the printing should happen at the same place in code to keep it readable and there is absolutely no need to include this in the Printer module itself. This means it would somehow to be terminated in the PostprocessMessage frame - or there should be a separate way of handling GPIO signals (but then there should be some functionality that disables the button)
  4. A print progress screen is a great idea, I'll add this at some point.
  5. The printer class was cluttered with some useless and unnecessary things. Make sure to run flake8 before pushing.

@AcidCool83
Copy link

Hello,

I have downloaded the development branch and I see the functionality of printing by pycups but I do not find the button to print on the GPIO25. Is it in the code? Do i have to do something else? I need your help.

Thank you.

@AcidCool83
Copy link

Hello,

I can get the code with the printer button but i have an error when init the program. This is the log:

libEGL warning: DRI2: failed to authenticate
qt5ct: using qt5ct plugin
Process GuiProcess-3:
Traceback (most recent call last):
File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
self.run()
File "/home/pi/Desktop/fotomaton/4/photobooth/photobooth/main.py", line 88, in run
retval = Gui(self._argv, self._cfg, self._comm).run()
File "/home/pi/Desktop/fotomaton/4/photobooth/photobooth/gui/Qt5Gui/PyQt5Gui.py", line 54, in init
self._postprocess = GuiPostprocessor(self._cfg, comm)
File "/home/pi/Desktop/fotomaton/4/photobooth/photobooth/gui/GuiPostprocessor.py", line 42, in init
PrintPostprocess(module, paper_size, pdf, config, comm))
File "/home/pi/Desktop/fotomaton/4/photobooth/photobooth/gui/GuiPostprocessor.py", line 109, in init
Printer = lookup_and_import(printer.modules, printer_module, 'printer')
File "/home/pi/Desktop/fotomaton/4/photobooth/photobooth/util.py", line 35, in lookup_and_import
'photobooth.' + package + '.' + result[0])
TypeError: 'NoneType' object is not subscriptable

Please, I need your help. Is urgent

@maelga031323
Copy link

AcidCool83 i have the same mistake
Have you find a solution?

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.

None yet

5 participants