Thanks. Using that as my search term, I found this thread: http://groups.google.com/group/pyside/browse_thread/thread/119c67971132f78a
What confuses me now is that there is both a google group and a python mailing list. Pepijn On Oct 27, 2011, at 6:06 PM, Hugo Parente Lima wrote: > On Thursday 27 October 2011 13:06:25 Pepijn de Vos wrote: >> Read Eval Print Loop. Like what you get when you type `python` or `ipython` >> even. What is that called in Python language? Interactive shell or >> something? > > I think is interactive shell, I'm not sure but at least now I know YAA[1] ;-) > > But back to the subject, PySide doesn't support interactive shells, REPL, > whatever when inside the Qt event loop, however you can file a bug[2] about > this missing feature. > > Regards > > [1] Yet Another Acronym > [2] http://bugs.pyside.org > > >> Pepijn >> >> On Oct 27, 2011, at 3:29 PM, Hugo Parente Lima wrote: >>> On Thursday 27 October 2011 06:33:47 Pepijn de Vos wrote: >>>> Thanks. So What about a REPL? I really want that, so if it isn't there, >>>> I'll attempt to write it. >>> >>> Sorry, but what means the term REPL? >>> >>>> Pepijn >>>> >>>> On Oct 26, 2011, at 6:02 PM, Hugo Parente Lima wrote: >>>>> On Wednesday 26 October 2011 11:58:14 Pepijn de Vos wrote: >>>>>> 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' >>>>> >>>>> Hi >>>>> >>>>> Here is the code to do this: >>>>> >>>>> from PySide.QtCore import * >>>>> import tempfile >>>>> import sys >>>>> >>>>> def onFileChanged(path): >>>>> print("%s was changed!" % path) >>>>> QCoreApplication.instance().quit() >>>>> >>>>> def writeOnMyFile(): >>>>> global file >>>>> print("Writing on %s." % file.name) >>>>> file.write("Hello World\n") >>>>> >>>>> # The file will not be modified until you call flush, close the file >>>>> or >>>>> >>>>> write contents enough. >>>>> >>>>> file.flush() >>>>> >>>>> app = QCoreApplication(sys.argv) >>>>> >>>>> file = tempfile.NamedTemporaryFile() >>>>> >>>>> watcher = QFileSystemWatcher() >>>>> watcher.addPath(file.name) >>>>> watcher.fileChanged.connect(onFileChanged) >>>>> QTimer.singleShot(0, writeOnMyFile) >>>>> sys.exit(app.exec_()) >>>>> >>>>> >>>>> Regards >>>>> >>>>>> 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 > > -- > Hugo Parente Lima > INdT - Instituto Nokia de Tecnologia _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
