Lazy Text Tool(Prototype) – A plugin that helps you type

It’s more difficult, I triggered it accidentally. It was not triggered afterwards. If it can be copied accurately next time, I will report

Even if you can’t replicate it exactly, just knowing the steps helps. I have a way for making the error go away, just I want to be sure the end result won’t be just it not working with no error.

image
In the case of small fonts, I pressed this button. No other operations. It triggered again just now.

So just to confirm, you created a text, then committed it. Then made a 2nd text and without selecting anything increased the font size as the first thing you did?

Also, you are on Krita 5 beta right?

It has not been completely repaired. The size was 10 when it was first started; it became 9 after creating a text. Later it was normal.

I tested it again, and the reason seems to be that there are decimals in the “font size”. Previously, this problem occurred because the “font size” was automatically reduced. The same problem occurs many times when manually inputting integers.
Create an empty box, and try to manually enter the “font size” and contain decimals, there is a high probability of triggering

In addition, there is no confirmation button when the user manually enters the “font size”, clicking on the canvas will create the text of the previous size

Nope :confused:

Let me try a windows VM. It could be something different between different OS.

When you manually change the font size, you hit enter. Same as in the normal text tool.

Edit: Nope, even with windows VM I can’t replicate it :confused:

Restart krita several times and try again. I don’t trigger bugs every time
1
Then I went to bed. Our time zone seems to be the opposite. It’s midnight here…

Okay, the problem here is that the config window didn’t disappear. So there was no target and you got an error. I’ll see why it didn’t disappear.

And k, good night.

Edit: Fixed the issue

Curious that why the plugin creates another scrollbar and not just use default krita ones? I hope it’s not intentional. (Zooming and panning also isn’t the same)

That is because another layer is created on top that you write on, then when you commit the changes it goes down. I hid the extra scrollbars.

As for the zooming being different, that is mentioned on top that normal zoom is based on the mouse, while the zoom here is centralized.

Is there any change that it can be modified to (or as if to) use krita’s default scrollbars and panning?

It is using Krita’s scrollbars. The zoom is not though. As for can the zoom be modified to make it work, the answer is yes.

1
This problem does not seem to be resolved

I’m not getting that :/, are you using commit or cancel?

All have this problem. No matter if I cancel directly or create a paragraph of text and then confirm
1

I can’t replicate it :frowning: … maybe you accidentally loaded up an old version? try uninstalling it and removing all the zip versions, and redownloading.

The latest version an hour ago still has this problem…

Hmm… maybe try Microsoft DebugView to see more log data. Maybe I can make it out from there :confused:

Edit: Okay, I managed to replicate it in a windows VM

Edit2: Okay, fixed, try now!

It is normal now.

I copied a sentence on a website using markdown syntax, and the following bug appeared:

AttributeError
Python 3.8.1: C:\GAMES\STEAM\steamapps\common\Krita\krita\bin\krita.exe
Sun Sep  5 12:50:55 2021

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:\Users\123\AppData\Roaming\krita\pykrita\LazyTextTool\LazyTextToolFunc.py in updateFormatButtons(self=<LazyTextTool.LazyTextToolFunc.LazyTextHelper object>, tcursor=<PyQt5.QtGui.QTextCursor object>)
 1170         self.blockMode = True
 1171         self.fontComboBox.setCurrentFont(font)
 1172         self.fontSizeDSpinBox.setValue( float(LazyTextUtils.calcFontSize( str(font.pointSizeF())+"pt",200,"primaryScreen","")) )
 1173         self.currentColor = charFormat.foreground().color()
 1174         self.colorButton.setStyleSheet('background-color: %s; color: %s' % (
self = <LazyTextTool.LazyTextToolFunc.LazyTextHelper object>
self.fontSizeDSpinBox = <PyQt5.QtWidgets.QDoubleSpinBox object>
self.fontSizeDSpinBox.setValue = <built-in method setValue of QDoubleSpinBox object>
builtinfloat = <class 'float'>
global LazyTextUtils = <class 'LazyTextTool.LazyTextToolFunc.LazyTextUtils'>
LazyTextUtils.calcFontSize = <function LazyTextUtils.calcFontSize>
builtinstr = <class 'str'>
font = <PyQt5.QtGui.QFont object>
font.pointSizeF = <built-in method pointSizeF of QFont object>

 C:\Users\123\AppData\Roaming\krita\pykrita\LazyTextTool\LazyTextToolFunc.py in calcFontSize(fontSize='-1.0pt', fromDPI=200, toDPI='primaryScreen', toUnit='')
  406 
  407         match = re.search("^([0-9\.]+)([^0-9]*)",fontSize)
  408         fontSize = match.group(1)
  409         fromUnit = match.group(2)
  410         if  1==2 or LazyTextUtils.APP_VERSION < 5: return str(fontSize) + toUnit
fontSize = '-1.0pt'
match = None
match.group undefined
AttributeError: 'NoneType' object has no attribute 'group'
    __cause__ = None
    __class__ = <class 'AttributeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of AttributeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of AttributeError object>
    __doc__ = 'Attribute not found.'
    __eq__ = <method-wrapper '__eq__' of AttributeError object>
    __format__ = <built-in method __format__ of AttributeError object>
    __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__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of AttributeError object>
    __lt__ = <method-wrapper '__lt__' of AttributeError object>
    __ne__ = <method-wrapper '__ne__' of AttributeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of AttributeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of AttributeError object>
    __repr__ = <method-wrapper '__repr__' of AttributeError object>
    __setattr__ = <method-wrapper '__setattr__' of AttributeError object>
    __setstate__ = <built-in method __setstate__ of AttributeError object>
    __sizeof__ = <built-in method __sizeof__ of AttributeError object>
    __str__ = <method-wrapper '__str__' of AttributeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ("'NoneType' object has no attribute 'group'",)
    with_traceback = <built-in method with_traceback of AttributeError object>

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

Traceback (most recent call last):
  File "C:\Users\123\AppData\Roaming\krita\pykrita\LazyTextTool\LazyTextToolFunc.py", line 1172, in updateFormatButtons
    self.fontSizeDSpinBox.setValue( float(LazyTextUtils.calcFontSize( str(font.pointSizeF())+"pt",200,"primaryScreen","")) )
  File "C:\Users\123\AppData\Roaming\krita\pykrita\LazyTextTool\LazyTextToolFunc.py", line 408, in calcFontSize
    fontSize = match.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

I couldn’t reproduce it later. But the way it works is still not normal.
1

Yeah, I would avoid directly copy and pasting formatted stuff. Use notepad first maybe to get rid of the formatting.

It is one of those things that will have to wait for the final version because you can’t really rely on the formatting (since html support and Krita’s svg support are not fully in sync). Which means I have to strip the copy and pasted formatting first to limit it to what Krita supports. Not to mention the font size has to be recalculated to match due to the difference between QT and svg.

For the final version, I plan to probably the whole layout from scratch and handle formatting myself.

2 Likes