This module defines Package classes.

A Package is a deplyment unit and contains a factories (Node generator) and meta informations (authors, license, doc...)

exception core.package.FactoryExistsError[source]

Bases: exceptions.Exception

exception core.package.UnknownNodeError(name)[source]

Bases: exceptions.Exception

class core.package.AbstractPackageReader(filename)[source]

Bases: object

Abstract class to add a package in the package manager.

register_packages(pkgmanager)[source]

Create and add a package in the package manager.

class core.package.DynamicPackage(name, metainfo)[source]

Bases: openalea.core.pkgdict.PackageDict

Package for dynamical parsing of python file

class core.package.Package(name, metainfo, path=None)[source]

Bases: openalea.core.pkgdict.PackageDict

A Package is a dictionnary of node factory. Each node factory is able to generate node and their widgets.

Meta informations are associated with a package.

add_factory(factory)[source]

Add to the package a factory ( node or subgraph )

get_factory(id)[source]

Return the factory associated with id

get_id()[source]

Return the package id

get_metainfo(key)[source]

Return a meta information. See the standard key in the __init__ function documentation.

Parameters:key -- todo
get_names()[source]

Return all the factory names in a list

get_pkg_files()[source]

Return the list of python filename of the package. The filename are relative to self.path

get_tip()[source]

Return the package description

get_wralea_path()[source]

Return the full path of the wralea.py (if set)

is_directory()[source]

New style package. A package is embeded in a unique directory. This directory can not contain more than one package. Thus, you can move, copy or delete a package by acting on the directory without ambiguity.

Return True if the package is embeded in a directory.

is_editable()[source]

A convention (for the GUI) to ensure that the user can modify the package.

reload()[source]

Reload all python file of the package

remove_files()[source]

Remove pkg files

update_factory(old_name, factory)[source]

Update factory (change its name)

mimetype = 'openalea/package'
class core.package.PyPackageReader(filename)[source]

Bases: core.package.AbstractPackageReader

Build packages from wralea file Use 'register_package' function

build_package(wraleamodule, pkgmanager)[source]

Build package and update pkgmanager

filename_to_module(filename)[source]

Transform the filename ending with .py to the module name

get_pkg_name()[source]

Return the OpenAlea (uniq) full package name

register_packages(pkgmanager)[source]

Execute Wralea.py

class core.package.PyPackageReaderVlab(filename)[source]

Bases: core.package.AbstractPackageReader

Build a package from a vlab specification file.

register_packages(pkgmanager)[source]

Create and add a package in the package manager.

class core.package.PyPackageReaderWralea(filename)[source]

Bases: core.package.PyPackageReader

Build a package from a __wralea__.py Use module variable

build_package(wraleamodule, pkgmanager)[source]

Build package and update pkgmanager

class core.package.PyPackageWriter(package)[source]

Bases: object

Write a wralea python file

get_factories_str()[source]

Return a dict of (name:repr) of all factory

get_str()[source]

Return string to write

write_wralea(full_filename)[source]

Write the wralea.py in the specified filename

pkg_template = '\n$PKGNAME\n\n$METAINFO\n\n$ALL\n\n$FACTORY_DECLARATION\n'
wralea_template = '\n# This file has been generated at $TIME\n\nfrom openalea.core import *\n\n$PKG_DECLARATION\n\n'
class core.package.UserPackage(name, metainfo, path=None)[source]

Bases: core.package.Package

Package user editable and persistent

add_data_file(filename, description='')[source]

Add a file in a package (copy it in the directory)

add_factory(factory)[source]

Write change on disk

clone_from_package(pkg)[source]

Copy the contents of pkg in self

create_user_compositenode(name, category, description, inputs, outputs)[source]

Add a new user composite node factory to the package and save the package. Returns the cn factory.

create_user_node(name, category, description, inputs, outputs)[source]

Return a new user node factory This function create a new python module in the package directory The factory is added to the package and the package is saved.

is_editable()[source]
remove_files()[source]

Remove pkg files

set_icon(filename)[source]

Set package icon Copy filename in the package dir

write()[source]

Return the writer class

Previous topic

<no title>

Next topic

<no title>

This Page