[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [krita/berger-scripting] krita/plugins/extensions/pykrita: Add a method to add scripts to a scriptin
From: Cyrille Berger <cberger () cberger ! net>
Date: 2015-12-09 21:13:29
Message-ID: E1a6m3F-0005XC-76 () scm ! kde ! org
[Download RAW message or body]
Git commit e6ff73a231c3582ddabce94812e2c5872789fbf5 by Cyrille Berger, on behalf of \
Boudewijn Rempt. Committed on 09/12/2015 at 19:42.
Pushed by berger into branch 'berger-scripting'.
Add a method to add scripts to a scripting menu.
M +17 -0 krita/plugins/extensions/pykrita/libkis/application.cpp
M +17 -0 krita/plugins/extensions/pykrita/libkis/application.h
M +17 -0 krita/plugins/extensions/pykrita/libkis/document.cpp
M +17 -0 krita/plugins/extensions/pykrita/libkis/document.h
M +17 -0 krita/plugins/extensions/pykrita/libkis/image.cpp
M +17 -0 krita/plugins/extensions/pykrita/libkis/image.h
M +40 -3 krita/plugins/extensions/pykrita/libkis/krita.cpp
M +20 -0 krita/plugins/extensions/pykrita/libkis/krita.h
M +17 -0 krita/plugins/extensions/pykrita/libkis/mainwindow.cpp
M +17 -0 krita/plugins/extensions/pykrita/libkis/mainwindow.h
M +17 -0 krita/plugins/extensions/pykrita/libkis/node.cpp
M +17 -0 krita/plugins/extensions/pykrita/libkis/node.h
M +17 -0 krita/plugins/extensions/pykrita/libkis/view.cpp
M +17 -0 krita/plugins/extensions/pykrita/libkis/view.h
M +1 -0 krita/plugins/extensions/pykrita/sip/krita/krita.sip
http://commits.kde.org/krita/e6ff73a231c3582ddabce94812e2c5872789fbf5
diff --git a/krita/plugins/extensions/pykrita/libkis/application.cpp \
b/krita/plugins/extensions/pykrita/libkis/application.cpp index bc646d1..1ef9ba9 \
100644
--- a/krita/plugins/extensions/pykrita/libkis/application.cpp
+++ b/krita/plugins/extensions/pykrita/libkis/application.cpp
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#include "application.h"
Application::Application(QObject *parent) :
diff --git a/krita/plugins/extensions/pykrita/libkis/application.h \
b/krita/plugins/extensions/pykrita/libkis/application.h index 55346ab..4033386 100644
--- a/krita/plugins/extensions/pykrita/libkis/application.h
+++ b/krita/plugins/extensions/pykrita/libkis/application.h
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef LIBKIS_APPLICATION_H
#define LIBKIS_APPLICATION_H
diff --git a/krita/plugins/extensions/pykrita/libkis/document.cpp \
b/krita/plugins/extensions/pykrita/libkis/document.cpp index eacb5d9..dd573f3 100644
--- a/krita/plugins/extensions/pykrita/libkis/document.cpp
+++ b/krita/plugins/extensions/pykrita/libkis/document.cpp
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#include "document.h"
#include "image.h"
diff --git a/krita/plugins/extensions/pykrita/libkis/document.h \
b/krita/plugins/extensions/pykrita/libkis/document.h index fbc4cfc..da1bf2b 100644
--- a/krita/plugins/extensions/pykrita/libkis/document.h
+++ b/krita/plugins/extensions/pykrita/libkis/document.h
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef LIBKIS_DOCUMENT_H
#define LIBKIS_DOCUMENT_H
diff --git a/krita/plugins/extensions/pykrita/libkis/image.cpp \
b/krita/plugins/extensions/pykrita/libkis/image.cpp index 83316b0..4c7d4f5 100644
--- a/krita/plugins/extensions/pykrita/libkis/image.cpp
+++ b/krita/plugins/extensions/pykrita/libkis/image.cpp
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#include "image.h"
Image::Image(QObject *image, QObject *parent)
diff --git a/krita/plugins/extensions/pykrita/libkis/image.h \
b/krita/plugins/extensions/pykrita/libkis/image.h index 4f23613..405cc16 100644
--- a/krita/plugins/extensions/pykrita/libkis/image.h
+++ b/krita/plugins/extensions/pykrita/libkis/image.h
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef LIBKIS_IMAGE_H
#define LIBKIS_IMAGE_H
diff --git a/krita/plugins/extensions/pykrita/libkis/krita.cpp \
b/krita/plugins/extensions/pykrita/libkis/krita.cpp index d12fc77..c7a6905 100644
--- a/krita/plugins/extensions/pykrita/libkis/krita.cpp
+++ b/krita/plugins/extensions/pykrita/libkis/krita.cpp
@@ -1,12 +1,31 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#include "krita.h"
#include <KoApplication.h>
#include <KoPart.h>
#include <KoMainWindow.h>
-#include "kis_view2.h"
-#include "kis_doc2.h"
-#include "kis_image.h"
+#include <kis_view2.h>
+#include <kis_doc2.h>
+#include <kis_image.h>
+#include <kis_action.h>
+#include <kis_script_manager.h>
Krita::Krita(QObject *parent) :
QObject(parent)
@@ -58,3 +77,21 @@ QList<Image *> Krita::images()
}
return ret;
}
+
+QAction *Krita::createAction(const QString &text)
+{
+ KisAction *action = new KisAction(text, this);
+ foreach(KoPart *part, koApp->partList()) {
+ if (part) {
+ foreach(KoMainWindow *mainWin, part->mainWindows()) {
+ if (mainWin && mainWin->rootView()) {
+ KisView2 *view = qobject_cast<KisView2*>(view);
+ if (view) {
+ view->scriptManager()->addAction(action);
+ }
+ }
+ }
+ }
+ }
+ return action;
+}
diff --git a/krita/plugins/extensions/pykrita/libkis/krita.h \
b/krita/plugins/extensions/pykrita/libkis/krita.h index c04839e..189551b 100644
--- a/krita/plugins/extensions/pykrita/libkis/krita.h
+++ b/krita/plugins/extensions/pykrita/libkis/krita.h
@@ -1,8 +1,26 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef LIBKIS_KRITA_H
#define LIBKIS_KRITA_H
#include <QObject>
#include <QPointer>
+#include <QAction>
#include "application.h"
#include "mainwindow.h"
@@ -23,6 +41,8 @@ public:
QList<Document*> documents();
QList<Image*> images();
+ QAction *createAction(const QString &text);
+
signals:
public slots:
diff --git a/krita/plugins/extensions/pykrita/libkis/mainwindow.cpp \
b/krita/plugins/extensions/pykrita/libkis/mainwindow.cpp index 1a7abe7..8166679 \
100644
--- a/krita/plugins/extensions/pykrita/libkis/mainwindow.cpp
+++ b/krita/plugins/extensions/pykrita/libkis/mainwindow.cpp
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#include "mainwindow.h"
#include <KoMainWindow.h>
diff --git a/krita/plugins/extensions/pykrita/libkis/mainwindow.h \
b/krita/plugins/extensions/pykrita/libkis/mainwindow.h index 3304859..6e06a53 100644
--- a/krita/plugins/extensions/pykrita/libkis/mainwindow.h
+++ b/krita/plugins/extensions/pykrita/libkis/mainwindow.h
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef LIBKIS_MAINWINDOW_H
#define LIBKIS_MAINWINDOW_H
diff --git a/krita/plugins/extensions/pykrita/libkis/node.cpp \
b/krita/plugins/extensions/pykrita/libkis/node.cpp index d46273d..35c2c60 100644
--- a/krita/plugins/extensions/pykrita/libkis/node.cpp
+++ b/krita/plugins/extensions/pykrita/libkis/node.cpp
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#include "node.h"
Node::Node(QObject *parent) :
diff --git a/krita/plugins/extensions/pykrita/libkis/node.h \
b/krita/plugins/extensions/pykrita/libkis/node.h index d5d7054..2df7714 100644
--- a/krita/plugins/extensions/pykrita/libkis/node.h
+++ b/krita/plugins/extensions/pykrita/libkis/node.h
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef LIBKIS_NODE_H
#define LIBKIS_NODE_H
diff --git a/krita/plugins/extensions/pykrita/libkis/view.cpp \
b/krita/plugins/extensions/pykrita/libkis/view.cpp index 90d1084..09ca699 100644
--- a/krita/plugins/extensions/pykrita/libkis/view.cpp
+++ b/krita/plugins/extensions/pykrita/libkis/view.cpp
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#include "view.h"
#include <kis_view2.h>
diff --git a/krita/plugins/extensions/pykrita/libkis/view.h \
b/krita/plugins/extensions/pykrita/libkis/view.h index b76069e..f2ecdef 100644
--- a/krita/plugins/extensions/pykrita/libkis/view.h
+++ b/krita/plugins/extensions/pykrita/libkis/view.h
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef LIBKIS_VIEW_H
#define LIBKIS_VIEW_H
diff --git a/krita/plugins/extensions/pykrita/sip/krita/krita.sip \
b/krita/plugins/extensions/pykrita/sip/krita/krita.sip index 9a7d30e..26d3f69 100644
--- a/krita/plugins/extensions/pykrita/sip/krita/krita.sip
+++ b/krita/plugins/extensions/pykrita/sip/krita/krita.sip
@@ -15,5 +15,6 @@ public:
QList<Document*> documents();
QList<Image*> images();
+ QAction *createAction(const QString &text);
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic