QTPlasmac - 'QImage' object has no attribute 'pixelColor'

More
14 Mar 2021 17:53 #202234 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:
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.
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 or Create an account to join the conversation.

More
14 Mar 2021 18:13 #202237 by snowgoer540
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.

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 18:22 #202240 by snowgoer540
Also, what version does it say in line 1 of the handler file?

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 18:52 #202243 by Uthayne
Looking back at the install script output, looks like I had a symbolic link fail.
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 :P

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 20:33 #202256 by snowgoer540


Handler is VERSION = '0.9.53', so a day old :P


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 or Create an account to join the conversation.

More
14 Mar 2021 21:17 #202260 by Uthayne
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
Attachments:

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 21:20 #202261 by cmorley
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

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 21:38 #202265 by snowgoer540
What does this yield in terminal:
dpkg-query -W -f='${Version}\n' qttools5-dev

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 21:46 - 14 Mar 2021 21:47 #202268 by Uthayne
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
Last edit: 14 Mar 2021 21:47 by Uthayne.

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 21:56 #202271 by snowgoer540
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.

Please Log in or Create an account to join the conversation.

Moderators: snowgoer540
Time to create page: 0.150 seconds
Powered by Kunena Forum