This plugin is awesome. Thanks for taking the time to create it and release it to the community!
I’m having a problem with it in 5.0.2, however. When I click an image, it throws up an error. It does load the image in, but it’s not scaled to the canvas (even if the fit to canvas button is selected) and the image comes in as a folder reference, meaning I can’t transform it without first adding a transform mask.
Any ideas what’s causing this?
Here’s the error message:
AttributeError
Python 3.8.1: C:\Program Files\Krita (x64)\bin\krita.exe
Wed Feb 2 18:19:07 2022
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
C:\Program Files\Krita (x64)\share\krita\pykrita\photobash_images\photobash.py in ()
85
86 self.imagesButtons[0].clicked.connect(lambda: self.buttonClick(0))
87 self.imagesButtons[1].clicked.connect(lambda: self.buttonClick(1))
88 self.imagesButtons[2].clicked.connect(lambda: self.buttonClick(2))
89 self.imagesButtons[3].clicked.connect(lambda: self.buttonClick(3))
self = <photobash_images.photobash.PhotobashDocker object>
self.imagesButtons = [<PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>]
].clicked undefined
self.buttonClick = <bound method PhotobashDocker.buttonClick of <photobash_images.photobash.PhotobashDocker object>>
C:\Program Files\Krita (x64)\share\krita\pykrita\photobash_images\photobash.py in buttonClick(self=<photobash_images.photobash.PhotobashDocker object>, position=1)
191 def buttonClick(self, position):
192 if position < len(self.foundImages) - len(self.imagesButtons) * self.currPage:
193 self.addImageLayer(self.foundImages[position + len(self.imagesButtons) * self.currPage])
194
195 def updateImages(self):
self = <photobash_images.photobash.PhotobashDocker object>
self.addImageLayer = <bound method PhotobashDocker.addImageLayer of <photobash_images.photobash.PhotobashDocker object>>
self.foundImages = [‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_278.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_546.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_547.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_548.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_549.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_550.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_551.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_552.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_553.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_554.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_555.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_556.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_557.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_558.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_559.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_560.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_561.png’, ‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_562.png’]
position = 1
builtinlen =
self.imagesButtons = [<PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>, <PyQt5.QtWidgets.QToolButton object>]
self.currPage = 1
C:\Program Files\Krita (x64)\share\krita\pykrita\photobash_images\photobash.py in addImageLayer(self=<photobash_images.photobash.PhotobashDocker object>, photoPath=‘D:/Assets/People/2D/vp_casual_2_01/vp_casual_v2_555.png’)
255
256 if self.fitCanvasChecked:
257 if activeNode.bounds().width() / activeNode.bounds().height() > doc.bounds().width() / doc.bounds().height():
258 scalingFactor = doc.bounds().width() / activeNode.bounds().width()
259 newWidth = doc.bounds().width() * self.currImageScale / 100
activeNode = None
activeNode.bounds undefined
doc = <PyKrita.krita.Document object>
doc.bounds =
).width undefined
).height undefined
AttributeError: ‘NoneType’ object has no attribute ‘bounds’
cause = None
class = <class ‘AttributeError’>
context = None
delattr = <method-wrapper ‘delattr’ of AttributeError object>
dict = {}
dir =
doc = ‘Attribute not found.’
eq = <method-wrapper ‘eq’ of AttributeError object>
format =
ge = <method-wrapper ‘ge’ of AttributeError object>
getattribute = <method-wrapper ‘getattribute’ of AttributeError object>
gt = <method-wrapper ‘gt’ of AttributeError object>
hash = <method-wrapper ‘hash’ of AttributeError object>
init = <method-wrapper ‘init’ of AttributeError object>
init_subclass =
le = <method-wrapper ‘le’ of AttributeError object>
lt = <method-wrapper ‘lt’ of AttributeError object>
ne = <method-wrapper ‘ne’ of AttributeError object>
new =
reduce =
reduce_ex =
repr = <method-wrapper ‘repr’ of AttributeError object>
setattr = <method-wrapper ‘setattr’ of AttributeError object>
setstate =
sizeof =
str = <method-wrapper ‘str’ of AttributeError object>
subclasshook =
suppress_context = False
traceback =
args = ("‘NoneType’ object has no attribute ‘bounds’",)
with_traceback =
The above is a description of an error in a Python program. Here is
the original traceback:
Traceback (most recent call last):
File “C:\Program Files\Krita (x64)\share\krita\pykrita\photobash_images\photobash.py”, line 87, in
self.imagesButtons[1].clicked.connect(lambda: self.buttonClick(1))
File “C:\Program Files\Krita (x64)\share\krita\pykrita\photobash_images\photobash.py”, line 193, in buttonClick
self.addImageLayer(self.foundImages[position + len(self.imagesButtons) * self.currPage])
File “C:\Program Files\Krita (x64)\share\krita\pykrita\photobash_images\photobash.py”, line 257, in addImageLayer
if activeNode.bounds().width() / activeNode.bounds().height() > doc.bounds().width() / doc.bounds().height():
AttributeError: ‘NoneType’ object has no attribute ‘bounds’