From frank at ohufx.com Thu Jan 12 00:02:32 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Thu, 12 Jan 2017 12:02:32 +1300 Subject: [PySide] suppressing tooltips of all widgets Message-ID: <28f4244a-6dc7-75e3-603b-fab1ed48828a@ohufx.com> Hi all, what is the best way to suppress tool tips for all widgets in an app? I have been asked to implement a user preference for showing tool tips and am reluctant to modify every single widget to check the preference before showing the tooltip. I had hoped that I can maybe intercept the QHelpEvent on the top level widget, but that doesn't catch the child widget's events. I also looked at intercepting topLevelWidget.childEvent(), but that is not recursive, so wouldn't catch all the nested widgets (and would probably lead to performance issues as well). Is there any way to intercept a any tool tip even from anywhere in the app? Cheers, frank -- 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 Thu Jan 12 01:45:49 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Thu, 12 Jan 2017 13:45:49 +1300 Subject: [PySide] suppressing tooltips of all widgets In-Reply-To: <28f4244a-6dc7-75e3-603b-fab1ed48828a@ohufx.com> References: <28f4244a-6dc7-75e3-603b-fab1ed48828a@ohufx.com> Message-ID: <4e7b2f03-92a1-44ee-3369-7bcf00a90600@ohufx.com> Ignore me. I simply need to install an event filter on main main widget. For some reason I thought I had tried that before but I hadn't, and it works perfectly. On 12/01/17 12:02 PM, Frank Rueter | OHUfx wrote: > Hi all, > > what is the best way to suppress tool tips for all widgets in an app? > I have been asked to implement a user preference for showing tool tips > and am reluctant to modify every single widget to check the preference > before showing the tooltip. > > I had hoped that I can maybe intercept the QHelpEvent on the top level > widget, but that doesn't catch the child widget's events. > > I also looked at intercepting topLevelWidget.childEvent(), but that is > not recursive, so wouldn't catch all the nested widgets (and would > probably lead to performance issues as well). > > Is there any way to intercept a any tool tip even from anywhere in the > app? > > 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: From frank at ohufx.com Wed Jan 18 02:12:45 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Wed, 18 Jan 2017 14:12:45 +1300 Subject: [PySide] decorator blocking thread signal? Message-ID: Hi all, this may be a pure python question or QT related, I'm not sure: I am having trouble with a decorated function not reporting back to the main thread to drive progress bars etc. When I remove the decorator and use the respective code directly in the function in question it all works fine. My code looks sort of like this (heavily simplified): class ThreadManager(object): def __init__(self, parent): self.worker = Worker() self.workerThread = QtCore.QThread(parent) self.worker.moveToThread(self.workerThread) def start(self): self.workerThread.start() class Worker(QtCore.QObject): def myMethod(self): someClassInstance.doHeavyLifting() In my main code I connect signals from *someClassInstance* that indicate progress during the heavy lifting, so that they drive progress bars in the UI. So far so good. Now I am wanting to use a decorator on *myMethod(self)*, i.e.: class Worker(QtCore.QObject): @testDec def myMethod(self): someClassInstance.doHeavyLifting() where testDec looks like this: def testDec(fn): def addTest(self): print 'inside decorator', self fn(self) return addTest The moment I do that, the threaded process does not report back to the main thread, so the progress bars sit at 0% until the process returns, then jump to 100% What am I missing? Cheers, frank -- 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 timr at probo.com Wed Jan 18 20:40:34 2017 From: timr at probo.com (Tim Roberts) Date: Wed, 18 Jan 2017 11:40:34 -0800 Subject: [PySide] decorator blocking thread signal? In-Reply-To: References: Message-ID: Frank Rueter | OHUfx wrote: > > this may be a pure python question or QT related, I'm not sure: > I am having trouble with a decorated function not reporting back to > the main thread to drive progress bars etc. > When I remove the decorator and use the respective code directly in > the function in question it all works fine. > > My code looks sort of like this (heavily simplified): I think this may be too heavily simplified. How does Worker.myMethod get called? Do you have a "start" or "run" handler within Worker to dispatch requests? There is a fair amount of monkey patching within PySide to make signals and slots work, but it does seem like your example is simple enough. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From frank at ohufx.com Wed Jan 18 21:50:42 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Thu, 19 Jan 2017 09:50:42 +1300 Subject: [PySide] decorator blocking thread signal? In-Reply-To: References: Message-ID: <7a1a1bd4-6fac-6eea-b8de-e0874a1a2713@ohufx.com> Hi Tim, I dispatch requests by connecting the thread's "start" signal to the worker's method, i.e.: self.workerThread.started.connect(self.worker.myMethod) I will try and make some time to put together a proper example if the above isn't enough. Cheers, frank On 19/01/17 8:40 AM, Tim Roberts wrote: > Frank Rueter | OHUfx wrote: >> this may be a pure python question or QT related, I'm not sure: >> I am having trouble with a decorated function not reporting back to >> the main thread to drive progress bars etc. >> When I remove the decorator and use the respective code directly in >> the function in question it all works fine. >> >> My code looks sort of like this (heavily simplified): > I think this may be too heavily simplified. How does Worker.myMethod > get called? Do you have a "start" or "run" handler within Worker to > dispatch requests? > > There is a fair amount of monkey patching within PySide to make signals > and slots work, but it does seem like your example is simple enough. > From frank at ohufx.com Thu Jan 19 23:12:02 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 20 Jan 2017 11:12:02 +1300 Subject: [PySide] decorator blocking thread signal? In-Reply-To: <7a1a1bd4-6fac-6eea-b8de-e0874a1a2713@ohufx.com> References: <7a1a1bd4-6fac-6eea-b8de-e0874a1a2713@ohufx.com> Message-ID: <70b1b23f-9fd9-4c9e-e80c-dc034b950e97@ohufx.com> Hi Tim, it seems that the culprit was that ThreadManager was not inheriting from QObject. I didn't think this was needed since Worker was the class that emitted the signals. However, I have since switched to using QRunnable and made ThreadManager a descendant of that, and now the signals seem to happen even with the decorator. I still need to do more testing though, just wanted to update this thread. Cheers, frank On 19/01/17 9:50 AM, Frank Rueter | OHUfx wrote: > Hi Tim, > > I dispatch requests by connecting the thread's "start" signal to the > worker's method, i.e.: > self.workerThread.started.connect(self.worker.myMethod) > > I will try and make some time to put together a proper example if the > above isn't enough. > > Cheers, > frank > > On 19/01/17 8:40 AM, Tim Roberts wrote: >> Frank Rueter | OHUfx wrote: >>> this may be a pure python question or QT related, I'm not sure: >>> I am having trouble with a decorated function not reporting back to >>> the main thread to drive progress bars etc. >>> When I remove the decorator and use the respective code directly in >>> the function in question it all works fine. >>> >>> My code looks sort of like this (heavily simplified): >> I think this may be too heavily simplified. How does Worker.myMethod >> get called? Do you have a "start" or "run" handler within Worker to >> dispatch requests? >> >> There is a fair amount of monkey patching within PySide to make signals >> and slots work, but it does seem like your example is simple enough. >> > > _______________________________________________ > 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 Jan 26 20:34:27 2017 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 27 Jan 2017 08:34:27 +1300 Subject: [PySide] TypeError during cythonize Message-ID: Hi all, I have run into this issue a couple of times now: Some of my class declarations look like this: class DBTaskQueue(QtCore.QObject): def __init__(self, npdbInstance, task=None, parent=None): super(DBTaskQueue, self).__init__(parent) This works fine when run as pure python code but when I cythonize I get this error: TypeError:super(type,obj):obj must be an instance orsubtype of type The error only happens when I provide arguments to t super() - e.g. "parent" in this case. The workaround is to use this instead: class DBTaskQueue(QtCore.QObject): def __init__(self, npdbInstance, task=None, parent=None): *QtCore.QObject.__init__(self, parent)* When there is no argument to super() it always seems to be happy. Is this a bug or user error? Cheers, frank -- 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: