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

DymoPrint GUI #54

Merged
merged 18 commits into from
May 27, 2023
Merged

DymoPrint GUI #54

merged 18 commits into from
May 27, 2023

Conversation

MooVx
Copy link
Contributor

@MooVx MooVx commented May 3, 2023

Closes #53

added GUI Application based on PyQt6

Install for testing

pipx install --force git+https://github.com/MooVx/dymoprint@master

The GUI is available with the command dymoprint_gui

To switch back to the release version:

pipx install --force dymoprint

shoebill-dev and others added 7 commits April 16, 2023 17:31
add multiline textalign and fontsize

replace text for multiline_text

mv anchor to center of text

add multiline text alignment

add fontsize selection

change default aligment to left

set constants back to default

add fixed label length

use original font_config.py
@maresb
Copy link
Collaborator

maresb commented May 3, 2023

Woah!!! This looks amazing!!! 🤯 I've been wanting to make something like this for the longest time, but honestly there was no way I was finding the time. ❤️

My LabelManager PnP is sadly broken, and I've been struggling to find a new one. (I'm in France.) Thus unfortunately it's a bit tough for me to thoroughly test it. I'm hoping that someone else can step up and give a proper review...

@MooVx
Copy link
Contributor Author

MooVx commented May 3, 2023

On my side tested only on Dymo LM 280.

printed_label_test_lm280

@maresb
Copy link
Collaborator

maresb commented May 3, 2023

@shoebill-dev, which device model do you have? Would you be willing to review this PR?

@MooVx, is this PR compatible with #53?

@maresb
Copy link
Collaborator

maresb commented May 3, 2023

@MooVx, I think you can solve the TypeError: 'type' object is not subscriptable error by adding the following line to the top of the file:

from __future__ import annotations

@MooVx
Copy link
Contributor Author

MooVx commented May 3, 2023

@shoebill-dev, which device model do you have? Would you be willing to review this PR?

@MooVx, is this PR compatible with #53?

It should be, except for the "Set relative text size" argument because this is solved by percent scalling instead of quantised size here.

@maresb
Copy link
Collaborator

maresb commented May 3, 2023

Nice job with the tests!

I found a shipper in France and just ordered a used device. I'm guessing it'll be here in ~1 week.

@maresb
Copy link
Collaborator

maresb commented May 3, 2023

Magnificent!!!!!

This was referenced May 3, 2023
@maresb
Copy link
Collaborator

maresb commented May 3, 2023

I just pinged two more recently active commenters in hopes of getting someone else to test this. I'm very eager to get this merged.

@MooVx
Copy link
Contributor Author

MooVx commented May 3, 2023

I added changes from #53 here. console & GUI

@maresb
Copy link
Collaborator

maresb commented May 3, 2023

Closes #53

Edit: Hmm, maybe it only works with issues

@MatthiasLohr
Copy link

Great work!

Some findings:

  • Context menu for adding/deleting elements: "AddText" etc. should be "Add Text"
  • Making the functionality of the context menu (adding, deleting) more easy to access would be great, e.g., directly having a "delete" button per line.
  • Printing two labels in a row does not work ([Errno 16] Resource busy). I have to either restart the printer (off/on) or to restart the application.

Beside that... awesome!

image

@maresb
Copy link
Collaborator

maresb commented May 4, 2023

Thanks so much @MatthiasLohr for the thoughtful review!!! 😁

What is your printer model? Is it the LabelManager PnP?

@MatthiasLohr
Copy link

What is your printer model? Is it the LabelManager PnP?

LabelManager 280

@maresb
Copy link
Collaborator

maresb commented May 4, 2023

Ok, thanks. I was really hoping to test this with the LabelManager PnP, but I'm otherwise completely convinced, so I'm going to just cut a new semver-minor release and add your remarks as issues to be patched.

@MatthiasLohr
Copy link

Why the hurry? Just wait until yours arrived?

@maresb
Copy link
Collaborator

maresb commented May 4, 2023

I'm really excited and I want to maintain the momentum. But yes, it's more prudent to wait, especially until we figure out what's going on with the test from #46.

@MooVx
Copy link
Contributor Author

MooVx commented May 5, 2023

Great work!

Some findings:

  • Context menu for adding/deleting elements: "AddText" etc. should be "Add Text"
  • Making the functionality of the context menu (adding, deleting) more easy to access would be great, e.g., directly having a "delete" button per line.
  • Printing two labels in a row does not work ([Errno 16] Resource busy). I have to either restart the printer (off/on) or to restart the application.

Beside that... awesome!

image

Context menu miss type fixed.
Printing two labels - fixed.
(adding, deleting) easier, I can do this in nearby future.

Yesterday I receive a new batch of 6mm tapes, and unfortunately, the type size doesn't work properly :( Looks like problem with the bytes alignment to the bottom instead to centre in DymoLabeler class

@shoebill-dev
Copy link
Contributor

@shoebill-dev, which device model do you have? Would you be willing to review this PR?

@MooVx, is this PR compatible with #53?

This looks amazing! I've got the 280. Bit busy at the moment, so not able to contribute anything. Sure to check it out in the future though.

@maresb
Copy link
Collaborator

maresb commented May 6, 2023

I just had a strange thing happen...

I'm running Ubuntu, and I encountered the following error while running dymoprint_gui after installing it with pipx.

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, vkkhrdisplay, eglfs, vnc, wayland-egl, wayland, minimal, minimalegl, offscreen, xcb.

I then ran QT_DEBUG_PLUGINS=1 dymoprint_gui to debug, and I got

qt.core.library: "~/.local/pipx/venvs/dymoprint/lib/python3.8/site-packages/PyQt6/Qt6/plugins/platforms/libqxcb.so" cannot load: Cannot load library ~/.local/pipx/venvs/dymoprint/lib/python3.8/site-packages/PyQt6/Qt6/plugins/platforms/libqxcb.so: (libxcb-cursor.so.0: cannot open shared object file: No such file or directory)

So then I ran

sudo apt-get remove libxcb-cursor0

to install the missing library, and it worked. Then I uninstalled, and it still worked. I'm pretty confused about what happened. In case anyone else runs into this error, or understands what's going on, please write here!

@MooVx
Copy link
Contributor Author

MooVx commented May 6, 2023

I just had a strange thing happen...

I'm running Ubuntu, and I encountered the following error while running dymoprint_gui after installing it with pipx.

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, vkkhrdisplay, eglfs, vnc, wayland-egl, wayland, minimal, minimalegl, offscreen, xcb.

I then ran QT_DEBUG_PLUGINS=1 dymoprint_gui to debug, and I got

qt.core.library: "~/.local/pipx/venvs/dymoprint/lib/python3.8/site-packages/PyQt6/Qt6/plugins/platforms/libqxcb.so" cannot load: Cannot load library ~/.local/pipx/venvs/dymoprint/lib/python3.8/site-packages/PyQt6/Qt6/plugins/platforms/libqxcb.so: (libxcb-cursor.so.0: cannot open shared object file: No such file or directory)

So then I ran

sudo apt-get remove libxcb-cursor0

to install the missing library, and it worked. Then I uninstalled, and it still worked. I'm pretty confused about what happened. In case anyone else runs into this error, or understands what's going on, please write here!

I had a similar problem. Qt6 is quite new. On my Ubuntu 20.04 I need to first update pip to the newest version and then force reinstall pyqt6.

@maresb
Copy link
Collaborator

maresb commented May 6, 2023

I'm also on 20.04. Probably time to upgrade to 22.04, or possibly even the recently released 23.04.

@maresb
Copy link
Collaborator

maresb commented May 12, 2023

I just received the LabelManager PnP. Unfortunately with this branch it neither prints nor gives an error. I'll need to do some debugging.

The code to print the label was indented to where
it only ran when using PyUSB, and not with the original
HID file mode.
@maresb
Copy link
Collaborator

maresb commented May 27, 2023

I fixed this for the LabelManager PnP! Thanks a lot!!!

@maresb maresb merged commit 502f8e5 into computerlyrik:master May 27, 2023
@maresb
Copy link
Collaborator

maresb commented May 28, 2023

Hey all, thanks everyone for helping me to test this!

Inspired by @MooVx's effort, I'm proposing a major change in #56 where I switch to pure PyUSB, opening up to plenty of exciting possibilities for future development.

I'd be very appreciative of any further feedback on #56. Thanks!

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.

4 participants