Skip to content

Commit 7da8d2f

Browse files
committed
improved sorting when more than 9 items of the same product
1 parent 8777d55 commit 7da8d2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/example__product__001.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
4444
Requirements:
4545
- pywinauto installed (pip install pywinauto).
46+
- natsort installed (pip install natsort).
4647
- An open product document with children that need sorting.
4748
4849
Warnings:
@@ -69,6 +70,7 @@
6970
from pywinauto import Desktop
7071
from pywinauto.controls.win32_controls import ButtonWrapper
7172
from pywinauto.controls.win32_controls import ListBoxWrapper
73+
from natsort import natsorted
7274

7375
from pycatia import catia
7476
from pycatia.product_structure_interfaces.product_document import ProductDocument
@@ -176,7 +178,7 @@ def get_window_text(window_text_translations: dict, lang):
176178
tree_items = []
177179
for text in list_box.item_texts(): # type: ignore
178180
tree_items.append(text)
179-
tree_items.sort()
181+
tree_items = natsorted(tree_items)
180182

181183
# reorder the items in the tree
182184
for i, value in enumerate(tree_items):

0 commit comments

Comments
 (0)