30 Update the contents of a combo box with a set of new values. 32 If the previously selected element is still present in the new values, it 33 will remain as active selection, even if its index has changed. This will 34 not trigger any signal. 36 If the previously selected element is no longer present in the new values, 37 the combo will unset its selection. This will trigger signals for changed 40 selected_val = combo.currentText()
41 old_vals = [combo.itemText(i)
for i
in range(combo.count())]
48 selected_id = new_vals.index(selected_val)
50 combo.setCurrentIndex(-1)
53 combo.blockSignals(
True)
55 combo.insertItems(0, new_vals)
56 combo.setCurrentIndex(selected_id)
57 combo.blockSignals(
False)
63 @return True if C{a} is a permutation of C{b}, false otherwise 66 return len(a) == len(b)
and sorted(a) == sorted(b)
def _is_permutation(a, b)
def update_combo(combo, new_vals)