Qt6.5 QPermission
Marko Luther
marko.luther at gmx.net
Mon May 22 09:33:14 BST 2023
> On 22. May 2023, at 10:01, Phil Thompson <phil at riverbankcomputing.com> wrote:
>
> On 22/05/2023 06:46, Marko Luther wrote:
>> Dear Phil,
>>> On 21. May 2023, at 17:07, Phil Thompson <phil at riverbankcomputing.com> wrote:
>>> On 16/05/2023 17:26, Marko Luther wrote:
>>>> Dear Phil,
>>>> shouldn't the QPermission class be available in QtCore, or is the
>>>> QPermission API not yet supported by PyQt6?
>>>>>>> from PyQt6.QtCore import QBluetoothPermission
>>>> Traceback (most recent call last):
>>>> File "<stdin>", line 1, in <module>
>>>> ImportError: cannot import name 'QBluetoothPermission' from
>>>> 'PyQt6.QtCore'
>>>> (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/PyQt6/QtCore.abi3.so)
>>> It isn't supported by PyQt6. It isn't supported on Linux and Windows anyway and for macOS you have to include entries in the Info.plist file. I'm not sure how practical that is.
>> That Info.plist entry is required anyhow. I am using QBluetooth and
>> without that Info.plist as well as the permission granted by the user
>> this API cannot be use on macOS. Thus the request for permission
>> dialog of the OS pops up also without operating this Permission API.
>> That Permission API allows an app to control this permission granting
>> process.
>
> So how are you updating Info.plist at the moment?
I add the following lines to the Info.plist of my app build with py2app.
<key>NSBluetoothAlwaysUsageDescription</key>
<string>MYAPP wants to access bluetooth</string>
This works only if running the final build. I did not find a way to use QBluetooth on current macOS under Python3/PyQt6 on running from source. I tried to add those lines to the "Python Launcher" (and by this perhaps invalidating its code signature) without any success.
Marko
>
> Phil
More information about the PyQt
mailing list