User:Quozl

From Sugar Labs
Revision as of 23:12, 9 March 2011 by Quozl (talk | contribs) (→‎Display)
Jump to navigation Jump to search

Pippy Design Idea 2011-03-10

Usage

A learner will:

  • review and run an included example module, observing code and behaviour,
  • modify an included example module, and run the modified version, observing changed behaviour,
  • write a fresh module, creating new behaviour,
  • write a fresh module that imports an included example module unchanged, deriving behaviour from existing behaviour,
  • write a fresh module that imports a modified example module,
  • write two fresh modules one of which imports the other,
  • derive more complex code using modules created by teachers or other learners, with or without changing the contributed module.

A group of learners will do the above, but also:

  • collaborate on a set of modules included in the shared activity instance,
  • run modules locally on each laptop.

A pair of learners may:

  • create one subordinate module each, and concentrate on it,
  • create one master module that imports the two subordinate modules,
  • write unit tests in each subordinate module and run them locally on each laptop,
  • integrate by running the master module.

Purpose

  • increase code sharing, at a module level,
  • increase relevance to Python users,
  • increase portability of code written, beyond Pippy and Sugar,

Data

A running Pippy instance will contain the following data:

  • zero or more modules,
    • (either pure python modules, packages, or distutil source distributions, though not a sugar bundle),
  • each module will include zero, one (pure python modules) or more (packages or distutil source distributions) source files,
  • each module will include a source file setup.py capable of creating the python distutil source distribution output, but unless the user has asked to edit the setup.py, it will not be shown, instead a default will be used, created and maintained by Pippy,

A shared Pippy will contain the same data as above on each laptop.

Input

Pippy may read from:

  • a saved instance of Pippy, in the journal, by activation only,
  • a module in the journal, (which may have come from a teacher, another learner, or a server), using the object chooser,
    • in pure python module form, as a single source file,
    • in distutil source distribution form, as multiple source files inside a tar or zip container,
  • pristine example modules included with Pippy, using a button and an example chooser.

Output

Pippy may write to:

  • a saved instance of Pippy, in the journal,
  • a pure python module, in the journal,
    • represented as a single source file,
  • a package module, in the journal,
    • represented as a distutils source distribution in tar or zip container.

Activation

Pippy may be activated from a journal entry:

  • a saved instance of Pippy, which will start the Pippy activity and present exactly what was visible at the time the saved instance was created,
  • a pure python module or package module, which will start the Pippy activity in an execution only mode that behaves in the same way as the "run" button, displaying a VTE (only if stdout is written to, or stdin is read from), and if not exiting immediately, without creating a journal entry.

Display

Display will contain:

  • toolbar,
  • a series of tabs, one for each module, an add module button, and an open example module button,
  • within each module, a series of tabs, one for __doc__ that is not editable (only if the module has non-empty __doc__), one for each source file that is editable, and an add file button,
  • within each file, a syntax highlighting text edit widget.

(the series of tabs encapsulated in another series of tabs is potentially difficult for a learner to comprehend, but an alternative tree view is thought inappropriate because of the horizontal space consumed, and because use of a module should be constrained to the public API of the module).

Process

When run is pressed, display will contain:

  • toolbar,
  • stdout stdin vte, (only if stdout is written to, or stdin is read from),
  • a stop button.

Changes

Partial list of changes to bring Pippy existing source to a state consistent with the design above:

  • remove the examples widget from the main screen, provide it only as an "open an example bundle" function,
  • remove the output window from the main screen, provide it only when a program is run, and only if the program generates stdout or reads from stdin,
  • enlarge the program text entry widget to be nearly full screen,
  • encapsulate the program text entry widget in tabs for files in a zip bundle,
  • encapsulate the bundle in tabs for zip bundles loaded into pippy instance,
  • on standard sugar save, save all zip bundles and files in a sugar journal entry,
  • provide an export zip bundle button that creates a sugar journal entry of type zip bundle, for sharing,
  • provide a way to import zip bundles from journal into the current pippy instance, using the object chooser,
  • on execution of a bundle, allow access to all other currently loaded bundles via import, and access to system bundles via import,

Alternative

  • create a new activity.

Existing Situation

Pippy provides example scripts written in Python, allows the learner to run them, edit them, and save them as a journal entry. See definition of the term script and discussion of modules.

for definitions ... module, pure python module, package.