jan: thuban/Thuban/UI extensionregistry.py,1.1,1.2
cvs@intevation.de
cvs at intevation.de
Thu Mar 10 23:39:14 CET 2005
Author: jan
Update of /thubanrepository/thuban/Thuban/UI
In directory doto:/tmp/cvs-serv3346
Modified Files:
extensionregistry.py
Log Message:
(ExtensionDesc.__init__): Added »···optional parameter init_callback.
ExtensionDesc.init_ext): New. Executes the callback and sets
a status.
Index: extensionregistry.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/extensionregistry.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- extensionregistry.py 28 Sep 2004 19:13:21 -0000 1.1
+++ extensionregistry.py 10 Mar 2005 22:39:11 -0000 1.2
@@ -1,6 +1,6 @@
-# Copyright (C) 2004 by Intevation GmbH
+# Copyright (C) 2004, 2005 by Intevation GmbH
# Authors:
-# Jan-Oliver Wagner <jan at intevation.de>
+# Jan-Oliver Wagner <jan at intevation.de> (2004, 2005)
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with Thuban for details.
@@ -23,13 +23,16 @@
# $Source$
# $Id$
+from Thuban import _
+
class ExtensionDesc:
"""
A description of a Thuban Extension.
"""
- def __init__(self, name, version, authors, copyright, desc):
+ def __init__(self, name, version, authors, copyright, desc,
+ init_callback = None):
"""
Initialize a new Thuban Extension information.
@@ -50,13 +53,39 @@
Converts GNS (Geographical Name Service of NIMA)
to Shapefile format and displays the data.
''')
+ init_callback -- a callback method that is executed if not
+ None. This method should contain gui specific
+ initializations of the extension.
+ Default is None.
+ This callback should return None if
+ the intialisation as successful. Else
+ a string describing the problems during
+ intialization.
"""
self.name = name
self.version = version
self.authors = authors
self.copyright = copyright
self.desc = desc
+ self.init_callback = init_callback
+ self.status = _("Initialization not yet requested.")
+
+ def init_ext(self):
+ """Execute the init callback for the extension.
+
+ Do nothing if the callback is None.
+
+ It is expected that the callback function returns
+ None if all was OK and a string if something was wrong.
+ The string is believed to describe the problems.
+ """
+ if self.init_callback is not None:
+ result = self.init_callback()
+ if result is not None:
+ self.status = result
+ else:
+ self.status = _("Initialization successful.")
class ExtensionRegistry:
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)