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

Boudewijn Rempt <b...@valdyas.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://commits.kde.org/kri |https://commits.kde.org/kri
                   |ta/e9b0661657f67ac4d1186641 |ta/3de294bc464390acc33be19a
                   |a78357f695a9a717            |a89a74ebfb18963e

--- Comment #10 from Boudewijn Rempt <b...@valdyas.org> ---
Git commit 3de294bc464390acc33be19aa89a74ebfb18963e by Boudewijn Rempt.
Committed on 14/03/2018 at 13:24.
Pushed by rempt into branch 'krita/4.0'.

Create actions per-window instead of per-application

Note that this changes the libkis scripting api. The Extension
class now has two methods: setup and createActions. Old code
was like this:

from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from krita import *

def hello():
    QMessageBox.information(QWidget(), "Test", "Hello World")

class HelloExtension(Extension):

  def __init__(self, parent):
      super().__init__(parent)

  def setup(self):
      action = Krita.createAction("Hello")
      action.triggered.connect(hello)

Krita.instance().addExtension(HelloExtension(Krita.instance()))

New code is like this:

from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from krita import *

def hello():
    QMessageBox.information(QWidget(), "Test", "Hello World")

class HelloExtension(Extension):

  def __init__(self, parent):
      super().__init__(parent)

  def setup(self):
      pass

  def createActions(self, window):
      action = window.createAction("Hello")
      action.triggered.connect(hello)

Krita.instance().addExtension(HelloExtension(Krita.instance()))

This also adds a new parameter to createAction: the menu location. This
is a path separated by /, for instance tools/scripts. Note that this
path must exist, otherwise a crash will happen. The paths are defined in
krita4.xmlgui...

Note: we're still leaking Action objects created in Window::createAction;
that's the next fix.

CCMAIL:kimages...@kde.org
(cherry picked from commit e9b0661657f67ac4d1186641a78357f695a9a717)

M  +1    -1    krita/krita4.xmlgui
M  +0    -11   libs/libkis/Action.cpp
M  +0    -12   libs/libkis/Action.h
M  +22   -14   libs/libkis/Extension.h
M  +10   -20   libs/libkis/Krita.cpp
M  +4    -10   libs/libkis/Krita.h
M  +5    -2    libs/libkis/Mainpage.dox
M  +35   -1    libs/libkis/Window.cpp
M  +17   -0    libs/libkis/Window.h
M  +0    -1    libs/ui/CMakeLists.txt
M  +0    -11   libs/ui/KisPart.cpp
M  +0    -11   libs/ui/KisPart.h
M  +0    -10   libs/ui/KisViewManager.cpp
M  +0    -3    libs/ui/KisViewManager.h
D  +0    -90   libs/ui/kis_script_manager.cpp
D  +0    -52   libs/ui/kis_script_manager.h
M  +2    -2    plugins/extensions/pykrita/plugin/plugin.cpp
M  +1    -2    plugins/extensions/pykrita/sip/krita/Action.sip
M  +1    -0    plugins/extensions/pykrita/sip/krita/Extension.sip
M  +0    -1    plugins/extensions/pykrita/sip/krita/Krita.sip
M  +1    -0    plugins/extensions/pykrita/sip/krita/Window.sip
M  +4    -1    plugins/python/assignprofiledialog/assignprofiledialog.py
M  +4    -1    plugins/python/colorspace/colorspace.py
M  +4    -1    plugins/python/documenttools/documenttools.py
M  +4    -1    plugins/python/exportlayers/exportlayers.py
M  +4    -1    plugins/python/filtermanager/filtermanager.py
M  +4    -2    plugins/python/hello/hello.py
M  +4    -1    plugins/python/highpass/highpass.py
M  +4    -1    plugins/python/scripter/scripter.py
M  +7    -9    plugins/python/tenbrushes/tenbrushes.py
M  +7    -7    plugins/python/tenscripts/tenscripts.py

https://commits.kde.org/krita/3de294bc464390acc33be19aa89a74ebfb18963e

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

Reply via email to