[PyQt] PyQt5 installation
Hello, I just installed PyQt5 from source on openSUSE and noticed, that the pyuic5 executable (script) didn't get installed with executable rights. Did I do anything wrong? Regards, Detlev-- *Detlev Offenbach* det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] graphical file tail
I'm trying to tail several files graphically. I have been trying to find a way to tail several files in a GUI without much luck at all. I get errors from tail saying broken pipe. I get PyQt errors saying underlying C++ objects have been destroyed. I get other Qt errors saying that threads are still running when the application exits etc The implementation posted below seems to suffer from the following errors. Not all the time. It depends. QThread: Destroyed while thread is still running QWaitCondition::wakeAll(): mutex lock failure: Please tell me what I'm doing wrong. Feel free to tell me if I'm doing something bone-headed. Basically, I want to graphically tail files and when the GUI closes the tail subprocesses are killed. Seems like a simple request, but I can't get it right. #!/usr/bin/env python from PyQt4.QtCore import * from PyQt4.QtGui import * import os from subprocess import Popen, PIPE class Tailer(QThread): def __init__(self, fname, parent=None): super(Tailer, self).__init__(parent) self.fname = fname self.connect(self, SIGNAL('finished()'), self.cleanup) def cleanup(self): print 'CLEANING UP' self.p.kill() print 'killed' def run(self): command = [tail, -f, self.fname] print command self.p = Popen(command, stdout=PIPE, stderr=PIPE) while True: line = self.p.stdout.readline() self.emit(SIGNAL('newline'), line.rstrip()) if not line: print 'BREAKING' break def foo(self): self.p.kill() class TailWidget(QWidget): def __init__(self, fnames, parent=None): super(TailWidget, self).__init__(parent) layout = QGridLayout() self.threads = {} self.browsers = {} for i, fname in enumerate(fnames): if not os.path.exists(fname): print fname, doesn't exist; creating p = Popen(['touch', fname], stdout=PIPE, stderr=PIPE) out, err = p.communicate() ret = p.wait() assert ret == 0 t = Tailer(fname, self) self.threads[fname] = t b = QTextBrowser() self.browsers[fname] = b layout.addWidget(QLabel('Tail on %s' % fname), 0, i) layout.addWidget(b, 1, i) self.connect(t, SIGNAL(newline), b.append) t.start() self.setLayout(layout) def closeEvent(self, event): for fname, t in self.threads.items(): t.foo() if __name__ == '__main__': import sys app = QApplication(sys.argv) tw = TailWidget(sys.argv[1:]) tw.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] ANN: PyQtChart v1.3 Released
PyQtChart v1.3 has been released. This supports the new features of Qt Charts v1.3.0. See... http://blog.qt.digia.com/blog/2013/06/19/qt-charts-1-3-0-released-2/ It can be built against PyQt4 and PyQt5. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt5 installation
On Mon, 24 Jun 2013 19:09:01 +0200, Detlev Offenbach det...@die-offenbachs.de wrote: Hello, I just installed PyQt5 from source on openSUSE and noticed, that the pyuic5 executable (script) didn't get installed with executable rights. Did I do anything wrong? No, it's a Linux specific bug. I was trying to avoid a warning message when stripping a shell script. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Kled module
Thank you for reading this. I'd like to include a led in my project which I've done in the past with Qt creator and Designer under C++. Adding the following to my Python project fails because there is no module named Kled. self.kled = KLed(self.centralwidget) Is it possible to add a Kled to a PyQt project? -- Regards, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] graphical file tail
On Mon, 24 Jun 2013, Eric Frederich wrote: I'm trying to tail several files graphically. I have been trying to find a way to tail several files in a GUI without much luck at all. I get errors from tail saying broken pipe. I get PyQt errors saying underlying C++ objects have been destroyed. I get other Qt errors saying that threads are still running when the application exits etc The implementation posted below seems to suffer from the following errors. Not all the time. It depends. QThread: Destroyed while thread is still running QWaitCondition::wakeAll(): mutex lock failure: You're not calling .wait on the threads, and you probably want to give e.g. your QObjects a parent where you can, so that Qt manages the lifetime of the wrapped C++ objects (e.g. pass in self to the parent arg of the QTextBrowser constructor). But, I recommend doing it a different way: I find event-based code easier to think about than threads. So, if you can use Qt5, you might want to do away with the threads and the tail subprocess and replace them with QFileSystemWatcher. Use event-based code instead of the threads (I'm not talking about Qt events, I just mean hook up to the signals that that class emits and process a little input at a time so as to avoid blocking the UI, using QTimer where needed). I say Qt5 because Qt4 isn't very friendly to this way of working since it uses threads in the implementation of QFileSystemWatcher. Caveat: QFileSystemWatcher still has its problems, but the ones discussed at the URL below are more convenience issues than fundamental problems: I just found I had to experiment a bit to see when the different signals got emitted. http://blog.rburchell.com/2012/03/qt-51-aka-when-qfilesystemwatcher-might.html Caveat #2: I imagine QFileSystemWatcher does not support filesystems like NFS, at least on Linux kernels with inotify support (but don't take my word for it, check the source). John ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] graphical file tail
Thanks for the suggestions. Unfortunately I do need to use Qt 4.6.2 from RHEL 6. This will also be on an NFS mounted drive. This is for a GUI that monitors the output of jobs run on Sun Grid Engine (SGE). So its not that the files _happen_ to be on NFS, it's actually _required_ that they are :-( Any Qt4 help would be appreciated. Am I cleaning up my tail processes correctly? Is it just the QThreads I'm screwing up? Are there other hidden dangers with my implementation? On Jun 24, 2013 7:25 PM, John Lee j...@pobox.com wrote: On Mon, 24 Jun 2013, Eric Frederich wrote: I'm trying to tail several files graphically. I have been trying to find a way to tail several files in a GUI without much luck at all. I get errors from tail saying broken pipe. I get PyQt errors saying underlying C++ objects have been destroyed. I get other Qt errors saying that threads are still running when the application exits etc The implementation posted below seems to suffer from the following errors. Not all the time. It depends. QThread: Destroyed while thread is still running QWaitCondition::wakeAll(): mutex lock failure: You're not calling .wait on the threads, and you probably want to give e.g. your QObjects a parent where you can, so that Qt manages the lifetime of the wrapped C++ objects (e.g. pass in self to the parent arg of the QTextBrowser constructor). But, I recommend doing it a different way: I find event-based code easier to think about than threads. So, if you can use Qt5, you might want to do away with the threads and the tail subprocess and replace them with QFileSystemWatcher. Use event-based code instead of the threads (I'm not talking about Qt events, I just mean hook up to the signals that that class emits and process a little input at a time so as to avoid blocking the UI, using QTimer where needed). I say Qt5 because Qt4 isn't very friendly to this way of working since it uses threads in the implementation of QFileSystemWatcher. Caveat: QFileSystemWatcher still has its problems, but the ones discussed at the URL below are more convenience issues than fundamental problems: I just found I had to experiment a bit to see when the different signals got emitted. http://blog.rburchell.com/**2012/03/qt-51-aka-when-** qfilesystemwatcher-might.htmlhttp://blog.rburchell.com/2012/03/qt-51-aka-when-qfilesystemwatcher-might.html Caveat #2: I imagine QFileSystemWatcher does not support filesystems like NFS, at least on Linux kernels with inotify support (but don't take my word for it, check the source). John __**_ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.**com/mailman/listinfo/pyqthttp://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt