18 from System.Windows
import (GridLength, SizeToContent, TextWrapping, Thickness,
19 Window, WindowStartupLocation)
20 from System.Windows.Controls
import (Button, ColumnDefinition, Grid, Label, ListBox,
21 PasswordBox, RowDefinition, TextBlock, TextBox, SelectionMode)
32 _right_button =
'Cancel'
34 def __init__(self, message, value=None, **extra):
42 self.
TitleTitle =
'Robot Framework'
49 left_column = ColumnDefinition()
50 right_column = ColumnDefinition()
51 grid.ColumnDefinitions.Add(left_column)
52 grid.ColumnDefinitions.Add(right_column)
53 label_row = RowDefinition()
54 label_row.Height = GridLength.Auto
55 selection_row = RowDefinition()
56 selection_row.Height = GridLength.Auto
57 button_row = RowDefinition()
58 button_row.Height = GridLength(50)
59 grid.RowDefinitions.Add(label_row)
60 grid.RowDefinitions.Add(selection_row)
61 grid.RowDefinitions.Add(button_row)
69 textblock = TextBlock()
70 textblock.Text = message
71 textblock.TextWrapping = TextWrapping.Wrap
72 _label.Content = textblock
73 _label.Margin = Thickness(10)
74 _label.SetValue(Grid.ColumnSpanProperty, 2)
75 _label.SetValue(Grid.RowProperty, 0)
76 self.
ContentContent.AddChild(_label)
79 self.
ContentContent.AddChild(selector)
88 self.
left_buttonleft_button.SetValue(Grid.ColumnProperty, 0)
93 self.
right_buttonright_button.SetValue(Grid.ColumnProperty, 1)
95 self.
left_buttonleft_button.SetValue(Grid.ColumnProperty, 0)
98 self.
left_buttonleft_button.SetValue(Grid.ColumnSpanProperty, 2)
104 button.Margin = Thickness(10)
105 button.MaxHeight = 50
106 button.MaxWidth = 150
107 button.SetValue(Grid.RowProperty, 2)
108 button.Content = content
109 button.Click += callback
119 button.IsCancel =
True
122 self.
ContentContent.AddChild(button)
159 def __init__(self, message, default='', hidden=False):
160 _WpfDialog.__init__(self, message, default, hidden=hidden)
165 self.
_entry_entry.Password = default
if default
else ''
167 self.
_entry_entry = TextBox()
168 self.
_entry_entry.Text = default
if default
else ''
169 self.
_entry_entry.SetValue(Grid.RowProperty, 1)
170 self.
_entry_entry.SetValue(Grid.ColumnSpanProperty, 2)
172 self.
_entry_entry.Height = 30
173 self.
_entry_entry.Width = 150
174 self.
_entry_entry.SelectAll()
179 return self.
_entry_entry.Text
180 except AttributeError:
181 return self.
_entry_entry.Password
187 _WpfDialog.__init__(self, message, values)
191 self.
_listbox_listbox.SetValue(Grid.RowProperty, 1)
192 self.
_listbox_listbox.SetValue(Grid.ColumnSpanProperty, 2)
193 self.
_listbox_listbox.Margin = Thickness(10)
195 self.
_listbox_listbox.Items.Add(item)
199 return bool(self.
_listbox_listbox.SelectedItem)
202 return self.
_listbox_listbox.SelectedItem
208 _WpfDialog.__init__(self, message, values)
212 self.
_listbox_listbox.SelectionMode = SelectionMode.Multiple
213 self.
_listbox_listbox.SetValue(Grid.RowProperty, 1)
214 self.
_listbox_listbox.SetValue(Grid.ColumnSpanProperty, 2)
215 self.
_listbox_listbox.Margin = Thickness(10)
217 self.
_listbox_listbox.Items.Add(item)
221 return sorted(self.
_listbox_listbox.SelectedItems,
222 key=list(self.
_listbox_listbox.Items).index)
229 _left_button =
'PASS'
233 _right_button =
'FAIL'
def _create_selector(self, values)
def __init__(self, message, values)
def _get_right_button_value(self)
def __init__(self, message, values)
def _create_selector(self, values)
def _validate_value(self)
def __init__(self, message, value=None, **extra)
def _create_buttons(self)
def _validate_value(self)
def _create_selector(self, value)
def _bind_esc_to_close_dialog(self)
def _create_button(self, content, callback)
def _right_button_clicked(self, sender, event_args)
def _initialize_dialog(self)
def _left_button_clicked(self, sender, event_args)
def _get_right_button_value(self)
def _create_body(self, message, value, **extra)