GUI

carolineclark edited this page Jul 27, 2015 · 2 revisions

Outline

This page will take you through the main classes used in the GUI.

The window is the MainWindow class. The left side is the Storybook side, the right is the Terminal and the bottom is the Spellbook section.

The Storybook class

This displays the narrative of the story, hints and any general explanation text. It is stored under linux_story/gtk3/Storybook.py

This is to separate the functionality of the terminal from any additional narrative.

Spellbook

Found under linux_story/gtk3/Spellbook.py This is the bottom part of the screen that displays a permanent reminder of the commands available to the user.

Terminal side

The terminal RHS is managed by two classes.

The GUI is a Vte.Terminal with very few changes to the default (found under linux_story/gtk3/TerminalUi.py)

Inside this Vte.Terminal, there is a subprocess which controls how the terminal responds to the user input. Since this subprocess determines how other aspects of the GUI should behave (e.g. if the user has unlocked a new command), we also have a TCP server running to allow this subprocess to communicate with the MainWindow class.

The functionality of the subprocess is heavily managed by the Terminal class (under linux_story/Terminal.py). This is the main controller of the application. It gives:

  • full control over what commands the user can run.
  • how the terminal behaves in response.
  • sends messages to the server to tell window how the GUI should respond.
  • handles when the user gets XP.

The Terminal class is inherited from the Cmd module.