ollyisonit / krita-separate-brush-eraser

Creates Krita hotkeys that treat the brush and eraser like separate tools
MIT License
4 stars 0 forks source link

Error on starting krita #1

Closed Readock closed 21 minutes ago

Readock commented 3 weeks ago

Thx for making this plugin. On installation i had an issue though. The get_eraser_button method failes for me

Traceback (most recent call last):
  File "C:\Users\***\AppData\Roaming\krita\pykrita\separatebrusheraser\separatebrusheraser.py", line 227, in bind_brush_toggled
    eraser_button.toggled.connect(self.on_eraser_button_toggled)
AttributeError: 'NoneType' object has no attribute 'toggled'

i changed the line 199 of separatebrusheraser.py to be if ERASER_BUTTON_TOOLTIP in item.toolTip(): because the tool tip for me was "Set eraser mode (E)". Having it not depend on the translation would be great but i never worked with krita so maybe its not possible

ollyisonit commented 3 weeks ago

Nice catch! I forgot about localization, the hacky way I identified the eraser button in the UI was matching its tooltip but you're right that that only works if the tooltip text exactly matches the one in my settings. I don't have time to look into this now but there's probably an ID field somewhere that would be better to match on, I think I made this plugin before I knew about the developer tools plugin for identifying UI elements so I was just sort of blindly firing shots into the dark. I'll try to fix this when I can, but in the meantime if anyone else encounters this and opens a PR I'll gladly merge it.

If anyone else is having this issue, the workaround would be to change the ERASER_BUTTON_TOOLTIP constant on line 17 of separatebrusheraser.py to be whatever the tooltip is for the eraser button in your installation of Krita.

ollyisonit commented 20 minutes ago

Just merged the fix! It finds the eraser using the erase action instead of the tooltip, so it should work no matter what the tooltip is now.