[PyQt] Additional decorators - not working correctly anymore

Phil Thompson phil at riverbankcomputing.co.uk
Thu May 31 23:06:35 BST 2007


On Thursday 31 May 2007 9:26 pm, Necoro wrote:
> Hi,
>
> me again ;) (just don't want to mangle the two topics.).

I think I agree with your other report - I need to do some testing.

> Switched from PyQt-4.1.1 to PyQt-4.2. and now the following does not
> work anymore:
>
> @Qt.pyqtSignature("")
> @Window.watch_cursor
> def on_searchBtn_clicked(self):
>    print "i have been clicked"
>
>
> Window.watch_cursor is defined as follows:
>
> @staticmethod
> def watch_cursor (func):
>     """This is a decorator for functions being so time consuming, that
> it is appropriate to show the watch-cursor."""
>     def wrapper (*args, **kwargs):
>         ret = None
>
>         Qt.QApplication.setOverrideCursor(Qt.Qt.WaitCursor)
>         try:
>             ret = func(*args, **kwargs)
>         finally:
>             Qt.QApplication.restoreOverrideCursor()
>
>         return ret
>
>     return wrapper
>
>
>
> If I remove the "watch_cursor" decorator, "on_searchBtn_clicked" is
> executed - but not if I use the decorator :(.
> Can anybody give me a hint or tell me, why this is not working?

Can you produce a small example that demonstrates the problem?

Phil


More information about the PyQt mailing list