[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Aw: Re: Python API questions
From:       "Thomas Werzmirzowsky" <Werzi2001 () gmx ! de>
Date:       2019-05-31 13:45:10
Message-ID: trinity-ff702419-9bc7-44ce-9159-7518f6fe3a6c-1559310310142 () 3c-app-gmx-bs71
[Download RAW message or body]

Thanks for the prompt reply=2E I went for the action=2E I would have prefer=
ed to do it non-interactive but digging into the colorspace stuff
is too much for now=2E

Thomas=C2=A0
=C2=A0

Gesendet:=C2=A0Freitag, 31=2E Mai 2019 um 15:06 Uhr
Von:=C2=A0"Wolthera" <griffinvalley@gmail=2Ecom>
An:=C2=A0"Krita's developers and users mailing list" <kimageshop@kde=2Eorg=
>
Betreff:=C2=A0Re: Python API questions
1=2E To open a file as a layer without triggering dialogs, you will need
to open the file, add a new paintlayer node to the document you want
to add the file to, and copy the pixel data from one to the other=2E
Here you will need to make sure that the source and result images are
the same colorspace=2E If you are okay with triggering dialogs use the
"import_layer_as_paint_layer" action(as noted in 3)=2E
2=2E Undo isn't implemented in python, there was never a proper design
for it conceived=2E Triggered actions will proly be added to the undo,
but for the rest it is better to clone the document=2E
3=2E Krita is not 100% python=2E Instead, what you can do is access
certain actions is to use application()=2Eaction("action_name") (you can
get all the action names with
https://api=2Ekde=2Eorg/extragear-api/graphics-apidocs/krita/libs/libkis/h=
tml/classKrita=2Ehtml#a5cf481b65e4c0971777ceb9330c8a8e9
), then from the QAction object that gives you, use action=2Etrigger()=2E
The krita4=2Exmlgui in your resource folder gives the exact layout of
your menus with the actions as an xml file, using these names too=2E

On Fri, May 31, 2019 at 2:01 PM Thomas Werzmirzowsky <Werzi2001@gmx=2Ede> =
wrote:
>
> Hello everybody,
>
> I'm trying to write a simple Python plugin but fail to find the correct =
APIs=2E Basically I'm searching for the following:
> - Open a file as a layer (basically what the "Layer > Import/Export > Im=
port Layer=2E=2E=2E" menu does)
> - I noticed that changes that my plugin does are not recorded in the "Un=
do History" and the canvas is not updated properly=2E So I guess I have to =
start/stop a transaction (or something like that)? Is that right and if so =
how to do it?
>
> Generally is there a way to find the API that is used by a menu item? Us=
ually the stuff I want to do is a summary of different menu actions but I c=
an't find the APIs for that=2E
>
> Thanks a lot and best regards
> Thomas



--
Wolthera
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic