[Schevo-devel] [TUTORIAL] - Create and Evolve a Simple OO Application

Patrick K. O'Brien pobrien at orbtech.com
Wed Feb 23 13:09:11 EST 2005


Ilias Lazaridis wrote:
> Ilias Lazaridis wrote:
> 
>> here's the tutorial 0.1 - draft version:
> 
> 
> From the several answers spreaded over this thread, I try to answer the
> relevant questions myself.
> 
>>
>> -
>>
>> Creating the Project
>> ====================
>>
>> open a command window
>>
>> cmd: evo new myapp
>>
>> within folder "myapp" in the file "entity.py"
> 
> 
> myapp/schema/1/entity.py
> 
>> use any editor to insert this:
>>
>> //---------------------------------------------------------------------------------
>>
>>
>> """Entity schema."""
>>
>> class Car:
>>     """Type of car."""
>>
>>     manufacturer = f.string()
>>     model = f.string()
>>     modelYear = f.integer()
>>
>>     _key(manufacturer, model, modelYear)
>>
>>     _icon('.actions.kgpg_key3')
>>
>>     def __str__(self):
>>         return '%s %s %s' % (
>>             self.modelYear, self.manufacturer, self.model)
>>
>> //---------------------------------------------------------------------------------
>>
>>
>> [preparation steps]
> 
> 
> no steps are necessary at this point.
> 
>> cmd: evo run myapp
> 
> 
>> GUI (schevo navigator): add 2 cars within the schevo-navigator.
> 
> 
> the schevo-navigator is self-explaining.
> 
>> Adding a 1:1 Relation
>> =====================
>>
>> add class "Owner" to "entity.py"
> 
> 
> class Owner:
>     """Individual human being."""
> 
>     name = f.string()
>     profession = f.string()
> 
>     _key(name)
> 
>     _icon('.apps.personal')
> 
>     _plural('Owners')
> 
>     def __str__(self):
>         return self.name
> 
>> add a "1:1" relation to Cars
> 
> 
> "class Car:"
> 
>     after: "modelYear = f.integer()"
>     add  : owner = f.entity(allow=Owner)
> 
>> [preparation steps]
> 
> 
> no further steps needed
> 
>> cmd: evo run myapp
> 
> 
> The Cars that I've entered before are not existent.
> 
> readding 2 Cars.
> 
>> GUI: add 2 Owners
> 
> 
> ok
> 
>> GUI: edit cars, assign Owner to Car [Car is owned by one Owner]
> 
> 
> Owner is withing drop-down-list:
> 
> ok
> 
> -
> 
> exiting schevo-navigator and restarting:
> 
> The objects were not available.
> 
> -
> 
> Have I possibly ommitted some steps?

At the moment, Schevo creates a config.py for the new app that defaults
to temporary in-memory storage.  To use disk-based Pypersyst storage,
either change the default in the config.py, or use the --use-disk
commandline option.  Asking your new app for help will display all these
options (and any others you add yourself), and indicate all the current
defaults.  For example:

C:\Code\schevo-svn\sandbox\pobrien>evo new myapp

C:\Code\schevo-svn\sandbox\pobrien>evo run myapp - --help
My Application options:
  --help                Show help

  sample:
    Sample data to load during application development.

    --use-sample        Use this option.

  navigator:
    Schevo Navigator user interface. (Used by default.)

    --use-navigator     Use this option.
    --navigator-geometry=STR
                        Geometry of the application's main window.  Use
                        XXXxYYY to specify a width and height.  Use
                        XXXxYYY+XOFFSET+YOFFSET to specify a width, height,
                        and offset from top left of screen.  Use the word
                        "maximized" to maximize, or "default" for Qt's
default
                        behavior.
    --navigator-shell   Show menu option for an embedded Python shell.
    --navigator-no-shell
                        Opposite of --navigator-shell (Default)

  disk:
    Pypersyst disk storage back-end.

    --use-disk          Use this option.
    --disk-storedir=STR
                        Storage directory to write database snapshots and
                        transaction logs to.
    --disk-storename=STR
                        Base name of storage files.

  icons:
    Available icon collections.

    --icons-default=STR
                        Default icon collection to use.

  memory:
    Memory-only storage back-end. (Used by default.)

    --use-memory        Use this option.

-- 
Patrick K. O'Brien
Orbtech    http://www.orbtech.com
Schevo     http://www.schevo.org
Pypersyst  http://www.pypersyst.org




More information about the Schevo-devel mailing list