From 663ddab7a704b04292def4a4c0f1dbdc50c08a10 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Mon, 6 May 2019 23:05:50 -0700 Subject: [PATCH] A start on docs for VUI. It's hella crude yet. --- docs/VUI-docs/source/conf.py | 8 ++++---- docs/VUI-docs/source/index.rst | 21 +++++++++++++++++++++ joy/vui/core.py | 12 +++++++++++- joy/vui/display.py | 6 +++++- joy/vui/stack_viewer.py | 6 ++++++ joy/vui/text_viewer.py | 6 ++++++ joy/vui/viewer.py | 13 +++++++++++++ 7 files changed, 66 insertions(+), 6 deletions(-) diff --git a/docs/VUI-docs/source/conf.py b/docs/VUI-docs/source/conf.py index c172be4..b376a9b 100644 --- a/docs/VUI-docs/source/conf.py +++ b/docs/VUI-docs/source/conf.py @@ -12,9 +12,9 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import os +import sys +sys.path.insert(0, os.path.abspath('../../..')) # -- Project information ----------------------------------------------------- @@ -69,7 +69,7 @@ language = None exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = None +pygments_style = 'colorful' # -- Options for HTML output ------------------------------------------------- diff --git a/docs/VUI-docs/source/index.rst b/docs/VUI-docs/source/index.rst index f8675e1..515373d 100644 --- a/docs/VUI-docs/source/index.rst +++ b/docs/VUI-docs/source/index.rst @@ -6,11 +6,32 @@ Welcome to Joy VUI's documentation! =================================== +.. image:: _static/Joy-VUI-screenshot.PNG + .. toctree:: :maxdepth: 2 :caption: Contents: +.. automodule:: joy.vui.core + :members: + + +.. automodule:: joy.vui.display + :members: + + +.. automodule:: joy.vui.viewer + :members: + + +.. automodule:: joy.vui.text_viewer + :members: + + +.. automodule:: joy.vui.stack_viewer + :members: + Indices and tables ================== diff --git a/joy/vui/core.py b/joy/vui/core.py index 6ed210b..aabb4b7 100644 --- a/joy/vui/core.py +++ b/joy/vui/core.py @@ -17,6 +17,14 @@ # You should have received a copy of the GNU General Public License # along with Thun. If not see . # +''' + +Core +===================== + + +A Module docstring yo. +''' from sys import stderr from traceback import format_exc import pygame @@ -39,8 +47,9 @@ MOUSE_EVENTS = frozenset({ pygame.MOUSEBUTTONDOWN, pygame.MOUSEBUTTONUP }) +# AM I DOCSY? - +# What about *moi?* ARROW_KEYS = frozenset({ pygame.K_UP, pygame.K_DOWN, @@ -68,6 +77,7 @@ SUCCESS = 1 class Message(object): + '''Message class.''' def __init__(self, sender): self.sender = sender diff --git a/joy/vui/display.py b/joy/vui/display.py index 81f69a6..903ad14 100644 --- a/joy/vui/display.py +++ b/joy/vui/display.py @@ -18,6 +18,10 @@ # along with Thun. If not see . # ''' + +Display +================= + This module implements a simple visual display system modeled on Oberon. Refer to Chapter 4 of the Project Oberon book for more information. @@ -355,7 +359,7 @@ class Track(Viewer): return self, y def open_viewer(self, y, class_): - '''Open and return a viewer of class_ at y.''' + '''Open and return a viewer of class at y.''' # Todo: if y coincides with some other viewer's y replace it. viewer, viewer_y = self.viewer_at(y) h = viewer.split(viewer_y) diff --git a/joy/vui/stack_viewer.py b/joy/vui/stack_viewer.py index e03fcf6..48a9a0a 100644 --- a/joy/vui/stack_viewer.py +++ b/joy/vui/stack_viewer.py @@ -17,6 +17,12 @@ # You should have received a copy of the GNU General Public License # along with Thun. If not see . # +''' + +Stack Viewer +================= + +''' from joy.utils.stack import expression_to_string, iter_stack from joy.vui import core, text_viewer diff --git a/joy/vui/text_viewer.py b/joy/vui/text_viewer.py index 1ffea26..4b2fa5f 100644 --- a/joy/vui/text_viewer.py +++ b/joy/vui/text_viewer.py @@ -17,6 +17,12 @@ # You should have received a copy of the GNU General Public License # along with Thun. If not see . # +''' + +Text Viewer +================= + +''' import string import pygame from joy.utils.stack import expression_to_string diff --git a/joy/vui/viewer.py b/joy/vui/viewer.py index e15d652..6fa61a0 100644 --- a/joy/vui/viewer.py +++ b/joy/vui/viewer.py @@ -17,11 +17,20 @@ # You should have received a copy of the GNU General Public License # along with joy.py. If not see . # +''' + +Viewer +================= + +''' import pygame from joy.vui.core import BACKGROUND, FOREGROUND class Viewer(object): + ''' + Base Viewer class + ''' MINIMUM_HEIGHT = 11 @@ -97,6 +106,10 @@ class Viewer(object): class MenuViewer(Viewer): + ''' + MenuViewer class + ''' + MINIMUM_HEIGHT = 26 def __init__(self, surface):