-
Notifications
You must be signed in to change notification settings - Fork 51
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
Another batch of changes #113
Conversation
Thanks @tomers! I'm not quite following what is Is the idea that for the preview we add a fake margin for the nonprintable area so that the preview resembles the physical tape after printing? |
That's really nice with the adjustable margin in the preview. But it's a bit weird that the margin code for the preview is different from the margin code for the printer. Looking more closely I see that the printer code prints no margin at the beginning and a double-margin at the end. I think this probably has to do with the gap between the printer head and the cutter. I'm guessing that the gap is approximately It might be nice to start distinguishing some of these concepts in the code. Like have a constant for In principle we could enable a margin-free mode where you print the first If the user wants a label with
Am I making sense? |
@marseb, thanks for the insights. I've contrinued to modify the code, and I am going to introduce some further changes soon. Thanks for the insight of explaining why we print the margins twice at the end. I was puzzled by that. |
Awesome, thanks so much for looking into that!!! I've converted the PR to draft for now. When you're finished just hit "Ready for review" and I'll give it another look and merge if I approve. |
Exactly. I still need to work on that part, but the idea is that preview
should show both horizontal and vertical margins.
…On Sat, Feb 3, 2024, 12:38 Ben Mares ***@***.***> wrote:
Thanks @tomers <https://github.com/tomers>!
I'm not quite following what is VERTICAL_PREVIEW_MARGIN_PX. Could you
explain it?
Is the idea that for the preview we add a fake margin for the nonprintable
area so that the preview resembles the physical tape after printing?
—
Reply to this email directly, view it on GitHub
<#113 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUL46ACLSJ36PFVNAFMEDYRYHRDAVCNFSM6AAAAABCXDDOQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVGI3TCNBYGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Okay, great! Keep in mind that there are a few different levels of abstraction coming together:
I think there are valid use cases to have preview functionality for both. Unfortunately I don't have any clever ideas for an implementation. Note that this is starting to connect up with @tomek-szczesny's work on a lookup table for various printer and label width combinations in #91. It's really great how things are coming together thanks to your work @tomers! Back when #91 was opened, I don't think the code was healthy enough to carry through that implementation. But now the code is becoming much easier to understand, opening up lots of exciting possibilities! |
Certainly I'm glad someone's cleaning up my amateur code. :) |
To be clear the obstacle wasn't your code, it was instead the underlying code which was very idiosyncratic with not-so-great separation of concerns and idiosyncratic variable names. Those sorts of things build up and create a tremendous amount of friction for making changes. |
Thanks, @maresb and @tomek-szczesny! @maresb, regarding your comment about idiosyncratic code, that's indeed true, and the was my initial effort, to clean these things off the table, before approaching any other new features. |
68f41e1
to
6924b9c
Compare
aa8d243
to
851c0ae
Compare
Hey @maresb and @tomek-szczesny, Can you please review this PR? Thanks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will finish a PR soon with some more in-depth suggestions
Oh, looks like you're actively working on this. I'll hold off on further review for the moment. |
Are you okay with the conflicts there? Looks like maybe you accidentally rebased on a stale branch? |
0dc29ca
to
0af729f
Compare
It is ready for review now. Sorry, but I use |
Any news? |
Sorry, I'm in a time crunch at the moment. It might have to wait another few days. |
Hey there, Due to irresponsivenes, I'm abandoning this project, and will fork it in a new organization, managed by me. Whoever wants to join me, is most welcome to contact me via LinkedIn. |
Consider `e = KeyError("x")`. Then `str(e) == "'x'"`. Instead we use `repr(e) = "KeyError('x')"`. This is achieved with `f"{e!r}"`.
I find it way faster to understand what's going on when one doesn't need to mentally parse a bunch of custom classes.
It's much better to consider the module itself as the object.
It's much easier and more inspectable by type checkers to use a NamedTuple instead of a custom class with Enum.
Using a kwargs dictionary does save a few lines of code, but it prevents the type checker from working, and it's harder to read and inspect.
Have separate class for each kind of rendered (text, barcode, QR, etc.). Combine renders are done using another kind of render (HorizontallyCombinedRenderEngine). Move logic to associate renders and dymo device in a separate labeler_device file. Note that the new architecture is design to support multiple labelers in the future. This commit is the first step in that direction.
Done with the fixes, @maresb |
Add linter for markdown files [1] [1] https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#use-with-pre-commit
It's really difficult to review such a large PR after a rebase, so could you please refrain from rebasing until after I've approved? |
Following long discussion in the PR [1], I'll go with maresb's style preference of favoring literal type hint over an enum. [1] computerlyrik#113 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whew, that was a whole lot of work, but I think we finally got it. Thanks @tomers for persevering. These are some really huge improvements.
Go ahead and rebase if you'd like, and then let's get this merged.
Thanks Ben,
The branch is ready to be merged from my side. I am not going to change it
anymore. You can merge according to the plan that we discussed privately.
…On Sun, Mar 24, 2024 at 8:13 PM Ben Mares ***@***.***> wrote:
***@***.**** approved this pull request.
Whew, that was a whole lot of work, but I think we finally got it. Thanks
@tomers <https://github.com/tomers> for persevering. These are some
really huge improvements.
Go ahead and rebase if you'd like, and then let's get this merged.
—
Reply to this email directly, view it on GitHub
<#113 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUL43WPD4PD2HOEJXUNDLYZ4JVBAVCNFSM6AAAAABCXDDOQ6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSNJWGYYTMMZVGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Each commit does something else, so please read each one separately