(self, host_window, future)
| 5 | |
| 6 | class 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 | |
| 34 | class InfoDialog(BaseDialog): |
nothing calls this directly
no test coverage detected