15
15
16
16
class ComponentDialog (Dialog ):
17
17
"""
18
- A :class:`Dialog` that is composed of other dialogs
19
-
20
- A component dialog has an inner :class:`DialogSet` :class:`DialogContext`,
21
- which provides an inner dialog stack that is hidden from the parent dialog.
18
+ A :class:`botbuilder.dialogs.Dialog` that is composed of other dialogs
22
19
23
20
:var persisted_dialog state:
24
21
:vartype persisted_dialog_state: str
@@ -52,12 +49,12 @@ async def begin_dialog(
52
49
If the task is successful, the result indicates whether the dialog is still
53
50
active after the turn has been processed by the dialog.
54
51
55
- :param dialog_context: The :class:`DialogContext` for the current turn of the conversation.
56
- :type dialog_context: :class:`DialogContext`
52
+ :param dialog_context: The :class:`botbuilder.dialogs. DialogContext` for the current turn of the conversation.
53
+ :type dialog_context: :class:`botbuilder.dialogs. DialogContext`
57
54
:param options: Optional, initial information to pass to the dialog.
58
55
:type options: object
59
56
:return: Signals the end of the turn
60
- :rtype: :class:`Dialog.end_of_turn`
57
+ :rtype: :class:`botbuilder.dialogs. Dialog.end_of_turn`
61
58
"""
62
59
if dialog_context is None :
63
60
raise TypeError ("ComponentDialog.begin_dialog(): outer_dc cannot be None." )
@@ -88,16 +85,16 @@ async def continue_dialog(self, dialog_context: DialogContext) -> DialogTurnResu
88
85
contain a return value.
89
86
90
87
If this method is *not* overriden the component dialog calls the
91
- :meth:`DialogContext.continue_dialog` method on it's inner dialog
88
+ :meth:`botbuilder.dialogs. DialogContext.continue_dialog` method on it's inner dialog
92
89
context. If the inner dialog stack is empty, the component dialog ends,
93
- and if a :class:` DialogTurnResult.result` is available, the component dialog
90
+ and if a :var:`botbuilder.dialogs. DialogTurnResult.result` is available, the component dialog
94
91
uses that as it's return value.
95
92
96
93
97
- :param dialog_context: The parent :class:`DialogContext` for the current turn of the conversation.
98
- :type dialog_context: :class:`DialogContext`
94
+ :param dialog_context: The parent dialog context for the current turn of the conversation.
95
+ :type dialog_context: :class:`botbuilder.dialogs. DialogContext`
99
96
:return: Signals the end of the turn
100
- :rtype: :class:` Dialog.end_of_turn`
97
+ :rtype: :var:`botbuilder.dialogs. Dialog.end_of_turn`
101
98
"""
102
99
if dialog_context is None :
103
100
raise TypeError ("ComponentDialog.begin_dialog(): outer_dc cannot be None." )
@@ -126,15 +123,14 @@ async def resume_dialog(
126
123
To avoid the container prematurely ending we need to implement this method and simply
127
124
ask our inner dialog stack to re-prompt.
128
125
129
- :param dialog_context: The :class:`DialogContext` for the current turn of the conversation.
130
- :type dialog_context: :class:`DialogContext`
126
+ :param dialog_context: The dialog context for the current turn of the conversation.
127
+ :type dialog_context: :class:`botbuilder.dialogs. DialogContext`
131
128
:param reason: Reason why the dialog resumed.
132
- :type reason: :class:`DialogReason`
133
- :param result: Optional, value returned from the dialog that was called. The type of the
134
- value returned is dependent on the child dialog.
129
+ :type reason: :class:`botbuilder.dialogs.DialogReason`
130
+ :param result: Optional, value returned from the dialog that was called.
135
131
:type result: object
136
132
:return: Signals the end of the turn
137
- :rtype: :class:`Dialog.end_of_turn`
133
+ :rtype: :class:`botbuilder.dialogs. Dialog.end_of_turn`
138
134
"""
139
135
140
136
await self .reprompt_dialog (dialog_context .context , dialog_context .active_dialog )
@@ -149,7 +145,7 @@ async def reprompt_dialog(
149
145
:param context: The context object for this turn.
150
146
:type context: :class:`botbuilder.core.TurnContext`
151
147
:param instance: State information for this dialog.
152
- :type instance: :class:`DialogInstance`
148
+ :type instance: :class:`botbuilder.dialogs. DialogInstance`
153
149
"""
154
150
# Delegate to inner dialog.
155
151
dialog_state = instance .state [self .persisted_dialog_state ]
@@ -167,11 +163,11 @@ async def end_dialog(
167
163
168
164
:param context: The context object for this turn.
169
165
:type context: :class:`botbuilder.core.TurnContext`
170
- :param instance: State information associated with the instance of this component dialog
166
+ :param instance: State information associated with the instance of this component dialog.
171
167
on its parent's dialog stack.
172
- :type instance: :class:`DialogInstance`
168
+ :type instance: :class:`botbuilder.dialogs. DialogInstance`
173
169
:param reason: Reason why the dialog ended.
174
- :type reason: :class:`DialogReason`
170
+ :type reason: :class:`botbuilder.dialogs. DialogReason`
175
171
"""
176
172
# Forward cancel to inner dialog
177
173
if reason == DialogReason .CancelCalled :
@@ -185,7 +181,7 @@ def add_dialog(self, dialog: Dialog) -> object:
185
181
Adds a :class:`Dialog` to the component dialog and returns the updated component.
186
182
187
183
:param dialog: The dialog to add.
188
- :return: The updated :class:`ComponentDialog`
184
+ :return: The updated :class:`ComponentDialog`.
189
185
:rtype: :class:`ComponentDialog`
190
186
"""
191
187
self ._dialogs .add (dialog )
@@ -199,7 +195,7 @@ def find_dialog(self, dialog_id: str) -> Dialog:
199
195
200
196
:param dialog_id: The dialog to add.
201
197
:return: The dialog; or None if there is not a match for the ID.
202
- :rtype: :class:Dialog
198
+ :rtype: :class:`botbuilder.dialogs. Dialog`
203
199
"""
204
200
return self ._dialogs .find (dialog_id )
205
201
@@ -213,13 +209,13 @@ async def on_begin_dialog(
213
209
If the task is successful, the result indicates whether the dialog is still
214
210
active after the turn has been processed by the dialog.
215
211
216
- By default, this calls the :meth:`Dialog.begin_dialog()` method of the component
217
- dialog's initial dialog.
212
+ By default, this calls the :meth:`botbuilder.dialogs. Dialog.begin_dialog()`
213
+ method of the component dialog's initial dialog.
218
214
219
215
Override this method in a derived class to implement interrupt logic.
220
216
221
- :param inner_dc: The inner :class:`DialogContext` for the current turn of conversation.
222
- :type inner_dc: :class:`DialogContext`
217
+ :param inner_dc: The inner dialog context for the current turn of conversation.
218
+ :type inner_dc: :class:`botbuilder.dialogs. DialogContext`
223
219
:param options: Optional, initial information to pass to the dialog.
224
220
:type options: object
225
221
"""
@@ -229,8 +225,8 @@ async def on_continue_dialog(self, inner_dc: DialogContext) -> DialogTurnResult:
229
225
"""
230
226
Called when the dialog is continued, where it is the active dialog and the user replies with a new activity.
231
227
232
- :param inner_dc: The inner :class:`DialogContext` for the current turn of conversation.
233
- :type inner_dc: :class:`DialogContext`
228
+ :param inner_dc: The inner dialog context for the current turn of conversation.
229
+ :type inner_dc: :class:`botbuilder.dialogs. DialogContext`
234
230
"""
235
231
return await inner_dc .continue_dialog ()
236
232
@@ -242,11 +238,10 @@ async def on_end_dialog( # pylint: disable=unused-argument
242
238
243
239
:param turn_context: The :class:`botbuilder.core.TurnContext` for the current turn of the conversation.
244
240
:type turn_context: :class:`botbuilder.core.TurnContext`
245
- :param instance: State information associated with the instance of this component dialog on
246
- its parent's dialog stack.
247
- :type instance: :class:`DialogInstance`
241
+ :param instance: State information associated with the inner dialog stack of this component dialog.
242
+ :type instance: :class:`botbuilder.dialogs.DialogInstance`
248
243
:param reason: Reason why the dialog ended.
249
- :type reason: :class:`DialogReason`
244
+ :type reason: :class:`botbuilder.dialogs. DialogReason`
250
245
"""
251
246
return
252
247
@@ -255,10 +250,9 @@ async def on_reprompt_dialog( # pylint: disable=unused-argument
255
250
) -> None :
256
251
"""
257
252
:param turn_context: The :class:`botbuilder.core.TurnContext` for the current turn of the conversation.
258
- :type turn_context: :class:`DialogInstance`
259
- :param instance: State information associated with the instance of this component dialog
260
- on its parent's dialog stack.
261
- :type instance: :class:`DialogInstance`
253
+ :type turn_context: :class:`botbuilder.dialogs.DialogInstance`
254
+ :param instance: State information associated with the inner dialog stack of this component dialog.
255
+ :type instance: :class:`botbuilder.dialogs.DialogInstance`
262
256
"""
263
257
return
264
258
@@ -272,20 +266,11 @@ async def end_component(
272
266
If the task is successful, the result indicates that the dialog ended after the
273
267
turn was processed by the dialog.
274
268
275
- In general, the parent context is the dialog or bot turn handler that started the dialog.
276
- If the parent is a dialog, the stack calls the parent's :meth:`Dialog.resume_dialog()` method
277
- to return a result to the parent dialog. If the parent dialog does not implement
278
- :meth:`Dialog.resume_dialog()`, then the parent will end, too, and the result is passed to the next
279
- parent context, if one exists.
280
-
281
- The returned :class:`DialogTurnResult`contains the return value in its
282
- :class:`DialogTurnResult.result` property.
283
-
284
- :param outer_dc: The parent class:`DialogContext` for the current turn of conversation.
285
- :type outer_dc: class:`DialogContext`
269
+ :param outer_dc: The parent dialog context for the current turn of conversation.
270
+ :type outer_dc: class:`botbuilder.dialogs.DialogContext`
286
271
:param result: Optional, value to return from the dialog component to the parent context.
287
272
:type result: object
288
273
:return: Value to return.
289
- :rtype: :class:` DialogTurnResult.result`
274
+ :rtype: :var:`botbuilder.dialogs. DialogTurnResult.result`
290
275
"""
291
276
return await outer_dc .end_dialog (result )
0 commit comments