Example #1
0
 def combobox_add_text_types(self):
     """Function to add all TextNoteTypes to ComboBox(self.UI_text_type)."""
     for n, type in enumerate(all_text_types):
         item = ComboBoxItem()
         item.Content    = type.get_Parameter(BuiltInParameter.ALL_MODEL_TYPE_NAME).AsString()
         item.IsSelected = True if n==0 else False
         self.UI_text_type.Items.Add(item)
Example #2
0
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()
Example #3
0
 def combobox_add_parameters(self):
     """Function to add all TextNoteTypes to ComboBox(self.UI_text_type)."""
     for n, p_name in enumerate(sorted(dict_sheet_parameters.keys())):
         item = ComboBoxItem()
         item.Content = p_name
         item.IsSelected = True if p_name == 'Sheet Number' else False
         self.UI_parameters.Items.Add(item)
Example #4
0
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()
Example #5
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
Example #6
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
Example #7
0
 def createComboAndCheck(self, grid):
    panel = StackPanel()
    
    label = Label()
    label.Content = "CheckBox & ComboBox"
    label.FontSize = 16
    label.Margin = Thickness(10)
    
    check = CheckBox()
    check.Content = "CheckBox"
    check.Margin = Thickness(10)
    check.FontSize = 16
    check.IsChecked = True
    def action(s, e):
       checked = check.IsChecked
       self.label.Content = "CheckBox IsChecked = %s" % checked
    check.Checked += action
    check.Unchecked += action
    
    combo = ComboBox()
    for entry in ("A ComboBox", "An Item", "The Next One", "Another"):
       item = ComboBoxItem()
       item.Content = entry
       item.FontSize = 16
       combo.Items.Add(item)
    combo.SelectedIndex = 0
    combo.Height = 26
    def action(s, e):
       selected = combo.SelectedIndex
       self.label.Content = "ComboBox SelectedIndex = %s" % selected
    combo.SelectionChanged += action
    combo.FontSize = 16
    combo.Margin = Thickness(10)
    
    panel.Children.Add(label)
    panel.Children.Add(combo)
    panel.Children.Add(check)
    SetGridChild(grid, panel, 0, 1, "ComboBox & CheckBox")
Example #8
0
		postMenuItem.Header = stackPanel
	
		comboBox = ComboBox()
		comboBox.IsEditable = True
		comboBox.Width = 240
		comboBox.MouseUp += onMouseUp
	
		stack = Stack[String]()
	
		for window in Application.Current.Windows:
			if clr.GetClrType(Agent).IsInstanceOfType(window):
				for message in window.Balloon.Messages:
					stack.Push(String.Format("\"{0}: {1}\"", sb.ToString(), Regex.Replace(message.Text, Environment.NewLine, String.Empty, RegexOptions.CultureInvariant)))

		while stack.Count > 0:
			comboBoxItem = ComboBoxItem()
			comboBoxItem.Content = stack.Pop()
			comboBox.Items.Add(comboBoxItem)

			if comboBox.SelectedItem is None:
				comboBox.SelectedItem = comboBoxItem
	
		checkBox = CheckBox()
		checkBox.Margin = Thickness(10, 0, 0, 0)
		checkBox.Padding = Thickness(5, 0, 5, 0)
		checkBox.HorizontalAlignment = HorizontalAlignment.Left
		checkBox.VerticalAlignment = VerticalAlignment.Center

		def onPostClick(source, rea):
			if not String.IsNullOrEmpty(comboBox.Text):
				fileName = None