https://bugs.kde.org/show_bug.cgi?id=423341

Scott Petrovic <scottpetro...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |scottpetro...@gmail.com

--- Comment #3 from Scott Petrovic <scottpetro...@gmail.com> ---
I am not sure if this helps, but adding actions to menus to do something. This
seems to work for something very simple.

from PyQt5.QtWidgets import (QWidget, QAction)
import krita

# connection methods
def close_application():
    print("whooaaaa so custom!!!")

#create an action that does stuff
extractAction = QAction("&GET TO THE CHOPPAH!!!")
extractAction.setShortcut("Ctrl+Q")
extractAction.setStatusTip('Leave The App')
extractAction.triggered.connect(close_application)


# Create menu off main menu and add a new action to it
main_menu = Krita.instance().activeWindow().qwindow().menuBar()
custom_menu = main_menu.addMenu("Special Actions Menu")
custom_menu.addAction(extractAction) # how to get items/actions in a menu


You are right thought that each new window in Krita is isolated...so the menu
isn't on new windows. If you look in the pykrita folder at some of the
pre-installed Python scripts, they have a "canvasChanged" method that signals
when the document changes. You might be able to do something with that. 

I made a little docker plugin that handles these document changed events if
that helps at all for reference...
https://invent.kde.org/scottpetrovic/krita-scratchpad-docker/-/blob/master/scratchpad/scratchpad.py#L201

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to