Allow passing iterator flags into GetPropertyValues

This commit is contained in:
Robin Dunn
2020-11-11 14:41:44 -08:00
parent 6b78295938
commit e3dbe68b49

View File

@@ -215,18 +215,20 @@ def run():
c.find('GetPropertyValues').ignore()
c.addPyMethod('GetPropertyValues',
'(self, dict_=None, as_strings=False, inc_attributes=False)',
'(self, dict_=None, as_strings=False, inc_attributes=False, flags=PG_ITERATE_PROPERTIES)',
doc="""\
Returns all property values in the grid.\n
:param `dict_`: A to fill with the property values. If not given,
then a new one is created. The dict_ can be an object as well,
in which case it's __dict__ is used.
Returns all property values in the grid.
:param `dict_`: A diftionary to fill with the property values.
If not given, then a new one is created. The dict_ can be an
object as well, in which case it's __dict__ is used.
:param `as_strings`: if True, then string representations of values
are fetched instead of native types. Useful for config and such.
:param `inc_attributes`: if True, then property attributes are added
in the form of "@<propname>@<attr>".
in the form of ``"@<propname>@<attr>"``.
:param `flags`: Flags to pass to the iterator, see :ref:`wx.propgrid.PG_ITERATOR_FLAGS`
:returns: A dictionary with values. It is always a dictionary,
so if dict_ was and object with __dict__ attribute, then that
so if dict_ was an object with __dict__ attribute, then that
attribute is returned.
""",
body="""\
@@ -237,7 +239,7 @@ def run():
getter = self.GetPropertyValue if not as_strings else self.GetPropertyValueAsString
it = self.GetVIterator(PG_ITERATE_PROPERTIES)
it = self.GetVIterator(flags)
while not it.AtEnd():
p = it.GetProperty()
name = p.GetName()
@@ -314,7 +316,7 @@ def run():
self.Refresh()
""")
# TODO: should these be marked as deprecated?
# TODO: should these be marked as deprecated? Probably...
module.addPyCode("""\
PropertyGridInterface.GetValues = PropertyGridInterface.GetPropertyValues
PropertyGridInterface.SetValues = PropertyGridInterface.SetPropertyValues