JLuebben / Floppy

Flowchart Python -- A multipurpose Python node editor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

strings in object fields

k-eks opened this issue · comments

When trying to write a string into an object field or bool field, makes the node crash and stuck in place and no values can be changed.
Sometimes, I'll get the following error on keyboard input for each pressed key:

Traceback (most recent call last):
  File "/Users/mydata/projects/Floppy_contribution/floppy/painter.py", line 195, in keyPressEvent
    self.relayTo.keyPressEvent(event)
  File "/Users/mydata/projects/Floppy_contribution/floppy/painter.py", line 1414, in keyPressEvent
    self.text += self.sanitizeInputString(event.text())
  File "/Users/mydata/projects/Floppy_contribution/floppy/painter.py", line 1422, in sanitizeInputString
    self.data.info.varType(string)
TypeError: object() takes no parameters

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

screen shot 2016-10-12 at 13 59 22

I can reproduce this.
The problem can be solved for boolean inputs by explicitly defining the options in the node definition:
Input('Value', bool, select=(True, False))

object type inputs currently do not support direct input. The reason for that is that Floppy cannot really know what type it should convert the string to. It could simply keep the string but that might cause more confusion than it does good.
Currently, the intended way to put strings into an object input is to use the CreateString method.

I will fix the crash and think about better ways to do this.

Apparently, the cause of the crash is already fixed.