Patch for adding version info for Extensions

Jan-Oliver Wagner jan at intevation.de
Thu Jul 29 14:40:48 CEST 2004


Hi,

some time ago Bernhard Reiter proposed to introduce
some versioning for extensions so that the about dialog
informs about which extensions are loaded and who the
author is etc.

I decided to have a explicit registration for the extensions.

Let me know what you think.

Attached is a patch (based on current CVS HEAD) and a new
file Thuban/UI/extensionregistry.py

	Jan
-- 
Jan-Oliver Wagner               http://intevation.de/~jan/

Intevation GmbH                      http://intevation.de/
FreeGIS                                http://freegis.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extensionregistry.py
Type: text/x-python
Size: 2827 bytes
Desc: not available
Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040729/e32f7edd/extensionregistry.py
-------------- next part --------------
? Extensions/wms-out
Index: Extensions/gns2shp/gns2shp.py
===================================================================
RCS file: /home/thuban/jail/thubanrepository/thuban/Extensions/gns2shp/gns2shp.py,v
retrieving revision 1.3
diff -u -3 -p -r1.3 gns2shp.py
--- Extensions/gns2shp/gns2shp.py	18 May 2004 21:09:50 -0000	1.3
+++ Extensions/gns2shp/gns2shp.py	29 Jul 2004 12:24:53 -0000
@@ -23,7 +23,7 @@ __version__ = '$Revision: 1.3 $'
 
 import os, sys
 
-# only import GUI when not called as command line tool
+# only import GUI and register when not called as command line tool
 if __name__ != '__main__':
     from wxPython.wx import *
 
@@ -32,8 +32,22 @@ if __name__ != '__main__':
     from Thuban import _
     from Thuban.Model.layer import Layer
 
+from Thuban.UI.extensionregistry import ThubanExtensionDesc, ext_registry
+
 import shapelib
 import dbflib
+
+
+ext_registry.Add(ThubanExtensionDesc(
+    name = 'gns2shp',
+    version = '1.0.0',
+    authors= [ 'Jan-Oliver Wagner' ],
+    copyright = '2003, 2004 Intevation GmbH',
+    desc = _("Converts GNS (Geographical Name Service\n" \
+             "of NIMA) to Shapefile format and\n" \
+             "displays the data."),
+    min_thuban_versions = { '1.0' : '0' }))
+
 
 def gns2shp(src_fname, dest_fname):
     """Convert a file from gns textformat into a Shapefile.
Index: Extensions/importAPR/importAPR.py
===================================================================
RCS file: /home/thuban/jail/thubanrepository/thuban/Extensions/importAPR/importAPR.py,v
retrieving revision 1.4
diff -u -3 -p -r1.4 importAPR.py
--- Extensions/importAPR/importAPR.py	11 May 2004 22:34:49 -0000	1.4
+++ Extensions/importAPR/importAPR.py	29 Jul 2004 12:24:53 -0000
@@ -27,9 +27,19 @@ from Thuban.UI.mainwindow import main_me
 from Thuban import _
 from Thuban.Model.layer import Layer
 from Thuban.Model.classification import ClassGroupRange, ClassGroupSingleton
+from Thuban.UI.extensionregistry import ThubanExtensionDesc, ext_registry
 
 from odb import ODBBaseObject
 from apr import APR_LClass, APR_TClr, APR_BLnSym, APR_BMkSym, APR_BShSym
+
+ext_registry.Add(ThubanExtensionDesc(
+    name = 'importAPR',
+    version = '0.1.0',
+    authors= [ 'Jan-Oliver Wagner' ],
+    copyright = '2003 Intevation GmbH',
+    desc = _("Import a ArcView project file (.apr)\n" \
+             "and convert it to Thuban."),
+    min_thuban_versions = { '1.0' : '0' }))
 
 class ODBExtension(Extension):
     def TreeInfo(self):
Index: Thuban/UI/about.py
===================================================================
RCS file: /home/thuban/jail/thubanrepository/thuban/Thuban/UI/about.py,v
retrieving revision 1.12
diff -u -3 -p -r1.12 about.py
--- Thuban/UI/about.py	26 Mar 2004 18:15:35 -0000	1.12
+++ Thuban/UI/about.py	29 Jul 2004 12:27:14 -0000
@@ -18,6 +18,8 @@ from Thuban import _
 from Thuban.version import versions
 from Thuban.Model.resource import gdal_support_status
 
+from Thuban.UI.extensionregistry import ext_registry
+
 class About(wxDialog):
 
     def __init__(self, parent):
@@ -70,6 +72,14 @@ class About(wxDialog):
             text+= '\t%s %s\n' % (name, version)
         text += '\n'
 
+        text += _('Extensions:\n')
+        if len(ext_registry.Get()) == 0:
+            text += _('\tNone registered.\n')
+        else:
+            for ext in ext_registry.Get():
+                text += '\t%s %s\n' % (ext.name, ext.version)
+        text += '\n'
+
         text += _('Lead Developer:\n')
         text += '\t%s\n\n' % lead_developer
 
@@ -94,6 +104,22 @@ class About(wxDialog):
             "\tDevelopers list (public):\n\t\t<thuban-devel at intevation.de>\n"
             "\tThuban team at Intevation:\n\t\t<thuban at intevation.de>\n"
             )
+
+        text += '\n\n'
+
+        text += _("Details on the registered extensions:\n\n")
+
+        if len(ext_registry.Get()) == 0:
+            text += _('\tNone registered.\n')
+        else:
+            for ext in ext_registry.Get():
+                text += '%s %s:\n' % (ext.name, ext.version)
+                text += _('Copyright %s\n') % ext.copyright
+                text += _('Authors:\n')
+                for author in ext.authors:
+                    text+= '\t%s\n' % author
+                text += ext.desc
+                text += '\n\n'
 
         self.text = text
 


More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)