##// END OF EJS Templates
Don't magically convert values to a list of tuples.
Jonathan Frederic -
Show More
@@ -36,7 +36,8 b' class _Selection(DOMWidget):'
36 36
37 37 value = Any(help="Selected value")
38 38 value_name = Unicode(help="The name of the selected value", sync=True)
39 values = Any(sync=True, help="""List of (key, value) tuples the user can select.
39 values = Any(help="""List of (key, value) tuples or dict of values that the
40 user can select.
40 41
41 42 The keys of this list are the strings that will be displayed in the UI,
42 43 representing the actual Python choices.
@@ -84,10 +85,12 b' class _Selection(DOMWidget):'
84 85 """
85 86 if self.values_lock.acquire(False):
86 87 try:
87 self.values = self._make_values(new)
88 self.values_dict = {i[0]: i[1] for i in self.values}
89 self.values_names = [i[0] for i in self.values]
90 self.values_values = [i[1] for i in self.values]
88 self.values = new
89
90 values = self._make_values(new)
91 self.values_dict = {i[0]: i[1] for i in values}
92 self.values_names = [i[0] for i in values]
93 self.values_values = [i[1] for i in values]
91 94 self._value_in_values()
92 95 finally:
93 96 self.values_lock.release()
General Comments 0
You need to be logged in to leave comments. Login now