Module Expr Str ImportFrom alias alias alias alias ImportFrom alias alias alias alias alias alias Assign NameStore ListLoad Str Str Str Str Str Str Str Str Str ClassDef bases NameLoad body Assign NameStore Call NameLoad NameLoad decorator_list Assign NameStore Call NameLoad ClassDef bases NameLoad body Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad Call NameLoad Call NameLoad Call NameLoad Str keyword Call NameLoad keyword Str keyword Str keyword NameLoad keyword Str Call NameLoad Call NameLoad Str keyword NameLoad keyword Str keyword Call NameLoad keyword NameLoad keyword Str keyword NameLoad keyword Str keyword Str decorator_list Assign NameStore Call NameLoad If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr
N/A N/A 
Dynamic changing an Enum selection list, depending on checked items

Another way to dynamically change the values shown by an EnumEditor.

The scenario is a restaurant that at the beginning of the day has a menu list
of entrees based upon a fully stocked kitchen. However, as the day progresses,
the kitchen's larder gets depleted, and the kitchen may no longer be able to
prepare certain entrees, which must then be deleted from the menu. Similarly,
deliveries may allow certain entrees to be added back onto the menu.

The demo is divided into two tabs: Order and Kitchen.

The Order tab represents a customer's order and consists of a single Entree
field, which represents the customer's selection from the drop-down list of
entrees that the kitchen can currently prepare.

The Kitchen tab represents the current set of entrees that the kitchen can
prepare, based upon the current contents of its larder.

As entrees are checked on or off from the Kitchen tab, the customer's Entree
drop-down is dynamically updated with the current list of available entrees.

Notes:

 - The key point of the demo is the use of the 'name' trait in the EnumEditor
   definition, which links the list of available entrees from the
   KitchenCapabilities object to the OrderMenu object's entree EnumEditor.

 - The design will work with any number of active OrderMenu objects, since they
   all share a common KitchenCapabilities object. As the KitchenCapabilities
   object is updated, all OrderMenu UI's will automatically update their
   associated Entree's drop-down list.

 - A careful reader will also observe that this example contains only
   declarative code. No imperative code is required to handle the automatic
   updating of the Entree list.
 traits.api HasPrivateTraits Str List Constant traitsui.api View Item VGroup HSplit EnumEditor CheckListEditor N/A possible_entrees N/A Chicken Fried Steak Chicken Fingers Chicken Enchiladas Cheeseburger Pepper Steak Beef Tacos Club Sandwich Ceasar Salad Cobb Salad KitchenCapabilities N/A HasPrivateTraits N/A N/A available N/A List possible_entrees N/A N/A kitchen_capabilities N/A KitchenCapabilities OrderMenu N/A HasPrivateTraits N/A N/A entree Str N/A capabilities N/A Constant kitchen_capabilities N/A view N/A View N/A HSplit N/A VGroup N/A Item entree editor N/A EnumEditor name object.capabilities.available label Order show_border True dock tab N/A VGroup N/A Item object.capabilities.available show_label False style custom editor N/A CheckListEditor values possible_entrees label Kitchen show_border True dock tab title Dynamic EnumEditor Demo N/A N/A demo N/A OrderMenu N/A N/A __name__ __main__ N/A N/A N/A N/A demo configure_traits