def change_pages(): unhook_events() part = topComboBoxPart.SelectedIndex unhook_events() topComboBoxPage.Items.Clear() bottomComboBoxPage.Items.Clear() if part == 0: return items = get_list('docs/part%s/list.txt' % part) topCombobox = topComboBoxPage bottomComboBox = bottomComboBoxPage items = ['Index'] + items for combobox in topCombobox, bottomComboBox: for item in items: boxitem = ComboBoxItem() boxitem.Content = item boxitem.Height = 25 combobox.Items.Add(boxitem) topComboBoxPage.SelectedIndex = 0 bottomComboBoxPage.SelectedIndex = 0 hook_events()
def change_pages(): unhook_events() part = topComboBoxPart.SelectedIndex unhook_events() topComboBoxPage.Items.Clear() bottomComboBoxPage.Items.Clear() if part == 0: return items = get_list("docs/part%s/list.txt" % part) topCombobox = topComboBoxPage bottomComboBox = bottomComboBoxPage items = ["Index"] + items for combobox in topCombobox, bottomComboBox: for item in items: boxitem = ComboBoxItem() boxitem.Content = item boxitem.Height = 25 combobox.Items.Add(boxitem) topComboBoxPage.SelectedIndex = 0 bottomComboBoxPage.SelectedIndex = 0 hook_events()
def setup_parts(): items = get_list('docs/list.txt') topCombobox = topComboBoxPart bottomComboBox = bottomComboBoxPart items = ['Index'] + items for combobox in topCombobox, bottomComboBox: for item in items: boxitem = ComboBoxItem() boxitem.Content = item boxitem.Height = 25 combobox.Items.Add(boxitem) topCombobox.SelectionChanged += on_change_top_part bottomComboBox.SelectionChanged += on_change_bottom_part topCombobox.SelectedIndex = bottomComboBox.SelectedIndex = 0
def setup_parts(): items = get_list("docs/list.txt") topCombobox = topComboBoxPart bottomComboBox = bottomComboBoxPart items = ["Index"] + items for combobox in topCombobox, bottomComboBox: for item in items: boxitem = ComboBoxItem() boxitem.Content = item boxitem.Height = 25 combobox.Items.Add(boxitem) topCombobox.SelectionChanged += on_change_top_part bottomComboBox.SelectionChanged += on_change_bottom_part topCombobox.SelectedIndex = bottomComboBox.SelectedIndex = 0