Adds bindable version of TextScrollList and IconTextScrollList
from maya import cmds
from mGui import gui, forms, lists
from mGui.bindings import bind
from mGui.observable import ViewCollection
import re
items = ViewCollection()
def create_filter(*args, **kwargs):
fn = kwargs['sender'].text
regex = re.compile(fn, re.I)
test = lambda p: regex.search(p)
items.update_filter(test)
with gui.Window() as w:
with forms.FooterForm() as nav:
with forms.HeaderForm() as main:
filter_field = gui.TextField()
s = lists.BoundIconTextScrollList()
with forms.HorizontalForm() as footer:
one = gui.Text(label="Showing: ")
two = gui.Text(label="0")
sep = gui.Text(label="/")
three = gui.Text(label="0")
filter_field.changeCommand += create_filter
items > bind() > s.collection
items.bind.viewCount > bind() > three.bind.label
items.bind.count > bind() > two.bind.label
w.show()
items.add(*[i for i in 'abcdefghiklmnopqrstuvwxyz'])
items.add('hello world')
Adds bindable version of
TextScrollList
andIconTextScrollList