From Silke.Reimer at intevation.de Wed Sep 1 18:26:36 2004 From: Silke.Reimer at intevation.de (Silke Reimer) Date: Wed, 1 Sep 2004 18:26:36 +0200 Subject: SPEC-File Message-ID: <20040901162636.GP16620@intevation.de> Hallo! I just sent some information about the Fedora Core 2 package which has been built for Thuban. I would like to suggest to include the resulting thuban.spec into Thuban CVS. The same we could also include the LinGIS SPEC-file. I would propose to do this in the following structure. rpm fedora SPEC thuban.spec suse SPEC thuban.spec Thus it is rather easy to build a new RPM package of Thuban based on different GNU/Linux-Systems. What do you think about it? Silke -- Silke Reimer Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040901/148f7a1e/attachment.bin From frank.koormann at intevation.de Wed Sep 1 18:44:29 2004 From: frank.koormann at intevation.de (Frank Koormann) Date: Wed, 1 Sep 2004 18:44:29 +0200 Subject: SPEC-File In-Reply-To: <20040901162636.GP16620@intevation.de> References: <20040901162636.GP16620@intevation.de> Message-ID: <20040901164429.GA2198@intevation.de> Hi, * Silke Reimer [040901 18:26]: > I just sent some information about the Fedora Core 2 package which > has been built for Thuban. I would like to suggest to include the > resulting thuban.spec into Thuban CVS. The same we could also > include the LinGIS SPEC-file. I would propose to do this in the > following structure. > > rpm > fedora > SPEC > thuban.spec > suse > SPEC > thuban.spec > > Thus it is rather easy to build a new RPM package of Thuban based on > different GNU/Linux-Systems. unfortunately we have already a debian directory in the thuban base. Otherwise I would propose something like packaging debian fedora SPEC suse SPEC ... Or would this violate debian policies? -- Frank Koormann Professional Service around Free Software (http://intevation.net/) FreeGIS Project (http://freegis.org/) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040901/691dc71d/attachment.bin From Silke.Reimer at intevation.de Wed Sep 1 19:02:26 2004 From: Silke.Reimer at intevation.de (Silke Reimer) Date: Wed, 1 Sep 2004 19:02:26 +0200 Subject: SPEC-File In-Reply-To: <20040901164429.GA2198@intevation.de> References: <20040901162636.GP16620@intevation.de> <20040901164429.GA2198@intevation.de> Message-ID: <20040901170226.GU16620@intevation.de> On Wed, Sep 01, 2004 at 06:44:29PM +0200, Frank Koormann wrote: > Hi, > > * Silke Reimer [040901 18:26]: > > I just sent some information about the Fedora Core 2 package which > > has been built for Thuban. I would like to suggest to include the > > resulting thuban.spec into Thuban CVS. The same we could also > > include the LinGIS SPEC-file. I would propose to do this in the > > following structure. > > > > rpm > > fedora > > SPEC > > thuban.spec > > suse > > SPEC > > thuban.spec > > > > Thus it is rather easy to build a new RPM package of Thuban based on > > different GNU/Linux-Systems. > > unfortunately we have already a debian directory in the thuban base. > Otherwise I would propose something like > > packaging > debian > fedora > SPEC > suse > SPEC > ... > > Or would this violate debian policies? Yes, it would. To build a debian package the debian directory has to be placed in the main directory of the sources. Silke -- Silke Reimer Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040901/e14d0837/attachment.bin From bernhard at intevation.de Thu Sep 2 12:38:49 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Thu, 2 Sep 2004 12:38:49 +0200 Subject: SPEC-File In-Reply-To: <20040901162636.GP16620@intevation.de> References: <20040901162636.GP16620@intevation.de> Message-ID: <20040902103849.GV11636@intevation.de> On Wed, Sep 01, 2004 at 06:26:36PM +0200, Silke Reimer wrote: > I just sent some information about the Fedora Core 2 package which > has been built for Thuban. I would like to suggest to include the > resulting thuban.spec into Thuban CVS. The same we could also > include the LinGIS SPEC-file. I would propose to do this in the > following structure. > > rpm > fedora > SPEC > thuban.spec > suse > SPEC > thuban.spec There is no need for "SPEC" in the patch, is there? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040902/3cd0d466/attachment.bin From Silke.Reimer at intevation.de Thu Sep 2 14:12:06 2004 From: Silke.Reimer at intevation.de (Silke Reimer) Date: Thu, 2 Sep 2004 14:12:06 +0200 Subject: SPEC-File In-Reply-To: <20040902103849.GV11636@intevation.de> References: <20040901162636.GP16620@intevation.de> <20040902103849.GV11636@intevation.de> Message-ID: <20040902121206.GB3185@intevation.de> On Thu, Sep 02, 2004 at 12:38:49PM +0200, Bernhard Reiter wrote: > On Wed, Sep 01, 2004 at 06:26:36PM +0200, Silke Reimer wrote: > > I just sent some information about the Fedora Core 2 package which > > has been built for Thuban. I would like to suggest to include the > > resulting thuban.spec into Thuban CVS. The same we could also > > include the LinGIS SPEC-file. I would propose to do this in the > > following structure. > > > > rpm > > fedora > > SPEC > > thuban.spec > > suse > > SPEC > > thuban.spec > > There is no need for "SPEC" in the patch, is there? I thought this is the easiest if some distribution needs patches.They can then be included in a subdirectory SOURCES. So you just have to put the tarball into SOURCES as well and can start to build your thuban package. But I don't stick to the SPEC-directory. Silke -- Silke Reimer Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040902/eaa5803f/attachment.bin From bh at intevation.de Thu Sep 2 14:34:25 2004 From: bh at intevation.de (Bernhard Herzog) Date: Thu, 02 Sep 2004 14:34:25 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources References: <20040713141846.GA9814@finlandia.infodrom.north.de> <20040713142901.GA13410@finlandia.infodrom.north.de> <20040713150122.GR4134@finlandia.infodrom.north.de> <20040718034419.GC4134@finlandia.infodrom.north.de> <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> Message-ID: Martin Schulze writes: >> >> > And for Thuban.UI.classifier: >> >> > >> >> > add_properties_dialog(Layer, Classifier) >> >> > add_properties_dialog(RasterLayer, Classifier) >> > >> > I'm not sure how I am supposed to implement this since >> > classifier.py doesn't import mainwindow and I don't know if it >> > would be a good idea to do so. >> >> You could put that code into Thuban.UI.mainwindow which already depends >> on Thuban.UI.classifier because it currently refers to the dialogs in >> there directly. That would keep the module dependencies the same as >> now. > > Err??? Now it's me going Err :) > Are you really sure you want this code appear in mainwindow.py? No, I'm not sure, and I don't have the time to find the perfect place for it. You didn't want it in Thuban.UI.classifier, though, and that was what I was replying to. classifier does not depend on mainwindow but would if you put the add_properties_dialog call there. That's how I understood your reply anyway. My suggestion, then, was that, since mainwindow currently depends on classifier, you could have the call in mainwindow and the depencies wouldn't change. FWIW, I don't see why putting the call into classifier would be a problem. Note: mainwindow is always the module Thuban.UI.mainwindow here, in case that wasn't clear from context which is sometimes hard to tell in conversations stretching over months :) > Similar code is required for other layers, too (e.g. currently WMS > layers). Should that code go into mainwindow as well? For layers in extensions definitely not. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From bh at intevation.de Thu Sep 2 14:39:08 2004 From: bh at intevation.de (Bernhard Herzog) Date: Thu, 02 Sep 2004 14:39:08 +0200 Subject: SPEC-File References: <20040901162636.GP16620@intevation.de> Message-ID: Silke Reimer writes: > I just sent some information about the Fedora Core 2 package which > has been built for Thuban. I would like to suggest to include the > resulting thuban.spec into Thuban CVS. The same we could also > include the LinGIS SPEC-file. I would propose to do this in the > following structure. Can this be tied in with the "setup.py bdist_rpm" somehow? Would it make sense to do so? Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From cvs at intevation.de Fri Sep 3 19:00:12 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 3 Sep 2004 19:00:12 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mapfile.py,1.11,1.12 Message-ID: <20040903170012.3AF2810016B@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv23554 Modified Files: mapfile.py Log Message: Fix a small bug with the line color. Now the line color will now only set if it is set in Thuban an not Transparent. Index: mapfile.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mapfile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- mapfile.py 9 Aug 2004 11:38:47 -0000 1.11 +++ mapfile.py 3 Sep 2004 17:00:10 -0000 1.12 @@ -479,7 +479,8 @@ new_styleobj.set_color(tb_style.GetFill()) else: new_styleobj.set_size(tb_style.GetLineWidth()) - new_styleobj.set_linecolor(tb_style.GetLineColor()) + if tb_style.GetLineColor() != Transparent: + new_styleobj.set_linecolor(tb_style.GetLineColor()) new_styleobj.set_color(tb_style.GetFill()) From cvs at intevation.de Fri Sep 3 19:01:47 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 3 Sep 2004 19:01:47 +0200 (CEST) Subject: jschuengel: thuban/Extensions/umn_mapserver mf_export.py,1.8,1.9 Message-ID: <20040903170147.88E6710016B@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban/Extensions/umn_mapserver In directory doto:/tmp/cvs-serv23587 Modified Files: mf_export.py Log Message: Fixed a bug with deleting the layers from mapfile. Now all layers will delete backwards from the. CVS ---------------------------------------------------------------------- Index: mf_export.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_export.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- mf_export.py 9 Aug 2004 11:39:37 -0000 1.8 +++ mf_export.py 3 Sep 2004 17:01:45 -0000 1.9 @@ -82,8 +82,10 @@ for rnr in range(0, bigint+1, 1): if rnr not in indexlist: removelist.append(rnr) - for i in removelist: - map.remove_layer(i) + + for i in range(len(removelist), 0, -1): + map.remove_layer(removelist[i-1]) + map.set_layerorder(tuple(indexlist)) def thuban_to_map(tb_context, map): @@ -134,8 +136,7 @@ out_file.write(thuban_umn_comment) out_file.write(text_in_file) # text in Datei schreiben out_file.close() # Datei schliessen - - + def export_mapfile(context): """ Exports an existing mapobj and set all stuff from thuban to @@ -169,7 +170,7 @@ # this funktion will write a commend to the generated mapfile # that shows that the file is generated by thuban write_creatorcomment(path,file) - + # check if an mapobj exists, to control the menuitem is available or not def _has_umn_mapobj(context): From cvs at intevation.de Fri Sep 3 19:02:30 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 3 Sep 2004 19:02:30 +0200 (CEST) Subject: jschuengel: thuban ChangeLog,1.686,1.687 Message-ID: <20040903170230.53FEF10016B@lists.intevation.de> Author: jschuengel Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv23604 Modified Files: ChangeLog Log Message: updated ChangeLog Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.686 retrieving revision 1.687 diff -u -d -r1.686 -r1.687 --- ChangeLog 20 Aug 2004 16:59:20 -0000 1.686 +++ ChangeLog 3 Sep 2004 17:02:28 -0000 1.687 @@ -1,3 +1,13 @@ +2004-09-03 Jan Schüngel + + * Extensions/umn_mapserver/mapfile(MF_Class.add_thubanstyle): Fix a + small bug with the line color. Now the line color will now only set + if it is set in Thuban an not Transparent. + + * Extensions/umn_mapserver/mf_export(tblayer_to_map): Fixed a bug with + deleting the layers from mapfile. Now all layers will delete backwards + from the last. + 2004-08-20 Silke Reimer * Thuban/Model/layer.py: From Silke.Reimer at intevation.de Mon Sep 6 17:40:02 2004 From: Silke.Reimer at intevation.de (Silke Reimer) Date: Mon, 6 Sep 2004 17:40:02 +0200 Subject: SPEC-File In-Reply-To: References: <20040901162636.GP16620@intevation.de> Message-ID: <20040906154002.GC3944@intevation.de> On Thu, Sep 02, 2004 at 02:39:08PM +0200, Bernhard Herzog wrote: > Silke Reimer writes: > > > I just sent some information about the Fedora Core 2 package which > > has been built for Thuban. I would like to suggest to include the > > resulting thuban.spec into Thuban CVS. The same we could also > > include the LinGIS SPEC-file. I would propose to do this in the > > following structure. > > Can this be tied in with the "setup.py bdist_rpm" somehow? Would it > make sense to do so? I don't know. As far as I understood setup.py, thuban_bdist_rpm is responsible for creating the SPEC-File. It shouldn't be too difficult to create different SPEC-files or to provide commands like bdist_fdr_rpm bdist_suse_rpm etc. But I think Bernhard Herzog probably knows more about the possibilities of distutils. Silke -- Silke Reimer Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040906/973e62d5/attachment.bin From bh at intevation.de Tue Sep 7 12:07:45 2004 From: bh at intevation.de (Bernhard Herzog) Date: Tue, 07 Sep 2004 12:07:45 +0200 Subject: jschuengel: thuban ChangeLog,1.686,1.687 In-Reply-To: <20040903170230.53FEF10016B@lists.intevation.de> (cvs@intevation.de's message of "Fri, 3 Sep 2004 19:02:30 +0200 (CEST)") References: <20040903170230.53FEF10016B@lists.intevation.de> Message-ID: cvs at intevation.de writes: > + * Extensions/umn_mapserver/mapfile(MF_Class.add_thubanstyle): Fix a > + small bug with the line color. Now the line color will now only set > + if it is set in Thuban an not Transparent. > + > + * Extensions/umn_mapserver/mf_export(tblayer_to_map): Fixed a bug with > + deleting the layers from mapfile. Now all layers will delete backwards > + from the last. Where are the test cases for these bug fixes? Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From joey at infodrom.org Tue Sep 7 17:46:16 2004 From: joey at infodrom.org (Martin Schulze) Date: Tue, 7 Sep 2004 17:46:16 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: References: <20040713150122.GR4134@finlandia.infodrom.north.de> <20040718034419.GC4134@finlandia.infodrom.north.de> <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> Message-ID: <20040907154616.GJ6910@finlandia.infodrom.north.de> Bernhard Herzog wrote: > >> >> > And for Thuban.UI.classifier: > >> >> > > >> >> > add_properties_dialog(Layer, Classifier) > >> >> > add_properties_dialog(RasterLayer, Classifier) > >> > > >> > I'm not sure how I am supposed to implement this since > >> > classifier.py doesn't import mainwindow and I don't know if it > >> > would be a good idea to do so. > >> > >> You could put that code into Thuban.UI.mainwindow which already depends > >> on Thuban.UI.classifier because it currently refers to the dialogs in > >> there directly. That would keep the module dependencies the same as > >> now. > > > > Err??? > > Now it's me going Err :) *sigh* > > Are you really sure you want this code appear in mainwindow.py? > > No, I'm not sure, and I don't have the time to find the perfect place > for it. You didn't want it in Thuban.UI.classifier, though, and that No, I wasn't sure how I am supposed to implement this in classifier.py. I'm fine adding it there. In fact, on July 27th I proposed to add this to classifier.py. > was what I was replying to. classifier does not depend on mainwindow > but would if you put the add_properties_dialog call there. That's how I > understood your reply anyway. My suggestion, then, was that, since > mainwindow currently depends on classifier, you could have the call in > mainwindow and the depencies wouldn't change. FWIW, I don't see why > putting the call into classifier would be a problem. > > Note: mainwindow is always the module Thuban.UI.mainwindow here, in case > that wasn't clear from context which is sometimes hard to tell in > conversations stretching over months :) > > > Similar code is required for other layers, too (e.g. currently WMS > > layers). Should that code go into mainwindow as well? > > For layers in extensions definitely not. Great, now we're discussing in a circle and can restart where we were on Jul 27th 2004 already, nearly one and a half month ago. So... let's restart this issue again: Problem: Different layer types require different properties dialogs. Solution: Set up a hash of layer classes and properties dialog classes. Each layer class will register itself and the respective properties dialoc class upon Thuban startup. Advantage: The solution is independent of the number of different layers and can easily be enhanced in the future (i.e. just register more layer:dialog class pairs. Disadvantage This solution requires: a) a global variable (_properties_dialogs) for the ClassMapper b) a globally available register function/method c) the register function/method needs to access the global variable and needs to be able to be imported into potentially any .py file (currently only Thuban/UI/classifier.py and Extensions/wms/wms.py). Solved: a) Not solved: b), c) Proposal: Add Thuban/UI/propdialgs.py (or any other name) with (as stated in the July 27th mail): a) the declaration of the global variable b) the global register function c) the access function to make it complete [optional] Since in practice only mainwindow needs to look up the mapping, this isn't required and can be done directly in mainwindow as well, but it would break the modular concept a bit. Would that be acceptable for you? Regards, Joey -- The good thing about standards is that there are so many to choose from. -- Andrew S. Tanenbaum From thuban-bugs at intevation.de Thu Sep 9 23:43:47 2004 From: thuban-bugs at intevation.de (Request Tracker) Date: Thu, 9 Sep 2004 23:43:47 +0200 (CEST) Subject: [bug #2616] (thuban) Shape files are not displayed Message-ID: <20040909214347.65C51102C58@lists.intevation.de> this bug's URL: http://intevation.de/rt/webrt?serial_num=2616 ------------------------------------------------------------------------- Subject: Shape files are not displayed Operating System: other, MAC OS X Thuban version: other, 1.0.0 wxPython version: 2.4.2.4 Python version: other, 2.3.3 PySQLite version: 0.5.1 SQLite version: 2.8.15 GDAL version: 1.2.1.0 proj version: 4.4.8 Thuban 1.0.0 on OS X - X11 (wxpython-gtk) works with small problems. I have built Thuban 1.0.0 (and last cvs) on OS X - Acqua version (wxpython-osx): it is native on Mac without x11 but THERE ARE TWO BIG PROBLEMS: it run with menu but IT LACKS THE TOOL BAR (zoom in, out, etc) and IT DOES NOT DISPLAY SHAPE FILES (it only display geotiff files). This is the message: Traceback (most recent call last): File "/Applications/thuban//lib/thuban/Thuban/UI/view.py", line 205, in _do_redraw File "/Applications/thuban//lib/thuban/Thuban/UI/view.py", line 254, in _render_iterator File "/Applications/thuban//lib/thuban/Thuban/UI/baserenderer.py", line 202, in render_map_incrementally File "/Applications/thuban//lib/thuban/Thuban/UI/baserenderer.py", line 255, in draw_shape_layer_incrementally File "/Applications/thuban//lib/thuban/Thuban/UI/renderer.py", line 89, in low_level_renderer SystemError: new style getargs format but argument is not a tuple Did you compile Thuban yourself? YES Thuban Release Version 1.0.0 From bh at intevation.de Tue Sep 14 16:57:50 2004 From: bh at intevation.de (Bernhard Herzog) Date: Tue, 14 Sep 2004 16:57:50 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: <20040907154616.GJ6910@finlandia.infodrom.north.de> (Martin Schulze's message of "Tue, 7 Sep 2004 17:46:16 +0200") References: <20040713150122.GR4134@finlandia.infodrom.north.de> <20040718034419.GC4134@finlandia.infodrom.north.de> <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> <20040907154616.GJ6910@finlandia.infodrom.north.de> Message-ID: Martin Schulze writes: > Bernhard Herzog wrote: >> No, I'm not sure, and I don't have the time to find the perfect place >> for it. You didn't want it in Thuban.UI.classifier, though, and that > > No, I wasn't sure how I am supposed to implement this in > classifier.py. Just as you would in the wms extension. [...] > Proposal: > > Add Thuban/UI/propdialgs.py (or any other name) with (as stated in > the July 27th mail): > > a) the declaration of the global variable > > b) the global register function > > c) the access function to make it complete [optional] > > Since in practice only mainwindow needs to look up the mapping, > this isn't required and can be done directly in mainwindow as > well, but it would break the modular concept a bit. > > Would that be acceptable for you? I'd at least omit the accessor functions in b) and c). It's fine to call methods on the ClassMapper instance directly. The variable name of the instance shouldn't start with _ then, though. Introducing a new module which effectively contains only one object seems wasteful. OTOH it is a bit more modular than putting it into the mainwindow module, but then again, even that is much more modular than what we have now. I'd probably just stick the ClassMapper instance into mainwindow for now and create a new module if we really need it some day. It wouldn't be hard to maintain a backwards compatible interface for a while either. However, I have spent practically 100% of my time on non-Thuban things for the last several months and that won't change anytime soon. I don't really have time to make up my mind about this or to keep discussing this much longer. I'd say, you decide which way to go here and just check that in. I'm sure you'll come up with a reasonable solution. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From bh at intevation.de Fri Sep 17 20:19:49 2004 From: bh at intevation.de (Bernhard Herzog) Date: Fri, 17 Sep 2004 20:19:49 +0200 Subject: [Thuban-devel] Re: Patch for adding version info for Extensions References: <20040729124048.GA27358@intevation.de> <20040810004202.GA5414@intevation.de> Message-ID: Jan-Oliver Wagner writes: >> > min_thuban_versions -- Minimum Thuban versions required to >> > run the extension. This is a dictionary >> > where the major release numbers ('X.Y') >> > are the keys and the minor release >> > number is the contents (e.g. 'Z'). >> > Example: { '1.0' : '0' } [...] > I opt for 1. and would like to remove this part. > Its more like a solution looking for a problem. > Better lets wait until we face a real problem. > Ok to drop this again? Yes. >> > + text += _('\tNone registered.\n') >> > + else: >> > + for ext in ext_registry.Get(): >> >> And this would be easier written as >> >> for ext in ext_registry: >> >> by implementing a suitable iter method as e.g. a generator. > > can you give me an example? With a generator (untested): def iter(self): for item in self.registry: yield item In this case it's easier to do this, though (also untested): def iter(self): return iter(self.registry) -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From jan at intevation.de Sun Sep 19 00:00:29 2004 From: jan at intevation.de (Jan-Oliver Wagner) Date: Sun, 19 Sep 2004 00:00:29 +0200 Subject: Patch for adding version info for Extensions In-Reply-To: References: <20040729124048.GA27358@intevation.de> <20040810004202.GA5414@intevation.de> Message-ID: <20040918220029.GA12348@intevation.de> On Fri, Sep 17, 2004 at 08:19:49PM +0200, Bernhard Herzog wrote: > Jan-Oliver Wagner writes: > >> > min_thuban_versions -- Minimum Thuban versions required to > >> > run the extension. This is a dictionary > >> > where the major release numbers ('X.Y') > >> > are the keys and the minor release > >> > number is the contents (e.g. 'Z'). > >> > Example: { '1.0' : '0' } > [...] > > I opt for 1. and would like to remove this part. > > Its more like a solution looking for a problem. > > Better lets wait until we face a real problem. > > Ok to drop this again? > > Yes. Done. > >> > + text += _('\tNone registered.\n') > >> > + else: > >> > + for ext in ext_registry.Get(): > >> > >> And this would be easier written as > >> > >> for ext in ext_registry: > >> > >> by implementing a suitable iter method as e.g. a generator. > > > > can you give me an example? > > With a generator (untested): > > def iter(self): > for item in self.registry: > yield item > > In this case it's easier to do this, though (also untested): > > def iter(self): > return iter(self.registry) well, it must be def __iter__ but then it worked. I also then was able to drop the Get() method. Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ From jan at intevation.de Sun Sep 19 00:11:28 2004 From: jan at intevation.de (Jan-Oliver Wagner) Date: Sun, 19 Sep 2004 00:11:28 +0200 Subject: Revised patch for adding version info for Extensions Message-ID: <20040918221128.GB12348@intevation.de> Hi, here is the revised patch for extension descriptions. Now OK to commit? (Will also baclport to 1_0) Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ -------------- next part -------------- Index: gns2shp.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/gns2shp/gns2shp.py,v retrieving revision 1.3 diff -u -3 -p -r1.3 gns2shp.py --- gns2shp.py 18 May 2004 21:09:50 -0000 1.3 +++ gns2shp.py 18 Sep 2004 22:07:02 -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,21 @@ if __name__ != '__main__': from Thuban import _ from Thuban.Model.layer import Layer +from Thuban.UI.extensionregistry import ExtensionDesc, ext_registry + import shapelib import dbflib + + +ext_registry.add(ExtensionDesc( + 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."))) + def gns2shp(src_fname, dest_fname): """Convert a file from gns textformat into a Shapefile. Index: importAPR.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/importAPR/importAPR.py,v retrieving revision 1.4 diff -u -3 -p -r1.4 importAPR.py --- importAPR.py 11 May 2004 22:34:49 -0000 1.4 +++ importAPR.py 18 Sep 2004 22:07:56 -0000 @@ -27,9 +27,18 @@ 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 ExtensionDesc, ext_registry from odb import ODBBaseObject from apr import APR_LClass, APR_TClr, APR_BLnSym, APR_BMkSym, APR_BShSym + +ext_registry.add(ExtensionDesc( + 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."))) class ODBExtension(Extension): def TreeInfo(self): Index: about.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/about.py,v retrieving revision 1.15 diff -u -3 -p -r1.15 about.py --- about.py 20 Aug 2004 16:50:22 -0000 1.15 +++ about.py 18 Sep 2004 22:08:21 -0000 @@ -21,6 +21,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): @@ -73,6 +75,14 @@ class About(wxDialog): text+= '\t%s %s\n' % (name, version) text += '\n' + text += _('Extensions:\n') + if ext_registry: + for ext in ext_registry: + text += '\t%s %s\n' % (ext.name, ext.version) + else: + text += _('\tNone registered.\n') + text += '\n' + text += _('Lead Developer:\n') text += '\t%s\n\n' % lead_developer @@ -97,6 +107,22 @@ class About(wxDialog): "\tDevelopers list (public):\n\t\t\n" "\tThuban team at Intevation:\n\t\t\n" ) + + text += '\n\n' + + text += _("Details on the registered extensions:\n\n") + + if ext_registry: + for ext in ext_registry: + 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' + else: + text += _('\tNone registered.\n') self.text = text -------------- next part -------------- A non-text attachment was scrubbed... Name: extensionregistry.py Type: text/x-python Size: 2384 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040919/e3906814/extensionregistry.py From cvs at intevation.de Mon Sep 20 10:13:03 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 20 Sep 2004 10:13:03 +0200 (CEST) Subject: bernhard: thuban/Thuban/Model base.py,1.6,1.7 layer.py,1.59,1.60 Message-ID: <20040920081303.179DD102C06@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/Thuban/Model In directory doto:/tmp/cvs-serv22669/Model Modified Files: base.py layer.py Log Message: Fixed typos in docstrings. Index: base.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/base.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- base.py 2 Jun 2003 13:46:45 -0000 1.6 +++ base.py 20 Sep 2004 08:13:00 -0000 1.7 @@ -6,7 +6,7 @@ # Read the file COPYING coming with Thuban for details. """ -Various base classes that didn't fir elsewhere +Various base classes that did not fit elsewhere. """ __version__ = "$Revision$" Index: layer.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/layer.py,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- layer.py 20 Aug 2004 16:59:21 -0000 1.59 +++ layer.py 20 Sep 2004 08:13:00 -0000 1.60 @@ -55,7 +55,7 @@ self.issue(LAYER_VISIBILITY_CHANGED, self) def HasClassification(self): - """Determine if this layer support classifications.""" + """Determine if this layer supports classifications.""" return False def HasShapes(self): @@ -67,7 +67,7 @@ return self.projection def SetProjection(self, projection): - """Set the layer's projection""" + """Set the layer's projection.""" self.projection = projection self.changed(LAYER_PROJECTION_CHANGED, self) From cvs at intevation.de Mon Sep 20 10:13:34 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 20 Sep 2004 10:13:34 +0200 (CEST) Subject: bernhard: thuban ChangeLog,1.687,1.688 Message-ID: <20040920081334.7F0DE102C06@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv22695 Modified Files: ChangeLog Log Message: Fixed typos in docstrings. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.687 retrieving revision 1.688 diff -u -d -r1.687 -r1.688 --- ChangeLog 3 Sep 2004 17:02:28 -0000 1.687 +++ ChangeLog 20 Sep 2004 08:13:32 -0000 1.688 @@ -1,3 +1,7 @@ +2004-09-20 Bernhard Reiter + + * Model/base.by, Model/layer.py: Fixed typos in docstrings. + 2004-09-03 Jan Schüngel * Extensions/umn_mapserver/mapfile(MF_Class.add_thubanstyle): Fix a From cvs at intevation.de Tue Sep 21 23:30:38 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 21 Sep 2004 23:30:38 +0200 (CEST) Subject: bernhard: thuban/Extensions/svgexport svgmapwriter.py, 1.2, 1.3 svgsaver.py, 1.2, 1.3 Message-ID: <20040921213038.463B0102BC3@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/Extensions/svgexport In directory doto:/tmp/cvs-serv28184/Extensions/svgexport Modified Files: svgmapwriter.py svgsaver.py Log Message: Improved the svgexport to only use unique ids. Will issues an error message dialoge when two layer names are the same. ShapeIDs are now added with a dash within the svg ids. * Extensions/svgexport/svgmapwriter.py (SVGMapWriterError): New. * Extensions/svgexport/test/test_svgmapwriter.py: Added imports (TestSVGRenderer): New test class with test_make_in() and test_check_for_layer_name_clash() * Extensions/svgexport/svgmapwriter.py (SVGRenderer): Fixed __init__() and draw_shape_layer_incrementally() to not use a baseid twice, satisfying test_check_for_layer_name_clash() (VirtualDC.make_id): Use a dash between baseit and id, satisfies test_make_in(). * Extensions/svexport/svgsaver.py: Import SVGMapWriterError, wxOK and wxICON_HAND. (write_to_svg): Put dc and rendering in a try statement and on catching SVGmapWriterError notify the user and delete the target file. ------------------------------------------------------------------- Index: svgmapwriter.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/svgexport/svgmapwriter.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- svgmapwriter.py 20 Feb 2004 14:33:22 -0000 1.2 +++ svgmapwriter.py 21 Sep 2004 21:30:36 -0000 1.3 @@ -25,6 +25,8 @@ from string import join # We need to determine some object types from types import ListType + +from Thuban import _ # VirtualDC extends XMLWriter from Thuban.Model.xmlwriter import XMLWriter, escape # Color related classes from the model of thuban @@ -147,6 +149,14 @@ # Instantiate a solid pattern. SOLID = Pattern() +class SVGMapWriterError(Exception): + """Get raised for problems when writing map-svg files. + + Occasion when this exception is raised: + Two layers have the same name to be used as BaseId: Name Clash + """ + + class SVGRenderer(BaseRenderer): """Class to render a map onto a VirtualDC. @@ -163,7 +173,8 @@ resolution, honor_visibility) # self.factor = (abs(region[2]) + abs(region[3])) / (2.0 * 1000.0) - + self.used_baseids=[] # needed for name clash check + def make_point(self, x, y): """Return a Point object from two values.""" return Point(x, y) @@ -231,7 +242,7 @@ dc = self.dc brush = TRANSPARENT_BRUSH pen = TRANSPARENT_PEN - + value = None field = None lc = layer.GetClassification() @@ -251,8 +262,12 @@ self.low_level_renderer(layer) tool_cache = {} - # Set baseid - prefix of a shape id to be unique + if layer.title in self.used_baseids: + raise SVGMapWriterError(_("Clash of layer names!\n")+ \ + _("Two layers probably have the same name, try renaming one.")) + # prefix of a shape id to be unique dc.SetBaseID(layer.title) + self.used_baseids.append(layer.title) # Titel of current layer to the groups meta informations dc.BeginGroup(meta={'Layer':layer.Title(), }) # Delete all MetaData @@ -558,10 +573,13 @@ return 'meta="%s"' % (join(result, '; ')) def make_id(self): - """Get the ID for the next object - if current ID is valid.""" + """Return id= string for object out of currently set baseid and id. + + Return the empty string if no id was set. + """ if self.id < 0: return '' - else: return 'id="%s%s"' % (self.baseid, self.id) + return 'id="%s-%s"' % (self.baseid, self.id) def DrawEllipse(self, x, y, dx, dy): """Draw an ellipse.""" Index: svgsaver.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/svgexport/svgsaver.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- svgsaver.py 16 May 2004 09:33:04 -0000 1.2 +++ svgsaver.py 21 Sep 2004 21:30:36 -0000 1.3 @@ -16,7 +16,8 @@ # Needed wx-toolkit classes -from wxPython.wx import wxFileDialog, wxSAVE, wxOVERWRITE_PROMPT, wxID_OK +from wxPython.wx import wxFileDialog, wxSAVE, wxOVERWRITE_PROMPT, wxID_OK, \ + wxOK, wxICON_HAND # We need os.path import os @@ -25,7 +26,7 @@ from Thuban import _ # Import SVG related classes -from svgmapwriter import VirtualDC, SVGRenderer +from svgmapwriter import VirtualDC, SVGRenderer, SVGMapWriterError def write_to_svg(context): @@ -64,15 +65,22 @@ # Get all selected layers and shapes that should be written as SVG selected_layer = canvas.selection.SelectedLayer() selected_shapes = canvas.selection.SelectedShapes() - dc = VirtualDC(file, (mapwidth, mapheight, )) - dc.BeginExport() - # map scale offset region - renderer = SVGRenderer(dc, map, 1.0, (0 - min(llx, urx), - 0 + max(lly, ury)), mapregion) - # Render the map - renderer.RenderMap(selected_layer, selected_shapes) - # - dc.EndExport() + try: + dc = VirtualDC(file, (mapwidth, mapheight, )) + dc.BeginExport() + # map scale offset region + renderer = SVGRenderer(dc, map, 1.0, (0 - min(llx, urx), + 0 + max(lly, ury)), mapregion) + # Render the map + renderer.RenderMap(selected_layer, selected_shapes) + dc.EndExport() + except SVGMapWriterError, inst: + context.mainwindow.RunMessageBox(_("Error: SVG not written!"), + text=_("Could not write SVG because: ")+ str(inst), + flags= wxOK | wxICON_HAND) + # delete partly writting file + os.remove(file) + # Thuban has named commands which can be registered in the central From cvs at intevation.de Tue Sep 21 23:30:38 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 21 Sep 2004 23:30:38 +0200 (CEST) Subject: bernhard: thuban ChangeLog,1.688,1.689 Message-ID: <20040921213038.4CD04102BFE@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv28184 Modified Files: ChangeLog Log Message: Improved the svgexport to only use unique ids. Will issues an error message dialoge when two layer names are the same. ShapeIDs are now added with a dash within the svg ids. * Extensions/svgexport/svgmapwriter.py (SVGMapWriterError): New. * Extensions/svgexport/test/test_svgmapwriter.py: Added imports (TestSVGRenderer): New test class with test_make_in() and test_check_for_layer_name_clash() * Extensions/svgexport/svgmapwriter.py (SVGRenderer): Fixed __init__() and draw_shape_layer_incrementally() to not use a baseid twice, satisfying test_check_for_layer_name_clash() (VirtualDC.make_id): Use a dash between baseit and id, satisfies test_make_in(). * Extensions/svexport/svgsaver.py: Import SVGMapWriterError, wxOK and wxICON_HAND. (write_to_svg): Put dc and rendering in a try statement and on catching SVGmapWriterError notify the user and delete the target file. ------------------------------------------------------------------- Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.688 retrieving revision 1.689 diff -u -d -r1.688 -r1.689 --- ChangeLog 20 Sep 2004 08:13:32 -0000 1.688 +++ ChangeLog 21 Sep 2004 21:30:36 -0000 1.689 @@ -1,3 +1,23 @@ +2004-09-21 Bernhard Reiter + + Improved the svgexport to only use unique ids. Will issues + an error message dialoge when two layer names are the same. + ShapeIDs are now added with a dash within the svg ids. + + * Extensions/svgexport/svgmapwriter.py (SVGMapWriterError): New. + * Extensions/svgexport/test/test_svgmapwriter.py: Added imports + (TestSVGRenderer): New test class with test_make_in() and + test_check_for_layer_name_clash() + * Extensions/svgexport/svgmapwriter.py (SVGRenderer): Fixed __init__() + and draw_shape_layer_incrementally() to not use a baseid twice, + satisfying test_check_for_layer_name_clash() + (VirtualDC.make_id): Use a dash between baseit and id, satisfies + test_make_in(). + * Extensions/svexport/svgsaver.py: Import SVGMapWriterError, wxOK + and wxICON_HAND. + (write_to_svg): Put dc and rendering in a try statement and on + catching SVGmapWriterError notify the user and delete the target file. + 2004-09-20 Bernhard Reiter * Model/base.by, Model/layer.py: Fixed typos in docstrings. From cvs at intevation.de Tue Sep 21 23:30:38 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 21 Sep 2004 23:30:38 +0200 (CEST) Subject: bernhard: thuban/Extensions/svgexport/test test_svgmapwriter.py, 1.3, 1.4 Message-ID: <20040921213038.4E6AA102BFF@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/Extensions/svgexport/test In directory doto:/tmp/cvs-serv28184/Extensions/svgexport/test Modified Files: test_svgmapwriter.py Log Message: Improved the svgexport to only use unique ids. Will issues an error message dialoge when two layer names are the same. ShapeIDs are now added with a dash within the svg ids. * Extensions/svgexport/svgmapwriter.py (SVGMapWriterError): New. * Extensions/svgexport/test/test_svgmapwriter.py: Added imports (TestSVGRenderer): New test class with test_make_in() and test_check_for_layer_name_clash() * Extensions/svgexport/svgmapwriter.py (SVGRenderer): Fixed __init__() and draw_shape_layer_incrementally() to not use a baseid twice, satisfying test_check_for_layer_name_clash() (VirtualDC.make_id): Use a dash between baseit and id, satisfies test_make_in(). * Extensions/svexport/svgsaver.py: Import SVGMapWriterError, wxOK and wxICON_HAND. (write_to_svg): Put dc and rendering in a try statement and on catching SVGmapWriterError notify the user and delete the target file. ------------------------------------------------------------------- Index: test_svgmapwriter.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/svgexport/test/test_svgmapwriter.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- test_svgmapwriter.py 28 Jun 2004 10:55:10 -0000 1.3 +++ test_svgmapwriter.py 21 Sep 2004 21:30:36 -0000 1.4 @@ -22,21 +22,31 @@ if __name__ == "__main__": sys.path.append(os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "..", "..", "..", "test")) +from mockgeo import SimpleShapeStore import support support.initthuban() import Thuban # Now import needed SVG stuff from Extensions.svgexport.svgmapwriter import VirtualDC, \ - Pen, Brush, SOLID, Point, Font, TRANSPARENT_PEN, TRANSPARENT_BRUSH + Pen, Brush, SOLID, Point, Font, TRANSPARENT_PEN, TRANSPARENT_BRUSH, \ + SVGRenderer, SVGMapWriterError # Color related classes from the model of thuban from Thuban.Model.color import Color, Black +from Thuban.Model.data import SHAPETYPE_ARC +from Thuban.Model.map import Map +from Thuban.Model.layer import BaseLayer, Layer +from Thuban.Model.table import MemoryTable, \ + FIELDTYPE_DOUBLE, FIELDTYPE_INT, FIELDTYPE_STRING + + + # We use xmlsupport to verify the SVG output import xmlsupport class TestVirtualDC(unittest.TestCase): - '''Tests the VirtualDC class that imitates a wxDC and writes + '''Test VirtualDC capabilities that imitates a wxDC and writes SVGRenderer instead.''' def setUp(self): @@ -156,6 +166,64 @@ self.assertEquals(xmlsupport.sax_eventlist(data = data), xmlsupport.sax_eventlist(data = file.getvalue())) +class TestSVGRenderer(unittest.TestCase): + + def setUp(self): + """Create dc for testing and set up self.to_destroy. + + Test should put all objects whose Destroy + should be called at unittest.main + the end into this list so that they're destroyed in tearDown + """ + self.to_destroy = [] + + file = StringIO.StringIO() + self.dc = VirtualDC(file) + + def tearDown(self): + for obj in self.to_destroy: + obj.Destroy() + + def test_make_id(self): + """Check "layer" and "layer1" do not clash; given integer ShapeIDs. + """ + dc=self.dc + dc.SetBaseID("layer") + dc.SetID(10) + id1=dc.make_id() + dc.SetBaseID("layer1") + dc.SetID(0) + id2=dc.make_id() + + self.assertNotEqual(id1,id2) + + + def test_check_for_layer_name_clash(self): + '''Create 2 layers with same name, try to write and check exception. + ''' + + # BaseLayer is not enough, because BaseRenderer.render_map() + # checks on isinstance of Layer not BaseLayer. + table = MemoryTable([("type", FIELDTYPE_STRING), + ("value", FIELDTYPE_DOUBLE), + ("code", FIELDTYPE_INT)], + [("UNKNOWN", 0.0, 0)]) + shapes = [[[(0, 0), (10, 10)]]] + store = SimpleShapeStore(SHAPETYPE_ARC, shapes, table) + + map = Map("TestLayerNameClash") + self.to_destroy.append(map) + layer=Layer("Same Name", store) + map.AddLayer(layer) + # reusing the same store with the same table and shapes should be okay + layer=Layer("Same Name", store) + map.AddLayer(layer) + + renderer = SVGRenderer(self.dc, map, + scale=1.0, offset=(0,0), region=(0,0,10,10)) + + self.assertRaises(SVGMapWriterError, + renderer.RenderMap, None, None) if __name__ == "__main__": support.run_tests() From bernhard at intevation.de Tue Sep 21 23:50:58 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Tue, 21 Sep 2004 23:50:58 +0200 Subject: pydoc usage and other documentation tools Message-ID: <20040921215058.GA10349@intevation.de> pydoc coming with Python can be quite useful as a class browser. If you want to use it on Thuban, you need to give it the right paths so you can browse all of it. e.g. , the following starts pydoc as webbrowser on localhost:1234/ cd root/thuban PYTHONPATH=./Lib:./test/ pydoc -p 1234 I briefly looked into other documentation tools and the best overview about them was coming with epydoc at: http://epydoc.sourceforge.net/relatedprojects.html epydoc seems to be very solid, because the author did a lot of reseach and decided for a very simple markup language. It might be surpased one day by docutils which use the more complicated reStructured text as markup. As nice side contender is happydoc, because it does not import the python modules. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040921/919e4db6/attachment.bin From bernhard at intevation.de Tue Sep 21 23:56:31 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Tue, 21 Sep 2004 23:56:31 +0200 Subject: FIXME count: 82 Message-ID: <20040921215631.GB10349@intevation.de> Did you know that grep -r 'FIXME\|XXX\|TODO' root/thuban/ | wc results into 122? (Okay it is 82 if I remove the duplicates in build/) Still not a bad number. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040921/60d4a2f3/attachment.bin From cvs at intevation.de Thu Sep 23 00:33:49 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 23 Sep 2004 00:33:49 +0200 (CEST) Subject: jan: thuban/Doc README,NONE,1.1 Message-ID: <20040922223349.73D4F10014F@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Doc In directory doto:/tmp/cvs-serv4024 Added Files: README Log Message: Some info about how to generate technical documentation from the source code. This text was send to the Thuban developer mailing list on September 21st 2004 by Bernhard Reiter. --- NEW FILE: README --- $Id: README,v 1.1 2004/09/22 22:33:47 jan Exp $ Currently, there is no explicit document on the implementation details. But you can generate class and method description automatically from the source code: pydoc coming with Python can be quite useful as a class browser. If you want to use it on Thuban, you need to give it the right paths so you can browse all of it. e.g. , the following starts pydoc as webbrowser on localhost:1234/ cd thuban PYTHONPATH=./Lib:./test/ pydoc -p 1234 A brief look into other documentation tools resulted in that the the best overview about them was coming with epydoc at: http://epydoc.sourceforge.net/relatedprojects.html epydoc seems to be very solid, because the author did a lot of reseach and decided for a very simple markup language. It might be surpased one day by docutils which use the more complicated reStructured text as markup. As nice side contender is happydoc, because it does not import the python modules. From cvs at intevation.de Thu Sep 23 00:35:40 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 23 Sep 2004 00:35:40 +0200 (CEST) Subject: jan: thuban ChangeLog,1.689,1.690 Message-ID: <20040922223540.7FADE10014F@lists.intevation.de> Author: jan Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv4065 Modified Files: ChangeLog Log Message: added Doc/README Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.689 retrieving revision 1.690 diff -u -d -r1.689 -r1.690 --- ChangeLog 21 Sep 2004 21:30:36 -0000 1.689 +++ ChangeLog 22 Sep 2004 22:35:38 -0000 1.690 @@ -1,3 +1,10 @@ +2004-09-23 Jan-Oliver Wagner + + * Doc/README: New. Some info about how to generate technical + documentation from the source code. + This text was send to the Thuban developer mailing list on + September 21st 2004 by Bernhard Reiter. + 2004-09-21 Bernhard Reiter Improved the svgexport to only use unique ids. Will issues From jan at intevation.de Thu Sep 23 00:57:35 2004 From: jan at intevation.de (Jan-Oliver Wagner) Date: Thu, 23 Sep 2004 00:57:35 +0200 Subject: Experimental patch for sizeable point symbols Message-ID: <20040922225735.GA16913@intevation.de> Hi, attached is a patch (against current HEAD) and a sample file that adds a size for point symbols. It is experimental. You have to edit the .thuban file manually to have symbols of different size. I am also not sure if it is the best technical approach to solve this. But I would be glad if we could as a first step agree on whether the dtd definition is OK and can be checked in with the sample file. Note: I wrote this patch in the train from D?sseldorf to Osnabr?ck (1h) plus some fiddling tonight with the wxGrid to adapt to the size of the symbol. Best Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ -------------- next part -------------- ? build ? thubaninit.py ? Data/iceland_sample_size.thuban ? test/temp Index: Resources/XML/thuban-1.1.dtd =================================================================== RCS file: /thubanrepository/thuban/Resources/XML/thuban-1.1.dtd,v retrieving revision 1.1 diff -u -3 -p -r1.1 thuban-1.1.dtd --- Resources/XML/thuban-1.1.dtd 12 Mar 2004 12:19:15 -0000 1.1 +++ Resources/XML/thuban-1.1.dtd 22 Sep 2004 22:45:12 -0000 @@ -10,7 +10,7 @@ Read the file COPYING coming with Thuban for details. $Revision: 1.1 $ - $Source: /thubanrepository/thuban/Resources/XML/thuban-1.1.dtd,v $ + $Source: /home/thuban/jail/thubanrepository/thuban/Resources/XML/thuban-1.1.dtd,v $ $Id: thuban-1.1.dtd,v 1.1 2004/03/12 12:19:15 bh Exp $ --> @@ -153,12 +153,13 @@ identify the version of the file format. + Index: Thuban/Model/classification.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/classification.py,v retrieving revision 1.38 diff -u -3 -p -r1.38 classification.py --- Thuban/Model/classification.py 3 Nov 2003 13:55:41 -0000 1.38 +++ Thuban/Model/classification.py 22 Sep 2004 22:45:12 -0000 @@ -315,7 +315,7 @@ class Classification(Publisher): items.append(build_item(p, p.GetDisplayText())) return (_("Classification"), items) - + class ClassIterator: """Allows the Groups in a Classifcation to be interated over. @@ -327,11 +327,11 @@ class ClassIterator: """Constructor. default -- the default group - + points -- a list of singleton groups ranges -- a list of range groups - + maps -- a list of map groups """ @@ -350,10 +350,10 @@ class ClassIterator: d = self.data[self.data_index] self.data_index += 1 return d - + class ClassGroupProperties: """Represents the properties of a single Classification Group. - + These are used when rendering a layer.""" def __init__(self, props = None): @@ -370,6 +370,7 @@ class ClassGroupProperties: else: self.SetLineColor(Black) self.SetLineWidth(1) + self.SetSize(5) self.SetFill(Transparent) def SetProperties(self, props): @@ -378,8 +379,9 @@ class ClassGroupProperties: assert isinstance(props, ClassGroupProperties) self.SetLineColor(props.GetLineColor()) self.SetLineWidth(props.GetLineWidth()) + self.SetSize(props.GetSize()) self.SetFill(props.GetFill()) - + def GetLineColor(self): """Return the line color as a Color object.""" return self.__stroke @@ -407,10 +409,25 @@ class ClassGroupProperties: self.__strokeWidth = lineWidth + def GetSize(self): + """Return the size.""" + return self.__size + + def SetSize(self, size): + """Set the size. + + size -- the new size. This must be > 0. + """ + assert isinstance(size, types.IntType) + if (size < 1): + raise ValueError(_("size < 1")) + + self.__size = size + def GetFill(self): """Return the fill color as a Color object.""" return self.__fill - + def SetFill(self, fill): """Set the fill color. @@ -431,7 +448,8 @@ class ClassGroupProperties: self.__stroke == other.__stroke) \ and (self.__fill is other.__fill or \ self.__fill == other.__fill) \ - and self.__strokeWidth == other.__strokeWidth + and self.__strokeWidth == other.__strokeWidth\ + and self.__size == other.__size def __ne__(self, other): return not self.__eq__(other) @@ -443,7 +461,8 @@ class ClassGroupProperties: return ClassGroupProperties(self) def __repr__(self): - return repr((self.__stroke, self.__strokeWidth, self.__fill)) + return repr((self.__stroke, self.__strokeWidth, self.__size, + self.__fill)) class ClassGroup: """A base class for all Groups within a Classification""" @@ -466,7 +485,7 @@ class ClassGroup: def GetLabel(self): """Return the Group's label.""" return self.label - + def SetLabel(self, label): """Set the Group's label. Index: Thuban/Model/load.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/load.py,v retrieving revision 1.48 diff -u -3 -p -r1.48 load.py --- Thuban/Model/load.py 12 Mar 2004 12:19:15 -0000 1.48 +++ Thuban/Model/load.py 22 Sep 2004 22:45:12 -0000 @@ -554,6 +554,7 @@ class SessionLoader(XMLReader): parse_color(attrs.get((None, 'stroke'), "None"))) self.cl_prop.SetLineWidth( int(attrs.get((None, 'stroke_width'), "0"))) + self.cl_prop.SetSize(int(attrs.get((None, 'size'), "5"))) self.cl_prop.SetFill(parse_color(attrs.get((None, 'fill'), "None"))) def end_cldata(self, name, qname): Index: Thuban/UI/baserenderer.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/baserenderer.py,v retrieving revision 1.11 diff -u -3 -p -r1.11 baserenderer.py --- Thuban/UI/baserenderer.py 13 Jul 2004 11:07:45 -0000 1.11 +++ Thuban/UI/baserenderer.py 22 Sep 2004 22:45:12 -0000 @@ -17,7 +17,7 @@ renderers. from __future__ import generators __version__ = "$Revision: 1.11 $" -# $Source: /thubanrepository/thuban/Thuban/UI/baserenderer.py,v $ +# $Source: /home/thuban/jail/thubanrepository/thuban/Thuban/UI/baserenderer.py,v $ # $Id: baserenderer.py,v 1.11 2004/07/13 11:07:45 bh Exp $ import sys @@ -289,7 +289,10 @@ class BaseRenderer: data = shape.RawData() else: data = shape.Points() - draw_func(draw_func_param, data, pen, brush) + if draw_func == self.draw_point_shape: + draw_func(draw_func_param, data, pen, brush, size = group.GetProperties().GetSize()) + else: + draw_func(draw_func_param, data, pen, brush) if count % 500 == 0: yield True @@ -421,7 +424,7 @@ class BaseRenderer: for part in points: self.dc.DrawLines(part) - def draw_point_shape(self, layer, points, pen, brush): + def draw_point_shape(self, layer, points, pen, brush, size = 5): """Draw a point shape from layer with the given brush and pen The shape is given by points argument which is a the return @@ -435,7 +438,7 @@ class BaseRenderer: if not points: return - radius = int(round(self.resolution * 5)) + radius = int(round(self.resolution * size)) self.dc.SetBrush(brush) self.dc.SetPen(pen) for part in points: Index: Thuban/UI/classifier.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/classifier.py,v retrieving revision 1.65 diff -u -3 -p -r1.65 classifier.py --- Thuban/UI/classifier.py 7 May 2004 20:20:43 -0000 1.65 +++ Thuban/UI/classifier.py 22 Sep 2004 22:45:12 -0000 @@ -331,7 +331,7 @@ class ClassTable(wxPyGridTableBase): row = -1 self.clazz = clazz - + self.__NotifyRowChanges(old_len, self.GetNumberRows()) # @@ -439,11 +439,11 @@ class ClassTable(wxPyGridTableBase): """ self.SetValueAsCustom(row, col, None, value) - + def GetValueAsCustom(self, row, col, typeName): """Return the object that is used to represent the given cell coordinates. This may not be a string. - + typeName -- unused, but needed to overload wxPyGridTableBase """ @@ -915,13 +915,13 @@ class Classifier(NonModalNonParentDialog table.SetValueAsCustom(row, COL_SYMBOL, None, new_prop) self.Enable(True) propDlg.Destroy() - + def _SetClassification(self, clazz): """Called from the ClassGen dialog when a new classification has been created and should be set in the table. """ # FIXME: This could be implemented using a message - + self.fields.SetClientData(self.__cur_field, clazz) self.classGrid.GetTable().SetClassification(clazz) @@ -1266,10 +1266,10 @@ class SelectPropertiesDialog(wxDialog): topBox.Add(buttonBox, 0, wxALIGN_RIGHT|wxBOTTOM|wxTOP, 10) button_ok.SetDefault() - + #EVT_BUTTON(self, wxID_OK, self._OnOK) #EVT_BUTTON(self, ID_SELPROP_CANCEL, self._OnCancel) - + self.SetAutoLayout(True) self.SetSizer(topBox) topBox.Fit(self) @@ -1296,7 +1296,7 @@ class SelectPropertiesDialog(wxDialog): dialog.Destroy() return ret - + def _OnChangeLineColor(self, event): clr = self.__GetColor(self.prop.GetLineColor()) if clr is not None: @@ -1306,7 +1306,7 @@ class SelectPropertiesDialog(wxDialog): def _OnChangeLineColorTrans(self, event): self.prop.SetLineColor(Transparent) self.previewWin.Refresh() # XXX: work around, see ClassDataPreviewer - + def _OnChangeFillColor(self, event): clr = self.__GetColor(self.prop.GetFill()) if clr is not None: @@ -1360,6 +1360,13 @@ class ClassDataPreviewer: """Class that actually draws a group property preview.""" def Draw(self, dc, rect, prop, shapeType): + """Draw the property. + + returns: (w, h) as adapted extend if the drawing size + exceeded the given rect. This can only be the case + for point symbols. If the symbol fits the given rect, + None is returned. + """ assert dc is not None assert isinstance(prop, ClassGroupProperties) @@ -1399,12 +1406,20 @@ class ClassDataPreviewer: elif shapeType == SHAPETYPE_POINT: - dc.DrawCircle(x + w/2, y + h/2, - (min(w, h) - prop.GetLineWidth())/2) + dc.DrawCircle(x + w/2, y + h/2, prop.GetSize()) + circle_size = prop.GetSize() * 2 + prop.GetLineWidth() * 2 + new_h = h + new_w = w + if h < circle_size: new_h = circle_size + if w < circle_size: new_w = circle_size + if new_h > h or new_w > w: + return (new_w, new_h) elif shapeType == SHAPETYPE_POLYGON: dc.DrawRectangle(x, y, w, h) + return None + class ClassRenderer(wxPyGridCellRenderer): """A wrapper class that can be used to draw group properties in a grid table. @@ -1426,7 +1441,26 @@ class ClassRenderer(wxPyGridCellRenderer rect.GetWidth(), rect.GetHeight()) if not isinstance(data, ClassGroupMap): - self.previewer.Draw(dc, rect, data.GetProperties(), self.shapeType) + new_size = self.previewer.Draw(dc, rect, data.GetProperties(), + self.shapeType) + if new_size is not None: + (new_w, new_h) = new_size + grid.SetRowSize(row, new_h) + grid.SetColSize(col, new_h) + grid.ForceRefresh() + + # now that we know the height, redraw everything + rect.SetHeight(new_h) + rect.SetWidth(new_w) + dc.DestroyClippingRegion() + dc.SetClippingRegion(rect.GetX(), rect.GetY(), + rect.GetWidth(), rect.GetHeight()) + dc.SetPen(wxPen(wxLIGHT_GREY)) + dc.SetBrush(wxBrush(wxLIGHT_GREY, wxSOLID)) + dc.DrawRectangle(rect.GetX(), rect.GetY(), + rect.GetWidth(), rect.GetHeight()) + self.previewer.Draw(dc, rect, data.GetProperties(), + self.shapeType) if isSelected: dc.SetPen(wxPen(wxBLACK, 1, wxSOLID)) Index: test/test_load.py =================================================================== RCS file: /thubanrepository/thuban/test/test_load.py,v retrieving revision 1.38 diff -u -3 -p -r1.38 test_load.py --- test/test_load.py 12 Mar 2004 12:19:15 -0000 1.38 +++ test/test_load.py 22 Sep 2004 22:45:12 -0000 @@ -162,6 +162,8 @@ class ClassificationTest(LoadSessionTest props.SetLineWidth(data[CLASSES][i][GROUP_PROPS][1]) props.SetFill( parse_color(data[CLASSES][i][GROUP_PROPS][2])) + if len(data[CLASSES][i][GROUP_PROPS]) > 3: + props.SetSize(data[CLASSES][i][GROUP_PROPS][3]) if data[CLASSES][i][GROUP_TYPE] == "default": g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL]) @@ -384,6 +386,53 @@ class TestLayerVisibility(LoadSessionTes layer = layers[0] eq(layer.Visible(), False) + + self.check_format() + + +class TestSymbolSize(ClassificationTest): + + file_contents = '''\ + + + + + + + + + + + + + + + + + + + + +''' + + def test(self): + """Test that the size definition for point symbols is correctly + loaded for a layer.""" + eq = self.assertEquals + session = load_session(self.filename()) + self.session = session + + map = session.Maps()[0] # only one map in the sample + + expected = [("cultural_landmark-point", 2, + [("default", (), "", + ("#000000", 1, "#000000", 3)), + ("single", "RUINS", "", + ("#000000", 1, "#ffffff", 6)), + ("single", "FARM", "", + ("#000000", 1, "#ffff00", 9))])] + + self.TestLayers(map.Layers(), expected) self.check_format() -------------- next part -------------- From cvs at intevation.de Thu Sep 23 21:37:35 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 23 Sep 2004 21:37:35 +0200 (CEST) Subject: jan: thuban/Doc ThubanModel.xmi,NONE,1.1 Message-ID: <20040923193735.76CA2102BF2@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Doc In directory doto:/tmp/cvs-serv3792 Added Files: ThubanModel.xmi Log Message: UML file for Thuban Model Module. --- NEW FILE: ThubanModel.xmi --- umbrello uml modeller http://uml.sf.net 1.2.0 UnicodeUTF8 [...1489 lines suppressed...] From cvs at intevation.de Thu Sep 23 21:37:57 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 23 Sep 2004 21:37:57 +0200 (CEST) Subject: jan: thuban/Doc README,1.1,1.2 Message-ID: <20040923193757.A53A8102BF6@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Doc In directory doto:/tmp/cvs-serv3816 Modified Files: README Log Message: Added info on ThubanModel.xmi. Index: README =================================================================== RCS file: /thubanrepository/thuban/Doc/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- README 22 Sep 2004 22:33:47 -0000 1.1 +++ README 23 Sep 2004 19:37:55 -0000 1.2 @@ -1,7 +1,11 @@ $Id$ Currently, there is no explicit document on the implementation -details. But you can generate class and method description +details but a UML description of the Model Module: + ThubanModul.xmi +You can edit this file with Umbrello. + +Furthermore, you can generate class and method description automatically from the source code: pydoc coming with Python can be quite useful as a class browser. From cvs at intevation.de Thu Sep 23 21:38:32 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Thu, 23 Sep 2004 21:38:32 +0200 (CEST) Subject: jan: thuban ChangeLog,1.690,1.691 Message-ID: <20040923193832.5E814102BFE@lists.intevation.de> Author: jan Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv3830 Modified Files: ChangeLog Log Message: Added xmi file for documentation. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.690 retrieving revision 1.691 diff -u -d -r1.690 -r1.691 --- ChangeLog 22 Sep 2004 22:35:38 -0000 1.690 +++ ChangeLog 23 Sep 2004 19:38:30 -0000 1.691 @@ -1,5 +1,12 @@ 2004-09-23 Jan-Oliver Wagner + * Doc/ThubanModel.xmi: New. UML file for Thuban Model + Module. + + * Doc/README: Added info on ThubanModel.xmi. + +2004-09-23 Jan-Oliver Wagner + * Doc/README: New. Some info about how to generate technical documentation from the source code. This text was send to the Thuban developer mailing list on From bernhard at intevation.de Thu Sep 23 22:20:57 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Thu, 23 Sep 2004 22:20:57 +0200 Subject: jan: thuban/Doc README,NONE,1.1 In-Reply-To: <20040922223349.73D4F10014F@lists.intevation.de> References: <20040922223349.73D4F10014F@lists.intevation.de> Message-ID: <20040923202057.GA4438@intevation.de> On Thu, Sep 23, 2004 at 12:33:49AM +0200, cvs at intevation.de wrote: > Update of /thubanrepository/thuban/Doc > In directory doto:/tmp/cvs-serv4024 > > Added Files: > README > Log Message: > Some info about how to generate technical documentation > from the source code. > This text was send to the Thuban developer mailing list on > September 21st 2004 by Bernhard Reiter. I'll appreciate the check-in of my pydoc hint, note that the comment below are just my current state of evalutating documentation tools. Most of them make a difference to pydoc, because they can use a markup language to format the contents of the docstrings (or in case of happydoc probably also the comments). So they do not provide much extra information, unless the Thuban developers decide for a docstring markup and one of those tools. For me this would be a decision between reStructured text and epydoc's markup language. Expect for a bit of different presentation and display of comments by happydoc, there is not much benefit over pydoc from the others. > A brief look into other documentation tools > resulted in that the the best overview about them was coming with > epydoc at: > http://epydoc.sourceforge.net/relatedprojects.html > > epydoc seems to be very solid, because the author did a lot > of reseach and decided for a very simple markup language. > It might be surpased one day by docutils which use the more > complicated reStructured text as markup. > > As nice side contender is happydoc, because it does not import > the python modules. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040923/c28f1970/attachment.bin From jan at intevation.de Sat Sep 25 14:35:32 2004 From: jan at intevation.de (Jan-Oliver Wagner) Date: Sat, 25 Sep 2004 14:35:32 +0200 Subject: [Thuban-devel] Revised patch for adding version info for Extensions In-Reply-To: <20040918221128.GB12348@intevation.de> References: <20040918221128.GB12348@intevation.de> Message-ID: <20040925123532.GB6651@intevation.de> On Sun, Sep 19, 2004 at 12:11:28AM +0200, Jan-Oliver Wagner wrote: > here is the revised patch for extension descriptions. > > Now OK to commit? (Will also baclport to 1_0) I take no response as OK and will start soon to commit ;-) Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ From cvs at intevation.de Sat Sep 25 20:29:26 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Sat, 25 Sep 2004 20:29:26 +0200 (CEST) Subject: bernhard: thuban/Extensions/svgexport svgmapwriter.py,1.3,1.4 Message-ID: <20040925182926.D1142100168@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/Extensions/svgexport In directory doto:/tmp/cvs-serv7097/Extensions/svgexport Modified Files: svgmapwriter.py Log Message: Added Bernhard R. as Author. (SetBaseID, SetID, make_id): Improved docstring comments to explain the interaction of the three functions and the XML id contrains. Index: svgmapwriter.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/svgexport/svgmapwriter.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- svgmapwriter.py 21 Sep 2004 21:30:36 -0000 1.3 +++ svgmapwriter.py 25 Sep 2004 18:29:24 -0000 1.4 @@ -1,6 +1,7 @@ # Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH # Authors: # Markus Rechtien +# Bernhard Reiter # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with Thuban for details. @@ -489,11 +490,22 @@ return (12,len(text) * 10) def SetID(self, id): - """Set the ID stored by the svg elements.""" + """Set second part of ID stored by the svg elements. + + Will be used in make_id() as first part of an XML attribute "id". + Read comments at SetBaseID() and make_id(). + + Common practice is to only set this to integer numbers. + """ self.id = id def SetBaseID(self, id): - """Set the ID stored by the svg elements.""" + """Set first part of ID stored by the svg elements. + + Will be used in make_id() as first part of an XML attribute "id". + The second part is set by SetID(). + Check comments at make_id(). + """ self.baseid = id def SetFont(self, font): @@ -576,6 +588,19 @@ """Return id= string for object out of currently set baseid and id. Return the empty string if no id was set. + + In an XML file each id should be unique + (see XML 1.0 section 3.3.1 Attribute Types, Validity constraint: ID) + So this function should only return a unique values. + which also coforms to the the XML "Name production" (section 3.2). + + For this it completely depends + on what has been set by SetBaseID() and SetID(). + Only call this function if you have called them w unique values before + (or SetID(0) to get an empty result) + + A check of uniqueness in this function might be time consuming, + because it would require to hold and search through a complete table. """ if self.id < 0: return '' From cvs at intevation.de Sat Sep 25 20:29:26 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Sat, 25 Sep 2004 20:29:26 +0200 (CEST) Subject: bernhard: thuban ChangeLog,1.691,1.692 Message-ID: <20040925182926.D71E2100169@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv7097 Modified Files: ChangeLog Log Message: Added Bernhard R. as Author. (SetBaseID, SetID, make_id): Improved docstring comments to explain the interaction of the three functions and the XML id contrains. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.691 retrieving revision 1.692 diff -u -d -r1.691 -r1.692 --- ChangeLog 23 Sep 2004 19:38:30 -0000 1.691 +++ ChangeLog 25 Sep 2004 18:29:24 -0000 1.692 @@ -1,3 +1,9 @@ +2004-09-25 Bernhard Reiter + + * Extensions/svgexport/svgmapwriter.py: Added Bernhard R. as Author. + (SetBaseID, SetID, make_id): Improved docstring comments to explain + the interaction of the three functions and the XML id contrains. + 2004-09-23 Jan-Oliver Wagner * Doc/ThubanModel.xmi: New. UML file for Thuban Model From cvs at intevation.de Sat Sep 25 20:49:22 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Sat, 25 Sep 2004 20:49:22 +0200 (CEST) Subject: bh: thuban/test test_layer.py,1.31,1.32 Message-ID: <20040925184922.CD8A7100168@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/test In directory doto:/tmp/cvs-serv7312/test Modified Files: test_layer.py Log Message: (TestLayer.test_arc_layer_with_projection): Remove a debug print and some tab characters. Index: test_layer.py =================================================================== RCS file: /thubanrepository/thuban/test/test_layer.py,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- test_layer.py 20 Aug 2004 16:59:21 -0000 1.31 +++ test_layer.py 25 Sep 2004 18:49:20 -0000 1.32 @@ -191,9 +191,8 @@ (90.0, -8.90043373, 120, 11.1616263)) self.assertFloatSeqEqual(layer.ClipBoundingBox((-180, -6, 100, +120)), - (90.0, -6, 100, 11.1616263)) + (90.0, -6, 100, 11.1616263)) shapes = layer.ShapesInRegion((-180, -170, 200, +120)) - print "Shapes", shapes self.assertEquals([s.ShapeID() for s in shapes],[0]) def test_empty_layer(self): From cvs at intevation.de Sat Sep 25 20:49:22 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Sat, 25 Sep 2004 20:49:22 +0200 (CEST) Subject: bh: thuban ChangeLog,1.692,1.693 Message-ID: <20040925184922.D7805100169@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv7312 Modified Files: ChangeLog Log Message: (TestLayer.test_arc_layer_with_projection): Remove a debug print and some tab characters. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.692 retrieving revision 1.693 diff -u -d -r1.692 -r1.693 --- ChangeLog 25 Sep 2004 18:29:24 -0000 1.692 +++ ChangeLog 25 Sep 2004 18:49:20 -0000 1.693 @@ -1,3 +1,8 @@ +2004-09-25 Bernhard Herzog + + * test/test_layer.py (TestLayer.test_arc_layer_with_projection): + Remove a debug print and some tab characters. + 2004-09-25 Bernhard Reiter * Extensions/svgexport/svgmapwriter.py: Added Bernhard R. as Author. From cvs at intevation.de Mon Sep 27 11:56:15 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 27 Sep 2004 11:56:15 +0200 (CEST) Subject: bernhard: thuban/Extensions/svgexport svgmapwriter.py,1.4,1.5 Message-ID: <20040927095615.3DF80102BF3@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/Extensions/svgexport In directory doto:/tmp/cvs-serv1600/Extensions/svgexport Modified Files: svgmapwriter.py Log Message: More fixes to svgexport to make used ids unique and conforming to XML's Name production. * Extensions/svgexport/test/test_svgmapwriter.py: Added new tests test_xml_id_constraints(), test_make_ide_nosetbaseid() and test_make_id_nonintegersetid(). Switched SetID and SetBaseID. Added Bernhard R. as author. * Extensions/svgexport/svgmapwriter.py (make_id): Using "_" as concatenation char now (makes test_make_ide_nosetbaseid() valid). Also transform second id part with "%d" and catch the TypeError to raise SVGMapWriterError (making test_make_id_nonintegersetid() ok). Corrected typo inBernhard's author line. (SetBaseID): Return the transformed base id. Transform characters which are not alnum() or in ".-_" to binascii.b2a_hex(). Added import binascii. If to be set string starts with "xml" or so, add "t". (draw_shape_layer_incrementally): use the returned value of SetBaseID for used_baseids checks. Index: svgmapwriter.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/svgexport/svgmapwriter.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- svgmapwriter.py 25 Sep 2004 18:29:24 -0000 1.4 +++ svgmapwriter.py 27 Sep 2004 09:56:13 -0000 1.5 @@ -1,7 +1,7 @@ # Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH # Authors: # Markus Rechtien -# Bernhard Reiter +# Bernhard Reiter # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with Thuban for details. @@ -26,6 +26,8 @@ from string import join # We need to determine some object types from types import ListType +# for SetBaseID +import binascii from Thuban import _ # VirtualDC extends XMLWriter @@ -263,12 +265,12 @@ self.low_level_renderer(layer) tool_cache = {} - if layer.title in self.used_baseids: + new_baseid=dc.SetBaseID(layer.title) + if new_baseid in self.used_baseids: raise SVGMapWriterError(_("Clash of layer names!\n")+ \ _("Two layers probably have the same name, try renaming one.")) # prefix of a shape id to be unique - dc.SetBaseID(layer.title) - self.used_baseids.append(layer.title) + self.used_baseids.append(new_baseid) # Titel of current layer to the groups meta informations dc.BeginGroup(meta={'Layer':layer.Title(), }) # Delete all MetaData @@ -489,25 +491,50 @@ except ValueError: return (12,len(text) * 10) - def SetID(self, id): - """Set second part of ID stored by the svg elements. + + def SetBaseID(self, id): + """Set first part of ID stored by the svg elements. Return it. Will be used in make_id() as first part of an XML attribute "id". - Read comments at SetBaseID() and make_id(). + The second part is set by SetID(). + Check comments at make_id(). - Common practice is to only set this to integer numbers. + We might add an abritrary "t" for thuban if the parameter + starts with XML, which is not allowed in XML 1.0. + + We need to ensure that all characters are okay as XML id attribute. + As there seem no easy way in Python (today 20040925) to check + for compliance with XML 1.0 character classes like NameChar, + we use Python's string method isalnum() as approximation. + (See http://mail.python.org/pipermail/xml-sig/2002-January/006981.html + and xmlgenchar.py. To be better we would need to hold our own + huge table of allowed unicode characters. + FIXME if python comes with a better funcation for XML 1.0 NameChar) + + Characters that are not in our approx of NameChar get transformed + get escaped to their hex value. """ - self.id = id + # an ID Name shall not start with xml. + if id[0:3].lower() == "xml": + id = "t" + id - def SetBaseID(self, id): - """Set first part of ID stored by the svg elements. + self.baseid = "" + for c in id: + if c.isalnum() or c in ".-_": + self.baseid += c + else: + self.baseid += binascii.b2a_hex(c) + return self.baseid + + def SetID(self, id): + """Set second part of ID stored by the svg elements. Will be used in make_id() as first part of an XML attribute "id". - The second part is set by SetID(). - Check comments at make_id(). + Only set this to positive integer numbers. + Read comments at SetBaseID() and make_id(). """ - self.baseid = id - + self.id = id + def SetFont(self, font): """Set the fontproperties to use with text elements.""" if font is not None: @@ -597,14 +624,20 @@ For this it completely depends on what has been set by SetBaseID() and SetID(). Only call this function if you have called them w unique values before - (or SetID(0) to get an empty result) + (or negative x in SetID(x) to get an empty result) + Will raise SVGMapWriterError if SetID value cannot be converted to %d. A check of uniqueness in this function might be time consuming, because it would require to hold and search through a complete table. """ if self.id < 0: return '' - return 'id="%s-%s"' % (self.baseid, self.id) + try: + id= 'id="%s_%d"' % (self.baseid, self.id) + except TypeError, inst: + raise SVGMapWriterError(_("Internal make_id() failure: ") \ + + repr(inst)) + return id def DrawEllipse(self, x, y, dx, dy): """Draw an ellipse.""" From cvs at intevation.de Mon Sep 27 11:56:15 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 27 Sep 2004 11:56:15 +0200 (CEST) Subject: bernhard: thuban ChangeLog,1.693,1.694 Message-ID: <20040927095615.44739102BF7@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv1600 Modified Files: ChangeLog Log Message: More fixes to svgexport to make used ids unique and conforming to XML's Name production. * Extensions/svgexport/test/test_svgmapwriter.py: Added new tests test_xml_id_constraints(), test_make_ide_nosetbaseid() and test_make_id_nonintegersetid(). Switched SetID and SetBaseID. Added Bernhard R. as author. * Extensions/svgexport/svgmapwriter.py (make_id): Using "_" as concatenation char now (makes test_make_ide_nosetbaseid() valid). Also transform second id part with "%d" and catch the TypeError to raise SVGMapWriterError (making test_make_id_nonintegersetid() ok). Corrected typo inBernhard's author line. (SetBaseID): Return the transformed base id. Transform characters which are not alnum() or in ".-_" to binascii.b2a_hex(). Added import binascii. If to be set string starts with "xml" or so, add "t". (draw_shape_layer_incrementally): use the returned value of SetBaseID for used_baseids checks. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.693 retrieving revision 1.694 diff -u -d -r1.693 -r1.694 --- ChangeLog 25 Sep 2004 18:49:20 -0000 1.693 +++ ChangeLog 27 Sep 2004 09:56:13 -0000 1.694 @@ -1,3 +1,23 @@ +2004-09-27 Bernhard Reiter + + More fixes to svgexport to make used ids unique and + conforming to XML's Name production. + + * Extensions/svgexport/test/test_svgmapwriter.py: Added new tests + test_xml_id_constraints(), test_make_ide_nosetbaseid() and + test_make_id_nonintegersetid(). Switched SetID and SetBaseID. + Added Bernhard R. as author. + * Extensions/svgexport/svgmapwriter.py (make_id): Using "_" as + concatenation char now (makes test_make_ide_nosetbaseid() valid). + Also transform second id part with "%d" and catch the TypeError + to raise SVGMapWriterError (making test_make_id_nonintegersetid() ok). + Corrected typo inBernhard's author line. + (SetBaseID): Return the transformed base id. Transform characters + which are not alnum() or in ".-_" to binascii.b2a_hex(). Added + import binascii. If to be set string starts with "xml" or so, add "t". + (draw_shape_layer_incrementally): use the returned value of SetBaseID + for used_baseids checks. + 2004-09-25 Bernhard Herzog * test/test_layer.py (TestLayer.test_arc_layer_with_projection): @@ -8,6 +28,7 @@ * Extensions/svgexport/svgmapwriter.py: Added Bernhard R. as Author. (SetBaseID, SetID, make_id): Improved docstring comments to explain the interaction of the three functions and the XML id contrains. + 2004-09-23 Jan-Oliver Wagner From cvs at intevation.de Mon Sep 27 11:56:15 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Mon, 27 Sep 2004 11:56:15 +0200 (CEST) Subject: bernhard: thuban/Extensions/svgexport/test test_svgmapwriter.py, 1.4, 1.5 Message-ID: <20040927095615.4608F102C19@lists.intevation.de> Author: bernhard Update of /thubanrepository/thuban/Extensions/svgexport/test In directory doto:/tmp/cvs-serv1600/Extensions/svgexport/test Modified Files: test_svgmapwriter.py Log Message: More fixes to svgexport to make used ids unique and conforming to XML's Name production. * Extensions/svgexport/test/test_svgmapwriter.py: Added new tests test_xml_id_constraints(), test_make_ide_nosetbaseid() and test_make_id_nonintegersetid(). Switched SetID and SetBaseID. Added Bernhard R. as author. * Extensions/svgexport/svgmapwriter.py (make_id): Using "_" as concatenation char now (makes test_make_ide_nosetbaseid() valid). Also transform second id part with "%d" and catch the TypeError to raise SVGMapWriterError (making test_make_id_nonintegersetid() ok). Corrected typo inBernhard's author line. (SetBaseID): Return the transformed base id. Transform characters which are not alnum() or in ".-_" to binascii.b2a_hex(). Added import binascii. If to be set string starts with "xml" or so, add "t". (draw_shape_layer_incrementally): use the returned value of SetBaseID for used_baseids checks. Index: test_svgmapwriter.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/svgexport/test/test_svgmapwriter.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test_svgmapwriter.py 21 Sep 2004 21:30:36 -0000 1.4 +++ test_svgmapwriter.py 27 Sep 2004 09:56:13 -0000 1.5 @@ -1,6 +1,7 @@ # Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH # Authors: -# Markus Rechtien +# Markus Rechtien +# Bernhard Reiter # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with Thuban for details. @@ -14,6 +15,7 @@ import os import sys +import string import StringIO import unittest @@ -166,7 +168,7 @@ self.assertEquals(xmlsupport.sax_eventlist(data = data), xmlsupport.sax_eventlist(data = file.getvalue())) -class TestSVGRenderer(unittest.TestCase): +class TestSVGRendererIDHandling(unittest.TestCase): def setUp(self): """Create dc for testing and set up self.to_destroy. @@ -183,6 +185,56 @@ def tearDown(self): for obj in self.to_destroy: obj.Destroy() + + def test_make_id_nonintegersetid(self): + """Test that exception is raised when SetID was called with chars.""" + dc=self.dc + dc.SetBaseID("a") + dc.SetID("abc") + self.assertRaises(SVGMapWriterError, dc.make_id) + + def test_make_ide_nosetbaseid(self): + """Test as no setbaseid results in valid XML id starting with '_'.""" + dc=self.dc + dc.SetBaseID("") + dc.SetID(123) + id=dc.make_id() # returns 'id="xxxxxx"' + self.assert_(id[4]=='_' or (id[4] in string.ascii_letters)) + + def test_xml_id_constraints(self): + """Test the checks for the XML id contraints by trying bad id parts.""" + + dc=self.dc + dc.SetID(42) + + # an xml Name shall better not start with "xml" (case insensitive) + dc.SetBaseID("xml") + id=dc.make_id() # returns 'id="xxxxxx"' + self.assert_(id[4:7].lower() != "xml") + + dc.SetBaseID("XmL") + id=dc.make_id() + self.assert_(id[4:7].lower() != "xml") + + # recommended to better not use ":" + dc.SetBaseID("abc:def") + id=dc.make_id() + self.assert_(":" not in id ) + + # an XML name shall only have: + # Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender + dc.SetBaseID("abc def") + id=dc.make_id() + self.assert_(" " not in id ) + + dc.SetBaseID("ab!cd") + id=dc.make_id() + self.assert_("!" not in id ) + + dc.SetBaseID("a.b-c_d") + id=dc.make_id() + self.assert_(id[4:11]=="a.b-c_d") + def test_make_id(self): """Check "layer" and "layer1" do not clash; given integer ShapeIDs. From cvs at intevation.de Tue Sep 28 21:13:23 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:13:23 +0200 (CEST) Subject: jan: thuban/Thuban/UI extensionregistry.py,NONE,1.1 Message-ID: <20040928191323.493F8102C17@lists.intevation.de> 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 # # 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() From cvs at intevation.de Tue Sep 28 21:17:16 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:17:16 +0200 (CEST) Subject: jan: thuban/Thuban/UI about.py,1.15,1.16 Message-ID: <20040928191716.D308F102C17@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Thuban/UI In directory doto:/tmp/cvs-serv10798 Modified Files: about.py Log Message: (About.__init__): Added description of the registered extensions with all of the information. Index: about.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/about.py,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- about.py 20 Aug 2004 16:50:22 -0000 1.15 +++ about.py 28 Sep 2004 19:17:14 -0000 1.16 @@ -21,6 +21,8 @@ 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): @@ -73,6 +75,14 @@ text+= '\t%s %s\n' % (name, version) text += '\n' + text += _('Extensions:\n') + if ext_registry: + for ext in ext_registry: + text += '\t%s %s\n' % (ext.name, ext.version) + else: + text += _('\tNone registered.\n') + text += '\n' + text += _('Lead Developer:\n') text += '\t%s\n\n' % lead_developer @@ -97,6 +107,22 @@ "\tDevelopers list (public):\n\t\t\n" "\tThuban team at Intevation:\n\t\t\n" ) + + text += '\n\n' + + text += _("Details on the registered extensions:\n\n") + + if ext_registry: + for ext in ext_registry: + 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' + else: + text += _('\tNone registered.\n') self.text = text From cvs at intevation.de Tue Sep 28 21:20:37 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:20:37 +0200 (CEST) Subject: jan: thuban/Thuban/Model extension.py,1.3,1.4 Message-ID: <20040928192037.4C87A102C17@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Thuban/Model In directory doto:/tmp/cvs-serv10899 Modified Files: extension.py Log Message: (Extension): Improved doc-string. Index: extension.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/extension.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extension.py 27 Jan 2003 14:14:38 -0000 1.3 +++ extension.py 28 Sep 2004 19:20:35 -0000 1.4 @@ -18,8 +18,10 @@ """Represent a extension. A extension is a package of additional functionality to Thuban and contains a number of Objects - that can be freely defined in an extension. - Each object must a a TitleObject with additional set "object.name". + that can be freely defined in an extension. + Each object must a a TitleObject with additional set "object.name". + Furthermore, each object must implement the methods Subscribe, + Unsubscribe and Destroy (i.e. derive from Modifiable). Extension objects send the following message types: From cvs at intevation.de Tue Sep 28 21:27:00 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:27:00 +0200 (CEST) Subject: jan: thuban/Extensions/gns2shp gns2shp.py,1.3,1.4 Message-ID: <20040928192700.6E300102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Extensions/gns2shp In directory doto:/tmp/cvs-serv11117 Modified Files: gns2shp.py Log Message: Added registration of the extension. Index: gns2shp.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/gns2shp/gns2shp.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gns2shp.py 18 May 2004 21:09:50 -0000 1.3 +++ gns2shp.py 28 Sep 2004 19:26:58 -0000 1.4 @@ -23,7 +23,7 @@ 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,21 @@ from Thuban import _ from Thuban.Model.layer import Layer +from Thuban.UI.extensionregistry import ExtensionDesc, ext_registry + import shapelib import dbflib + + +ext_registry.add(ExtensionDesc( + 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."))) + def gns2shp(src_fname, dest_fname): """Convert a file from gns textformat into a Shapefile. From cvs at intevation.de Tue Sep 28 21:29:08 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:29:08 +0200 (CEST) Subject: jan: thuban/Extensions/importAPR importAPR.py,1.4,1.5 Message-ID: <20040928192908.61EF7102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Extensions/importAPR In directory doto:/tmp/cvs-serv11201 Modified Files: importAPR.py Log Message: Added registration of the extension. Index: importAPR.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/importAPR/importAPR.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- importAPR.py 11 May 2004 22:34:49 -0000 1.4 +++ importAPR.py 28 Sep 2004 19:29:06 -0000 1.5 @@ -27,9 +27,18 @@ from Thuban import _ from Thuban.Model.layer import Layer from Thuban.Model.classification import ClassGroupRange, ClassGroupSingleton +from Thuban.UI.extensionregistry import ExtensionDesc, ext_registry from odb import ODBBaseObject from apr import APR_LClass, APR_TClr, APR_BLnSym, APR_BMkSym, APR_BShSym + +ext_registry.add(ExtensionDesc( + 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."))) class ODBExtension(Extension): def TreeInfo(self): From cvs at intevation.de Tue Sep 28 21:31:07 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:31:07 +0200 (CEST) Subject: jan: thuban/Extensions/bboxdump bboxdump.py,1.3,1.4 Message-ID: <20040928193107.8CAA3102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Extensions/bboxdump In directory doto:/tmp/cvs-serv11287 Modified Files: bboxdump.py Log Message: Added registration of the extension. Index: bboxdump.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/bboxdump/bboxdump.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- bboxdump.py 11 May 2004 22:34:49 -0000 1.3 +++ bboxdump.py 28 Sep 2004 19:31:05 -0000 1.4 @@ -1,4 +1,4 @@ -# Copyright (C) 2003 by Intevation GmbH +# Copyright (C) 2003-2004 by Intevation GmbH # Authors: # Frank Koormann # @@ -26,10 +26,19 @@ from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor from Thuban.UI.command import registry, Command from Thuban.UI.mainwindow import main_menu, _has_selected_shape_layer +from Thuban.UI.extensionregistry import ExtensionDesc, ext_registry from Thuban import _ import shapelib import dbflib + +ext_registry.add(ExtensionDesc( + name = 'bboxdump', + version = '1.0.0', + authors= [ 'Frank Koormann' ], + copyright = '2003-2004 Intevation GmbH', + desc = _("Dumps the bounding boxes of all\n" \ + "shapes of the selected layer."))) # Widget IDs ID_FILENAME = 4001 From cvs at intevation.de Tue Sep 28 21:53:54 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:53:54 +0200 (CEST) Subject: jan: thuban/Extensions/profiling profiling.py,1.4,1.5 Message-ID: <20040928195354.9F699102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Extensions/profiling In directory doto:/tmp/cvs-serv11865 Modified Files: profiling.py Log Message: Added registration of the extension. Index: profiling.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/profiling/profiling.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- profiling.py 11 May 2004 22:34:49 -0000 1.4 +++ profiling.py 28 Sep 2004 19:53:52 -0000 1.5 @@ -33,6 +33,15 @@ from Thuban import _ from Thuban.UI.command import registry, Command from Thuban.UI.mainwindow import main_menu +from Thuban.UI.extensionregistry import ExtensionDesc, ext_registry + +ext_registry.add(ExtensionDesc( + name = 'profiling', + version = '1.0.0', + authors= [ 'Bernhard Herzog' ], + copyright = '2003 Intevation GmbH', + desc = _("Provide a profiler and a timer\n" + "for screen rendering."))) # # Customization From cvs at intevation.de Tue Sep 28 21:54:52 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:54:52 +0200 (CEST) Subject: jan: thuban/Extensions/wms wms.py,1.9,1.10 Message-ID: <20040928195452.4F0A6102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Extensions/wms In directory doto:/tmp/cvs-serv11912 Modified Files: wms.py Log Message: Added registration of the extension. Index: wms.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/wms/wms.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- wms.py 11 May 2004 22:34:49 -0000 1.9 +++ wms.py 28 Sep 2004 19:54:50 -0000 1.10 @@ -31,8 +31,16 @@ from Thuban.UI.mainwindow import main_menu from Thuban import _ import Thuban.UI.baserenderer +from Thuban.UI.extensionregistry import ExtensionDesc, ext_registry from layer import WMSLayer + +ext_registry.add(ExtensionDesc( + name = 'WMS', + version = '0.1.0', + authors= [ 'Jan-Oliver Wagner' ], + copyright = '2003, 2004 Intevation GmbH', + desc = _("Provide layers via OGC WMS."))) class WMSExtension(Extension): From cvs at intevation.de Tue Sep 28 21:58:53 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 21:58:53 +0200 (CEST) Subject: jan: thuban ChangeLog,1.694,1.695 Message-ID: <20040928195853.EFA26102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv12004 Modified Files: ChangeLog Log Message: New feature: Registry for Extensions. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.694 retrieving revision 1.695 diff -u -d -r1.694 -r1.695 --- ChangeLog 27 Sep 2004 09:56:13 -0000 1.694 +++ ChangeLog 28 Sep 2004 19:58:51 -0000 1.695 @@ -1,3 +1,19 @@ +2004-09-28 Jan-Oliver Wagner + + New feature: Registry for Extensions. + + * Thuban/UI/extensionregistry.py: This module defines a registry for + Extensions. + + * Thuban/UI/about.py (About.__init__): Added description + of the registered extensions with all of the information. + + * Thuban/Model/extension.py (Extension): Improved doc-string. + + * Extensions/gns2shp/gns2shp.py, Extensions/importAPR/importAPR.py, + Extensions/bboxdump/bboxdump.py, Extensions/profiling/profiling.py, + Extensions/wms/wms.py: Added registration of the extension. + 2004-09-27 Bernhard Reiter More fixes to svgexport to make used ids unique and From jan at intevation.de Tue Sep 28 22:04:03 2004 From: jan at intevation.de (Jan-Oliver Wagner) Date: Tue, 28 Sep 2004 22:04:03 +0200 Subject: Revised patch for adding version info for Extensions In-Reply-To: <20040925123532.GB6651@intevation.de> References: <20040918221128.GB12348@intevation.de> <20040925123532.GB6651@intevation.de> Message-ID: <20040928200403.GA6764@intevation.de> On Sat, Sep 25, 2004 at 02:35:32PM +0200, Jan-Oliver Wagner wrote: > On Sun, Sep 19, 2004 at 12:11:28AM +0200, Jan-Oliver Wagner wrote: > > here is the revised patch for extension descriptions. > > > > Now OK to commit? (Will also baclport to 1_0) > > I take no response as OK and will start soon to commit ;-) I commited all now. Whats' missing is still: - svgexport: Version 1.0.0 I guess? - umn_mapserver: I'd like to change this a bit first, so that only one module needs to be imported from thubanstart.py - Manual: adapt description for writing extensions. Best Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ FreeGIS http://freegis.org/ From cvs at intevation.de Tue Sep 28 22:21:36 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 22:21:36 +0200 (CEST) Subject: jan: thuban/Thuban/UI classgen.py,1.30.2.2,1.30.2.3 Message-ID: <20040928202136.A28FC102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/Thuban/UI In directory doto:/tmp/cvs-serv12558 Modified Files: Tag: thuban-1-0-branch classgen.py Log Message: (GenQuantilesPanel.GetList): Fixed a missing-bracket bug. Index: classgen.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/classgen.py,v retrieving revision 1.30.2.2 retrieving revision 1.30.2.3 diff -u -d -r1.30.2.2 -r1.30.2.3 --- classgen.py 22 Apr 2004 15:52:13 -0000 1.30.2.2 +++ classgen.py 28 Sep 2004 20:21:34 -0000 1.30.2.3 @@ -879,7 +879,7 @@ # for i in range(table.NumRows()): _list.append(table.ReadValue(i, self.fieldName, - row_is_ordinal = True) + row_is_ordinal = True)) finally: ThubanEndBusyCursor() From cvs at intevation.de Tue Sep 28 22:21:55 2004 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 28 Sep 2004 22:21:55 +0200 (CEST) Subject: jan: thuban ChangeLog,1.624.2.8,1.624.2.9 Message-ID: <20040928202155.4EF52102BD5@lists.intevation.de> Author: jan Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv12599 Modified Files: Tag: thuban-1-0-branch ChangeLog Log Message: a bug fix Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.624.2.8 retrieving revision 1.624.2.9 diff -u -d -r1.624.2.8 -r1.624.2.9 --- ChangeLog 6 Aug 2004 18:12:51 -0000 1.624.2.8 +++ ChangeLog 28 Sep 2004 20:21:53 -0000 1.624.2.9 @@ -1,3 +1,8 @@ +2004-09-28 Jan-Oliver Wagner + + * Thuban/UI/classgen.py (GenQuantilesPanel.GetList): Fixed + a missing-bracket bug. + 2004-08-06 Bernhard Herzog Backport some fixes from HEAD From joey at infodrom.org Wed Sep 29 21:08:39 2004 From: joey at infodrom.org (Martin Schulze) Date: Wed, 29 Sep 2004 21:08:39 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: References: <20040718034419.GC4134@finlandia.infodrom.north.de> <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> <20040907154616.GJ6910@finlandia.infodrom.north.de> Message-ID: <20040929190839.GE15510@finlandia.infodrom.north.de> Moin! Bernhard Herzog wrote: > > Bernhard Herzog wrote: > >> No, I'm not sure, and I don't have the time to find the perfect place > >> for it. You didn't want it in Thuban.UI.classifier, though, and that > > > > No, I wasn't sure how I am supposed to implement this in > > classifier.py. > > Just as you would in the wms extension. Exactly. > [...] > > Proposal: > > > > Add Thuban/UI/propdialgs.py (or any other name) with (as stated in > > the July 27th mail): > > > > a) the declaration of the global variable > > > > b) the global register function > > > > c) the access function to make it complete [optional] > > > > Since in practice only mainwindow needs to look up the mapping, > > this isn't required and can be done directly in mainwindow as > > well, but it would break the modular concept a bit. > > > > Would that be acceptable for you? > > I'd at least omit the accessor functions in b) and c). It's fine to > call methods on the ClassMapper instance directly. The variable name of > the instance shouldn't start with _ then, though. Ok. That works. It's basically a two-line module, but... well... it works at least and is a more or less clean design. > Introducing a new module which effectively contains only one object > seems wasteful. OTOH it is a bit more modular than putting it into the > mainwindow module, but then again, even that is much more modular than > what we have now. I'd probably just stick the ClassMapper instance into > mainwindow for now and create a new module if we really need it some > day. It wouldn't be hard to maintain a backwards compatible interface > for a while either. Having it in mainwindow doesn't work since that would introduce a circular import chain. mainwindow is already importing the classifier, so the classifier cannot import the mainwindow. Hence, this needs to be dragged out into a different module. > However, I have spent practically 100% of my time on non-Thuban things > for the last several months and that won't change anytime soon. I don't > really have time to make up my mind about this or to keep discussing > this much longer. I'd say, you decide which way to go here and just > check that in. I'm sure you'll come up with a reasonable solution. Thanks. I'm attaching the solution in a patch to this mail, in case you or anybody else still wants to comment on it. If not, I'll commit it on Friday. Regards, Joey -- The MS-DOS filesystem is nice for removable media. -- H. Peter Anvin From joey at infodrom.org Thu Sep 30 08:30:28 2004 From: joey at infodrom.org (Martin Schulze) Date: Thu, 30 Sep 2004 08:30:28 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: <20040929190839.GE15510@finlandia.infodrom.north.de> References: <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> <20040907154616.GJ6910@finlandia.infodrom.north.de> <20040929190839.GE15510@finlandia.infodrom.north.de> Message-ID: <20040930063028.GF15510@finlandia.infodrom.north.de> Martin Schulze wrote: > I'm attaching the solution in a patch to this mail, in case you or > anybody else still wants to comment on it. If not, I'll commit it > on Friday. As usual I forgot to attach the patch, next try... Regards, Joey -- This is GNU/Linux Country. On a quiet night, you can hear Windows reboot. -------------- next part -------------- Index: Extensions/wms/wms.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/wms/wms.py,v retrieving revision 1.10 diff -u -r1.10 wms.py --- Extensions/wms/wms.py 28 Sep 2004 19:54:50 -0000 1.10 +++ Extensions/wms/wms.py 29 Sep 2004 19:01:39 -0000 @@ -65,6 +65,8 @@ return () Thuban.UI.baserenderer.add_renderer_extension(WMSLayer, render_wms_layer) +from Thuban.UI.propertiesdialogs import layer_properties_dialogs +layer_properties_dialogs.add(WMSLayer, wmsProperties) class SelectWMSServer(wxDialog): Index: Thuban/UI/classifier.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/classifier.py,v retrieving revision 1.65 diff -u -r1.65 classifier.py --- Thuban/UI/classifier.py 7 May 2004 20:20:43 -0000 1.65 +++ Thuban/UI/classifier.py 29 Sep 2004 19:01:42 -0000 @@ -685,7 +685,7 @@ FIELDTYPE_INT: _("Integer"), FIELDTYPE_DOUBLE: _("Decimal")} - def __init__(self, parent, name, map, layer, group = None): + def __init__(self, parent, name, layer, group = None): """Create a Properties/Classification dialog for a layer. The layer is part of map. If group is not None, select that group in the classification table. @@ -697,7 +697,7 @@ self.parent.Subscribe(MAP_REPLACED, self.map_replaced) self.layer = layer - self.map = map + self.map = parent.Map() self.map.Subscribe(MAP_LAYERS_REMOVED, self.map_layers_removed) self.layer.Subscribe(LAYER_SHAPESTORE_REPLACED, @@ -1510,3 +1510,7 @@ def _OnLeftDClick(self, event): self.DoEdit() + +from Thuban.UI.propertiesdialogs import layer_properties_dialogs +layer_properties_dialogs.add(Layer, Classifier) +layer_properties_dialogs.add(RasterLayer, Classifier) Index: Thuban/UI/mainwindow.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/mainwindow.py,v retrieving revision 1.132 diff -u -r1.132 mainwindow.py --- Thuban/UI/mainwindow.py 18 Apr 2004 20:37:01 -0000 1.132 +++ Thuban/UI/mainwindow.py 29 Sep 2004 19:01:43 -0000 @@ -48,6 +48,7 @@ from Thuban.UI.dock import DockFrame from Thuban.UI.join import JoinDialog from Thuban.UI.dbdialog import DBFrame, DBDialog, ChooseDBTableDialog +from Thuban.UI.propertiesdialogs import layer_properties_dialogs import resource import Thuban.Model.resource @@ -349,6 +350,23 @@ """ self.SetStatusText(text) + def OpenOrRaiseDialog(self, name, dialog_class, *args, **kw): + """ + Open or raise a dialog. + + If a dialog with the denoted name does already exist it is + raised. Otherwise a new dialog, an instance of dialog_class, + is created, inserted into the main list and displayed. + """ + dialog = self.get_open_dialog(name) + + if dialog is None: + dialog = dialog_class(self, name, *args, **kw) + self.add_dialog(name, dialog) + dialog.Show(True) + else: + dialog.Raise() + def save_modified_session(self, can_veto = 1): """If the current session has been modified, ask the user whether to save it and do so if requested. Return the outcome of @@ -705,14 +723,18 @@ self.OpenLayerProperties(layer) def OpenLayerProperties(self, layer, group = None): - name = "layer_properties" + str(id(layer)) - dialog = self.get_open_dialog(name) + """ + Open or raise the properties dialog. - if dialog is None: - dialog = Classifier(self, name, self.Map(), layer, group) - self.add_dialog(name, dialog) - dialog.Show() - dialog.Raise() + This method opens or raises the properties dialog for the + currently selected layer if one is defined for this layer + type. + """ + dialog_class = layer_properties_dialogs.get(layer) + + if dialog_class is not None: + name = "layer_properties" + str(id(layer)) + self.OpenOrRaiseDialog(name, dialog_class, layer, group = group) def LayerJoinTable(self): layer = self.canvas.SelectedLayer() -------------------------- Index: Thuban/UI/propertiesdialogs.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/propertiesdialogs.py,v diff -u -rNONE propertiesdialogs.py --- Extensions/wms/wms.py 28 Sep 2004 19:54:50 -0000 1.10 --- Extensions/wms/wms.py 2004-08-27 17:25:15.000000000 +0200 +++ Thuban/UI/propertiesdialogs.py 2004-09-29 20:44:23.000000000 +0200 @@ -0,0 +1,3 @@ +from Thuban.Lib.classmapper import ClassMapper + +layer_properties_dialogs = ClassMapper() From bh at intevation.de Thu Sep 30 12:00:26 2004 From: bh at intevation.de (Bernhard Herzog) Date: Thu, 30 Sep 2004 12:00:26 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: <20040929190839.GE15510@finlandia.infodrom.north.de> (Martin Schulze's message of "Wed, 29 Sep 2004 21:08:39 +0200") References: <20040718034419.GC4134@finlandia.infodrom.north.de> <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> <20040907154616.GJ6910@finlandia.infodrom.north.de> <20040929190839.GE15510@finlandia.infodrom.north.de> Message-ID: Martin Schulze writes: > Having it in mainwindow doesn't work since that would introduce a > circular import chain. mainwindow is already importing the classifier, > so the classifier cannot import the mainwindow. mainwindow only imports classifier because it's referenced directly in the OpenLayerProperties method. That reference will go away, of course, since that's basically the point of the changes we're discussing here. So there's no need anymore for mainwindow to import classifier at all, and there would be no circular import. In your patch the import statement for the classifier module should be removed, therefore, BTW. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/ From bernhard at intevation.de Thu Sep 30 12:37:06 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Thu, 30 Sep 2004 12:37:06 +0200 Subject: News for Mapserver Extension? In-Reply-To: <20040922113209.GA1299@intevation.de> References: <20040922113209.GA1299@intevation.de> Message-ID: <20040930103706.GK18854@intevation.de> I guess we should make this a Thuban news. Is anybody working on that? On Wed, Sep 22, 2004 at 01:32:09PM +0200, Jan-Oliver Wagner wrote: > finally, Jan Sch?ngel finished his Master Thesis on > implementing a UMN MapServer .map-file Management tool > as an extension for Thuban. > > The thesis is a free document and listed on the > Thuban documentation page: > http://thuban.intevation.org/documentation.html > It is written in german language. > > The extension itself is part of CVS HEAD and of > course uses english language. > > Many thanks for Jan Sch?ngel for this great work! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040930/c2c0eb30/attachment.bin From joey at infodrom.org Thu Sep 30 18:06:40 2004 From: joey at infodrom.org (Martin Schulze) Date: Thu, 30 Sep 2004 18:06:40 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: References: <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> <20040907154616.GJ6910@finlandia.infodrom.north.de> <20040929190839.GE15510@finlandia.infodrom.north.de> Message-ID: <20040930160640.GC15510@finlandia.infodrom.north.de> Bernhard Herzog wrote: > > Having it in mainwindow doesn't work since that would introduce a > > circular import chain. mainwindow is already importing the classifier, > > so the classifier cannot import the mainwindow. > > mainwindow only imports classifier because it's referenced directly in > the OpenLayerProperties method. That reference will go away, of course, > since that's basically the point of the changes we're discussing here. > So there's no need anymore for mainwindow to import classifier at all, > and there would be no circular import. Whoops, you are correct. Great. In that case, at least at the moment there is no problem with having the definition in mainwindow.py. New patch attached. Will commit tomorrow. Regards, Joey -- This is GNU/Linux Country. On a quiet night, you can hear Windows reboot. -------------- next part -------------- Index: Extensions/wms/properties.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/wms/properties.py,v retrieving revision 1.1 diff -u -r1.1 properties.py --- Extensions/wms/properties.py 15 Apr 2004 16:14:51 -0000 1.1 +++ Extensions/wms/properties.py 30 Sep 2004 16:03:44 -0000 @@ -72,7 +72,7 @@ Representation for the WMS properties dialog """ - def __init__(self, parent, name, layer): + def __init__(self, parent, name, layer, *args, **kw): """ Build the properties dialog """ Index: Extensions/wms/wms.py =================================================================== RCS file: /thubanrepository/thuban/Extensions/wms/wms.py,v retrieving revision 1.10 diff -u -r1.10 wms.py --- Extensions/wms/wms.py 28 Sep 2004 19:54:50 -0000 1.10 +++ Extensions/wms/wms.py 30 Sep 2004 16:03:44 -0000 @@ -28,7 +28,7 @@ from Thuban.Model.proj import Projection from Thuban.Model.extension import Extension from Thuban.UI.command import registry, Command -from Thuban.UI.mainwindow import main_menu +from Thuban.UI.mainwindow import main_menu, layer_properties_dialogs from Thuban import _ import Thuban.UI.baserenderer from Thuban.UI.extensionregistry import ExtensionDesc, ext_registry @@ -65,6 +65,8 @@ return () Thuban.UI.baserenderer.add_renderer_extension(WMSLayer, render_wms_layer) +from properties import wmsProperties +layer_properties_dialogs.add(WMSLayer, wmsProperties) class SelectWMSServer(wxDialog): Index: Thuban/UI/classifier.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/classifier.py,v retrieving revision 1.65 diff -u -r1.65 classifier.py --- Thuban/UI/classifier.py 7 May 2004 20:20:43 -0000 1.65 +++ Thuban/UI/classifier.py 30 Sep 2004 16:03:45 -0000 @@ -685,7 +685,7 @@ FIELDTYPE_INT: _("Integer"), FIELDTYPE_DOUBLE: _("Decimal")} - def __init__(self, parent, name, map, layer, group = None): + def __init__(self, parent, name, layer, group = None): """Create a Properties/Classification dialog for a layer. The layer is part of map. If group is not None, select that group in the classification table. @@ -697,7 +697,7 @@ self.parent.Subscribe(MAP_REPLACED, self.map_replaced) self.layer = layer - self.map = map + self.map = parent.Map() self.map.Subscribe(MAP_LAYERS_REMOVED, self.map_layers_removed) self.layer.Subscribe(LAYER_SHAPESTORE_REPLACED, @@ -1510,3 +1510,7 @@ def _OnLeftDClick(self, event): self.DoEdit() + +from Thuban.UI.mainwindow import layer_properties_dialogs +layer_properties_dialogs.add(Layer, Classifier) +layer_properties_dialogs.add(RasterLayer, Classifier) Index: Thuban/UI/mainwindow.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/mainwindow.py,v retrieving revision 1.132 diff -u -r1.132 mainwindow.py --- Thuban/UI/mainwindow.py 18 Apr 2004 20:37:01 -0000 1.132 +++ Thuban/UI/mainwindow.py 30 Sep 2004 16:03:46 -0000 @@ -35,7 +35,6 @@ import view import tree import tableview, identifyview -from Thuban.UI.classifier import Classifier import legend from menu import Menu @@ -53,6 +52,9 @@ import projdialog +from Thuban.Lib.classmapper import ClassMapper + +layer_properties_dialogs = ClassMapper() class MainWindow(DockFrame): @@ -349,6 +351,23 @@ """ self.SetStatusText(text) + def OpenOrRaiseDialog(self, name, dialog_class, *args, **kw): + """ + Open or raise a dialog. + + If a dialog with the denoted name does already exist it is + raised. Otherwise a new dialog, an instance of dialog_class, + is created, inserted into the main list and displayed. + """ + dialog = self.get_open_dialog(name) + + if dialog is None: + dialog = dialog_class(self, name, *args, **kw) + self.add_dialog(name, dialog) + dialog.Show(True) + else: + dialog.Raise() + def save_modified_session(self, can_veto = 1): """If the current session has been modified, ask the user whether to save it and do so if requested. Return the outcome of @@ -705,14 +724,18 @@ self.OpenLayerProperties(layer) def OpenLayerProperties(self, layer, group = None): - name = "layer_properties" + str(id(layer)) - dialog = self.get_open_dialog(name) + """ + Open or raise the properties dialog. - if dialog is None: - dialog = Classifier(self, name, self.Map(), layer, group) - self.add_dialog(name, dialog) - dialog.Show() - dialog.Raise() + This method opens or raises the properties dialog for the + currently selected layer if one is defined for this layer + type. + """ + dialog_class = layer_properties_dialogs.get(layer) + + if dialog_class is not None: + name = "layer_properties" + str(id(layer)) + self.OpenOrRaiseDialog(name, dialog_class, layer, group = group) def LayerJoinTable(self): layer = self.canvas.SelectedLayer() From bernhard at intevation.de Thu Sep 30 18:25:12 2004 From: bernhard at intevation.de (Bernhard Reiter) Date: Thu, 30 Sep 2004 18:25:12 +0200 Subject: Revised patch for adding version info for Extensions In-Reply-To: <20040928200403.GA6764@intevation.de> References: <20040918221128.GB12348@intevation.de> <20040925123532.GB6651@intevation.de> <20040928200403.GA6764@intevation.de> Message-ID: <20040930162512.GC31040@intevation.de> On Tue, Sep 28, 2004 at 10:04:03PM +0200, Jan-Oliver Wagner wrote: > Whats' missing is still: > - svgexport: Version 1.0.0 I guess? There might be a TODO to solve for the legend, but I probably work on Skencil first, so 0.9.0 is not bad until it got more external testers. On the other hand 1.0.0 is also okay. Do you make the change? I would prefer this as you are into that subject. ;) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20040930/f282e647/attachment.bin From bh at intevation.de Thu Sep 30 21:06:57 2004 From: bh at intevation.de (Bernhard Herzog) Date: Thu, 30 Sep 2004 21:06:57 +0200 Subject: [Thuban-devel] Re: RfD: Support for layer specific resources In-Reply-To: <20040930160640.GC15510@finlandia.infodrom.north.de> (Martin Schulze's message of "Thu, 30 Sep 2004 18:06:40 +0200") References: <20040727104502.GK1334@finlandia.infodrom.north.de> <20040811143417.GB3511@finlandia.infodrom.north.de> <20040824125321.GB853@finlandia.infodrom.north.de> <20040907154616.GJ6910@finlandia.infodrom.north.de> <20040929190839.GE15510@finlandia.infodrom.north.de> <20040930160640.GC15510@finlandia.infodrom.north.de> Message-ID: Martin Schulze writes: > Whoops, you are correct. Great. In that case, at least at the moment > there is no problem with having the definition in mainwindow.py. New > patch attached. Looks good. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://sketch.sourceforge.net/ Thuban http://thuban.intevation.org/