Robot Framework Integrated Development Environment (RIDE)
Dialogs.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 
30 
31 from robotide.lib.robot.version import get_version
32 from robotide.lib.robot.utils import IRONPYTHON, JYTHON, is_truthy
33 
34 if JYTHON:
35  from .dialogs_jy import MessageDialog, PassFailDialog, InputDialog, SelectionDialog, MultipleSelectionDialog
36 elif IRONPYTHON:
37  from .dialogs_ipy import MessageDialog, PassFailDialog, InputDialog, SelectionDialog, MultipleSelectionDialog
38 else:
39  from .dialogs_py import MessageDialog, PassFailDialog, InputDialog, SelectionDialog, MultipleSelectionDialog
40 
41 
42 __version__ = get_version()
43 __all__ = ['execute_manual_step', 'get_value_from_user',
44  'get_selection_from_user', 'pause_execution', 'get_selections_from_user']
45 
46 
47 
51 def pause_execution(message='Test execution paused. Press OK to continue.'):
52  MessageDialog(message).show()
53 
54 
55 
64 def execute_manual_step(message, default_error=''):
65  if not _validate_user_input(PassFailDialog(message)):
66  msg = get_value_from_user('Give error message:', default_error)
67  raise AssertionError(msg)
68 
69 
70 
91 def get_value_from_user(message, default_value='', hidden=False):
92  return _validate_user_input(InputDialog(message, default_value,
93  is_truthy(hidden)))
94 
95 
96 
106 def get_selection_from_user(message, *values):
107  return _validate_user_input(SelectionDialog(message, values))
108 
109 
110 
124 def get_selections_from_user(message, *values):
125  return _validate_user_input(MultipleSelectionDialog(message, values))
126 
127 
129  value = dialog.show()
130  if value is None:
131  raise RuntimeError('No value provided by user.')
132  return value
def execute_manual_step(message, default_error='')
Pauses test execution until user sets the keyword status.
Definition: Dialogs.py:64
def pause_execution(message='Test execution paused. Press OK to continue.')
Pauses test execution until user clicks Ok button.
Definition: Dialogs.py:51
def get_selections_from_user(message, *values)
Pauses test execution and asks user to select multiple values.
Definition: Dialogs.py:124
def get_value_from_user(message, default_value='', hidden=False)
Pauses test execution and asks user to input a value.
Definition: Dialogs.py:91
def get_selection_from_user(message, *values)
Pauses test execution and asks user to select a value.
Definition: Dialogs.py:106
def is_truthy(item)
Returns True or False depending is the item considered true or not.
Definition: robottypes.py:49
def get_version(naked=False)
Definition: version.py:24