knowzero / krita-lazytexttool-prototype Goto Github PK
View Code? Open in Web Editor NEWA prototype of a lazily made text tool alternative for Krita (Use at your own risk)
A prototype of a lazily made text tool alternative for Krita (Use at your own risk)
UnicodeEncodeError: 'ascii' codec can't encode character '\u0444' in position 319: ordinal not in range(128)
Hello, first off, I would like to thanks you a lot for the impressive effort of pulling out such an awesome and so needed plugin, it should be the default text editor, just like that, this is a major UX and UI improvement. I didn't really went for the programming side of things, but would really like to help this plugin improvement, I would even try to fix this bug if I knew any python, but I'm in POP!OS using Krita 5.1.1 and every now and then I get this error message:
UnboundLocalError
Python 3.9.9: /usr/bin/python3
Tue Sep 27 19:41:58 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.
/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py in eventFilter(self=<LazyTextTool.LazyTextTool.LazyTextTool.toolboxButtonFilter object>, obj=<PyQt5.QtWidgets.QToolButton object>, event=<PyQt5.QtGui.QPaintEvent object>)
30 if obj.isChecked():
31 print ("OPEN CANVAS FROM FILTER")
32 LazyTextTool.openTextCanvas(self.textTool)
33 else:
34 if self.textTool.currentTextCanvas is not None:
global LazyTextTool = <class 'LazyTextTool.LazyTextTool.LazyTextTool'>
LazyTextTool.openTextCanvas = <function LazyTextTool.openTextCanvas>
self = <LazyTextTool.LazyTextTool.LazyTextTool.toolboxButtonFilter object>
self.textTool = <LazyTextTool.LazyTextTool.LazyTextTool object>
/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py in openTextCanvas(self=<LazyTextTool.LazyTextTool.LazyTextTool object>)
655 if self.currentLayer.type() == 'vectorlayer':
656 shapes = self.currentLayer.shapes()
657 self.currentTextCanvas.fillLayer(self.currentLayer, shapes)
658
659 self.currentTextCanvas.view.setFocus()
self = <LazyTextTool.LazyTextTool.LazyTextTool object>
self.currentTextCanvas = <LazyTextTool.LazyTextTool.LazyTextTool.TextCanvas object>
self.currentTextCanvas.fillLayer = <bound method LazyTextTool.TextCanvas.fillLayer ...ool.LazyTextTool.LazyTextTool.TextCanvas object>>
self.currentLayer = <PyKrita.krita.VectorLayer object>
shapes = [<PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>]
/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py in fillLayer(self=<LazyTextTool.LazyTextTool.LazyTextTool.TextCanvas object>, layer=<PyKrita.krita.VectorLayer object>, shapes=[<PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>, <PyKrita.krita.Shape object>])
75 def fillLayer(self, layer, shapes):
76 for shape in shapes:
77 self.textObjectFromLayerAndShape([ layer, shape ])
78
79 def textObjectFromLayerAndShape(self, textItem):
self = <LazyTextTool.LazyTextTool.LazyTextTool.TextCanvas object>
self.textObjectFromLayerAndShape = <bound method LazyTextTool.TextCanvas.textObject...ool.LazyTextTool.LazyTextTool.TextCanvas object>>
layer = <PyKrita.krita.VectorLayer object>
shape = <PyKrita.krita.Shape object>
/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py in textObjectFromLayerAndShape(self=<LazyTextTool.LazyTextTool.LazyTextTool.TextCanvas object>, textItem=[<PyKrita.krita.VectorLayer object>, <PyKrita.krita.Shape object>])
115
116
117 docContent = LazyTextUtils.svgToDocument(svgContent)
118
119 if docContent[1]['version'] == 0 and textItem[1].name() is not None:
docContent undefined
global LazyTextUtils = <class 'LazyTextTool.LazyTextToolFunc.LazyTextUtils'>
LazyTextUtils.svgToDocument = <function LazyTextUtils.svgToDocument>
svgContent = '<rect id="shape0" transform="matrix(1.1065020916...-linejoin="bevel" width="388.5" height="218.25"/>'
/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextToolFunc.py in svgToDocument(svgContent='<rect id="shape0" transform="matrix(1.1065020916...-linejoin="bevel" width="388.5" height="218.25"/>')
680 @staticmethod
681 def svgToDocument(svgContent):
682 htmlData = LazyTextUtils.svgToHtml2(svgContent)
683 htmlData['content'] = re.sub(r'(<p[^>]*?>)[ ]*?</p>',r'\1 </p>', htmlData['content'])
684 print ("HTML2", htmlData['content'])
htmlData undefined
global LazyTextUtils = <class 'LazyTextTool.LazyTextToolFunc.LazyTextUtils'>
LazyTextUtils.svgToHtml2 = <function LazyTextUtils.svgToHtml2>
svgContent = '<rect id="shape0" transform="matrix(1.1065020916...-linejoin="bevel" width="388.5" height="218.25"/>'
/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextToolFunc.py in svgToHtml2(svgContent='<rect id="shape0" transform="matrix(1.1065020916...-linejoin="bevel" width="388.5" height="218.25"/>')
790
791 print ("ELM", elementList[i]['el'].attrib )
792 if elementType in tagConvert:
793 if elementType == "block":
794 blockSettings.append({ 'lines':[{}], 'fragments':[], 'attrib':{}, 'lineheight':0 })
elementType undefined
tagConvert = {'block': {'tag': 'p'}, 'line': {'tag': 'span'}, 'mark': {'tag': 'span'}, 'root': {'tag': 'body'}}
UnboundLocalError: local variable 'elementType' referenced before assignment
__cause__ = None
__class__ = <class 'UnboundLocalError'>
__context__ = None
__delattr__ = <method-wrapper '__delattr__' of UnboundLocalError object>
__dict__ = {}
__dir__ = <built-in method __dir__ of UnboundLocalError object>
__doc__ = 'Local name referenced but not bound to a value.'
__eq__ = <method-wrapper '__eq__' of UnboundLocalError object>
__format__ = <built-in method __format__ of UnboundLocalError object>
__ge__ = <method-wrapper '__ge__' of UnboundLocalError object>
__getattribute__ = <method-wrapper '__getattribute__' of UnboundLocalError object>
__gt__ = <method-wrapper '__gt__' of UnboundLocalError object>
__hash__ = <method-wrapper '__hash__' of UnboundLocalError object>
__init__ = <method-wrapper '__init__' of UnboundLocalError object>
__init_subclass__ = <built-in method __init_subclass__ of type object>
__le__ = <method-wrapper '__le__' of UnboundLocalError object>
__lt__ = <method-wrapper '__lt__' of UnboundLocalError object>
__ne__ = <method-wrapper '__ne__' of UnboundLocalError object>
__new__ = <built-in method __new__ of type object>
__reduce__ = <built-in method __reduce__ of UnboundLocalError object>
__reduce_ex__ = <built-in method __reduce_ex__ of UnboundLocalError object>
__repr__ = <method-wrapper '__repr__' of UnboundLocalError object>
__setattr__ = <method-wrapper '__setattr__' of UnboundLocalError object>
__setstate__ = <built-in method __setstate__ of UnboundLocalError object>
__sizeof__ = <built-in method __sizeof__ of UnboundLocalError object>
__str__ = <method-wrapper '__str__' of UnboundLocalError object>
__subclasshook__ = <built-in method __subclasshook__ of type object>
__suppress_context__ = False
__traceback__ = <traceback object>
args = ("local variable 'elementType' referenced before assignment",)
with_traceback = <built-in method with_traceback of UnboundLocalError 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/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py", line 32, in eventFilter
LazyTextTool.openTextCanvas(self.textTool)
File "/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py", line 657, in openTextCanvas
self.currentTextCanvas.fillLayer(self.currentLayer, shapes)
File "/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py", line 77, in fillLayer
self.textObjectFromLayerAndShape([ layer, shape ])
File "/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextTool.py", line 117, in textObjectFromLayerAndShape
docContent = LazyTextUtils.svgToDocument(svgContent)
File "/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextToolFunc.py", line 682, in svgToDocument
htmlData = LazyTextUtils.svgToHtml2(svgContent)
File "/home/cesar/.var/app/org.kde.krita/data/krita/pykrita/LazyTextTool/LazyTextToolFunc.py", line 792, in svgToHtml2
if elementType in tagConvert:
UnboundLocalError: local variable 'elementType' referenced before assignment
Hope it helps in someway at least reporting the bug, and hope I can make something about it, because this tool is amazing
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.