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

Pen, DrawLines and others take integers, fix a TypeError on Python 3.10+ #1224

Merged
merged 1 commit into from
Nov 18, 2021

Conversation

hroncok
Copy link
Collaborator

@hroncok hroncok commented Nov 13, 2021

@hroncok
Copy link
Collaborator Author

hroncok commented Nov 13, 2021

I will test this and see if there are no other obvious cases like this.,

@hroncok
Copy link
Collaborator Author

hroncok commented Nov 15, 2021

There are more:

Traceback (most recent call last):
  File "/usr/lib64/python3.10/site-packages/printrun/gui/bufferedcanvas.py", line 111, in onPaint
    self.draw(dc, w, h)
  File "/usr/lib64/python3.10/site-packages/printrun/gui/graph.py", line 343, in draw
    self.drawgrid(dc, gc)
  File "/usr/lib64/python3.10/site-packages/printrun/gui/graph.py", line 138, in drawgrid
    dc.DrawLine(x * (float(self.width - 1) / (self.xbars - 1)),
TypeError: DC.DrawLine(): arguments did not match any overloaded call:
  overload 1: argument 1 has unexpected type 'float'
  overload 2: argument 1 has unexpected type 'float'

@hroncok
Copy link
Collaborator Author

hroncok commented Nov 16, 2021

Ok, there are plenty of more :(

@hroncok hroncok force-pushed the penwidth_int branch 3 times, most recently from d545516 to e6dac82 Compare November 16, 2021 15:46
@hroncok
Copy link
Collaborator Author

hroncok commented Nov 16, 2021

This fix is very dirty, but I think it works. We might want to actually change some logic to count with integers, but I didn't want to do that here.

@hroncok hroncok marked this pull request as ready for review November 16, 2021 15:48
@hroncok hroncok changed the title Pen width is an integer, fix a TypeError on Python 3.10+ Pen, DrawLines and others take integers, fix a TypeError on Python 3.10+ Nov 16, 2021
@hroncok
Copy link
Collaborator Author

hroncok commented Nov 16, 2021

Note: originally, I've started with round() approach, but then I've switched to int() not to introduce subtle bugs in the behavior. Previously, the floats were casted to integers implicitly, so this should not change the behavior at all.

@hroncok
Copy link
Collaborator Author

hroncok commented Nov 17, 2021

This has been confirmed as at least mostly working in #1225 (comment)

Copy link
Owner

@kliment kliment left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we got them all but I suspect there will be more. Other than the one thing I commented on I have no objections, feel free to merge at your convenience.

printrun/gviz.py Show resolved Hide resolved
@hroncok hroncok merged commit faade5b into kliment:master Nov 18, 2021
@hroncok hroncok removed the request for review from rockstorm101 November 18, 2021 10:26
@hroncok hroncok deleted the penwidth_int branch November 18, 2021 10:26
@hroncok hroncok mentioned this pull request Jan 2, 2022
2 tasks
@rockstorm101
Copy link
Collaborator

Hi @pmead7399, #1225 is a known error which I assume is what you are experiencing. Sadly, the latest package of Printrun does not contain this fix yet as it hasn't been released.

  • I'm currently pushing an interim fix for the Debian package, which will (hopefully) propagate its way to Ubuntu which in turn will propagate onto Pop!_OS.
  • In the meantime I guess you could try to run pronterface with Python 3.9 instead as a workaround. See below.

To use Python 3.9 instead:

  1. Confirm you have python 3.9. A command like the following should throw something like this.
$ ls -l /usr/bin/python3.9
-rwxr-xr-x 1 root root 5442952 May 14 06:57 /usr/bin/python3.9
  1. Edit the first line of the file /usr/bin/pronterface to:
- #!/usr/bin/python3
+ #!/usr/bin/python3.9

If you go down this route, please remember to revert the change or remove and re-install the package once the fix is implemented.

@Fedetecnico07
Copy link

Fedetecnico07 commented Jun 25, 2023

Hello, i don't have python3.9, i have python3.10. I try to follow guides to install python3.9 and miss. ¿Is the only way to fix the problem? ¿there is some new notice or update?.

i don't speack good english, but i spend to many days to fix this problem and i can't do it. >:(, i have the last lubuntu, i don't know whats is wrong. I only see "mention to #1277" and i don't know whats this means.

This is the only place where i found information and not work.

Kind regards

@rockstorm101
Copy link
Collaborator

Hi @Fedetecnico07, sorry it took me this long to reply. I assume you run (L)ubuntu 22.04 or older. I'm afraid the only other easy alternatives are:

  1. Hopefully you've got all required packages already installed and simply running the following in a terminal works:

    git clone https://github.com/kliment/Printrun
    cd Printrun
    ./pronterface.py
    
  2. Running from source

  3. Upgrading to a newer Lubuntu like 22.10 or later

@Fedetecnico07
Copy link

Fedetecnico07 commented Jul 23, 2023

Hi @Fedetecnico07, sorry it took me this long to reply. I assume you run (L)ubuntu 22.04 or older. I'm afraid the only other easy alternatives are:

  1. Hopefully you've got all required packages already installed and simply running the following in a terminal works:
    git clone https://github.com/kliment/Printrun
    cd Printrun
    ./pronterface.py
    
  2. Running from source
  3. Upgrading to a newer Lubuntu like 22.10 or later

@rockstorm101
Thank you. Sorry for taking so long but I was with exams.
Option 1 has worked, I installed it directly from github with the commands you wrote.

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