-
Notifications
You must be signed in to change notification settings - Fork 0
/
krita-test.py
50 lines (44 loc) · 1.57 KB
/
krita-test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from krita import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
QtCore.qDebug("RELOADING EXTENSION FROM KRITA_MENU")
# keys = '\n'.join(sys.modules.keys())
# QtCore.qDebug(f'keys: {keys}')
try:
# Execution from Krita menu
sys.path.append(os.path.realpath("~/Library/Application Support/krita/pykrita/kaligner"))
if 'kaligner' in sys.modules:
from importlib import reload
print("Reload pyKritaLib")
reload(sys.modules['kaligner'])
elif 'kaligner.kaligner' in sys.modules:
from importlib import reload
print("Reload pyKritaLib")
reload(sys.modules['kaligner.kaligner'])
else:
print("Import kaligner")
import kaligner
from kaligner import (Kaligner, KalignerExtension)
PLUGIN_EXEC_FROM = 'KRITA_MENU'
except:
# Execution from 'Scripter' plugin
# In this case add current plugin in path to let
# python being able to find and import files
#
# Fix path for your environment
sys.path.append(os.path.realpath("~/Library/Application Support/krita/pykrita/kaligner"))
if 'kaligner' in sys.modules:
from importlib import reload
print("Reload pyKritaLib")
reload(sys.modules['kaligner'])
elif 'kaligner.kaligner' in sys.modules:
from importlib import reload
print("Reload pyKritaLib")
reload(sys.modules['kaligner.kaligner'])
else:
print("Import kaligner")
import kaligner
from kaligner import (Kaligner, KalignerExtension)
PLUGIN_EXEC_FROM = 'SCRIPTER_PLUGIN'