jan: thuban/Thuban/UI extensionregistry.py,NONE,1.1
cvs@intevation.de
cvs at intevation.de
Tue Sep 28 21:13:23 CEST 2004
Author: jan
Update of /thubanrepository/thuban/Thuban/UI
In directory doto:/tmp/cvs-serv10669
Added Files:
extensionregistry.py
Log Message:
This module defines a registry for Extensions.
--- NEW FILE: extensionregistry.py ---
# Copyright (C) 2004 by Intevation GmbH
# Authors:
# Jan-Oliver Wagner <jan at intevation.de>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with Thuban for details.
"""
Registry for Extensions.
This module defines a registry for Extensions.
This is basically used for displaying information on
the active Extensions in the general About-Dialog.
A registration is not mandatory to make a Extension
work, but any Extension should register to provide
a complete information in the Thuban About Dialog.
A Extension should define a ExtensionDesc object
and apply ext_registry.add() to register it.
"""
__version__ = "$Revision: 1.1 $"
# $Source: /thubanrepository/thuban/Thuban/UI/extensionregistry.py,v $
# $Id: extensionregistry.py,v 1.1 2004/09/28 19:13:21 jan Exp $
class ExtensionDesc:
"""
A description of a Thuban Extension.
"""
def __init__(self, name, version, authors, copyright, desc):
"""
Initialize a new Thuban Extension information.
name -- The name of the Thuban Extension.
Example: 'gns2shp'
version -- The version number of the Thuban Extension.
Example: '1.0.0'
authors -- List of authors.
Example: [ 'Jan-Oliver Wagner' ]
copyright -- Copyright notice.
Example: '2003, 2004 Intevation GmbH'
desc -- Short description of the Thuban Extension.
Example: _('''
Converts GNS (Geographical Name Service of NIMA)
to Shapefile format and displays the data.
''')
"""
self.name = name
self.version = version
self.authors = authors
self.copyright = copyright
self.desc = desc
class ExtensionRegistry:
"""
A ExtensionRegistry keeps information on the registered
Thuban Extensions.
The registry will raise a exception either when the version
required for the Extensions exceeds the version of the currently
running Thuban or if the name of a registered extension already
is used for registering another extension.
"""
def __init__(self):
self.registry = []
def __nonzero__(self):
return len(self.registry) <> 0
def __iter__(self):
return iter(self.registry)
def add(self, ext):
self.registry.append(ext)
# The central Thuban Extensions registry
ext_registry = ExtensionRegistry()
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)