- Posts: 147
- Thank you received: 0
QTPlasmac - 'QImage' object has no attribute 'pixelColor'
5 years 7 months ago #202234
by Uthayne
QTPlasmac - 'QImage' object has no attribute 'pixelColor' was created by Uthayne
I am in the process of updating and making the switch over to QTPlasmac. I just cloned the most current version of master to work with. I ran the install script (~/linuxcnc-dev4/lib/python/qtvcp/designer/install_script) to make sure all dependencies were met. Python version the install script detected is version 2.
I set the rip-environment script and then I start the appropriate .ini file after converting using the qtplasmac converter tool, I get the following error:
Looking at the qtplasmac_handler.py file and commenting out the following lines, I can get qtplasmac to run and everything seems functional. I have only testing jogging and various buttons, but they all seem to be working.
LinuxCNC Version : 2.9.0~pre0
Checking which qtvcp is running and it is in the correct linuxcnc-dev folder (current master)
which qtvcp
/home/bryan/linuxcnc-dev4/bin/qtvcp
I set the rip-environment script and then I start the appropriate .ini file after converting using the qtplasmac converter tool, I get the following error:
Code:
Traceback (most recent call last):
File "/home/bryan/linuxcnc-dev4/bin/qtvcp", line 415, in <module>
APP = QTVCP()
File "/home/bryan/linuxcnc-dev4/bin/qtvcp", line 260, in __init__
window.handler_instance.initialized__()
File "/home/bryan/linuxcnc-dev4/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py", line 298, in initialized__
self.set_color_styles()
File "/home/bryan/linuxcnc-dev4/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py", line 3949, in set_color_styles
self.color_button_image(button, self.foreColor)
File "/home/bryan/linuxcnc-dev4/share/qtvcp/screens/qtplasmac/qtplasmac_handler.py", line 4059, in color_button_image
pColor = self.image.pixelColor(x, y)
AttributeError: 'QImage' object has no attribute 'pixelColor'
Looking at the qtplasmac_handler.py file and commenting out the following lines, I can get qtplasmac to run and everything seems functional. I have only testing jogging and various buttons, but they all seem to be working.
Code:
def color_button_image(self, button, color):
image_path = '{}{}.png'.format(self.IMAGES, button)
self.image = QImage(image_path)
for x in range(self.image.width()):
for y in range(self.image.height()):
#pColor = self.image.pixelColor(x, y)
#if pColor.alpha() > 0:
newColor = QColor(color)
# newColor.setAlpha(pColor.alpha())
# self.image.setPixelColor(x, y, newColor)
self.w['{}'.format(button)].setIcon(QIcon(QPixmap.fromImage(self.image)))
LinuxCNC Version : 2.9.0~pre0
Checking which qtvcp is running and it is in the correct linuxcnc-dev folder (current master)
which qtvcp
/home/bryan/linuxcnc-dev4/bin/qtvcp
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
Less
More
- Posts: 2580
- Thank you received: 0
5 years 7 months ago #202237
by snowgoer540
Replied by snowgoer540 on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
Commenting those out affects the GUI jog images.
I am guessing it's a pathing issue, as you are using "linuxcnc-dev4" and somewhere it's probably hard coded to "linuxcnc-dev". I remember in the past when I tried to call "linuxcnc-dev" something other than that, it gave me issues.
At any rate, Phill will be able to confirm when he hops on here later.
I am guessing it's a pathing issue, as you are using "linuxcnc-dev4" and somewhere it's probably hard coded to "linuxcnc-dev". I remember in the past when I tried to call "linuxcnc-dev" something other than that, it gave me issues.
At any rate, Phill will be able to confirm when he hops on here later.
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
Less
More
- Posts: 2580
- Thank you received: 0
5 years 7 months ago #202240
by snowgoer540
Replied by snowgoer540 on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
Also, what version does it say in line 1 of the handler file?
Please Log in to join the conversation.
5 years 7 months ago #202243
by Uthayne
Replied by Uthayne on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
Looking back at the install script output, looks like I had a symbolic link fail.
I deleted the file that already existed in /.designer/plugins/python/ and ran the installer script again. It successfully made the new link.
I am going to tidy up the dev folders and rebuild it in just linuxcnc-dev and see if that works.
Handler is VERSION = '0.9.53', so a day old
Code:
copy python2 plugin module
libpyqt5_py2.so
ln: failed to create symbolic link '/home/bryan/.designer/plugins/python/qtvcp_plugin.py': File exists
I deleted the file that already existed in /.designer/plugins/python/ and ran the installer script again. It successfully made the new link.
I am going to tidy up the dev folders and rebuild it in just linuxcnc-dev and see if that works.
Handler is VERSION = '0.9.53', so a day old
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
Less
More
- Posts: 2580
- Thank you received: 0
5 years 7 months ago #202256
by snowgoer540
Haha I could just tell because the line numbers made no sense/didn’t match to anything.
Hopefully that fixes your problem. It works fine over here and I’m on RIP, so I suspect that’s the issue.
Replied by snowgoer540 on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
Uthayne wrote:
Handler is VERSION = '0.9.53', so a day old
Haha I could just tell because the line numbers made no sense/didn’t match to anything.
Hopefully that fixes your problem. It works fine over here and I’m on RIP, so I suspect that’s the issue.
Please Log in to join the conversation.
5 years 7 months ago #202260
by Uthayne
Replied by Uthayne on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
Fresh pull of master, qtplasmac_handler.py is version 0.9.54, but unfortunately I'm getting the same error.
Here is probably a better log dump for what's happening while it's trying to build the ui
Here is probably a better log dump for what's happening while it's trying to build the ui
Please Log in to join the conversation.
5 years 7 months ago #202261
by cmorley
Replied by cmorley on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
Sounds like too old a version of qt. I can't test qtplasmac on my oldest dev computer.
It has qt version 5.5.1
It has qt version 5.5.1
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
Less
More
- Posts: 2580
- Thank you received: 0
5 years 7 months ago #202265
by snowgoer540
Replied by snowgoer540 on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
What does this yield in terminal:
Code:
dpkg-query -W -f='${Version}\n' qttools5-dev
Please Log in to join the conversation.
5 years 7 months ago #202268
by Uthayne
Replied by Uthayne on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
I also have Qt 5.5.1. Looks like the function pixelColor was added on version Qt 5.6.
@snowgoer540 : 5.5.1-3ubuntu0.1
@snowgoer540 : 5.5.1-3ubuntu0.1
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
Less
More
- Posts: 2580
- Thank you received: 0
5 years 7 months ago #202271
by snowgoer540
Replied by snowgoer540 on topic QTPlasmac - 'QImage' object has no attribute 'pixelColor'
Might be the issue. I'm on 5.11.3-4 over here. (on MX Linux 19.3).
Even my Mint 19.2 machine had 5.9.5-0ubuntu1.
Not sure how to tell you to update, Chris or Phill will have to help you there.
Even my Mint 19.2 machine had 5.9.5-0ubuntu1.
Not sure how to tell you to update, Chris or Phill will have to help you there.
Please Log in to join the conversation.
Time to create page: 0.112 seconds
