20 from ..namespace.suggesters
import ResourceSuggester, LibrariesSuggester, HistorySuggester
21 from ..validators
import (ScalarVariableNameValidator, ListVariableNameValidator, TimeoutValidator, ArgumentsValidator,
22 TestCaseNameValidator, UserKeywordNameValidator, DictionaryVariableNameValidator)
23 from ..widgets
import HelpLabel, RIDEDialog, ButtonWithHandler
24 from .dialoghelps
import get_help
25 from .fieldeditors
import (ValueEditor, ListValueEditor, MultiLineEditor, ContentAssistEditor, VariableNameEditor,
26 ArgumentEditor, FileNameEditor)
27 from .formatters
import ListToStringFormatter
31 return globals()[obj.label.replace(
' ',
'') +
'Dialog']
38 _title = property(
lambda self: utils.name_from_class(self, drop=
'Dialog'))
40 def __init__(self, controller, item=None, plugin=None):
42 RIDEDialog.__init__(self, self.
_title_title)
44 self.SetLayoutDirection(wx.Layout_LeftToRight)
45 self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)
48 self.
_sizer_sizer = wx.BoxSizer(wx.VERTICAL)
49 self.
_editors_editors = self._get_editors(item)
51 self.
_sizer_sizer.Add(editor, editor.expand_factor, wx.EXPAND)
56 self.SetSizer(self.
_sizer_sizer)
57 self.
_sizer_sizer.Fit(self)
66 line = wx.StaticLine(self, size=(20,-1), style=wx.LI_HORIZONTAL)
67 if wx.VERSION < (4, 1, 0):
68 self.
_sizer_sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
70 self.
_sizer_sizer.Add(line, 0, wx.GROW | wx.RIGHT | wx.TOP, 5)
74 flag=wx.ALL, border=2)
77 buttons = self.CreateStdDialogButtonSizer(wx.OK|wx.CANCEL)
78 self.SetBackgroundColour(Colour(self.color_background))
79 self.SetForegroundColour(Colour(self.color_foreground))
80 for item
in self.GetChildren():
81 if isinstance(item, (wx.Button, wx.BitmapButton, ButtonWithHandler)):
82 item.SetBackgroundColour(Colour(self.color_secondary_background))
83 item.SetOwnBackgroundColour(Colour(self.color_secondary_background))
84 item.SetForegroundColour(Colour(self.color_secondary_foreground))
85 item.SetOwnForegroundColour(Colour(self.color_secondary_foreground))
86 self.
_sizer_sizer.Add(buttons, 0, wx.ALIGN_CENTER|wx.ALL, 5)
89 return [ e.get_value()
for e
in self.
_editors_editors ]
95 self.FindWindowById(wx.ID_OK).SetFocus()
101 class ScalarVariableDialog(_Dialog):
104 name = var.name
if var
and var.name
else '${}'
105 value = var.value[0]
if var
else ''
114 class ListVariableDialog(_Dialog):
117 name = var.name
if var
and var.name
else '@{}'
118 value = var.value
if var
and var.value
else ''
122 settings=self.
pluginplugin.global_settings)]
128 class DictionaryVariableDialog(_Dialog):
131 name = var.name
if var
and var.name
else '&{}'
132 value = var.value
if var
and var.value
else ''
136 settings=self.
pluginplugin.global_settings)]
142 class LibraryDialog(_Dialog):
150 name = item
and item.name
or ''
151 args = item
and utils.join_value(item.args)
or ''
152 alias = item.alias
if item
else ''
159 values = _Dialog.get_value(self)
167 class VariablesDialog(LibraryDialog):
175 path = item
and item.name
or ''
176 args = item
and utils.join_value(item.args)
or ''
184 class ResourceDialog(_Dialog):
187 name = item
and item.name
or ''
195 class DocumentationDialog(_Dialog):
204 return _Dialog.get_value(self)
213 class _SettingDialog(_Dialog):
222 editor.set_validator(self.
_validator_validator())
229 class ForceTagsDialog(_SettingDialog):
234 class DefaultTagsDialog(_SettingDialog):
239 class TagsDialog(_SettingDialog):
244 class _FixtureDialog(_SettingDialog):
253 class SuiteSetupDialog(_FixtureDialog):
254 tooltip =
"Suite Setup is run before any tests"
260 class SuiteTeardownDialog(_FixtureDialog):
265 class TestSetupDialog(_FixtureDialog):
270 class TestTeardownDialog(_FixtureDialog):
275 class SetupDialog(_FixtureDialog):
280 class TeardownDialog(_FixtureDialog):
285 class TemplateDialog(_FixtureDialog):
290 class TestTemplateDialog(_FixtureDialog):
295 class ArgumentsDialog(_SettingDialog):
303 class ReturnValueDialog(_SettingDialog):
308 class TestTimeoutDialog(_SettingDialog):
312 _validator = TimeoutValidator
318 class TimeoutDialog(TestTimeoutDialog):
323 class MetadataDialog(_Dialog):
326 name, value = item
and (item.name, item.value)
or (
'',
'')
334 class TestCaseNameDialog(_Dialog):
338 _title =
'New Test Case'
344 value = test.name
if test
else ''
349 return _Dialog.get_value(self)[0]
355 class CopyUserKeywordDialog(_Dialog):
359 _title =
'Copy User Keyword'
365 value = uk.name
if uk
else ''
370 return _Dialog.get_value(self)[0]
376 class UserKeywordNameDialog(_Dialog):
383 _title =
'New User Keyword'
389 value = uk.name
if uk
else ''
390 args_value =
' | '.join(uk.args.value)
if uk
else ''
396 return _Dialog.get_value(self)[0]
399 return _Dialog.get_value(self)[1]
def _get_editors(self, item)
def _add_comment_editor(self, item)
def _get_editors(self, uk)
def _get_editors(self, var)
def _add_comment_editor(self, item)
def _get_editors(self, doc)
def _get_editors(self, item)
def _get_editors(self, var)
def _get_editors(self, item)
def _get_editors(self, var)
def _get_editors(self, item)
def _create_buttons(self, **kwargs)
def __init__(self, controller, item=None, plugin=None)
def _add_comment_editor(self, item)
def _get_editors(self, item)
def _get_editors(self, item)