From techtonik at gmail.com Wed Jul 1 22:30:42 2015 From: techtonik at gmail.com (anatoly techtonik) Date: Wed, 1 Jul 2015 23:30:42 +0300 Subject: [PySide] PySide accessibility, is possible? In-Reply-To: <5592871B.8090609@gmail.com> References: <5592871B.8090609@gmail.com> Message-ID: Hi Germano. Unfortunately, I don't know of any separate efforts of enabling accessibility to run PySide. PySide is just a Python wrapper over Qt4, so things that work in Qt4 should work for PySide as well. I don't believe that there is anything extra in PySide that adds more features to accessibility to that. >From http://doc.qt.io/qt-4.8/accessible.html it looks like on Unix you need to enable accessibility features with: export QT_ACCESSIBILITY=1 On Tue, Jun 30, 2015 at 3:10 PM, germano carella < germanocarella.list at gmail.com> wrote: > Hi, > I downloaded and installed PySide on my windows 8.1. > I tried to run some examples, such as application example, and other. > I seen there are accessibility plugins for QT 4.8, but examples are > inaccessible to screen readers. > There is a way to enable accessibility in pySide? > Some tutorial or document? > Thannks! > Germano > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > -- anatoly t. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Marc.Poinot at onera.fr Wed Jul 8 17:16:26 2015 From: Marc.Poinot at onera.fr (Marc.Poinot at onera.fr) Date: Wed, 08 Jul 2015 17:16:26 +0200 Subject: [PySide] released slot Message-ID: <559D3ECA.509@onera.fr> I can find the pressed(QModelIndex) slot in the QTreeView, but no released(QModelIndex). I want my item to be actually select'ed when the user stops moving its mouse around with the button down and get the last index the pointer was on. Is there any other way to do that without the released slot? -MP- -- -- ---------------------------------------------------------------------------- -- Marc POINOT [ONERA/DSNA] Tel:+33.1.46.73.42.84 Fax:+33.1.46.73.41.66 -- Avertissement/disclaimer http://www.onera.fr/en/emails-terms -- ---------------------------------------------------------------------------- -- From guillaume.baty at gmx.fr Wed Jul 8 17:36:48 2015 From: guillaume.baty at gmx.fr (Guillaume Baty) Date: Wed, 8 Jul 2015 17:36:48 +0200 Subject: [PySide] released slot In-Reply-To: <559D3ECA.509@onera.fr> References: <559D3ECA.509@onera.fr> Message-ID: An HTML attachment was scrubbed... URL: From Marc.Poinot at onera.fr Thu Jul 9 08:08:22 2015 From: Marc.Poinot at onera.fr (Marc.Poinot at onera.fr) Date: Thu, 09 Jul 2015 08:08:22 +0200 Subject: [PySide] released slot In-Reply-To: References: <559D3ECA.509@onera.fr> Message-ID: <559E0FD6.6010003@onera.fr> Hi Guillaume, This was actually the first I've tried, without success. The mouseReleaseEvent is a known function of the QAbstractItem but it is never called. Probably QTreeView redefines the function that calls the mouseReleaseEvent function. -MP- On 07/08/15 17:36, Guillaume Baty wrote: > Hello, > I think you can try to reimplement: > QAbstractItemView::mouseReleaseEvent(QMouseEvent * event) > -- -- ---------------------------------------------------------------------------- -- Marc POINOT [ONERA/DSNA] Tel:+33.1.46.73.42.84 Fax:+33.1.46.73.41.66 -- Avertissement/disclaimer http://www.onera.fr/en/emails-terms -- ---------------------------------------------------------------------------- -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaume.baty at gmx.fr Thu Jul 9 08:48:13 2015 From: guillaume.baty at gmx.fr (Guillaume Baty) Date: Thu, 9 Jul 2015 08:48:13 +0200 Subject: [PySide] released slot In-Reply-To: <559E0FD6.6010003@onera.fr> References: <559D3ECA.509@onera.fr> , <559E0FD6.6010003@onera.fr> Message-ID: An HTML attachment was scrubbed... URL: From Marc.Poinot at onera.fr Thu Jul 9 09:21:12 2015 From: Marc.Poinot at onera.fr (Marc.Poinot at onera.fr) Date: Thu, 09 Jul 2015 09:21:12 +0200 Subject: [PySide] released slot In-Reply-To: References: <559D3ECA.509@onera.fr> , <559E0FD6.6010003@onera.fr> Message-ID: <559E20E8.4010409@onera.fr> On 07/09/15 08:48, Guillaume Baty wrote: > Hi, ok ... > Can you send a simple example containing Python file with the model and view ? > Does-it work with PyQt ? ok, fixed, I was on the wrong class. Now the redefine is ok. source (no commit with mouseReleaseEvent yet) here: https://sourceforge.net/p/pycgns/code/ci/default/tree/NAVigater/CGNS/NAV/mtree.py see Q7Tree class, thanks for the time Guillaume, -MP- -- -- ---------------------------------------------------------------------------- -- Marc POINOT [ONERA/DSNA] Tel:+33.1.46.73.42.84 Fax:+33.1.46.73.41.66 -- Avertissement/disclaimer http://www.onera.fr/en/emails-terms -- ---------------------------------------------------------------------------- -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From tismer at stackless.com Thu Jul 9 22:45:19 2015 From: tismer at stackless.com (Christian Tismer) Date: Thu, 09 Jul 2015 22:45:19 +0200 Subject: [PySide] Ann: porting PySide to Qt5 Message-ID: <559EDD5F.5070403@stackless.com> Hi all, to let you be informed: PySide will live on. -------------------- There is someone intensively working on porting PySide to Qt5, with some help from Autodesk. I started end of May and am still very busy to get the most important modules to compile. Now I think it is time to open things up to the community and discuss some things, do reviews, and most importantly: stop working alone for too long. This stuff is still under heavy development, and I'm inviting experienced PySide developers to join me on the pyside-dev list. I will post more details there. All the best - Chris -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : http://www.pydica.net/ 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: From mark.melvin at gmail.com Thu Jul 9 22:49:55 2015 From: mark.melvin at gmail.com (Mark Melvin) Date: Thu, 09 Jul 2015 20:49:55 +0000 Subject: [PySide] Ann: porting PySide to Qt5 In-Reply-To: <559EDD5F.5070403@stackless.com> References: <559EDD5F.5070403@stackless.com> Message-ID: This is great news! I'll definitely contribute where I can. PySide is an awesome piece of software and I have benefited from it. Mark. On Thu, 9 Jul 2015 at 16:45 Christian Tismer wrote: > Hi all, > > to let you be informed: > > PySide will live on. > -------------------- > > There is someone intensively working on porting PySide to Qt5, > with some help from Autodesk. > > I started end of May and am still very busy to get the most > important modules to compile. Now I think it is time to open > things up to the community and discuss some things, do reviews, > and most importantly: stop working alone for too long. > > This stuff is still under heavy development, and I'm inviting > experienced PySide developers to join me on the pyside-dev > list. I will post more details there. > > All the best - Chris > > -- > Christian Tismer :^) tismer at stackless.com > Software Consulting : http://www.stackless.com/ > Karl-Liebknecht-Str. 121 : http://www.pydica.net/ > 14482 Potsdam : GPG key -> 0xFB7BEE0E > phone +49 173 24 18 776 fax +49 (30) 700143-0023 > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwoehlke.floss at gmail.com Fri Jul 10 15:27:15 2015 From: mwoehlke.floss at gmail.com (Matthew Woehlke) Date: Fri, 10 Jul 2015 09:27:15 -0400 Subject: [PySide] Ann: porting PySide to Qt5 In-Reply-To: <559EDD5F.5070403@stackless.com> References: <559EDD5F.5070403@stackless.com> Message-ID: On 2015-07-09 16:45, Christian Tismer wrote: > There is someone intensively working on porting PySide to Qt5, > with some help from Autodesk. Awesome! This is excellent news! > I started end of May and am still very busy to get the most > important modules to compile. Did you have any problems with *shiboken* and Qt5? Hopefully not; we pushed a bunch of patches for that a little while back (that were accepted and merged) and it seems to work for us. I don't know if or how much I'll be able to be involved personally, though I will certainly benefit from this work. There's another group I sometimes work with that might also get involved. Again, great to hear! Thanks for sharing! -- Matthew From tismer at stackless.com Fri Jul 10 16:25:32 2015 From: tismer at stackless.com (Christian Tismer) Date: Fri, 10 Jul 2015 16:25:32 +0200 Subject: [PySide] Ann: porting PySide to Qt5 In-Reply-To: References: <559EDD5F.5070403@stackless.com> Message-ID: <559FD5DC.90309@stackless.com> Hi Mathew, On 10.07.15 15:27, Matthew Woehlke wrote: > On 2015-07-09 16:45, Christian Tismer wrote: >> There is someone intensively working on porting PySide to Qt5, >> with some help from Autodesk. > Awesome! This is excellent news! > >> I started end of May and am still very busy to get the most >> important modules to compile. > Did you have any problems with *shiboken* and Qt5? Hopefully not; we > pushed a bunch of patches for that a little while back (that were > accepted and merged) and it seems to work for us. I used the official shiboken repos and had of course some problems, but compared with the huge amount of work on PySide, this was more like a warm-up. My shiboken version works fine after patching a few things. There are of course some errors which show only up with Qt5, which I circumvented, and it works for me. > > I don't know if or how much I'll be able to be involved personally, > though I will certainly benefit from this work. There's another group I > sometimes work with that might also get involved. > > Again, great to hear! Thanks for sharing! > Thanks a lot! Please let me know if some group might help. This is a bit too much for one person. Also, if you have personal hints, please let me know. There is, for instance, the question where I should put the issue tracker, and where things get merged into. If somebody like you can simply give me advice, that would simplify my life a lot ;-) cheers - Chris -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : http://www.pydica.net/ 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: From matthew.brett at gmail.com Fri Jul 10 16:29:28 2015 From: matthew.brett at gmail.com (Matthew Brett) Date: Fri, 10 Jul 2015 15:29:28 +0100 Subject: [PySide] Ann: porting PySide to Qt5 In-Reply-To: <559FD5DC.90309@stackless.com> References: <559EDD5F.5070403@stackless.com> <559FD5DC.90309@stackless.com> Message-ID: Hi, On Fri, Jul 10, 2015 at 3:25 PM, Christian Tismer wrote: > Hi Mathew, > > On 10.07.15 15:27, Matthew Woehlke wrote: >> On 2015-07-09 16:45, Christian Tismer wrote: >>> There is someone intensively working on porting PySide to Qt5, >>> with some help from Autodesk. >> Awesome! This is excellent news! >> >>> I started end of May and am still very busy to get the most >>> important modules to compile. >> Did you have any problems with *shiboken* and Qt5? Hopefully not; we >> pushed a bunch of patches for that a little while back (that were >> accepted and merged) and it seems to work for us. > > I used the official shiboken repos and had of course some problems, > but compared with the huge amount of work on PySide, this was > more like a warm-up. > My shiboken version works fine after patching a few things. > There are of course some errors which show only up with Qt5, which > I circumvented, and it works for me. > >> >> I don't know if or how much I'll be able to be involved personally, >> though I will certainly benefit from this work. There's another group I >> sometimes work with that might also get involved. >> >> Again, great to hear! Thanks for sharing! >> > > Thanks a lot! Please let me know if some group might help. > This is a bit too much for one person. > > Also, if you have personal hints, please let me know. > There is, for instance, the question where I should put the > issue tracker, and where things get merged into. If somebody > like you can simply give me advice, that would simplify my > life a lot ;-) I can certainly help with github workflow, if that is of interest. Cheers, Matthew From mr.smittye at gmail.com Sat Jul 11 17:40:25 2015 From: mr.smittye at gmail.com (E Smitty) Date: Sat, 11 Jul 2015 08:40:25 -0700 Subject: [PySide] Ann: porting PySide to Qt5 In-Reply-To: References: <559EDD5F.5070403@stackless.com> <559FD5DC.90309@stackless.com> Message-ID: Hello, I know you said "experienced PySide developers", but I *really* want to see a Qt5 version of PySide. Anything I can do to help (I can document, test, etc), I am willing to do. I don't think I would be able to help with the core development, but anything that helps, I will try. Thank you so much for your amazing work. And wow Autodesk is helping, they rock! ~>Ethan On Fri, Jul 10, 2015 at 7:29 AM, Matthew Brett wrote: > Hi, > > On Fri, Jul 10, 2015 at 3:25 PM, Christian Tismer > wrote: > > Hi Mathew, > > > > On 10.07.15 15:27, Matthew Woehlke wrote: > >> On 2015-07-09 16:45, Christian Tismer wrote: > >>> There is someone intensively working on porting PySide to Qt5, > >>> with some help from Autodesk. > >> Awesome! This is excellent news! > >> > >>> I started end of May and am still very busy to get the most > >>> important modules to compile. > >> Did you have any problems with *shiboken* and Qt5? Hopefully not; we > >> pushed a bunch of patches for that a little while back (that were > >> accepted and merged) and it seems to work for us. > > > > I used the official shiboken repos and had of course some problems, > > but compared with the huge amount of work on PySide, this was > > more like a warm-up. > > My shiboken version works fine after patching a few things. > > There are of course some errors which show only up with Qt5, which > > I circumvented, and it works for me. > > > >> > >> I don't know if or how much I'll be able to be involved personally, > >> though I will certainly benefit from this work. There's another group I > >> sometimes work with that might also get involved. > >> > >> Again, great to hear! Thanks for sharing! > >> > > > > Thanks a lot! Please let me know if some group might help. > > This is a bit too much for one person. > > > > Also, if you have personal hints, please let me know. > > There is, for instance, the question where I should put the > > issue tracker, and where things get merged into. If somebody > > like you can simply give me advice, that would simplify my > > life a lot ;-) > > I can certainly help with github workflow, if that is of interest. > > Cheers, > > Matthew > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > -------------- next part -------------- An HTML attachment was scrubbed... URL: From redstone-cold at 163.com Sun Jul 12 09:50:19 2015 From: redstone-cold at 163.com (redstone-cold) Date: Sun, 12 Jul 2015 15:50:19 +0800 (CST) Subject: [PySide] Ann: porting PySide to Qt5 In-Reply-To: <559EDD5F.5070403@stackless.com> References: <559EDD5F.5070403@stackless.com> Message-ID: <2baad33a.1d5.14e813e4997.Coremail.redstone-cold@163.com> I hope you guys be careful about the signal - slot mechanism in Qt5 http://www.riverbankcomputing.com/pipermail/pyqt/2014-January/033575.html 在2015年07月10 04时45分, "Christian Tismer"写道: Hi all, to let you be informed: PySide will live on. -------------------- There is someone intensively working on porting PySide to Qt5, with some help from Autodesk. I started end of May and am still very busy to get the most important modules to compile. Now I think it is time to open things up to the community and discuss some things, do reviews, and most importantly: stop working alone for too long. This stuff is still under heavy development, and I'm inviting experienced PySide developers to join me on the pyside-dev list. I will post more details there. All the best - Chris -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : http://www.pydica.net/ 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tismer at stackless.com Sun Jul 12 12:15:03 2015 From: tismer at stackless.com (Christian Tismer) Date: Sun, 12 Jul 2015 12:15:03 +0200 Subject: [PySide] Ann: porting PySide to Qt5 In-Reply-To: <2baad33a.1d5.14e813e4997.Coremail.redstone-cold@163.com> References: <559EDD5F.5070403@stackless.com> <2baad33a.1d5.14e813e4997.Coremail.redstone-cold@163.com> Message-ID: <55A23E27.5020009@stackless.com> Thank you for the hint! Exactly this is what I saved for later, because I needed to gain more experience by the porting, before going into this. cheers - Chris On 12.07.15 09:50, redstone-cold wrote: > I hope you guys be careful about the signal - slot mechanism in Qt5 > > http://www.riverbankcomputing.com/pipermail/pyqt/2014-January/033575.html > > > > 在2015年07月10 04时45分, "Christian Tismer"写道: > > > Hi all, > > to let you be informed: > > PySide will live on. > -------------------- > > There is someone intensively working on porting PySide to Qt5, > with some help from Autodesk. > > I started end of May and am still very busy to get the most > important modules to compile. Now I think it is time to open > things up to the community and discuss some things, do reviews, > and most importantly: stop working alone for too long. > > This stuff is still under heavy development, and I'm inviting > experienced PySide developers to join me on the pyside-dev > list. I will post more details there. > > All the best - Chris > > -- > Christian Tismer :^) tismer at stackless.com > > Software Consulting : http://www.stackless.com/ > Karl-Liebknecht-Str. 121 : http://www.pydica.net/ > 14482 Potsdam : GPG key -> 0xFB7BEE0E > phone +49 173 24 18 776 fax +49 (30) 700143-0023 > > > -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : http://www.pydica.net/ 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: From yishenggudou at gmail.com Mon Jul 20 11:04:56 2015 From: yishenggudou at gmail.com (=?UTF-8?B?dGltZ2Vy4oSi?=) Date: Mon, 20 Jul 2015 17:04:56 +0800 Subject: [PySide] how to listen global shortcut? Message-ID: hi all: how to listen global shortcut use pyside ? Regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlos.zun at gmail.com Mon Jul 20 18:07:24 2015 From: carlos.zun at gmail.com (Carlos Zuniga) Date: Mon, 20 Jul 2015 11:07:24 -0500 Subject: [PySide] how to listen global shortcut? In-Reply-To: References: Message-ID: On Mon, Jul 20, 2015 at 4:04 AM, timger™ wrote: > hi all: > how to listen global shortcut use pyside ? > Hi, I don't know about a pyside specific library, but there is pygs [0] which works with pyqt and pyhk [1] which is Windows specific. [0] https://pypi.python.org/pypi/PyGlobalShortcut [1] https://github.com/schurpf/pyhk From mr.smittye at gmail.com Mon Jul 20 20:59:10 2015 From: mr.smittye at gmail.com (E Smitty) Date: Mon, 20 Jul 2015 11:59:10 -0700 Subject: [PySide] how to listen global shortcut? In-Reply-To: References: Message-ID: I have written a library for Windows that listens to key presses. https://github.com/IronManMark20/hooked On Jul 20, 2015 6:07 AM, "Carlos Zuniga" wrote: > On Mon, Jul 20, 2015 at 4:04 AM, timger™ wrote: > > hi all: > > how to listen global shortcut use pyside ? > > > > > Hi, I don't know about a pyside specific library, but there is pygs > [0] which works with pyqt and pyhk [1] which is Windows specific. > > > [0] https://pypi.python.org/pypi/PyGlobalShortcut > [1] https://github.com/schurpf/pyhk > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at ohufx.com Thu Jul 23 06:05:05 2015 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Thu, 23 Jul 2015 16:05:05 +1200 Subject: [PySide] using QProcess to run python function In-Reply-To: References: <52E1C66C.3050400@ohufx.com> <52E1CD36.4070302@ohufx.com> <52E1D314.8000800@ohufx.com> <52E1E19E.7090402@ohufx.com> <52E1EEE3.9040801@ohufx.com> <52E3488F.1060501@ohufx.com> <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> <53227ED7.7020607@ohufx.com> <53228524.20102@ohufx.com> Message-ID: <55B067F1.2080501@ohufx.com> Hi all, once again I got dragged away from this for ages,my apologies. I am still trying to get all the stdout from other python functions to print to a QPlainTextWidget. I left off with a modified example of Sean's code below and am realising that the issue is that I don't have an event loop in my worker's run() method. My run() looks like this: class Worker(QtCore.QObject, QtCore.QRunnable): processed = QtCore.Signal(int) curProcess = QtCore.Signal(str) finished = QtCore.Signal() def __init__(self, parent=None): QtCore.QObject.__init__(self, parent) QtCore.QRunnable.__init__(self, parent) def run(self): self.curProcess.emit('starting processing') * dummyFunction() # need to grab output from this as it runs* self.curProcess.emit('current process...') self.finished.emit() The question is how do I emit the stdout from dummyFunction() while it's running (it takes a minute or so to finish all sorts of tasks)? Do I have to move it to an extra thread again and connect to that? Cheers, frank On 14/03/14 6:39 pm, Sean Fisk wrote: > > Hi Frank, > > I’ve modified the earlier example to display the progress in the best > way that I know. It doesn’t use the |finished| signal, but it should > be pretty easy to adapt it to your needs. Let me know if this is what > you want! [Either way, it’s fun to click it a bunch of times :) ] > > Cheers, > > - Sean > > |#!/usr/bin/env python > > import sys > import time > > from PySideimport QtGui > from PySideimport QtCore > > TOTAL_WIDGETS =10 > > class Worker(QtCore.QRunnable, QtCore.QObject): > processed = QtCore.Signal(int) > finished = QtCore.Signal() > > def __init__(self, parent=None): > # IMPORTANT: We must call the constructors of *both* parents. > QtCore.QObject.__init__(self, parent) > QtCore.QRunnable.__init__(self, parent) > > def run(self): > for iin xrange(TOTAL_WIDGETS): > # We sleep first to simulate an operation taking place. > time.sleep(0.5) > print 'Thread: {0}, Processed: {1}'.format( > QtCore.QThread.currentThread(), i) > self.processed.emit(i +1) > # Must manually emit the finished signal. > self.finished.emit() > > class MainWindow(QtGui.QWidget): > def __init__(self, parent=None): > super(MainWindow, self).__init__(parent) > self._thread_pool = QtCore.QThreadPool.globalInstance() > > # IMPORTANT: Don't quit the app until the thread has completed. > # Prevents errors like: > # > # QThread: Destroyed while thread is still running > # > # QThreadPool.waitForDone() is, unfortunately, not a slot. > QtGui.QApplication.instance().aboutToQuit.connect( > lambda: self._thread_pool.waitForDone()) > > self._layout = QtGui.QVBoxLayout(self) > self._add_button = QtGui.QPushButton('Start New Task') > self._layout.addWidget(self._add_button) > > self._add_button.clicked.connect(self._start_new_task) > > def _start_new_task(self): > task = Worker() > progress_bar = QtGui.QProgressBar() > progress_bar.setRange(0, TOTAL_WIDGETS) > task.processed.connect(progress_bar.setValue) > self._layout.addWidget(progress_bar) > self._thread_pool.start(task) > > if __name__ =='__main__': > app = QtGui.QApplication(sys.argv) > window = MainWindow() > window.show() > window.raise_() > raise SystemExit(app.exec_()) > | > > > -- > Sean Fisk > > > On Fri, Mar 14, 2014 at 12:27 AM, Frank Rueter | OHUfx > > wrote: > > great, thanks Sean. > In order to communicate with the progress in each thread (to drive > progress and catch finished and error events), should I use > QtCore.QThread.currentThread() and hook up my slots to it's events? > > Cheers and thanks a lot for bearing with me here. > > frank > > > > On 14/03/14 17:15, Sean Fisk wrote: >> >> Hi Frank, >> >> Glad you got that figured out. One more important thing: >> >> To achieve a “clean exit”, you should wait for the completion of >> all tasks associated with the |QThreadPool| before exiting. Use >> something like: >> >> |thread_pool = QtCore.QThreadPool.globalInstance() >> thread_pool.start(hello) >> thread_pool.waitForDone() >> | >> >> It is a common idiom to have the application wait for this before >> it exits: >> >> If you are using a |QApplication| or |QCoreApplication| (i.e., a >> Qt event loop): >> >> |from PySideimport QtCore >> QtCore.QCoreApplication.instance().aboutToQuit.connect(thread_pool.waitForDone) >> | >> >> Or with Python’s exit handlers: >> >> |import atexit >> atexit.register(thread_pool.waitForDone) >> | >> >> In general, I would prefer Qt’s method if you are running an >> event loop. >> >> Hope this helps! >> >> >> >> -- >> Sean Fisk >> >> >> On Fri, Mar 14, 2014 at 12:00 AM, Frank Rueter | OHUfx >> > wrote: >> >> False alarm: >> Looks like the culprit wasn't the code but the debugger I was >> using spat it's dummy more or less silently. >> When I run the same code in a different interpreter it works >> as expected. >> >> >> >> >> On 14/03/14 14:30, Frank Rueter | OHUfx wrote: >>> after a much longer absence from this than anticipated, I'm >>> finally trying to get back into this. >>> I had a look at your example Sean and it makes sense so far. >>> Now I'm trying to follow your advise and use QThreadPool, >>> but am not finding any good examples on it's usage. >>> Unfortunately, the first example mentioned in the docs >>> >>> already throws an error for me: >>> >>> from PySide import QtCore >>> class HelloWorldTask(QtCore.QRunnable): >>> def run(self): >>> print "Hello world from thread", >>> QtCore.QThread.currentThread() >>> >>> hello = HelloWorldTask() >>> # QThreadPool takes ownership and deletes 'hello' automatically >>> QtCore.QThreadPool.globalInstance().start(hello) >>> >>> result: >>> Hello world from thread >>> Traceback (most recent call last): >>> File >>> "/ohufx/pipeline/tools/python/sandbox/QThreadPoolTest.py", >>> line 6, in run >>> print "Hello world from thread", >>> QtCore.QThread.currentThread() >>> AttributeError: 'NoneType' object has no attribute 'QThread' >>> >>> >>> >>> What am I missing here? >>> >>> Cheers, >>> frank >>> >>> >>> >>> >>> >>> On 28/01/14 08:00, Sean Fisk wrote: >>>> On Sat, Jan 25, 2014 at 2:38 AM, Frank Rueter | OHUfx >>>> > wrote: >>>> >>>> fantastic, thanks Sean!! >>>> I will examine this to make sure I understand >>>> everything, then give QThreadPool a whirl. Am more than >>>> happy to learn from more experienced people and adjust >>>> my approaches accordingly, so thanks a lot for your >>>> time with this! >>>> >>>> >>>> No problem! Let me know if you have any questions about the >>>> code. >>>> >>>> >>>> Cheers, >>>> frank >>>> >>>> >>>> >>>> On 25/01/14 20:03, Sean Fisk wrote: >>>>> >>>>> Hi Frank, >>>>> >>>>> I updated your example to hopefully work as you would >>>>> like. I added a progress bar update as well. I’m going >>>>> to make a last-ditch effort to convince you to stop >>>>> doing things manually with |QThread|, and move to >>>>> using |QThreadPool| >>>>> . >>>>> Everything about the |QThreadPool| API is much nicer, >>>>> and it’s worked much better for me in real projects. >>>>> Also, the Python ‘s |multiprocessing| >>>>> and >>>>> |concurrent.futures| >>>>> modules can work >>>>> well if you’re careful about your callbacks. >>>>> >>>>> Also, there is a large discussion about not overriding >>>>> the |run()| method of |QThread|. I don’t think >>>>> overriding it is so bad if you don’t need the thread >>>>> to be running an event loop of its own. I still prefer >>>>> the |QThreadPool| API, though. Someone please correct >>>>> me if this is totally wrong and there is never a >>>>> reason to override it. >>>>> >>>>> Here is the code: >>>>> >>>>> |#!/usr/bin/env python >>>>> >>>>> import sys >>>>> import time >>>>> >>>>> from PySideimport QtGui >>>>> from PySideimport QtCore >>>>> >>>>> TOTAL_WIDGETS =10 >>>>> >>>>> class Worker(QtCore.QObject): >>>>> processed = QtCore.Signal(int) >>>>> finished = QtCore.Signal() >>>>> >>>>> # Overriding this is not necessary if you're not doing anything in it. >>>>> >>>>> # def __init__(self): >>>>> # super(Worker, self).__init__() >>>>> >>>>> def helloWorld(self): >>>>> for iin xrange(TOTAL_WIDGETS): >>>>> # We sleep first to simulate an operation taking place. >>>>> time.sleep(0.5) >>>>> print 'hello %s' % i >>>>> self.processed.emit(i +1) >>>>> # Must manually emit the finished signal. >>>>> self.finished.emit() >>>>> >>>>> class MainUI(QtGui.QWidget): >>>>> def __init__(self, parent=None): >>>>> super(MainUI, self).__init__(parent) >>>>> self.extraThread = QtCore.QThread() >>>>> >>>>> # IMPORTANT: Don't quit the app until the thread has completed. Prevents errors like: >>>>> # >>>>> # QThread: Destroyed while thread is still running >>>>> # >>>>> QtGui.QApplication.instance().aboutToQuit.connect(self.quit) >>>>> >>>>> self.worker = Worker() >>>>> self.worker.moveToThread(self.extraThread) >>>>> self.setupUI() >>>>> self.connectSignalsAndSlots() >>>>> >>>>> def setupUI(self): >>>>> # CREAT MAIN LAYOUT AND WIDGETS >>>>> mainLayout = QtGui.QVBoxLayout() >>>>> btnLayout = QtGui.QHBoxLayout() >>>>> mainLayout.addLayout(btnLayout) >>>>> self.setLayout(mainLayout) >>>>> >>>>> self.progressBar = QtGui.QProgressBar(self) >>>>> self.progressBar.setRange(0, TOTAL_WIDGETS) >>>>> self.progressBar.setVisible(False) >>>>> self.btnWork = QtGui.QPushButton('Do Work') >>>>> self.btnCancel = QtGui.QPushButton('Cancel') >>>>> self.btnCancel.setDisabled(True) >>>>> >>>>> self.guiResponseProgressbar = QtGui.QProgressBar(self) >>>>> self.guiResponseProgressbar.setRange(0,0) >>>>> >>>>> self.outputWindow = QtGui.QTextEdit() >>>>> >>>>> mainLayout.addWidget(self.progressBar) >>>>> mainLayout.addWidget(self.outputWindow) >>>>> mainLayout.addWidget(self.guiResponseProgressbar) >>>>> >>>>> btnLayout.addWidget(self.btnWork) >>>>> btnLayout.addWidget(self.btnCancel) >>>>> >>>>> def connectSignalsAndSlots(self): >>>>> print 'connecting signals' >>>>> self.btnWork.clicked.connect(self.startWorker) >>>>> >>>>> # Pleas see . Bad bad bad bad bad. >>>>> # self.btnCancel.clicked.connect(self.extraThread.terminate) >>>>> >>>>> # THREAD STARTED >>>>> # Not necessary; just do this in startWorker. >>>>> # self.extraThread.started.connect(lambda: self.btnWork.setDisabled(True)) >>>>> # self.extraThread.started.connect(lambda: self.btnCancel.setEnabled(True)) >>>>> # self.extraThread.started.connect(self.progressBar.show) >>>>> self.extraThread.started.connect(self.worker.helloWorld) >>>>> >>>>> # THREAD FINISHED >>>>> # self.extraThread.finished.connect(lambda: self.btnCancel.setDisabled(True)) >>>>> # self.extraThread.finished.connect(self.extraThread.deleteLater) >>>>> # self.extraThread.finished.connect(self.worker.deleteLater) >>>>> self.extraThread.finished.connect(self.finished) >>>>> >>>>> # Connect worker signals. >>>>> self.worker.processed.connect(self.progressBar.setValue) >>>>> self.worker.finished.connect(self.finished) >>>>> >>>>> # SHOW PROGRESS BAR WHEN PUBLISHING STARTS >>>>> # self.extraThread.started.connect(self.progressBar.show) >>>>> # CONNECT PROCESS TO PROGRESS BAR AND OUTPUT WINDOW >>>>> # NOT DONE YET >>>>> >>>>> def startWorker(self): >>>>> # GO >>>>> self.btnWork.setDisabled(True) >>>>> self.btnCancel.setEnabled(True) >>>>> self.progressBar.show() >>>>> print 'starting worker thread' >>>>> self.extraThread.start() >>>>> >>>>> # THIS IS BLOCKING THE GUI THREAD! Try putting this back in and seeing >>>>> # what happens to the gui_response_progressbar. >>>>> >>>>> # for i in xrange(10): >>>>> # print 'from main thread:', i >>>>> # time.sleep(.3) >>>>> >>>>> def finished(self): >>>>> print 'finished' >>>>> self.btnCancel.setDisabled(True) >>>>> # self.extraThread.deleteLater() >>>>> # self.worker.deleteLater() >>>>> >>>>> def quit(self): >>>>> # Quit the thread's event loop. Note that this *doesn't* stop tasks >>>>> # running in the thread, it just stops the thread from dispatching >>>>> # events. >>>>> self.extraThread.quit() >>>>> # Wait for the thread to complete. If the thread's task is not done, >>>>> # this will block. >>>>> self.extraThread.wait() >>>>> >>>>> if __name__ =='__main__': >>>>> args = sys.argv >>>>> app = QtGui.QApplication(args) >>>>> p = MainUI() >>>>> p.show() >>>>> # Annoyance on Mac OS X. >>>>> p.raise_() >>>>> sys.exit(app.exec_())| >>>>> >>>>> Cheers, >>>>> >>>>> >>>>> >>>>> -- >>>>> Sean Fisk >>>>> >>>>> >>>>> On Sat, Jan 25, 2014 at 12:30 AM, Frank Rueter | OHUfx >>>>> > wrote: >>>>> >>>>> quick update: >>>>> I just learnt about connection types but those >>>>> didn't help either in this case: >>>>> http://qt-project.org/doc/qt-5/threads-qobject.html#signals-and-slots-across-threads >>>>> >>>>> >>>>> >>>>> >>>>> On 25/01/14 18:15, Frank Rueter | OHUfx wrote: >>>>>> And of course I ran into trouble :-D >>>>>> Here is my test code trying to ustilise QThread: >>>>>> http://pastebin.com/Q26Q9M1M >>>>>> >>>>>> The basic structure seems to work (the extra >>>>>> thread and the main thread are running at the >>>>>> same time), but my UI does not update according >>>>>> to the signal connections, e.g.: >>>>>> When the thread starts the progress bar is >>>>>> supposed to be shown, the "Do Work" button should >>>>>> be disabled, the "Cancel" button disabled. >>>>>> etc. >>>>>> >>>>>> I tried calling self.update() in the MainUI when >>>>>> the thread starts but to no avail. >>>>>> I'm sure I'm missing something obvious as usual. >>>>>> >>>>>> I tried to adhere to what I learnt on this list >>>>>> about threading and avoid sub-classing QThread. >>>>>> >>>>>> Cheers, >>>>>> frank >>>>>> >>>>>> On 24/01/14 17:41, Frank Rueter | OHUfx wrote: >>>>>>> Great, thanks. I shall adjust my code. >>>>>>> I am interested in seeing how you would go about >>>>>>> it, but let me have a go from scratch, I will be >>>>>>> able to understand things much better afterwards :) >>>>>>> >>>>>>> Cheers, >>>>>>> frank >>>>>>> >>>>>>> >>>>>>> On 24/01/14 17:38, Sean Fisk wrote: >>>>>>>> On Thu, Jan 23, 2014 at 10:44 PM, Frank Rueter >>>>>>>> | OHUfx >>>>>>> > wrote: >>>>>>>> >>>>>>>> Much appreciated but as I mentioned, I >>>>>>>> think I jumped the gun with my post and >>>>>>>> should be using QThread to hook the python >>>>>>>> code to my QProgressBar and debug output >>>>>>>> window (QTextEdit). >>>>>>>> >>>>>>>> That would be a correct way to use >>>>>>>> |QProgressBar|. Also, for subprocess output, I >>>>>>>> would consider using |QPlainTextEdit| instead >>>>>>>> of |QTextEdit| as is is more performant with >>>>>>>> high amounts of text. >>>>>>>> >>>>>>>> If you are interested, I just wrote an >>>>>>>> asynchronous module for PySide for the project >>>>>>>> on which I am currently working. It is based on >>>>>>>> Python’s futures >>>>>>>> module and >>>>>>>> works great with Qt’s signals/slots. Although >>>>>>>> the project is primarily closed-source, I would >>>>>>>> be happy to share the async implementation with >>>>>>>> you. I don’t know if would fit your needs, but >>>>>>>> for us it’s much easier than manually spawning >>>>>>>> |QThread|s and even easier than |QThreadPool|. >>>>>>>> >>>>>>>> Good luck! >>>>>>>> >>>>>>>> I will investigate that now >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On 24/01/14 16:08, Sean Fisk wrote: >>>>>>>>> On Thu, Jan 23, 2014 at 9:42 PM, Frank >>>>>>>>> Rueter | OHUfx >>>>>>>> > wrote: >>>>>>>>> >>>>>>>>> Thanks Sean and Ryan, >>>>>>>>> >>>>>>>>> I'm still not quite clear on how this >>>>>>>>> ties into QProcess.start() >>>>>>>>> >>>>>>>>> >>>>>>>>> It doesn’t tie in with |QProcess| at all. >>>>>>>>> We’re advising to avoid using that :) >>>>>>>>> >>>>>>>>> I do have a if __name__ ... block in >>>>>>>>> the script in question. >>>>>>>>> An example would certainly be awesome, >>>>>>>>> but if it's less hassle, explaining >>>>>>>>> how your and Ryan's advise helps use >>>>>>>>> QProcess on a python module might >>>>>>>>> already suffice. Maybe a simlpe >>>>>>>>> example says it all though?! >>>>>>>>> >>>>>>>>> >>>>>>>>> I will whip up a simple example for you, >>>>>>>>> but it might take a few hours (lots of >>>>>>>>> stuff to do right now). >>>>>>>>> >>>>>>>>> I'm not using python 3 btw >>>>>>>>> >>>>>>>>> Thanks guys for your help!! >>>>>>>>> >>>>>>>>> frank >>>>>>>>> >>>>>>>>> >>>>>>>>> On 24/01/14 15:33, Sean Fisk wrote: >>>>>>>>>> >>>>>>>>>> Hi Frank, >>>>>>>>>> >>>>>>>>>> You should definitely avoid calling >>>>>>>>>> Python as a subprocess if you can. As >>>>>>>>>> far as Ryan’s example, I agree with >>>>>>>>>> the |if __name__...| but I think that >>>>>>>>>> using the |imp| module is a bit >>>>>>>>>> overkill. I would recommend using >>>>>>>>>> Setuptool’s |entry_points| keyword >>>>>>>>>> . >>>>>>>>>> Or distutils’ |scripts| keyword >>>>>>>>>> , >>>>>>>>>> if you must. >>>>>>>>>> >>>>>>>>>> An example of a well-known Python >>>>>>>>>> package which does this is Pygments >>>>>>>>>> , >>>>>>>>>> which has a large “library” component >>>>>>>>>> but also comes with the |pygmentize| >>>>>>>>>> command-line script. The Pygments >>>>>>>>>> codebase is pretty large, so if you >>>>>>>>>> would like me to whip up a simpler >>>>>>>>>> example I’d be glad to do so. >>>>>>>>>> >>>>>>>>>> Cheers, >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Sean Fisk >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Thu, Jan 23, 2014 at 9:17 PM, >>>>>>>>>> Frank Rueter | OHUfx >>>>>>>>> > wrote: >>>>>>>>>> >>>>>>>>>> Sorry if I'm being thick, but I'm >>>>>>>>>> not quite understanding how this >>>>>>>>>> helps to connect a python >>>>>>>>>> function to qprocess?! All your >>>>>>>>>> code does is execute the script, >>>>>>>>>> right?! >>>>>>>>>> I can already call >>>>>>>>>> myscript.main() straight up, but >>>>>>>>>> maybe I'm missing the point as >>>>>>>>>> I'm unfamiliar with the imp module. >>>>>>>>>> >>>>>>>>>> Let me elaborate a little bit more: >>>>>>>>>> myscript.main() calls a bunch of >>>>>>>>>> other python scripts that >>>>>>>>>> (directly or through other >>>>>>>>>> scripts again) execute external >>>>>>>>>> programs to do some conversion >>>>>>>>>> work. Those external programs >>>>>>>>>> spit out their progress to stdout >>>>>>>>>> which I can see fine when I run >>>>>>>>>> myscript.main() manually in a >>>>>>>>>> python terminal. >>>>>>>>>> >>>>>>>>>> Now I need run myscript.main() >>>>>>>>>> via QProcess and grab stdout to >>>>>>>>>> do be able to show a progress bar >>>>>>>>>> as well as show stdout and stderr >>>>>>>>>> in a debug window inside my QT code. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Cheers, >>>>>>>>>> frank >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On 24/01/14 14:58, Ryan Gonzalez >>>>>>>>>> wrote: >>>>>>>>>>> If you put an "if __name__ == >>>>>>>>>>> '__main__'" and a main >>>>>>>>>>> functions, you could always >>>>>>>>>>> import the script from the GUI >>>>>>>>>>> frontend. Example: >>>>>>>>>>> >>>>>>>>>>> myscript.py >>>>>>>>>>> >>>>>>>>>>> def main(argv): >>>>>>>>>>> do_cool_stuff() >>>>>>>>>>> return 0 >>>>>>>>>>> >>>>>>>>>>> if __name__ == '__main__': >>>>>>>>>>> sys.exit(main(sys.argv)) >>>>>>>>>>> >>>>>>>>>>> mygui.py(Python 2): >>>>>>>>>>> >>>>>>>>>>> import imp >>>>>>>>>>> >>>>>>>>>>> ... >>>>>>>>>>> >>>>>>>>>>> main = >>>>>>>>>>> imp.load_module('myscript', >>>>>>>>>>> *imp.find_module('myscript')) >>>>>>>>>>> >>>>>>>>>>> main.main(my_argv) >>>>>>>>>>> >>>>>>>>>>> mygui.py(Python 3): >>>>>>>>>>> >>>>>>>>>>> import importlib.machinery >>>>>>>>>>> >>>>>>>>>>> main = >>>>>>>>>>> importlib.machinery.SourceFileLoader('myscript', >>>>>>>>>>> 'myscript.py').load_module('myscript') >>>>>>>>>>> >>>>>>>>>>> main.main(my_argv) >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Thu, Jan 23, 2014 at 7:48 PM, >>>>>>>>>>> Frank Rueter | OHUfx >>>>>>>>>>> >>>>>>>>>> > wrote: >>>>>>>>>>> >>>>>>>>>>> Hi all, >>>>>>>>>>> >>>>>>>>>>> I got a little code design >>>>>>>>>>> question: >>>>>>>>>>> >>>>>>>>>>> I have a python script that >>>>>>>>>>> does a lot of file >>>>>>>>>>> processing/converting/uploading >>>>>>>>>>> etc and I'd like to write a >>>>>>>>>>> decent >>>>>>>>>>> interface for it now. >>>>>>>>>>> The main goal is to be able >>>>>>>>>>> to show the user detailed >>>>>>>>>>> info about the >>>>>>>>>>> current step and progress as >>>>>>>>>>> well as clean up properly in >>>>>>>>>>> case the whole >>>>>>>>>>> thing is cancelled. >>>>>>>>>>> >>>>>>>>>>> My existing python code >>>>>>>>>>> needs to stay independent of >>>>>>>>>>> QT so any >>>>>>>>>>> application that supports >>>>>>>>>>> python can use it. >>>>>>>>>>> I am wondering now how to >>>>>>>>>>> best connect the python >>>>>>>>>>> script and the PySide >>>>>>>>>>> code. Should I just run the >>>>>>>>>>> script as an argument to the >>>>>>>>>>> python >>>>>>>>>>> interpreter like I would >>>>>>>>>>> with any other program? E.g.: >>>>>>>>>>> >>>>>>>>>>> process = QtCore.QProcess(self) >>>>>>>>>>> process.start(, >>>>>>>>>>> ) >>>>>>>>>>> >>>>>>>>>>> As simple as this seems, it >>>>>>>>>>> feels odd to use python to >>>>>>>>>>> call itself as an >>>>>>>>>>> external program. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> I'm happy to go that way but >>>>>>>>>>> am curious how others are >>>>>>>>>>> doing this?! >>>>>>>>>>> >>>>>>>>>>> Cheers, >>>>>>>>>>> frank >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> PySide mailing list >>>>>>>>>>> PySide at qt-project.org >>>>>>>>>>> >>>>>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> Ryan >>>>>>>>>>> If anybody ever asks me why I >>>>>>>>>>> prefer C++ to C, my answer will >>>>>>>>>>> be simple: "It's >>>>>>>>>>> becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. >>>>>>>>>>> Wait, I don't think that was >>>>>>>>>>> nul-terminated." >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> PySide mailing list >>>>>>>>>> PySide at qt-project.org >>>>>>>>>> >>>>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> PySide mailing list >>>>>>> PySide at qt-project.org >>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> PySide mailing list >>>>>> PySide at qt-project.org >>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>> >>>>> >>>>> _______________________________________________ >>>>> PySide mailing list >>>>> PySide at qt-project.org >>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>> >>>>> >>>> >>>> >>> >>> -- >>> ohufxLogo 50x50 *vfx compositing >>> | *workflow >>> customisation and consulting >>> * * >>> >>> >>> >>> _______________________________________________ >>> PySide mailing list >>> PySide at qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/pyside >> >> -- >> ohufxLogo 50x50 *vfx compositing >> | *workflow >> customisation and consulting >> * * >> >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside >> >> > > -- > ohufxLogo 50x50 *vfx compositing > | *workflow > customisation and consulting > * * > > -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From me at the-compiler.org Thu Jul 23 09:22:00 2015 From: me at the-compiler.org (Florian Bruhin) Date: Thu, 23 Jul 2015 09:22:00 +0200 Subject: [PySide] using QProcess to run python function In-Reply-To: <55B067F1.2080501@ohufx.com> References: <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> <53227ED7.7020607@ohufx.com> <53228524.20102@ohufx.com> <55B067F1.2080501@ohufx.com> Message-ID: <20150723072159.GZ18503@tonks> (disclaimer: I didn't read your whole quoted private discussion as this seems to be the first mail going to the pyside mailinglist) * Frank Rueter | OHUfx [2015-07-23 16:05:05 +1200]: > [...] > The question is how do I emit the stdout from dummyFunction() while it's > running (it takes a minute or so to finish all sorts of tasks)? Do I have to > move it to an extra thread again and connect to that? There are some solutions I can imagine for this - but it all really depends on how dummyFunction() looks and how it prints to stdout. (Can't you just make it do something more sane than printing to stdout?) Florian -- http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From frank at ohufx.com Thu Jul 23 23:17:52 2015 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 24 Jul 2015 09:17:52 +1200 Subject: [PySide] using QProcess to run python function In-Reply-To: <20150723072159.GZ18503@tonks> References: <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> <53227ED7.7020607@ohufx.com> <53228524.20102@ohufx.com> <55B067F1.2080501@ohufx.com> <20150723072159.GZ18503@tonks> Message-ID: <55B15A00.80407@ohufx.com> Hi Florian, thanks for the reply. This entire thread was posted here, not sure why it wouldn't show up for you. >>it all really depends on how dummyFunction() looks and how it prints to stdout. It's python code that calls calls other python code which eventually calls external image processing programs to do some heavy lifting, which print their progress to stdout. E.g.: dummyFunction() calls fucntionA() which calls fucntionB() which runs the external program via Popen.subprocess. I'm happy to restructure a bit as long as the functions that deal with managing the external program stay non-QT so they can be used via command line without QT present. Cheers, frank On 23/07/15 7:22 pm, Florian Bruhin wrote: > (disclaimer: I didn't read your whole quoted private discussion as > this seems to be the first mail going to the pyside mailinglist) > > * Frank Rueter | OHUfx [2015-07-23 16:05:05 +1200]: >> [...] >> The question is how do I emit the stdout from dummyFunction() while it's >> running (it takes a minute or so to finish all sorts of tasks)? Do I have to >> move it to an extra thread again and connect to that? > There are some solutions I can imagine for this - but it all really > depends on how dummyFunction() looks and how it prints to stdout. > > (Can't you just make it do something more sane than printing to > stdout?) > > Florian > -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From frank at ohufx.com Sun Jul 26 08:21:30 2015 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Sun, 26 Jul 2015 18:21:30 +1200 Subject: [PySide] using QProcess to run python function In-Reply-To: <55B15A00.80407@ohufx.com> References: <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> <53227ED7.7020607@ohufx.com> <53228524.20102@ohufx.com> <55B067F1.2080501@ohufx.com> <20150723072159.GZ18503@tonks> <55B15A00.80407@ohufx.com> Message-ID: <55B47C6A.7060400@ohufx.com> Looks like I finally got what I was after. This thread seems to be the solution for my situation (combined with Sean's QThreadPool example): http://stackoverflow.com/questions/8356336/how-to-capture-output-of-pythons-interpreter-and-show-in-a-text-widget Thanks everybody for bearing with me. frank On 24/07/15 09:17, Frank Rueter | OHUfx wrote: > Hi Florian, > thanks for the reply. This entire thread was posted here, not sure why > it wouldn't show up for you. > > >>it all really depends on how dummyFunction() looks and how it prints > to stdout. > It's python code that calls calls other python code which eventually > calls external image processing programs to do some heavy lifting, > which print their progress to stdout. E.g.: > dummyFunction() calls fucntionA() which calls fucntionB() which runs > the external program via Popen.subprocess. > > I'm happy to restructure a bit as long as the functions that deal with > managing the external program stay non-QT so they can be used via > command line without QT present. > > Cheers, > frank > > > On 23/07/15 7:22 pm, Florian Bruhin wrote: >> (disclaimer: I didn't read your whole quoted private discussion as >> this seems to be the first mail going to the pyside mailinglist) >> >> * Frank Rueter | OHUfx [2015-07-23 16:05:05 +1200]: >>> [...] >>> The question is how do I emit the stdout from dummyFunction() while it's >>> running (it takes a minute or so to finish all sorts of tasks)? Do I have to >>> move it to an extra thread again and connect to that? >> There are some solutions I can imagine for this - but it all really >> depends on how dummyFunction() looks and how it prints to stdout. >> >> (Can't you just make it do something more sane than printing to >> stdout?) >> >> Florian >> > > -- > ohufxLogo 50x50 *vfx compositing > | *workflow customisation > and consulting * * > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: