@@ -168,8 +168,12 @@ def formatDoc(self, doc):
168168 def fillItems (self ):
169169
170170 ver = (Krita .instance ().version ().split ('-' ))[0 ]
171-
172- if os .path .exists ( os .path .dirname (os .path .realpath (__file__ )) + '.KritaAPI.' + ver + '.zip' ):
171+ respath = Krita .instance ().readSetting ('' ,'ResourceDirectory' ,'' )
172+ if respath == '' :
173+ respath = os .path .dirname (os .path .realpath (__file__ ))
174+ else :
175+ respath = os .path .join (respath ,'pykrita' ,'PluginDevTools' )
176+ if os .path .exists ( respath + '.KritaAPI.' + ver + '.zip' ):
173177 getAPI = GetKritaAPI ()
174178
175179 self .caller .kritaAPI [ver ] = getAPI .parseData (ver )
@@ -304,6 +308,11 @@ def exportKritaAPI(self):
304308
305309 def downloadKritaAPI (self ):
306310 ver = (Krita .instance ().version ().split ('-' ))[0 ]
311+ respath = Krita .instance ().readSetting ('' ,'ResourceDirectory' ,'' )
312+ if respath == '' :
313+ respath = os .path .dirname (os .path .realpath (__file__ ))
314+ else :
315+ respath = os .path .join (respath ,'pykrita' ,'PluginDevTools' )
307316 msgbox = QMessageBox (QMessageBox .Question ,'Would you like to download the API details automatically?' ,
308317 '' , QMessageBox .Yes | QMessageBox .No )
309318 msgbox .setTextFormat (Qt .RichText )
@@ -317,7 +326,7 @@ def downloadKritaAPI(self):
317326<u>https://invent.kde.org/graphics/krita/-/archive/master/krita-master.zip?path=libs/libkis</u>
318327<br>
319328And place it in:<br>
320- <u>""" + os . path . dirname ( os . path . realpath ( __file__ )) + """.KritaAPI.""" + ver + """.zip</u>
329+ <u>""" + respath + """.KritaAPI.""" + ver + """.zip</u>
321330<hr>
322331This only needs to be done once per new version of Krita. Do note that Krita may freeze up for about a minute.
323332<hr>
@@ -538,8 +547,12 @@ class PluginDevToolsConsole():
538547 def __init__ (self , caller ):
539548 super ().__init__ ()
540549 self .caller = caller
541-
542- self .tempFilePath = os .path .dirname (os .path .realpath (__file__ )) + ".console.temp.py"
550+ respath = Krita .instance ().readSetting ('' ,'ResourceDirectory' ,'' )
551+ if respath == '' :
552+ respath = os .path .dirname (os .path .realpath (__file__ ))
553+ else :
554+ respath = os .path .join (respath ,'pykrita' ,'PluginDevTools' )
555+ self .tempFilePath = respath + ".console.temp.py"
543556 self .watcher = None
544557 self .currentExecuteKey = self .EXECUTE_KEYS [0 ]
545558
0 commit comments