Commit 770f50fd authored by 李康's avatar 李康

support non-scrollable filter pane

parent 3f908459
...@@ -51,11 +51,11 @@ def getAllFilterTypes(d): ...@@ -51,11 +51,11 @@ def getAllFilterTypes(d):
filter.click() filter.click()
ftype_names = [] ftype_names = []
filter_pane = d(scrollable=True) filter_pane = d(scrollable=True)
if filter_pane.count != 1: if filter_pane.count not in [0, 1]:
print("filter pane is invalid!") print("filter pane is invalid(with count %d)!" % filter_pane.count)
return return
while True: while True:
ftypes = filter_pane.child(resourceId="org.c2h4.afei.beauty:id/tv_type") ftypes = d(resourceId="org.c2h4.afei.beauty:id/tv_type")
new_flag = False new_flag = False
for ftype in ftypes: for ftype in ftypes:
if ftype.get_text() == "全部品类": if ftype.get_text() == "全部品类":
...@@ -65,11 +65,13 @@ def getAllFilterTypes(d): ...@@ -65,11 +65,13 @@ def getAllFilterTypes(d):
else: else:
new_flag = True new_flag = True
ftype_names.append(ftype.get_text()) ftype_names.append(ftype.get_text())
if new_flag: if new_flag and filter_pane.count:
filter_pane.scroll.vert(steps=filter_scroll_steps) filter_pane.scroll.vert(steps=filter_scroll_steps)
else: else:
break break
filter_pane.scroll.vert.backward() if filter_pane.count:
filter_pane.scroll.vert.backward()
return ftype_names return ftype_names
def filterProduct(d, ftype_name): def filterProduct(d, ftype_name):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment