photobooth icon indicating copy to clipboard operation
photobooth copied to clipboard

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

Open oelegeirnaert opened this issue 5 years ago • 7 comments

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!

oelegeirnaert avatar Mar 26 '19 23:03 oelegeirnaert

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

qwertyFrank avatar Mar 27 '19 07:03 qwertyFrank

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.

oelegeirnaert avatar Mar 27 '19 11:03 oelegeirnaert

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

qwertyFrank avatar Mar 27 '19 14:03 qwertyFrank

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.

reuterbal avatar May 11 '19 20:05 reuterbal

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 avatar Jun 14 '19 17:06 AcidCool83

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

AcidCool83 avatar Jun 16 '19 17:06 AcidCool83

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

maelga031323 avatar Feb 04 '20 18:02 maelga031323