From frank at ohufx.com Fri Oct 20 06:17:38 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 20 Oct 2017 17:17:38 +1300 Subject: [PySide] auto scrolling QTextEdit Message-ID: HI guys, been really quiet in here, hopefully this channel is still used. Quick question: I am using a QTextEdit ti print output from an external process which is run via QProcess. However, QTextEdit does nto auto-scroll when the output fills up the widget. Based on info I found online I put this code together in the slot that feeds the stdout to my widget: cursor = self.outputWidget.textCursor() cursor.movePosition(cursor.End) cursor.insertText(unicode(self.process.readAll())) # trying to auto-scroll but tit won't work: sb = self.outputWidget.verticalScrollBar() sb.setValue(sb.maximum()) self.outputWidget.ensureCursorVisible() Can somebody help please? Cheers, frank -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at ohufx.com Fri Oct 20 07:18:15 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 20 Oct 2017 18:18:15 +1300 Subject: [PySide] auto scrolling QTextEdit In-Reply-To: References: Message-ID: I found the problem I think. Seems like I have to setTextCursor(cursor) after insertion. I missed the bit in the docs that said textCursor() returns a *copy* of the cursor object. On 10/20/2017 05:17 PM, Frank Rueter | OHUfx wrote: > HI guys, > > been really quiet in here, hopefully this channel is still used. > Quick question: > I am using a QTextEdit ti print output from an external process which > is run via QProcess. > However, QTextEdit does nto auto-scroll when the output fills up the > widget. > Based on info I found online I put this code together in the slot that > feeds the stdout to my widget: > > cursor = self.outputWidget.textCursor() > cursor.movePosition(cursor.End) > cursor.insertText(unicode(self.process.readAll())) > > # trying to auto-scroll but tit won't work: > sb = self.outputWidget.verticalScrollBar() > sb.setValue(sb.maximum()) > self.outputWidget.ensureCursorVisible() > > > Can somebody help please? > > Cheers, > frank > > > -- > ohufxLogo 50x50 *vfx compositing > | *workflow customisation > and consulting * * > > > > _______________________________________________ > 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 Sun Oct 22 08:21:57 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Sun, 22 Oct 2017 19:21:57 +1300 Subject: [PySide] subclassing dict to connect to QT signal Message-ID: <13fdd8ef-9eaf-c0a2-484c-3e7687051bf2@ohufx.com> Hi all, I am trying to subclass dict in order to connect it to a QT signal which will create a value in a predetermined key. This is what I got: class CustomDict(dict): '''Container for a simple version dictionary to be able to connect a signal to it''' def setData(self, data): self['my_custom_data'] = data However, when I try to connect the setData method I get this: worker.receivedData.connect(customDict.setData) TypeError: unhashable type: 'CustomDict' Can somebody help me understand what's going on? Cheers, frank -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: From jorge at esavara.cr Sun Oct 22 09:03:06 2017 From: jorge at esavara.cr (Jorge Javier Araya Navarro) Date: Sun, 22 Oct 2017 01:03:06 -0600 Subject: [PySide] subclassing dict to connect to QT signal In-Reply-To: <13fdd8ef-9eaf-c0a2-484c-3e7687051bf2@ohufx.com> References: <13fdd8ef-9eaf-c0a2-484c-3e7687051bf2@ohufx.com> Message-ID: <874lqru0k5.fsf@esavara.cr> In my opinion, instead of trying to use inheritance, you may want to use composition. Thus, you create a class based on `QtCore.QObject` and make it to keep the dictionary you want to manipulate as an attribute of the class. El domingo 22 de octubre del 2017 a las 0621 horas, Frank Rueter escribió: > Hi all, > > I am trying to subclass dict in order to connect it to a QT signal which > will create a value in a predetermined key. > > This is what I got: > > class CustomDict(dict): > '''Container for a simple version dictionary to be able to connect > a signal to it''' > > def setData(self, data): > self['my_custom_data'] = data > > > However, when I try to connect the setData method I get this: > > worker.receivedData.connect(customDict.setData) > > TypeError: unhashable type: 'CustomDict' > > > Can somebody help me understand what's going on? > > Cheers, > frank -- 👋 Pax et bonum. Jorge Javier Araya Navarro http://www.esavara.cr From frank at ohufx.com Sun Oct 22 09:19:37 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Sun, 22 Oct 2017 20:19:37 +1300 Subject: [PySide] subclassing dict to connect to QT signal In-Reply-To: <874lqru0k5.fsf@esavara.cr> References: <13fdd8ef-9eaf-c0a2-484c-3e7687051bf2@ohufx.com> <874lqru0k5.fsf@esavara.cr> Message-ID: Thanks, that is exactly what I have done for now, but I thought subclassing dict was more to the point in context of what I was trying to achieve. But I'm happy either way. Thanks for the advice! frank On 10/22/2017 08:03 PM, Jorge Javier Araya Navarro wrote: > In my opinion, instead of trying to use inheritance, you may want to use composition. > > Thus, you create a class based on `QtCore.QObject` and make it to keep the dictionary you want to > manipulate as an attribute of the class. > > El domingo 22 de octubre del 2017 a las 0621 horas, Frank Rueter escribió: > >> Hi all, >> >> I am trying to subclass dict in order to connect it to a QT signal which >> will create a value in a predetermined key. >> >> This is what I got: >> >> class CustomDict(dict): >> '''Container for a simple version dictionary to be able to connect >> a signal to it''' >> >> def setData(self, data): >> self['my_custom_data'] = data >> >> >> However, when I try to connect the setData method I get this: >> >> worker.receivedData.connect(customDict.setData) >> >> TypeError: unhashable type: 'CustomDict' >> >> >> Can somebody help me understand what's going on? >> >> Cheers, >> frank > > -- > 👋 Pax et bonum. > Jorge Javier Araya Navarro > http://www.esavara.cr From frank at ohufx.com Sun Oct 22 10:18:41 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Sun, 22 Oct 2017 21:18:41 +1300 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver Message-ID: Hi, I am downloading a few images in a separate thread using QRunnable. To download I am just using urllib2.urlopen() like this: [...] def run(self): imageData = urllib2.urlopen(self.url).read() print 'emitted:', imageData self.signals.receivedData.emit(imageData) # this signal is declared like this: QtCore.Signal(str) However, the receiving slot is receiving nothing: def setPixmap(self, imageData): print 'received:', imageData pixmap = QtGui.QPixmap() pixmap.loadFromData(imageData) self.data['pixmap'] = pixmap I guess this is too naive an approach to download image data in a separate thread?! How can I fix this please? Cheers, frank -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at ohufx.com Sun Oct 22 11:19:47 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Sun, 22 Oct 2017 22:19:47 +1300 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver In-Reply-To: References: Message-ID: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> quick follow up: I am now writing the files to a temp directory and only passing the respective path via the signal, but I'm still curious how I would do this without writing anything to disk. Cheers, frank On 10/22/2017 09:18 PM, Frank Rueter | OHUfx wrote: > Hi, > > I am downloading a few images in a separate thread using QRunnable. > To download I am just using urllib2.urlopen() like this: > > [...] > def run(self): > imageData = urllib2.urlopen(self.url).read() > print 'emitted:', imageData > self.signals.receivedData.emit(imageData) # this signal is > declared like this: QtCore.Signal(str) > > > However, the receiving slot is receiving nothing: > > def setPixmap(self, imageData): > print 'received:', imageData > pixmap = QtGui.QPixmap() > pixmap.loadFromData(imageData) > self.data['pixmap'] = pixmap > > > I guess this is too naive an approach to download image data in a > separate thread?! > > How can I fix this please? > > Cheers, > frank > > > -- > ohufxLogo 50x50 *vfx compositing > | *workflow customisation > and consulting * * > > > > _______________________________________________ > 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 erik.johansson at fido.se Sun Oct 22 18:36:46 2017 From: erik.johansson at fido.se (Erik Johansson) Date: Sun, 22 Oct 2017 18:36:46 +0200 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver In-Reply-To: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> References: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> Message-ID: Had the same problem. Solved it by creating a QImage and emitting that. Cheers, Erik On Sun, Oct 22, 2017 at 11:19 AM, Frank Rueter | OHUfx wrote: > quick follow up: > I am now writing the files to a temp directory and only passing the > respective path via the signal, but I'm still curious how I would do this > without writing anything to disk. > > Cheers, > frank > > > On 10/22/2017 09:18 PM, Frank Rueter | OHUfx wrote: > > Hi, > > I am downloading a few images in a separate thread using QRunnable. > To download I am just using urllib2.urlopen() like this: > > [...] > def run(self): > imageData = urllib2.urlopen(self.url).read() > print 'emitted:', imageData > self.signals.receivedData.emit(imageData) # this signal is > declared like this: QtCore.Signal(str) > > > However, the receiving slot is receiving nothing: > > def setPixmap(self, imageData): > print 'received:', imageData > pixmap = QtGui.QPixmap() > pixmap.loadFromData(imageData) > self.data['pixmap'] = pixmap > > > I guess this is too naive an approach to download image data in a separate > thread?! > > How can I fix this please? > > Cheers, > frank > > > -- > [image: ohufxLogo 50x50] *vfx compositing > | workflow customisation and > consulting * > > > _______________________________________________ > PySide mailing listPySide at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/pyside > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -- *ERIK JOHANSSON* Pipeline TD *GOODBYE KANSAS STUDIOS* Rosenlundsgatan 40, 4th floor 118 53 Stockholm, Sweden Ph: +46 8 556 990 00 <+46855699000> www.goodbyekansas.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From renaudtalon at fusefx.com Sun Oct 22 20:54:37 2017 From: renaudtalon at fusefx.com (Renaud Talon) Date: Sun, 22 Oct 2017 18:54:37 +0000 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver In-Reply-To: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> References: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> Message-ID: Hi Frank ! I first attempted to re-create your issue but I didn’t have any problem on my end. ( using PySide2 + Python3) That said when I tried the same thing using Python2 I had the same issue as you did. I made a few changes and here is an example I created for you which works for both Python 2 and 3. https://gitlab.com/talonrenaud/codeSharing/blob/master/urlImgLoader.py When using Python 3 “urllib.urlopen” returns a “bytes” object which PySide2 has no problem emitting and receiving as such: receivedData = Signal(bytes) With Python 2 though using “urllib2.urlopen” I can print the image data within the thread and when checking the type it says “str” (which is fine since “str” and “bytes” are the same from what I understand in Py2) That said after emitting the imgData as a string when I print the imgData type received from the signal it says “Unicode” instead of string and no matter what encoding I set it to (ascii, utf-8, utf-16) I can no longer read/print the imageData. I am not sure why, this could be a Py2 + PySide2 bug or issue ? To get around the issue I converted the data to a BytesIO object using the “io” module, setup the signal to use a “BytesIO” type instead of a “str” and that seems to work fine: receivedData = Signal(io.BytesIO) I am not sure if this is the most elegant way. I’m curious to know what you guys think about this. Take care, Renaud _______________________________________________ Renaud Talon Pipeline / TD FuseFX 14823 Califa Street Los Angeles, CA 91411 Office: 818-237-5052 Mobile: 310-430-8834 www.FuseFX.com From: PySide [mailto:pyside-bounces+renaudtalon=fusefx.com at qt-project.org] On Behalf Of Frank Rueter | OHUfx Sent: Sunday, October 22, 2017 2:20 AM To: pyside at qt-project.org Subject: Re: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver quick follow up: I am now writing the files to a temp directory and only passing the respective path via the signal, but I'm still curious how I would do this without writing anything to disk. Cheers, frank On 10/22/2017 09:18 PM, Frank Rueter | OHUfx wrote: Hi, I am downloading a few images in a separate thread using QRunnable. To download I am just using urllib2.urlopen() like this: [...] def run(self): imageData = urllib2.urlopen(self.url).read() print 'emitted:', imageData self.signals.receivedData.emit(imageData) # this signal is declared like this: QtCore.Signal(str) However, the receiving slot is receiving nothing: def setPixmap(self, imageData): print 'received:', imageData pixmap = QtGui.QPixmap() pixmap.loadFromData(imageData) self.data['pixmap'] = pixmap I guess this is too naive an approach to download image data in a separate thread?! How can I fix this please? Cheers, frank -- [ohufxLogo 50x50] vfx compositing | workflow customisation and consulting _______________________________________________ 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 Mon Oct 23 02:38:52 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Mon, 23 Oct 2017 13:38:52 +1300 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver In-Reply-To: References: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> Message-ID: <3d48cd32-7ea2-95a4-24e8-d4328025c234@ohufx.com> Great, thank you very much for this! frank On 10/23/2017 07:54 AM, Renaud Talon wrote: > > Hi Frank ! > > I first attempted to re-create your issue but I didn’t have any > problem on my end. ( using PySide2 + Python3) > > That said when I tried the same thing using Python2 I had the same > issue as you did. I made a few changes and here is an example I > created for you which works for both Python 2 and 3. > > https://gitlab.com/talonrenaud/codeSharing/blob/master/urlImgLoader.py > > When using Python 3 “urllib.urlopen” returns a “bytes” object which > PySide2 has no problem emitting and receiving as such: receivedData = > Signal(bytes) > > With Python 2 though using “urllib2.urlopen” I can print the image > data within the thread and when checking the type it says “str” (which > is fine since “str” and “bytes” are the same from what I understand in > Py2) > > That said after emitting the imgData as a string when I print the > imgData type received from the signal it says “Unicode” instead of > string and no matter what encoding I set it to (ascii, utf-8, utf-16) > I can no longer read/print the imageData. > > I am not sure why, this could be a Py2 + PySide2 bug or issue ? > > To get around the issue I converted the data to a BytesIO object using > the “io” module, setup the signal to use a “BytesIO” type instead of a > “str” and that seems to work fine: receivedData = Signal(io.BytesIO) > > I am not sure if this is the most elegant way. I’m curious to know > what you guys think about this. > > Take care, > > Renaud > > *_______________________________________________* > > *Renaud Talon* > > Pipeline / TD > > *FuseFX* > > 14823 Califa Street > > Los Angeles, CA 91411 > > Office: 818-237-5052 > > Mobile: 310-430-8834 > > *www.FuseFX.com * > > *From:*PySide > [mailto:pyside-bounces+renaudtalon=fusefx.com at qt-project.org] *On > Behalf Of *Frank Rueter | OHUfx > *Sent:* Sunday, October 22, 2017 2:20 AM > *To:* pyside at qt-project.org > *Subject:* Re: [PySide] sending data from urllib2.urlopen().read() via > signal corrupts in receiver > > quick follow up: > I am now writing the files to a temp directory and only passing the > respective path via the signal, but I'm still curious how I would do > this without writing anything to disk. > > Cheers, > frank > > On 10/22/2017 09:18 PM, Frank Rueter | OHUfx wrote: > > Hi, > > I am downloading a few images in a separate thread using QRunnable. > To download I am just using urllib2.urlopen() like this: > > [...] > def run(self): > imageData = urllib2.urlopen(self.url).read() > print 'emitted:', imageData > self.signals.receivedData.emit(imageData) # this signal is > declared like this: QtCore.Signal(str) > > > However, the receiving slot is receiving nothing: > > def setPixmap(self, imageData): > print 'received:', imageData > pixmap = QtGui.QPixmap() > pixmap.loadFromData(imageData) > self.data['pixmap'] = pixmap > > > I guess this is too naive an approach to download image data in a > separate thread?! > > How can I fix this please? > > Cheers, > frank > > -- > > ohufxLogo 50x50 > > > > *vfx compositing **| > **workflow customisation and consulting > * > > > > > _______________________________________________ > > 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 Mon Oct 23 02:40:02 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Mon, 23 Oct 2017 13:40:02 +1300 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver In-Reply-To: References: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> Message-ID: <888da8da-efcd-bc42-2258-74ef10ed20e9@ohufx.com> Interesting. I assumed you can't do that between different threads to I never tried it. On 10/23/2017 05:36 AM, Erik Johansson wrote: > Had the same problem. > > Solved it by creating a QImage and emitting that. > > Cheers, > Erik > > On Sun, Oct 22, 2017 at 11:19 AM, Frank Rueter | OHUfx > > wrote: > > quick follow up: > I am now writing the files to a temp directory and only passing > the respective path via the signal, but I'm still curious how I > would do this without writing anything to disk. > > Cheers, > frank > > > On 10/22/2017 09:18 PM, Frank Rueter | OHUfx wrote: >> Hi, >> >> I am downloading a few images in a separate thread using QRunnable. >> To download I am just using urllib2.urlopen() like this: >> >> [...] >> def run(self): >> imageData = urllib2.urlopen(self.url).read() >> print 'emitted:', imageData >> self.signals.receivedData.emit(imageData) # this signal >> is declared like this: QtCore.Signal(str) >> >> >> However, the receiving slot is receiving nothing: >> >> def setPixmap(self, imageData): >> print 'received:', imageData >> pixmap = QtGui.QPixmap() >> pixmap.loadFromData(imageData) >> self.data['pixmap'] = pixmap >> >> >> I guess this is too naive an approach to download image data in a >> separate thread?! >> >> How can I fix this please? >> >> Cheers, >> frank >> >> >> -- >> ohufxLogo 50x50 *vfx compositing >> | *workflow >> customisation and consulting >> * * >> >> >> >> _______________________________________________ >> 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 > > > > > > -- > > * > ERIK JOHANSSON* > Pipeline TD > > *GOODBYE KANSAS STUDIOS* > Rosenlundsgatan 40, 4th floor > 118 53 Stockholm, Sweden > > Ph: +46 8 556 990 00 > www.goodbyekansas.com > > > > _______________________________________________ > 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 renaudtalon at fusefx.com Mon Oct 23 02:50:42 2017 From: renaudtalon at fusefx.com (Renaud Talon) Date: Mon, 23 Oct 2017 00:50:42 +0000 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver In-Reply-To: <888da8da-efcd-bc42-2258-74ef10ed20e9@ohufx.com> References: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> , <888da8da-efcd-bc42-2258-74ef10ed20e9@ohufx.com> Message-ID: If you’re talking about a QRunnable receiving data from another QRunnable you are correct. QRunnable can’t receive data through signals. I learned that the hard way recently. You have to use QThread or Qt Concurent if you want to do that, see table called “Comparison of Solutions” here : http://doc.qt.io/qt-5/threads-technologies.html From: Frank Rueter | OHUfx Sent: Sunday, October 22, 2017 5:40 PM To: pyside at qt-project.org Subject: Re: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver Interesting. I assumed you can't do that between different threads to I never tried it. On 10/23/2017 05:36 AM, Erik Johansson wrote: Had the same problem. Solved it by creating a QImage and emitting that. Cheers, Erik On Sun, Oct 22, 2017 at 11:19 AM, Frank Rueter | OHUfx > wrote: quick follow up: I am now writing the files to a temp directory and only passing the respective path via the signal, but I'm still curious how I would do this without writing anything to disk. Cheers, frank On 10/22/2017 09:18 PM, Frank Rueter | OHUfx wrote: Hi, I am downloading a few images in a separate thread using QRunnable. To download I am just using urllib2.urlopen() like this: [...] def run(self): imageData = urllib2.urlopen(self.url).read() print 'emitted:', imageData self.signals.receivedData.emit(imageData) # this signal is declared like this: QtCore.Signal(str) However, the receiving slot is receiving nothing: def setPixmap(self, imageData): print 'received:', imageData pixmap = QtGui.QPixmap() pixmap.loadFromData(imageData) self.data['pixmap'] = pixmap I guess this is too naive an approach to download image data in a separate thread?! How can I fix this please? Cheers, frank -- [ohufxLogo 50x50] vfx compositing | workflow customisation and consulting _______________________________________________ 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 -- ERIK JOHANSSON Pipeline TD GOODBYE KANSAS STUDIOS Rosenlundsgatan 40, 4th floor 118 53 Stockholm, Sweden Ph: +46 8 556 990 00 www.goodbyekansas.com _______________________________________________ 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 Mon Oct 23 04:12:08 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Mon, 23 Oct 2017 15:12:08 +1300 Subject: [PySide] sending data from urllib2.urlopen().read() via signal corrupts in receiver In-Reply-To: References: <7cde6109-59b8-96a6-5077-2d150430b082@ohufx.com> <888da8da-efcd-bc42-2258-74ef10ed20e9@ohufx.com> Message-ID: <242b3727-425a-3ba9-8ff0-61ab5e254ec1@ohufx.com> I am just sending a signal from a worker thread to the main thread. But since QPixmap can't be passed betwen threads I thought QImage can't either. Great link, thank you! For my next task I need to turn a loop that spawns various QProcesses into a queu to control the max number of concurrent processes. I am hoping to just use QRunnable to launch a QProcess and control the max number of threads via the global QThreadPool(). But will check that link if this approach is the right now. Cheers, frank On 10/23/2017 01:50 PM, Renaud Talon wrote: > > If you’re talking about a QRunnable receiving data from another > QRunnable you are correct. QRunnable can’t receive data through > signals. I learned that the hard way recently. > > You have to use QThread or Qt Concurent if you want to do that, see > table called “Comparison of Solutions” here : > > http://doc.qt.io/qt-5/threads-technologies.html > > *From: *Frank Rueter | OHUfx > *Sent: *Sunday, October 22, 2017 5:40 PM > *To: *pyside at qt-project.org > *Subject: *Re: [PySide] sending data from urllib2.urlopen().read() via > signal corrupts in receiver > > Interesting. I assumed you can't do that between different threads to > I never tried it. > > On 10/23/2017 05:36 AM, Erik Johansson wrote: > > Had the same problem. > > Solved it by creating a QImage and emitting that. > > Cheers, > > Erik > > On Sun, Oct 22, 2017 at 11:19 AM, Frank Rueter | OHUfx > > wrote: > > quick follow up: > I am now writing the files to a temp directory and only > passing the respective path via the signal, but I'm still > curious how I would do this without writing anything to disk. > > Cheers, > frank > > On 10/22/2017 09:18 PM, Frank Rueter | OHUfx wrote: > > Hi, > > I am downloading a few images in a separate thread using > QRunnable. > To download I am just using urllib2.urlopen() like this: > > [...] > def run(self): > imageData = urllib2.urlopen(self.url).read() > print 'emitted:', imageData > self.signals.receivedData.emit(imageData) # this signal is > declared like this: QtCore.Signal(str) > > > However, the receiving slot is receiving nothing: > > def setPixmap(self, imageData): > print 'received:', imageData > pixmap = QtGui.QPixmap() > pixmap.loadFromData(imageData) > self.data['pixmap'] = pixmap > > > I guess this is too naive an approach to download image > data in a separate thread?! > > How can I fix this please? > > Cheers, > frank > > -- > > ohufxLogo 50x50 > > > > *vfx compositing > | workflow > customisation and consulting > * > > > > _______________________________________________ > > 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 > > > > -- > > * > **ERIK JOHANSSON* > Pipeline TD > > *GOODBYE KANSAS STUDIOS* > Rosenlundsgatan 40, 4th floor > 118 53 Stockholm, Sweden > > Ph: +46 8 556 990 00 > www.goodbyekansas.com > > > > > _______________________________________________ > > PySide mailing list > > PySide at qt-project.org > > http://lists.qt-project.org/mailman/listinfo/pyside > -------------- next part -------------- An HTML attachment was scrubbed... URL: