/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/extensionregistry.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/extensionregistry.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2353 by jan, Tue Sep 28 19:13:21 2004 UTC revision 2580 by jan, Thu Mar 10 22:39:11 2005 UTC
# Line 1  Line 1 
1  # Copyright (C) 2004 by Intevation GmbH  # Copyright (C) 2004, 2005 by Intevation GmbH
2  # Authors:  # Authors:
3  # Jan-Oliver Wagner <[email protected]>  # Jan-Oliver Wagner <[email protected]> (2004, 2005)
4  #  #
5  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
6  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
# Line 23  __version__ = "$Revision$" Line 23  __version__ = "$Revision$"
23  # $Source$  # $Source$
24  # $Id$  # $Id$
25    
26    from Thuban import _
27    
28  class ExtensionDesc:  class ExtensionDesc:
29    
30      """      """
31      A description of a Thuban Extension.      A description of a Thuban Extension.
32      """      """
33    
34      def __init__(self, name, version, authors, copyright, desc):      def __init__(self, name, version, authors, copyright, desc,
35                     init_callback = None):
36          """          """
37          Initialize a new Thuban Extension information.          Initialize a new Thuban Extension information.
38    
# Line 50  class ExtensionDesc: Line 53  class ExtensionDesc:
53                           Converts GNS (Geographical Name Service of NIMA)                           Converts GNS (Geographical Name Service of NIMA)
54                           to Shapefile format and displays the data.                           to Shapefile format and displays the data.
55                           ''')                           ''')
56            init_callback -- a callback method that is executed if not
57                             None. This method should contain gui specific
58                             initializations of the extension.
59                             Default is None.
60    
61                             This callback should return None if
62                             the intialisation as successful. Else
63                             a string describing the problems during
64                             intialization.
65          """          """
66          self.name = name          self.name = name
67          self.version = version          self.version = version
68          self.authors = authors          self.authors = authors
69          self.copyright = copyright          self.copyright = copyright
70          self.desc = desc          self.desc = desc
71            self.init_callback = init_callback
72            self.status = _("Initialization not yet requested.")
73    
74        def init_ext(self):
75            """Execute the init callback for the extension.
76    
77            Do nothing if the callback is None.
78    
79            It is expected that the callback function returns
80            None if all was OK and a string if something was wrong.
81            The string is believed to describe the problems.
82            """
83            if self.init_callback is not None:
84                result = self.init_callback()
85                if result is not None:
86                    self.status = result
87                else:
88                    self.status = _("Initialization successful.")
89    
90  class ExtensionRegistry:  class ExtensionRegistry:
91    

Legend:
Removed from v.2353  
changed lines
  Added in v.2580

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26