python - How to write lists as a file attribute using PyGTK -


enter image description here

a comment linux mint founder stated file emblems in newer versions of nemo can programatically accessed, seen in following example using python , pygtk:

import gio file = gio.file("/home/guest/documents/todo") emblems = file.query_info("metadata::emblems") print emblems.get_attribute_as_string("metadata::emblems") 

which outputs in format

[emblem-important, emblem-urgent] 

the object stored metadata::emblems, can see, list (i guess of strings). however, in pygtk documentation on gio.fileinfo, can't find method access (read or write) attributes of array types.

is there method (i.e. reading single emblems or setting new emblems programatically)? if yes, how can accomplish this?

it's strange there's no convenience method this, can call file.set_attribute directly, using stringv type.

f.set_attribute('metadata::emblems', gio.file_attribute_type_stringv, ['emblem-important', 'emblem-urgent']) 

Comments