Krita-Photobash-Images-Plugin icon indicating copy to clipboard operation
Krita-Photobash-Images-Plugin copied to clipboard

Some problem with an image being scaled

Open MAA28 opened this issue 2 years ago • 0 comments
trafficstars

When i select a png, a error pops up with the following error message:

TypeError
Python 3.10.9: /usr/bin/python3
Fri Mar 10 18:42:38 2023

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /home/maa/.local/share/krita/pykrita/photobash_images/photobash_images_docker.py in buttonClick(self=<photobash_images.photobash_images_docker.PhotobashDocker object>, position=0)
  448     def buttonClick(self, position):
  449         if position < len(self.foundImages) - len(self.imagesButtons) * self.currPage:
  450             self.addImageLayer(self.foundImages[position + len(self.imagesButtons) * self.currPage])
  451 
  452     def changePath(self):
self = <photobash_images.photobash_images_docker.PhotobashDocker object>
self.addImageLayer = <bound method PhotobashDocker.addImageLayer of <....photobash_images_docker.PhotobashDocker object>>
self.foundImages = ['/home/maa/Pictures/Photobash/voronoi - militar.png', '/home/maa/Pictures/Photobash/Endfossil.png', '/home/maa/Pictures/Photobash/Logo.png']
position = 0
builtinlen = <built-in function len>
self.imagesButtons = [<photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>, <photobash_images.photobash_images_modulo.Photobash_Button object>]
self.currPage = 0

 /home/maa/.local/share/krita/pykrita/photobash_images/photobash_images_docker.py in addImageLayer(self=<photobash_images.photobash_images_docker.PhotobashDocker object>, photoPath='/home/maa/Pictures/Photobash/voronoi - militar.png')
  345         # Scale Image
  346         if self.fitCanvasChecked:
  347             image = QImage(photoPath).scaled(doc.width() * scale, doc.height() * scale, Qt.KeepAspectRatio, Qt.SmoothTransformation)
  348         else:
  349             image = QImage(photoPath)
image undefined
global QImage = <class 'PyQt5.QtGui.QImage'>
photoPath = '/home/maa/Pictures/Photobash/voronoi - militar.png'
).scaled undefined
doc = <PyKrita.krita.Document object>
doc.width = <built-in method width of Document object>
scale = 1.0
doc.height = <built-in method height of Document object>
global Qt = <class 'PyQt5.QtCore.Qt'>
Qt.KeepAspectRatio = 1
Qt.SmoothTransformation = 1
TypeError: arguments did not match any overloaded call:
  scaled(self, width: int, height: int, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
  scaled(self, size: QSize, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
    __cause__ = None
    __class__ = <class 'TypeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of TypeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of TypeError object>
    __doc__ = 'Inappropriate argument type.'
    __eq__ = <method-wrapper '__eq__' of TypeError object>
    __format__ = <built-in method __format__ of TypeError object>
    __ge__ = <method-wrapper '__ge__' of TypeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of TypeError object>
    __gt__ = <method-wrapper '__gt__' of TypeError object>
    __hash__ = <method-wrapper '__hash__' of TypeError object>
    __init__ = <method-wrapper '__init__' of TypeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of TypeError object>
    __lt__ = <method-wrapper '__lt__' of TypeError object>
    __ne__ = <method-wrapper '__ne__' of TypeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of TypeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of TypeError object>
    __repr__ = <method-wrapper '__repr__' of TypeError object>
    __setattr__ = <method-wrapper '__setattr__' of TypeError object>
    __setstate__ = <built-in method __setstate__ of TypeError object>
    __sizeof__ = <built-in method __sizeof__ of TypeError object>
    __str__ = <method-wrapper '__str__' of TypeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ("arguments did not match any overloaded call:\n  s...ormation): argument 1 has unexpected type 'float'",)
    with_traceback = <built-in method with_traceback of TypeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/home/maa/.local/share/krita/pykrita/photobash_images/photobash_images_docker.py", line 450, in buttonClick
    self.addImageLayer(self.foundImages[position + len(self.imagesButtons) * self.currPage])
  File "/home/maa/.local/share/krita/pykrita/photobash_images/photobash_images_docker.py", line 347, in addImageLayer
    image = QImage(photoPath).scaled(doc.width() * scale, doc.height() * scale, Qt.KeepAspectRatio, Qt.SmoothTransformation)
TypeError: arguments did not match any overloaded call:
  scaled(self, width: int, height: int, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
  scaled(self, size: QSize, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'

MAA28 avatar Mar 10 '23 17:03 MAA28