def get_ui_select(self, param, desc, opts, size=10): # opts == [['Desc', 'value'], ['Desc #2', 'value2']] v = getattr(self, param) return UI.LayoutTableRow( UI.Label(text=desc), UI.Select(UI.SelectOption(text='Ignore', value='ign', selected=v[1] is None), UI.SelectOption(text='Is', value='nrm', selected=not v[0] and v[1] is not None), UI.SelectOption(text='Isn\'t', value='inv', selected=v[0] and v[1] is not None), name='%s-mode' % param), UI.SelectTextInput(*[ UI.SelectOption(text=x[0], value=x[1], selected=v[1] == x[1]) for x in opts ], name=param, value=v[1] or '', size=size))
def get_ui_select(self, param, opts): # opts == [['Desc', 'value'], ['Desc #2', 'value2']] v = getattr(self, param) return UI.HContainer(UI.SelectInput( UI.SelectOption(text='Ign.', value='ign', selected=v[1] is None), UI.SelectOption(text='Is', value='nrm', selected=not v[0] and v[1] is not None), UI.SelectOption(text='Isn\'t', value='inv', selected=v[0] and v[1] is not None), design='mini', name='%s-mode' % param), UI.SelectTextInput(*[ UI.SelectOption(text=x[0], value=x[1], selected=v[1] == x[1]) for x in opts ], name=param, value=v[1] or '', design='mini'), spacing=5)