[PyQt] PyKDE4 OpenUrlArguments metaData ( QMap ) is uneditable

Simon Edwards simon at simonzone.com
Mon Feb 18 19:40:26 GMT 2013


On 02/14/2013 03:31 PM, Daniel Nagy wrote:
>
> -------- Original-Nachricht --------
>> Datum: Wed, 13 Feb 2013 09:45:31 +0000
>> Von: Phil Thompson <phil at riverbankcomputing.com>
>> An: Daniel Nagy <DanielNagy at gmx.de>
>> CC: pyqt at riverbankcomputing.com
>> Betreff: Re: [PyQt] PyKDE4 OpenUrlArguments metaData ( QMap ) is uneditable
>
>> On Wed, 13 Feb 2013 00:51:05 +0100, "Daniel Nagy" <DanielNagy at gmx.de>
>> wrote:
>>> Hi,
>>>
>>> there is a PyKDE4-datatype at
>>> http://api.kde.org/pykde-4.7-api/kparts/KParts.OpenUrlArguments.html
>>> and I don't seem to be able to modify the QMap "metaData" property.
>>>  From C++ you can easily do that, but not from python.
>>> Here is how you can reproduce this issue:
>>>
>>> $ python
>>>>>> from PyKDE4.kparts import KParts
>>>>>> oua = KParts.OpenUrlArguments()
>>>>>> oua.metaData()["prop1"] = "val1"
>>>>>> oua.metaData()
>>> {}
>>>>>>
>>>
>>> So the QMap metaData remains empty. Do you have any hint on how I can
>> edit
>>> this from within python?
>>> I am using Python 2.7.3.
>>
>> I don't use PyKDE so this is a guess. The QMap is converted to a dict
>> which is what you are updating. The QMap is never updated from the dict.
>> There needs to be a separate API call (either real or added specifically
>> to
>> PyKDE) to do this, eg
>>
>> meta_data = oua.metaData()
>> meta_data["prop1"] = "val"
>> oua.setMetaData(meta_data)
>>
>> ...or...
>>
>> oua.setMetaData("prop1", "val")
>>

> Thanks for your answer Phil,
>
> unfortunately there is no such method as setMetaData.
>
> If i write a patch to fix this, do you think the PyQT/PyKDE4 team would accept it?

I don't see why we wouldn't.

I have preference for a setMetaData(dict) method that just updates the 
lot in one go.

cheers,

-- 
Simon Edwards
simon at simonzone.com
Nijmegen, The Netherlands


More information about the PyQt mailing list