Hi,

I'm trying to get started with PySide, after some hacking on 
https://bitbucket.org/3david/qtodotxt

disclaimer: I'm a little frustrated, but I mean well.

I read about the model-view architecture, so I want to start by developing my 
model, which would update itself with a QFileSystemWatcher.

The event loop is severely interfering with my development process. Before I 
start it, nothing works, after I start it, I can't use the REPL anymore.

My very modest goal for today was to test QFileSystemWatcher, because in my 
hacking on QTodoTxt, it only notified once and then crashed. It's telling that 
watching files has its own module on the Qt bug tracker.

Simple, right?

1. open a file
2. set up a watcher
2. register a handler
3. write to the file

But... the watcher only runs when I start the event loop. How would I write to 
a file after that?

Best would be to run the event loop in the background, or have a REPL that runs 
on the event loop. Couldn't find how to do it.

Second alternative would be to set up a Signal to invoke the write from the 
event loop. How? How about...

s = Signal()
s.connect(write)
s.emit()
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
AttributeError: 'PySide.QtCore.Signal' object has no attribute 'emit'

You don't expect me to set up a push button to fire the event, right?

Okay, then maybe there is a test framework for PySide that understand the event 
loop, like in Twisted. Maybe? Searching for it turned up nothing, but at last I 
found http://www.pyside.org/docs/pyside/PySide/QtTest/QTest.html No idea how to 
use it though.

I'm sure this is all very simple to you, but I've been trying for hours to do 
something simple, like testing a file watcher.

Pepijn
_______________________________________________
PySide mailing list
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to