nucleic/enaml — pull request #90 by blink1073 (2013-11-22 18:28:39+00:00)
Title: Allow multiline field to update text from a thread

As it stands, the text attribute of a `MultilineField` cannot be updated outside of the MainThread. The following code throws the bug:

```
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QTextDocument(0x1e57f30), parent's thread is QThread(0x19d2598), current thread is QThread(0x1e62770)
QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QTextDocument(0x1e57f30), parent's thread is QThread(0x19d2598), current thread is QThread(0x1e62770)
```

```python
import threading
import time
from enaml.widgets.api import *
from atom.api import Atom, Unicode

class Test(Atom):

foo = Unicode()

def foo_updater(self):
while 1:
self.foo += 'hello\n'
time.sleep(1.)

enamldef Main(MainWindow):
attr test = Test()
attr thread = None
activated ::
thread = threading.Thread(target = test.foo_updater)
thread.setDaemon(True)
thread.start()
Container:
Field:
text << test.foo
MultilineField:
text << test.foo
```

After the patch, the code runs just fine.