Skip to content

Commit

Permalink
add get_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jesicasusanto committed Jul 11, 2023
1 parent 5bbc2f3 commit 3dc81e5
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions openadapt/window/_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,7 @@ def get_element_properties(element):
'children': [{'prop1': 'child_value1', 'prop2': 'child_value2',
'children': []}]}
"""

try:
properties = element.get_properties()
except comtypes.COMError as com_err:
logger.warning(f"COMError occurred: {com_err}")
return {}
properties = get_properties(element)
children = element.children()

if children:
Expand Down Expand Up @@ -164,6 +159,20 @@ def main():

ipdb.set_trace()

def get_properties(element):
"""Return the properties of the control as a dictionary."""
#import ipdb; ipdb.set_trace()
props = {}

# for each of the properties that can be written out
for propname in element.writable_props:
# set the item in the props dictionary keyed on the propname
try :
props[propname] = getattr(element, propname)()
except :
continue

return props

if __name__ == "__main__":
main()

0 comments on commit 3dc81e5

Please sign in to comment.