[plugin] Pie Menu v0.4

when start Krita appears this error:

AttributeError
Python 3.8.5: /usr/bin/python3
Tue Dec 22 12:34:57 2020

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

/home/chancho/.local/share/krita/pykrita/kritapluginpiemenu/PieMenuExtension.py in createActions(self=<kritapluginpiemenu.PieMenuExtension.PieMenuExtension object>, window=<PyKrita.krita.Window object>)
33 self.actionsList = ActionsList(self.qWin)
34
35 self.settings = Settings(self.actionsList, self.qWin)
36 self.settings.menusChanged.connect(self.updateMenus)
37 self.menus = self.settings.menus
self = <kritapluginpiemenu.PieMenuExtension.PieMenuExtension object>
self.settings undefined
global Settings = <class ‘kritapluginpiemenu.Settings.Settings’>
self.actionsList = <kritapluginpiemenu.ActionsList.ActionsList object>
self.qWin = <PyQt5.QtWidgets.QMainWindow object>

/home/chancho/.local/share/krita/pykrita/kritapluginpiemenu/Settings.py in init(self=<kritapluginpiemenu.Settings.Settings object>, actionsList=<kritapluginpiemenu.ActionsList.ActionsList object>, parent=<PyQt5.QtWidgets.QMainWindow object>)
44
45 self.settingsFormLayout = QFormLayout()
46 self.settingsFormLayout.setAlignment(Qt.AlignLeft | Qt.AlignTop)
47 self.groupBox = QGroupBox(“Pie Menu Settings”)
48 self.groupBox.setStyleSheet(“QGroupBox {font-size: 16px; text-decoration: underline;}”)
self = <kritapluginpiemenu.Settings.Settings object>
self.settingsFormLayout = <PyQt5.QtWidgets.QFormLayout object>
self.settingsFormLayout.setAlignment =
global Qt = <module ‘PyQt5.Qt’ from ‘/usr/lib/python3/dist-packages/PyQt5/Qt.cpython-38-x86_64-linux-gnu.so’>
Qt.AlignLeft undefined
Qt.AlignTop undefined
AttributeError: module ‘PyQt5.Qt’ has no attribute ‘AlignLeft’
cause = None
class = <class ‘AttributeError’>
context = None
delattr = <method-wrapper ‘delattr’ of AttributeError object>
dict = {}
dir =
doc = ‘Attribute not found.’
eq = <method-wrapper ‘eq’ of AttributeError object>
format =
ge = <method-wrapper ‘ge’ of AttributeError object>
getattribute = <method-wrapper ‘getattribute’ of AttributeError object>
gt = <method-wrapper ‘gt’ of AttributeError object>
hash = <method-wrapper ‘hash’ of AttributeError object>
init = <method-wrapper ‘init’ of AttributeError object>
init_subclass =
le = <method-wrapper ‘le’ of AttributeError object>
lt = <method-wrapper ‘lt’ of AttributeError object>
ne = <method-wrapper ‘ne’ of AttributeError object>
new =
reduce =
reduce_ex =
repr = <method-wrapper ‘repr’ of AttributeError object>
setattr = <method-wrapper ‘setattr’ of AttributeError object>
setstate =
sizeof =
str = <method-wrapper ‘str’ of AttributeError object>
subclasshook =
suppress_context = False
traceback =
args = (“module ‘PyQt5.Qt’ has no attribute ‘AlignLeft’”,)
with_traceback =

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
File “/home/chancho/.local/share/krita/pykrita/kritapluginpiemenu/PieMenuExtension.py”, line 35, in createActions
self.settings = Settings(self.actionsList, self.qWin)
File “/home/chancho/.local/share/krita/pykrita/kritapluginpiemenu/Settings.py”, line 46, in init
self.settingsFormLayout.setAlignment(Qt.AlignLeft | Qt.AlignTop)
AttributeError: module ‘PyQt5.Qt’ has no attribute ‘AlignLeft’

@Labi
Can you go to resource folder (in Krita: Settings - Manage Resources - Open Resource Folder), here go to 2 directories:

  1. actions - delete file called “kritapluginpiemenu.action” (if there is one)
  2. pykrita - delete directory called “kritapluginpiemenu” and the file “kritapluginpiemenu.desktop”

Then go to the github page of the plugin, download it anew and install once again.

After that please let me know if you are still having any problems, oki?
(I made some slight adjustments to the code, hopefully it will work better for you now)

1 Like

Are you on a linux machine by any chance @Labi ?

1 Like

Yes he is, at least that’s what the error message says.

1 Like

Small bugfix update

  • Isolate layer now works properly.
  • Select Opaque is now in “Layer” category
    (Select Opaque is what ctrl + click on layer miniature does)
  • Qt -> QtCore.Qt (not sure why it works for me and others and not for Labi, but I had just a few lines with only Qt (for some reason I replaced the QtCore.Qt at some point a few days ago so I reverted it back to QtCore)

Hi

Glad to see the result resulting from your questions :slight_smile:

No time yet to test it for now.
But a Qt problem like this one might means that @Labi don’t use an appimage; in this case, Krita use Qt libraries installed on system and it’s possible that Qt version installed is too old

This error log:
/usr/lib/python3/dist-packages/PyQt5/Qt.cpython-38-x86_64-linux-gnu.so
Seems to confirm that te Qt library is the one provided by system

In this case you can’t do anything:

  • Krita require a minimum version of Qt (or here, PyQt) to works properly
  • If user don’t use appimage (or flatpak maybe) they have to upgrade themselve the (Py)Qt libraries to the expected version

You ensure that user’s system is up to date with this:

from PyQt5.Qt import *

print("Qt version:", QT_VERSION_STR)
print("PyQt version:", PYQT_VERSION_STR)

It should return 5.12.9 (version embedded in appimage) at least to be sure that users’s environment is fully compatible with plugin

Grum999

2 Likes

Yeah, many questions xD

I still can’t figure out how to confirm transform through python though (?), the longer I’m in the more questions come to me ;).

I was suspecting that he had that kind of problem, I’ve noticed him in the ui thread as well with a problem which seems to be original to him.

Definitely thanks for letting me know about the version, certainly a useful thing for the future if a linux user comes around.
(I might even include it eventually somewhere inside the plugin to let the user know in the future).

Well, past month and more I spent working on plugins, I’m starting to really want to do some drawing now heh. :thinking:

yeah … and even with the same version of PyQt you will notice that there are odd diferences between linux and windows pyqt like, tighter bottlenecks with signals and commands that are not responsive despite the API documentation statements. Also assuming linux users to have standard fonts and icons and QtSVG is also a mistake, some distros seem to just push them out as a user instalation.

I had to go some hops to assure things were more aligned but I had some luck in the mix also on my way to get there. But I think it is still possible just not as forgiving because reasons… Only after I got a linux computer I was able to see the weird behaviours and calibrate them properly :frowning:

The best thing to do with github is to make a release and provide a zip file “ready to use”

It’s what I do when I update a new plugin release
Example:

=> I upload the zip, ready to use
=> Github build the source code automatically (because source code in github contains more than you need in plugin zip file)

Personally, I stop to watch a video after 2minutes… here your first video was 45minutes and I have t confess that I didn’t look a her, that’s too long.

An installation procedure should be few step described as text, it’s easier to follow :slight_smile:

I started to wrote a plugin manager few month ago, it was able to manage properly zip content, but i didn’t try to continue…

No idea for now… the only one thing I can see, if API doesn’t provide any information, is to analyze krita window content (but I’m not sure if transform tool is a QWidget or if it’s something paint over window area)

Grum999

I didn’t notice anything about this on my side, but I don’t use them to manage real-time actions…

It hasn’t been fixed?

For this, it will depend.
If user use appimage, everything you need for a cross-platform application is embedded in appimage (Qt fonts and QtSvg library)
After, if you use explicitely fonts provided with windows, most of them are under license and can’t be (legally) found on Linux… If you use unicode character, normally practically most of them are available in Linux (on my side, never has any problem)
If user use a version from a distro repository, it will depend of the distro and the maintener of package in repository; normally (on Debian for example) when you provide a .deb package to deploy an application, the package list all needed dependencies.
For Krita for example, it should list all Qt+PyQt libraries (module + version) that are expected for Krita (5.12.9 for Krita 4.4.1)

That’s easier to get a Linux computer than a Windows computer or even an Apple computer :slight_smile:
On my side, I don’t have Windows 10 at home, and won’t buy a license just to check if my plugin is working on an OS I won’t use :grimacing:
I don’t even talk about apple, for which you have to sell an arm to be able to buy a more closed system than windows is…
On the other side, anybody is able to download a Linux distro and install it for free :wink:

Grum999

1 Like

Signals:

  • Linux does the calculations slowly and by the book so to speak. I have managed to stop Krita’s UI for 10 minutes or more because of overloading it with signals. A Softlock if you will.
  • Window detects it has a bunch of signals on cache and sorta hops to the end line? or just calculates really faster? I cant say which as my calculations are not dependant of the previous ones.

Commands:
one that is always on my mind is QLabel align horizontal center for the text display. it remains aligned to the left. not sure if that was corrected now I made everything super tight so it does not look as odd when it falls out of place.

Fonts:
I don’t know about the license issues with distribution on the distro itself but you can install it for free after by searching “symbola font”. I got rid of this issue by creating my own svg icons and have them embedded on the code.

OS:
you can use windows 10 at home freely as any Linux distro, only if you go pro with that machine you will have to get the license. just go to their website and make a pen. This is a old issue. also personally I am forced into windows because it allows me to use my wacom tablet properlly and before someone asks, yes I tried linux wacom drivers in linux.

Yeah, I was wondering about that github release possibility to keep it like that.

Right now I’ll let the user download the zip form git and use that zip itself for installation (it works with the importer just fine at least since this afternoon after I managed to fix it).

The video was longer and I was expecting it to be (I might split it into 2 videos, one for install the other for the rest), that’s why I also include the written guide so anyone who wants to skip ahead can do so. I’ll put a link to the installation to the top post here to make sure everyone who visits knows about it.
I want to add just a very short video with the plugin in action and that’s all no need for words there. Just as a showcase.

But for now I’ll keep the video as is because it takes the user through everything step by step visually, I hope I won’t need to ask that many questions if someone decides to watch it :wink:

With the transform, I found action that’s related to transform but I haven’t found any that could confirm it, I’m not even sure if it was coded to begin with, i’ll need more time to figure it out otherwise I’ll just hack it together and fake enter key event through python but I’d prefer avoiding it if possible.

Well, there’s some code clean up, proper default menu and more actions to be done thus I’ll be making a few updates for a while. So installation method will probabyl stay as is right now, it should hopefully be clear now after today’s changes.
(but I’ll keep an eye on the method you have, I still expect the user to delete the zip file anyway though ;)).

Update v0.3

  • Added offset to where submenus appear in the cursor movement direction to make triggering the inital tool (which invoked the submenu) more reliable (especially with short quick hand movement)
  • I’ve updated the video to reflect new categories for actions and simpler installation process.
  • Top post now contains info about written instructions on the plugins website which are noted before the video itself, there’s also a note about the length of the video to make sure people know there’s a faster method to get started if needed.
4 Likes

this is amazing! very usefull.

1 Like

Omg! Version 0.3!

Eager to try it out :v:t2::v:t2:

1 Like

Oh yeah I’m upping up the version becase I have no rules what can be called a new version or not! Muhahaha :rofl:

But then again, it might look like a small update but it makes working with the submenus so much much smoother (hopefully). I had some messages that if you try to select the initial tool which triggers the submenu since the hand is already moving you can easily slip out of the wheel area to a different tool. Right that should be minimal… again hopefully ;0.

1 Like

My way to change Versions is to run a self coded script assistant in the background, which does the job to auto-save my code every 9 minutes or so (if the code has been modified) and adding after each save minimal increments to scripts (version) , like 0.001 points each time.
Maybe too technical :sweat_smile:. I should learn python as well. There’s little time

It took me a whole day to prepare for giving feedback (two major releases since then :smiley: ), but now I’m ready I think :slight_smile:

First of all - huge thanks for doing it. It’s very beneficial for me on many levels. The plugin itself is very useful, and there’s no need for me to write multiple actions on one shortcut plugin, as this thing is way better for this purpose.

Secondly, there is just so much good code to analize there: it already helped me to find out what I was doing wrong in my tool modifiers plugin, and yesterday I managed to get it working with shortcuts being set in krita settings, instead of hardcoded in the plugin itself. I’ll try to release this update if I figure out how to make some plugin settings (your settings looks like a very cool example and starting point).

Lastly, recently I was thinking if it would be possible to create a plugin for a RMB pop-up preset selection in form of a pie-menu - I don’t use the RMB pop-up for anything else than selecting those presets, and it would be very cool to get them with only one small movement of a pen instead of having to click a given preset. If I ever decide to do so (unlikely, but who knows), here is quite a lot of work already done for me :wink:

Now for the feedback for a plugin itself. Why the selection is so complicated and different between mouse and stylus? From the user point of view it would make sense to work the same for both of these (press a stylus, move, and release - instead of additionally clicking).

But for me, the most convenient way of picking the option is how it’s made in blender - press a keyboard shortcut, move your cursor in a direction (no differentiation between stylus and mouse) and release the button. That’s just one keyboard button pressing and no mouse/stylus actions other than movement. Compared to that, pressing a shortcut and making two clicks with a stylus feels a bit complicated.
Is the current behaviour a matter of sub-menus, workarounds or just personal preference?

In terms of sub-menus, I haven’t tested them yet, as for me as a minimalist these seems a bit overcomplicated (I mean, it’s wonderful you created them, and I’m sure they will find their users). My way of dealing with many different groups of actions would be to enable more than one pie-menus on different keyboard shortcuts (with a combobox at the start of pie settings to specify which pie menu you’re personalizing). What sucks is that then all those actions for multiple pie menus would have to be created in .actions, so it’s not possible to specify amount of pie-menus dynamically, but something between 3-5 would make sense for me.
Personally I would probably end up with just one or two of those pie-menus, but who knows - my keyboard scheme changes a lot as I go :slight_smile: So I’ll just leave this suggestion here. Maybe others would like it.

Last but not least, I got a traceback error at the very beginning of testing the plugin. It appeared on kubuntu 20.04, with krita 4.4.2-beta1, appimage. I need to use the plugin with a mouse, and then try to do it with a stylus. I specified only 3 actions, and “similar color selector” was the last one that seemed to make an error the most often, but I believe it’s unrelated to the actions you set, more switching between mouse and stylus (error only when using stylus).
I’ll let you know if I manage to specify when exactly the error happens:

Traceback (most recent call last):
  File "/home/wojtryb/.local/share/krita/pykrita/kritapluginpiemenu/MenuArea.py", line 105, in eventFilter
    self.eventObj.eventHandler(event)
  File "/home/wojtryb/.local/share/krita/pykrita/kritapluginpiemenu/MenuArea.py", line 272, in eventHandler
    self.labels["children"][self.labels["activeLabel"]].setStyleSheet(self.labelStyleBase)
IndexError: list index out of range 

And once again, thank you for your work, the plugin is wonderful :slight_smile:

1 Like

Hmm, since you are on the beta I need to check it out if it behaves differently there or if it’s just the kubuntu thing. Because the only thing you need to do is to release the mouse you shouldn’t need to “click” with the stylus. As far as I can tell so far the mosue and pen should work the same.

In my brief test in Fedore (Linux) the mouse and pen worked just the same so hotkey press + mouse or pen touch move to an action and release.

The traceback error could come from this problem with events since it’s made to work with release not another click so since the release doesn’t properly trigger in your case it goes off the bounds.

I’ll download the 4.4.2 beta (are you on beta1 or beta2 please?) and see how it works and eventually I’ll install linux again to see but it worked for me fine and even for some other people on linux so far. I’ll definitely give it some testing but I can’t promise anything for today and tomorrow it’s christmas and I got food poisoning today so not sure how much active I’ll be for today and tomorrow ;0.

I originally had it set up the same way as Blender has it (key down, mouse move, key up), this works really well with mouse but it’s really hellishly clulnky with the pen I just kept releasing the pen all the time (I think most people are used to when you hold the pen down you have open menus or something and when you release it goes off).
This was one of the points I wanted to see how people would react to so it’s on my watch list if there’s more people wanting to use only the key.

With multiple keys I’m not sure how much krita files are protected or not so maybe there’s a way to just open the already existing .action file and adjust it but I’m not sure about it.

For now I’ll check the beta and at some point I’ll check linux again, maybe I should try a different linux distro but there’s just too many options ;0.

Thanks a lot and I’m glad it helped in some way at least.

Get well, and don’t overwork during christmas. There’s really no need to fix anything so fast :wink:
I haven’t seen there’s already a beta-2. I will check how it works on other versions, and will let you know if I find some more information.
But please don’t feel obligated to work on that during holidays :slight_smile: