MCPcopy
hub / github.com/beeware/toga / show

Method show

dummy/src/toga_dummy/dialogs.py:7–31  ·  view source on GitHub ↗
(self, host_window, future)

Source from the content-addressed store, hash-verified

5
6class BaseDialog(LoggedObject):
7 def show(self, host_window, future):
8 self.future = future
9
10 try:
11 if host_window:
12 host_window._impl._action(f"show window {self.__class__.__name__}")
13 result = host_window._impl.dialog_responses[
14 self.__class__.__name__
15 ].pop(0)
16 else:
17 toga.App.app._impl._action(f"show app {self.__class__.__name__}")
18 result = toga.App.app._impl.dialog_responses[
19 self.__class__.__name__
20 ].pop(0)
21
22 except KeyError as exc:
23 raise RuntimeError(
24 f"Was not expecting responses for {self.__class__.__name__}"
25 ) from exc
26 except IndexError as exc:
27 raise RuntimeError(
28 f"Ran out of prepared responses for {self.__class__.__name__}"
29 ) from exc
30
31 self.future.set_result(result)
32
33
34class InfoDialog(BaseDialog):

Callers

nothing calls this directly

Calls 2

_actionMethod · 0.80
set_resultMethod · 0.80

Tested by

no test coverage detected