How to use the asciimatics.exceptions.NextScene function in asciimatics

To help you get started, we’ve selected a few asciimatics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github peterbrittain / asciimatics / tests / test_widgets.py View on Github external
def _reset(self):
        self.reset()
        raise NextScene()
github peterbrittain / asciimatics / tests / test_screen.py View on Github external
def internal_checks(screen):
            # Check for exit
            for char in ("X", "x", "Q", "q"):
                with self.assertRaises(StopApplication):
                    event = KeyboardEvent(ord(char))
                    screen._unhandled_event_default(event)

            for char in (" ", "\n"):
                with self.assertRaises(NextScene):
                    event = KeyboardEvent(ord(char))
                    screen._unhandled_event_default(event)
github peterbrittain / asciimatics / tests / test_widgets.py View on Github external
def test_on_click(selection):
            raise NextScene(str(selection))
github peterbrittain / asciimatics / asciimatics / screen.py View on Github external
for effect in scene.effects:
                    # Update the effect and delete if needed.
                    effect.update(self._frame)
                    if effect.delete_count is not None:
                        effect.delete_count -= 1
                        if effect.delete_count <= 0:
                            scene.remove_effect(effect)

                    # Sort out when we next _need_ to do a refresh.
                    if effect.frame_update_count > 0:
                        self._idle_frame_count = min(self._idle_frame_count,
                                                     effect.frame_update_count)
                self.refresh()

            if 0 < scene.duration <= self._frame:
                raise NextScene()
        except NextScene as e:
            # Tidy up the current scene.
            scene.exit()

            # Find the specified next Scene
            if e.name is None:
                # Just allow next iteration of loop
                self._scene_index += 1
                if self._scene_index >= len(self._scenes):
                    if repeat:
                        self._scene_index = 0
                    else:
                        raise StopApplication("Repeat disabled")
            else:
                # Find the required scene.
                for i, scene in enumerate(self._scenes):
github kayagoban / shadowlands / shadowlands / tui / effects / widgets.py View on Github external
def _cancel(self):
        self._scene.remove_effect(self)
        raise NextScene(self._scene.name)
        #raise NextScene("Main")
github kayagoban / shadowlands / shadowlands / tui / effects / credstick_watcher.py View on Github external
Credstick.interface = self._interface
            Credstick.eth_node = self._interface._node
            Credstick.config = self._interface._config
            Credstick.start_detect_thread()

            self.detect_thread_started = True


        if self._interface.credstick and self._interface.node.w3 and self._interface._credstick_inserted == True:
            logging.debug("credstick found - Switching to Main scene")
            # deleting the loading scene entirely.
            # This makes sure the loading screen does not come back upon resize.
            #self._screen._scenes = [self._interface.main_scene]
            #self._interface._loading_scene = False
            self._interface._credstick_inserted = False
            raise NextScene("Main")
github kayagoban / shadowlands / shadowlands / sl_transaction_frame.py View on Github external
def close(self):
        # deregister from new_block callbacks
        self.dapp.remove_block_listener(self)
        self._destroy_window_stack()
        raise NextScene(self._scene.name)
github peterbrittain / asciimatics / samples / contact_list.py View on Github external
def _ok(self):
        self.save()
        self._model.update_current_contact(self.data)
        raise NextScene("Main")
github peterbrittain / asciimatics / samples / forms.py View on Github external
def _reset(self):
        self.reset()
        raise NextScene()
github peterbrittain / asciimatics / samples / contact_list.py View on Github external
def _add(self):
        self._model.current_id = None
        raise NextScene("Edit Contact")