Feature request: 'del app' automatically

classic Classic list List threaded Threaded
6 messages Options
BPL
Reply | Threaded
Open this post in threaded view
|

Feature request: 'del app' automatically

BPL
Phil,

A while ago I'd posted you a bug that happened when copying content to the clipboard and the information copied being lost when exiting the app... at that time you'd provided a fast hack that "solved" the issue, let me bring back your answer here at that time:

Ok I can now reproduce the problem. It also happens with C++ when the 
QApplication is created on the heap and not explicitly destroyed.
The workaround in your test is to 'del app' at the end of the script.
Tonight's PyQt snapshot adds support for using QCoreApplication (and 
sub-classes) as a context manager which calls the C++ dtor when exiting 
the context. So...
with QApplication([]) as app:
     ....
     app->exec()
Phil  

Thing is, in pyside2 you don't need to use any context manager to provide clipboard reliable behaviour so my question is, how hard would be for you to fix this issue properly without forcing the user to use this context manager at all?

Asking cos I have apps where everything is a plugin, even QApplication & subclasses are just plugins so I don't even know how or when they'll be instantiated... being forced to use this context manager is really inconvenient and ugly in many cases (not just mine) so having a reliable behaviour of the clipboard without these context managers like pyside2 would be awesome!!! :)

Thanks in advance.

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: 'del app' automatically

Phil Thompson-5
On 13/08/2019 19:33, BPL wrote:

> Phil,
>
> A while ago I'd posted you a bug that happened when copying content to
> the
> clipboard and the information copied being lost when exiting the app...
> at
> that time you'd provided a fast hack that "solved" the issue, let me
> bring
> back your answer here at that time:
>
> Ok I can now reproduce the problem. It also happens with C++ when the
>> QApplication is created on the heap and not explicitly destroyed.
>> The workaround in your test is to 'del app' at the end of the script.
>> Tonight's PyQt snapshot adds support for using QCoreApplication (and
>> sub-classes) as a context manager which calls the C++ dtor when
>> exiting
>> the context. So...
>> with QApplication([]) as app:
>>      ....
>>      app->exec()
>> Phil
>
>
> Thing is, in pyside2 you don't need to use any context manager to
> provide
> clipboard reliable behaviour so my question is, how hard would be for
> you
> to fix this issue properly without forcing the user to use this context
> manager at all?
>
> Asking cos I have apps where everything is a plugin, even QApplication
> &
> subclasses are just plugins so I don't even know how or when they'll be
> instantiated... being forced to use this context manager is really
> inconvenient and ugly in many cases (not just mine) so having a
> reliable
> behaviour of the clipboard without these context managers like pyside2
> would be awesome!!! :)

Try the current sip and PyQt5 snapshots.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
BPL
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: 'del app' automatically

BPL
Oh! I didn't know this was already living in the dev branch :O , by any chance... is it the commit `2f419c7ebaae`? If that's so, that's great news! can't wait to try, this bug was really nasty and a lot of times when testing apps I ended up losing a lot of clipboard information.

Anyway, considering `5.13.1` is being released in 15.08.2019 and probably an official new wheel will be uploaded to pypi after that I think I'll wait. Wow, this new release will contain a lot
of interesting bug fixes... really a major one in my book :)

Thanks Phil!!!

On Tue, Aug 13, 2019 at 11:10 PM Phil Thompson <[hidden email]> wrote:
On 13/08/2019 19:33, BPL wrote:
> Phil,
>
> A while ago I'd posted you a bug that happened when copying content to
> the
> clipboard and the information copied being lost when exiting the app...
> at
> that time you'd provided a fast hack that "solved" the issue, let me
> bring
> back your answer here at that time:
>
> Ok I can now reproduce the problem. It also happens with C++ when the
>> QApplication is created on the heap and not explicitly destroyed.
>> The workaround in your test is to 'del app' at the end of the script.
>> Tonight's PyQt snapshot adds support for using QCoreApplication (and
>> sub-classes) as a context manager which calls the C++ dtor when
>> exiting
>> the context. So...
>> with QApplication([]) as app:
>>      ....
>>      app->exec()
>> Phil
>
>
> Thing is, in pyside2 you don't need to use any context manager to
> provide
> clipboard reliable behaviour so my question is, how hard would be for
> you
> to fix this issue properly without forcing the user to use this context
> manager at all?
>
> Asking cos I have apps where everything is a plugin, even QApplication
> &
> subclasses are just plugins so I don't even know how or when they'll be
> instantiated... being forced to use this context manager is really
> inconvenient and ugly in many cases (not just mine) so having a
> reliable
> behaviour of the clipboard without these context managers like pyside2
> would be awesome!!! :)

Try the current sip and PyQt5 snapshots.

Phil

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
BPL
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: 'del app' automatically

BPL
Phil,

I've upgraded from PyQt5-5.13.0 to PyQt5-5.13.1 using pip and the clipboard issue is still there... aren't the commit 2f419c7ebaae changes living in the latest pypi wheel?

On Tue, Aug 13, 2019 at 11:48 PM BPL <[hidden email]> wrote:
Oh! I didn't know this was already living in the dev branch :O , by any chance... is it the commit `2f419c7ebaae`? If that's so, that's great news! can't wait to try, this bug was really nasty and a lot of times when testing apps I ended up losing a lot of clipboard information.

Anyway, considering `5.13.1` is being released in 15.08.2019 and probably an official new wheel will be uploaded to pypi after that I think I'll wait. Wow, this new release will contain a lot
of interesting bug fixes... really a major one in my book :)

Thanks Phil!!!

On Tue, Aug 13, 2019 at 11:10 PM Phil Thompson <[hidden email]> wrote:
On 13/08/2019 19:33, BPL wrote:
> Phil,
>
> A while ago I'd posted you a bug that happened when copying content to
> the
> clipboard and the information copied being lost when exiting the app...
> at
> that time you'd provided a fast hack that "solved" the issue, let me
> bring
> back your answer here at that time:
>
> Ok I can now reproduce the problem. It also happens with C++ when the
>> QApplication is created on the heap and not explicitly destroyed.
>> The workaround in your test is to 'del app' at the end of the script.
>> Tonight's PyQt snapshot adds support for using QCoreApplication (and
>> sub-classes) as a context manager which calls the C++ dtor when
>> exiting
>> the context. So...
>> with QApplication([]) as app:
>>      ....
>>      app->exec()
>> Phil
>
>
> Thing is, in pyside2 you don't need to use any context manager to
> provide
> clipboard reliable behaviour so my question is, how hard would be for
> you
> to fix this issue properly without forcing the user to use this context
> manager at all?
>
> Asking cos I have apps where everything is a plugin, even QApplication
> &
> subclasses are just plugins so I don't even know how or when they'll be
> instantiated... being forced to use this context manager is really
> inconvenient and ugly in many cases (not just mine) so having a
> reliable
> behaviour of the clipboard without these context managers like pyside2
> would be awesome!!! :)

Try the current sip and PyQt5 snapshots.

Phil

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: 'del app' automatically

Phil Thompson-5
On 17/09/2019 13:03, BPL wrote:
> Phil,
>
> I've upgraded from PyQt5-5.13.0 to PyQt5-5.13.1 using pip and the
> clipboard
> issue is still there... aren't the commit 2f419c7ebaae changes living
> in
> the latest pypi wheel?

To quote the release email...

This version of PyQt implements an alternative strategy for tidying up
objects when an application exits. By default the new strategy is
disabled. To enable it add the following to your script...

     from PyQt5.QtCore import pyqt5_enable_new_onexit_scheme

     pyqt5_enable_new_onexit_scheme(True)

The intention is to make the new scheme the default (and to remove the
above function) in PyQt v5.14. I would really appreciate it if people
could try out the new scheme (if only for 5 minutes) and let me know if
it causes any problems. I'm hoping that 99% won't notice any difference
and the remaining 1% will see an improvement.
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
BPL
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: 'del app' automatically

BPL
Phil,

Just to let you know I've added `from PyQt5.Qt import *; from PyQt5.QtCore import pyqt5_enable_new_onexit_scheme; pyqt5_enable_new_onexit_scheme(True)`
to ~30 different widgets and ~4different apps and so far the new scheme works wonderfully.

I've tested this on:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
window7 ultimate
PyQt5-5.13.1-5.13.1-cp35.cp36.cp37.cp38-none-win32.whl

Hopefully other people can test it on different operating systems... It'd be great to make this new scheme the default one. To me the fact of losing clipboard information
was a really nasty (if not critical) bug that made you lose valuable information when testing/using apps.

That said, thanks for all good work... this new release is pretty amazing!

Regards


On Tue, Sep 17, 2019 at 2:48 PM Phil Thompson <[hidden email]> wrote:
On 17/09/2019 13:03, BPL wrote:
> Phil,
>
> I've upgraded from PyQt5-5.13.0 to PyQt5-5.13.1 using pip and the
> clipboard
> issue is still there... aren't the commit 2f419c7ebaae changes living
> in
> the latest pypi wheel?

To quote the release email...

This version of PyQt implements an alternative strategy for tidying up
objects when an application exits. By default the new strategy is
disabled. To enable it add the following to your script...

     from PyQt5.QtCore import pyqt5_enable_new_onexit_scheme

     pyqt5_enable_new_onexit_scheme(True)

The intention is to make the new scheme the default (and to remove the
above function) in PyQt v5.14. I would really appreciate it if people
could try out the new scheme (if only for 5 minutes) and let me know if
it causes any problems. I'm hoping that 99% won't notice any difference
and the remaining 1% will see an improvement.

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt