From cvs at intevation.de Fri Jul 1 19:42:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 1 Jul 2005 19:42:06 +0200 (CEST) Subject: bh: thuban ChangeLog,1.818,1.819 Message-ID: <20050701174206.A3C16101FB7@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv9196 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.818 retrieving revision 1.819 diff -u -d -r1.818 -r1.819 --- ChangeLog 30 Jun 2005 16:15:03 -0000 1.818 +++ ChangeLog 1 Jul 2005 17:42:04 -0000 1.819 @@ -1,5 +1,9 @@ 2005-06-30 Bernhard Herzog + * test/runtests.py: Untabify. + +2005-06-30 Bernhard Herzog + * Thuban/UI/renderer.py (ScreenRenderer.draw_selection_incrementally): untabify. From cvs at intevation.de Fri Jul 1 22:49:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 1 Jul 2005 22:49:06 +0200 (CEST) Subject: bh: thuban/Thuban/UI about.py,1.21,1.22 __init__.py,1.4,1.5 Message-ID: <20050701204906.57E02101FA9@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/UI In directory doto:/tmp/cvs-serv11857/Thuban/UI Modified Files: about.py __init__.py Log Message: First step towards unicode. With this roughly we're at step 1 string_representation.txt * Doc/technotes/string_representation.txt: New. Document how strings are represented in Thuban and how to get to a Unicode Thuban. * Thuban/__init__.py (set_internal_encoding) (unicode_from_internal, internal_from_unicode): New. The first few functions for the internal string representation * Thuban/UI/about.py (unicodeToLocale): Removed. Use internal_from_unicode instead. * Thuban/UI/__init__.py (install_wx_translation): Determine the encoding to use for the internal string representation. Also, change the translation function to return strings in internal representation even on unicode builds of wxPython * Thuban/Model/load.py (SessionLoader.check_attrs): Decode filenames too. (SessionLoader.start_clrange): Use check_attrs to decode and check the attributes. * Thuban/Model/xmlreader.py (XMLReader.encode): Use internal_from_unicode to convert unicode strings. * Thuban/Model/xmlwriter.py (XMLWriter.encode): Use unicode_from_internal when applicable * test/runtests.py (main): New command line option: internal-encoding to specify the internal string encoding to use in the tests. * test/support.py (initthuban): Set the internal encoding to latin-1 * test/test_load.py (TestSingleLayer.test, TestClassification.test) (TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_1_0.py (TestSingleLayer.test) (TestClassification.test, TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_9.py (TestSingleLayer.test) (TestClassification.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_8.py (TestUnicodeStrings.test): Use the internal string representation when dealing with non-ascii characters * test/test_save.py (XMLWriterTest.testEncode) (SaveSessionTest.testClassifiedLayer): Use the internal string representation when dealing with non-ascii characters where applicable Index: about.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/about.py,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- about.py 10 Mar 2005 22:47:14 -0000 1.21 +++ about.py 1 Jul 2005 20:49:04 -0000 1.22 @@ -17,7 +17,7 @@ from locale import getdefaultlocale -from Thuban import _ +from Thuban import _, internal_from_unicode from Thuban.version import versions from Thuban.Model.resource import gdal_support_status @@ -39,11 +39,12 @@ lead_developer = 'Bernhard Herzog' developers = [ 'Jonathan Coles', 'Frank Koormann', - unicodeToLocale(u'Martin M\xfcller'), + internal_from_unicode(u'Martin M\xfcller'), 'Bernhard Reiter', 'Jan-Oliver Wagner' ] translators = [ ( _('French'), 'Daniel Calvelo Aros' ), - ( _('German'), unicodeToLocale(u'Bj\xf6rn Broscheit')), + ( _('German'), + internal_from_unicode(u'Bj\xf6rn Broscheit')), ( _('Hungarian'), 'Norbert Solymosi'), ( _('Italian'), 'Maurizio Napolitano'), ( _('Portuguese (Brazilian)'), 'Eduardo Patto Kanegae'), @@ -163,15 +164,3 @@ def OnCancel(self, event): self.EndModal(wxID_CANCEL) - - -def unicodeToLocale(unicodeStr): - "Function to convert unicode to the user's locale encoding" - # Under a german windows 2000 getlocale returns an encoding name - # that's not direcly usable (it's missing a "cp" at the beginning). - # getdefaultlocale does return a usable encoding name so we use that - # instead. - locale=getdefaultlocale()[1] - if locale is None: - locale = 'ascii' - return unicodeStr.encode(locale,'replace') Index: __init__.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- __init__.py 27 Oct 2003 17:11:06 -0000 1.4 +++ __init__.py 1 Jul 2005 20:49:04 -0000 1.5 @@ -1,4 +1,4 @@ -# Copyright (c) 2001, 2002, 2003 by Intevation GmbH +# Copyright (c) 2001, 2002, 2003, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -22,7 +22,23 @@ wx.wxLocale_AddCatalogLookupPathPrefix(Thuban._message_dir) _locale = wx.wxLocale() _locale.AddCatalog("thuban") - Thuban.install_translation_function(wx.wxGetTranslation) + + # With a unicode build of wxPython, wxGetTranslation returns a + # unicode object, so we have a wrapper that handles the case of + # not using unicode as the internal string representation of + # Thuban: If wxGetTranslation returns unicode and the internal + # string representation of Thuban is not unicode, we convert the + # translated string to the internal representation. wxPython + # will convert such strings back to unicode if necessary, + # provided the internal encoding used is the one expected by + # wxPython, which is taken care of below. + def thuban_wx_translation(s): + t = wx.wxGetTranslation(s) + if isinstance(t, unicode) and Thuban._internal_encoding!="unicode": + t = t.encode(Thuban._internal_encoding, "replace") + return t + + Thuban.install_translation_function(thuban_wx_translation) # Reset the python locale. This makes sure that the LC_NUMERIC # seen by the python interpreter and by C modules is "C" instead @@ -31,5 +47,31 @@ # work for some reason import locale locale.setlocale(locale.LC_NUMERIC, "") + + # determine the internal encoding to use. + # This is very tricky. It's probably not optimal yet. + encoding = None + + # If we have a wxPython >= 2.5.4.1, we use the + # GetDefaultPyEncoding function to use exactly what wxPython + # also uses when converting between unicode and byte-strings ... + if hasattr(wx, "wxGetDefaultPyEncoding"): + # AFAICT from the code this will always be a usable string, + # although it could be "ascii". + internal_encoding = wx.wxGetDefaultPyEncoding() + + # ... otherwise we use Python's getdefaultlocale. This is what + # GetDefaultPyEncoding also uses ... + if encoding is None: + encoding = locale.getdefaultlocale()[1] + + # ... finally, if we haven't figured it out yet, use latin 1 for + # historical reasons. Maybe ascii would be better. + if encoding is None: + encoding = "latin1" + + # set the encoding + Thuban.set_internal_encoding(encoding) + install_wx_translation() From cvs at intevation.de Fri Jul 1 22:49:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 1 Jul 2005 22:49:06 +0200 (CEST) Subject: bh: thuban/test test_save.py, 1.36, 1.37 test_load_1_0.py, 1.1, 1.2 test_load_0_9.py, 1.3, 1.4 test_load_0_8.py, 1.4, 1.5 test_load.py, 1.46, 1.47 support.py, 1.20, 1.21 runtests.py, 1.16, 1.17 Message-ID: <20050701204906.60EDC101FB1@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/test In directory doto:/tmp/cvs-serv11857/test Modified Files: test_save.py test_load_1_0.py test_load_0_9.py test_load_0_8.py test_load.py support.py runtests.py Log Message: First step towards unicode. With this roughly we're at step 1 string_representation.txt * Doc/technotes/string_representation.txt: New. Document how strings are represented in Thuban and how to get to a Unicode Thuban. * Thuban/__init__.py (set_internal_encoding) (unicode_from_internal, internal_from_unicode): New. The first few functions for the internal string representation * Thuban/UI/about.py (unicodeToLocale): Removed. Use internal_from_unicode instead. * Thuban/UI/__init__.py (install_wx_translation): Determine the encoding to use for the internal string representation. Also, change the translation function to return strings in internal representation even on unicode builds of wxPython * Thuban/Model/load.py (SessionLoader.check_attrs): Decode filenames too. (SessionLoader.start_clrange): Use check_attrs to decode and check the attributes. * Thuban/Model/xmlreader.py (XMLReader.encode): Use internal_from_unicode to convert unicode strings. * Thuban/Model/xmlwriter.py (XMLWriter.encode): Use unicode_from_internal when applicable * test/runtests.py (main): New command line option: internal-encoding to specify the internal string encoding to use in the tests. * test/support.py (initthuban): Set the internal encoding to latin-1 * test/test_load.py (TestSingleLayer.test, TestClassification.test) (TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_1_0.py (TestSingleLayer.test) (TestClassification.test, TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_9.py (TestSingleLayer.test) (TestClassification.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_8.py (TestUnicodeStrings.test): Use the internal string representation when dealing with non-ascii characters * test/test_save.py (XMLWriterTest.testEncode) (SaveSessionTest.testClassifiedLayer): Use the internal string representation when dealing with non-ascii characters where applicable Index: test_save.py =================================================================== RCS file: /thubanrepository/thuban/test/test_save.py,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- test_save.py 6 May 2005 14:19:40 -0000 1.36 +++ test_save.py 1 Jul 2005 20:49:04 -0000 1.37 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003, 2004 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -25,6 +25,7 @@ import dbflib +from Thuban import internal_from_unicode from Thuban.Lib.fileutil import relative_filename from Thuban.Model.save import XMLWriter, save_session, sort_data_stores from Thuban.Model.session import Session @@ -53,9 +54,9 @@ eq(writer.encode("hello world"), "hello world") eq(writer.encode(unicode("hello world")), unicode("hello world")) - eq(writer.encode("\x80\x90\xc2\x100"), + eq(writer.encode(internal_from_unicode(u"\x80\x90\xc2\x100")), "\xc2\x80\xc2\x90\xc3\x82\x100") - eq(writer.encode(u"\x80\x90\xc2\x100"), + eq(writer.encode(u"\x80\x90\xc2\x100"), "\xc2\x80\xc2\x90\xc3\x82\x100") eq(writer.encode(u"\xFF5E"), "\xc3\xbf5E") @@ -325,9 +326,10 @@ layer2.SetClassificationColumn("POPYCOUN") # Classification with Latin 1 text - clazz.AppendGroup(ClassGroupSingleton('\xe4\xf6\xfc', # ae, oe, ue - ClassGroupProperties(), - '\xdcml\xe4uts')) # Uemlaeuts + clazz.AppendGroup(ClassGroupSingleton( + internal_from_unicode(u'\xe4\xf6\xfc'), # ae, oe, ue + ClassGroupProperties(), + internal_from_unicode(u'\xdcml\xe4uts'))) # Uemlaeuts filename = self.temp_file_name("%s.thuban" % self.id()) Index: test_load_1_0.py =================================================================== RCS file: /thubanrepository/thuban/test/test_load_1_0.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test_load_1_0.py 12 Mar 2004 12:19:15 -0000 1.1 +++ test_load_1_0.py 1 Jul 2005 20:49:04 -0000 1.2 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003, 2004 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -27,6 +27,7 @@ import dbflib import shapelib +from Thuban import internal_from_unicode from Thuban.Model.save import save_session from Thuban.Model.load import load_session, parse_color, LoadError, \ LoadCancelled @@ -179,7 +180,7 @@ self.session = session # Check the title - eq(session.Title(), "Stra\xdfen & Landmarken") + eq(session.Title(), internal_from_unicode(u"Stra\xdfen & Landmarken")) # the session has one map. maps = session.Maps() @@ -187,7 +188,7 @@ # Check the map's attributes map = maps[0] - eq(map.Title(), "\xdcbersicht") + eq(map.Title(), internal_from_unicode(u"\xdcbersicht")) proj = map.GetProjection() eq(proj.GetName(), "WGS 84 / UTM zone 27N") eq(proj.EPSGCode(), "32627") @@ -202,7 +203,7 @@ # Check the layer attributes layer = layers[0] - eq(layer.Title(), "K\xfcste") + eq(layer.Title(), internal_from_unicode(u"K\xfcste")) self.failUnless(filenames_equal(layer.ShapeStore().FileName(), os.path.join(self.temp_dir(), os.pardir, os.pardir, @@ -421,7 +422,8 @@ ("#000000", 2, "None")), ("single", "1", "", ("#000000", 10, "None")), - ("single", "\xe4\xf6\xfc", "\xdcml\xe4uts", + ("single", internal_from_unicode(u"\xe4\xf6\xfc"), + internal_from_unicode(u"\xdcml\xe4uts"), ("#000000", 1, "None"))]), ("My Layer 2", 4, [("default", (), "", @@ -690,7 +692,8 @@ label_layer = self.session.Maps()[0].LabelLayer() expected_labels = [(-21.5, 64.25, "RUINS", ALIGN_LEFT, ALIGN_CENTER), - (-15.125, 64.75, "H\xfctte", ALIGN_RIGHT, ALIGN_TOP), + (-15.125, 64.75, internal_from_unicode(u"H\xfctte"), + ALIGN_RIGHT, ALIGN_TOP), ] for label, values in zip(label_layer.Labels(), expected_labels): self.assertEquals((label.x, label.y, label.text, label.halign, Index: test_load_0_9.py =================================================================== RCS file: /thubanrepository/thuban/test/test_load_0_9.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- test_load_0_9.py 12 Mar 2004 12:19:15 -0000 1.3 +++ test_load_0_9.py 1 Jul 2005 20:49:04 -0000 1.4 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003, 2004 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -26,6 +26,7 @@ import dbflib +from Thuban import internal_from_unicode from Thuban.Model.save import save_session from Thuban.Model.load import load_session, parse_color, LoadError, \ LoadCancelled @@ -169,7 +170,7 @@ self.session = session # Check the title - eq(session.Title(), "Stra\xdfen & Landmarken") + eq(session.Title(), internal_from_unicode(u"Stra\xdfen & Landmarken")) # the session has one map. maps = session.Maps() @@ -177,7 +178,7 @@ # Check the map's attributes map = maps[0] - eq(map.Title(), "\xdcbersicht") + eq(map.Title(), internal_from_unicode(u"\xdcbersicht")) # the map has a single layer layers = map.Layers() @@ -185,7 +186,7 @@ # Check the layer attributes layer = layers[0] - eq(layer.Title(), "K\xfcste") + eq(layer.Title(), internal_from_unicode(u"K\xfcste")) self.failUnless(filenames_equal(layer.ShapeStore().FileName(), os.path.join(self.temp_dir(), os.pardir, os.pardir, @@ -305,7 +306,8 @@ ("#000000", 2, "None")), ("single", "1", "", ("#000000", 10, "None")), - ("single", "\xe4\xf6\xfc", "\xdcml\xe4uts", + ("single", internal_from_unicode(u"\xe4\xf6\xfc"), + internal_from_unicode(u"\xdcml\xe4uts"), ("#000000", 1, "None"))]), ("My Layer 2", 4, [("default", (), "", Index: test_load_0_8.py =================================================================== RCS file: /thubanrepository/thuban/test/test_load_0_8.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test_load_0_8.py 11 Nov 2003 18:16:53 -0000 1.4 +++ test_load_0_8.py 1 Jul 2005 20:49:04 -0000 1.5 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003 by Intevation GmbH +# Copyright (c) 2002, 2003, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -21,6 +21,7 @@ import dbflib +from Thuban import internal_from_unicode from Thuban.Model.load import load_session, parse_color, LoadError from Thuban.Model.color import Transparent from Thuban.Model.classification import ClassGroupProperties, ClassGroupRange,\ @@ -565,21 +566,23 @@ self.session = session # Check the title - eq(session.Title(), "Frida: Free Vector Geodata Osnabr\xfcck") + eq(session.Title(), + internal_from_unicode(u"Frida: Free Vector Geodata Osnabr\xfcck")) # Check the map's title maps = session.Maps() map = maps[0] - eq(map.Title(), "Osnabr\xfcck") + eq(map.Title(), internal_from_unicode(u"Osnabr\xfcck")) # Check the layer's title layers = map.Layers() layer = layers[0] - eq(layer.Title(), "Osnabr\xfcck Layer") + eq(layer.Title(), internal_from_unicode(u"Osnabr\xfcck Layer")) # Check the projection's title projection = map.GetProjection() - eq(projection.GetName(), "Osnabr\xfcck Projection") + eq(projection.GetName(), + internal_from_unicode(u"Osnabr\xfcck Projection")) self.session.Destroy() self.session = None Index: test_load.py =================================================================== RCS file: /thubanrepository/thuban/test/test_load.py,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- test_load.py 6 May 2005 14:19:23 -0000 1.46 +++ test_load.py 1 Jul 2005 20:49:04 -0000 1.47 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003, 2004 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -40,6 +40,7 @@ import dbflib import shapelib +from Thuban import internal_from_unicode from Thuban.Model.save import save_session from Thuban.Model.load import load_session, parse_color, LoadError, \ LoadCancelled @@ -214,7 +215,7 @@ self.session = session # Check the title - eq(session.Title(), "Stra\xdfen & Landmarken") + eq(session.Title(), internal_from_unicode(u"Stra\xdfen & Landmarken")) # the session has one map. maps = session.Maps() @@ -222,7 +223,7 @@ # Check the map's attributes map = maps[0] - eq(map.Title(), "\xdcbersicht") + eq(map.Title(), internal_from_unicode(u"\xdcbersicht")) proj = map.GetProjection() eq(proj.GetName(), "WGS 84 / UTM zone 27N") eq(proj.EPSGCode(), "32627") @@ -237,7 +238,7 @@ # Check the layer attributes layer = layers[0] - eq(layer.Title(), "K\xfcste") + eq(layer.Title(), internal_from_unicode(u"K\xfcste")) self.failUnless(filenames_equal(layer.ShapeStore().FileName(), os.path.join(self.temp_dir(), os.pardir, os.pardir, @@ -510,7 +511,8 @@ ("#000000", 2, "None")), ("single", "1", "", ("#000000", 10, "None")), - ("single", "\xe4\xf6\xfc", "\xdcml\xe4uts", + ("single", internal_from_unicode(u"\xe4\xf6\xfc"), + internal_from_unicode(u"\xdcml\xe4uts"), ("#000000", 1, "None"))]), ("My Layer 2", 4, [("default", (), "", @@ -792,7 +794,8 @@ label_layer = self.session.Maps()[0].LabelLayer() expected_labels = [(-21.5, 64.25, "RUINS", ALIGN_LEFT, ALIGN_CENTER), - (-15.125, 64.75, "H\xfctte", ALIGN_RIGHT, ALIGN_TOP), + (-15.125, 64.75, internal_from_unicode(u"H\xfctte"), + ALIGN_RIGHT, ALIGN_TOP), ] for label, values in zip(label_layer.Labels(), expected_labels): self.assertEquals((label.x, label.y, label.text, label.halign, Index: support.py =================================================================== RCS file: /thubanrepository/thuban/test/support.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- support.py 9 May 2005 18:36:02 -0000 1.20 +++ support.py 1 Jul 2005 20:49:04 -0000 1.21 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003, 2004 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -64,6 +64,11 @@ # need to import wxPython import Thuban Thuban.install_translation_function(lambda s: s) + + # For the time being the default encoding in the test suite is + # latin 1. This is mostly for historical reasons. Other + # encodings can be specified as an argument for runtests.py. + Thuban.set_internal_encoding("latin-1") _initthuban_done = 1 Index: runtests.py =================================================================== RCS file: /thubanrepository/thuban/test/runtests.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- runtests.py 30 Jun 2005 19:24:45 -0000 1.16 +++ runtests.py 1 Jul 2005 20:49:04 -0000 1.17 @@ -74,10 +74,13 @@ verbosity = 1 - opts, args = getopt.getopt(sys.argv[1:], 'v', ['verbose']) + opts, args = getopt.getopt(sys.argv[1:], 'v', + ['verbose', "internal-encoding="]) for optchar, value in opts: if optchar in ("-v", "--verbose"): verbosity = 2 + elif optchar == "--internal-encoding": + Thuban.set_internal_encoding(value) else: print>>sys.stderr, "Unknown option", optchar From cvs at intevation.de Fri Jul 1 22:49:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 1 Jul 2005 22:49:06 +0200 (CEST) Subject: bh: thuban/Thuban/Model xmlwriter.py, 1.2, 1.3 xmlreader.py, 1.1, 1.2 load.py, 1.55, 1.56 Message-ID: <20050701204906.62C9A101FB2@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/Model In directory doto:/tmp/cvs-serv11857/Thuban/Model Modified Files: xmlwriter.py xmlreader.py load.py Log Message: First step towards unicode. With this roughly we're at step 1 string_representation.txt * Doc/technotes/string_representation.txt: New. Document how strings are represented in Thuban and how to get to a Unicode Thuban. * Thuban/__init__.py (set_internal_encoding) (unicode_from_internal, internal_from_unicode): New. The first few functions for the internal string representation * Thuban/UI/about.py (unicodeToLocale): Removed. Use internal_from_unicode instead. * Thuban/UI/__init__.py (install_wx_translation): Determine the encoding to use for the internal string representation. Also, change the translation function to return strings in internal representation even on unicode builds of wxPython * Thuban/Model/load.py (SessionLoader.check_attrs): Decode filenames too. (SessionLoader.start_clrange): Use check_attrs to decode and check the attributes. * Thuban/Model/xmlreader.py (XMLReader.encode): Use internal_from_unicode to convert unicode strings. * Thuban/Model/xmlwriter.py (XMLWriter.encode): Use unicode_from_internal when applicable * test/runtests.py (main): New command line option: internal-encoding to specify the internal string encoding to use in the tests. * test/support.py (initthuban): Set the internal encoding to latin-1 * test/test_load.py (TestSingleLayer.test, TestClassification.test) (TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_1_0.py (TestSingleLayer.test) (TestClassification.test, TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_9.py (TestSingleLayer.test) (TestClassification.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_8.py (TestUnicodeStrings.test): Use the internal string representation when dealing with non-ascii characters * test/test_save.py (XMLWriterTest.testEncode) (SaveSessionTest.testClassifiedLayer): Use the internal string representation when dealing with non-ascii characters where applicable Index: xmlwriter.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/xmlwriter.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- xmlwriter.py 30 Oct 2003 09:21:54 -0000 1.2 +++ xmlwriter.py 1 Jul 2005 20:49:04 -0000 1.3 @@ -1,4 +1,4 @@ -# Copyright (c) 2003 by Intevation GmbH +# Copyright (c) 2003, 2005 by Intevation GmbH # Authors: # Jonathan Coles # @@ -14,6 +14,8 @@ import os from types import UnicodeType +from Thuban import unicode_from_internal + # # one level of indention # @@ -119,12 +121,12 @@ self.file.write(' %s="%s"' % (self.encode(name), self.encode(value))) - def encode(self, str): - """Return an XML-escaped and UTF-8 encoded copy of the string str.""" - - esc = escape(str) + def encode(self, s): + """Return an XML-escaped and UTF-8 encoded copy of the string s. - if isinstance(esc, UnicodeType): - return esc.encode("utf8") - else: - return unicode(escape(str),'latin1').encode("utf8") + The parameter must be a string in Thuban's internal string + representation or a unicode object. + """ + if not isinstance(s, unicode): + s = unicode_from_internal(s) + return escape(s).encode("utf8") Index: xmlreader.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/xmlreader.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- xmlreader.py 12 Jun 2003 12:52:19 -0000 1.1 +++ xmlreader.py 1 Jul 2005 20:49:04 -0000 1.2 @@ -1,4 +1,4 @@ -# Copyright (C) 2003 by Intevation GmbH +# Copyright (C) 2003, 2005 by Intevation GmbH # Authors: # Jonathan Coles # @@ -15,6 +15,7 @@ import xml.sax import xml.sax.handler from xml.sax import make_parser, ErrorHandler, SAXNotRecognizedException +from Thuban import internal_from_unicode class XMLReader(xml.sax.handler.ContentHandler): @@ -124,12 +125,10 @@ getattr(self, method_name[1])(name, qname) def encode(self, str): - """Assume that str is in Unicode and encode it into Latin1. - + """Return the unicode object str in Thuban's internal representation + If str is None, return None """ - - if str is not None: - return str.encode("latin1") - else: + if str is None: return None + return internal_from_unicode(str) Index: load.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/load.py,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- load.py 6 May 2005 14:17:03 -0000 1.55 +++ load.py 1 Jul 2005 20:49:04 -0000 1.56 @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2002, 2003, 2004 by Intevation GmbH +# Copyright (C) 2001, 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Jan-Oliver Wagner # Bernhard Herzog @@ -248,7 +248,7 @@ % (element, d.name)) elif d.conversion == "filename": value = os.path.abspath(os.path.join(self.GetDirectory(), - value)) + self.encode(value))) elif d.conversion == "ascii": value = value.encode("ascii") elif d.conversion: @@ -579,11 +579,15 @@ del self.cl_group, self.cl_prop def start_clrange(self, name, qname, attrs): + attrs = self.check_attrs(name, attrs, + [AttrDesc("range", False, None), + AttrDesc("min", False, None), + AttrDesc("max", False, None)]) - range = attrs.get((None, 'range'), None) + range = attrs['range'] # for backward compatibility (min/max are not saved) - min = attrs.get((None, 'min'), None) - max = attrs.get((None, 'max'), None) + min = attrs['min'] + max = attrs['max'] try: if range is not None: From cvs at intevation.de Fri Jul 1 22:49:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 1 Jul 2005 22:49:06 +0200 (CEST) Subject: bh: thuban/Thuban __init__.py,1.4,1.5 Message-ID: <20050701204906.6AF8E101FB4@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban In directory doto:/tmp/cvs-serv11857/Thuban Modified Files: __init__.py Log Message: First step towards unicode. With this roughly we're at step 1 string_representation.txt * Doc/technotes/string_representation.txt: New. Document how strings are represented in Thuban and how to get to a Unicode Thuban. * Thuban/__init__.py (set_internal_encoding) (unicode_from_internal, internal_from_unicode): New. The first few functions for the internal string representation * Thuban/UI/about.py (unicodeToLocale): Removed. Use internal_from_unicode instead. * Thuban/UI/__init__.py (install_wx_translation): Determine the encoding to use for the internal string representation. Also, change the translation function to return strings in internal representation even on unicode builds of wxPython * Thuban/Model/load.py (SessionLoader.check_attrs): Decode filenames too. (SessionLoader.start_clrange): Use check_attrs to decode and check the attributes. * Thuban/Model/xmlreader.py (XMLReader.encode): Use internal_from_unicode to convert unicode strings. * Thuban/Model/xmlwriter.py (XMLWriter.encode): Use unicode_from_internal when applicable * test/runtests.py (main): New command line option: internal-encoding to specify the internal string encoding to use in the tests. * test/support.py (initthuban): Set the internal encoding to latin-1 * test/test_load.py (TestSingleLayer.test, TestClassification.test) (TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_1_0.py (TestSingleLayer.test) (TestClassification.test, TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_9.py (TestSingleLayer.test) (TestClassification.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_8.py (TestUnicodeStrings.test): Use the internal string representation when dealing with non-ascii characters * test/test_save.py (XMLWriterTest.testEncode) (SaveSessionTest.testClassifiedLayer): Use the internal string representation when dealing with non-ascii characters where applicable Index: __init__.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- __init__.py 27 Oct 2003 17:11:06 -0000 1.4 +++ __init__.py 1 Jul 2005 20:49:04 -0000 1.5 @@ -1,4 +1,4 @@ -# Copyright (c) 2001, 2003 by Intevation GmbH +# Copyright (c) 2001, 2003, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # Jan-Oliver Wagner @@ -74,3 +74,49 @@ global _translation_function if not translation_function_installed(): _translation_function = function + + + +# String representation in Thuban +# +# Thuban has an internal representation for textual data that all text +# that comes into Thuban has to be converted into. Any text written by +# Thuban has to be converted to whatever is needed by the output device. +# +# Currently, the internal representation is usually a byte-string in a +# particuler encoding. For more details see the file +# Doc/technotes/string_representation.txt. + +# The encoding to use for the internal string representation. Usually +# it's a string with the encoding name to use when converting between +# Python byte-strings and unicode objects. The special value "unicode" +# means the use unicode objects as the internal representation. +_internal_encoding = None + +def internal_from_unicode(unistr): + """Return Thuban's internal representation for the unicode object unistr""" + if _internal_encoding != "unicode": + # we use replace so that we don't get exceptions when the + # conversion can't be done properly. + return unistr.encode(_internal_encoding, "replace") + else: + return unistr + +def unicode_from_internal(s): + """Return the unicode object for the string s in internal representation""" + if _internal_encoding != "unicode": + return unicode(s, _internal_encoding) + else: + return s + + +def set_internal_encoding(encoding): + """Set the encoding to use for the internal string representation + + The parameter should be the name of an encoding known to Python so + that it can be used with e.g. the encode method of unicode objects. + As a special case it can be the string 'unicode' to indicate that + the internal representation are unicode objects. + """ + global _internal_encoding + _internal_encoding = encoding From cvs at intevation.de Fri Jul 1 22:49:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 1 Jul 2005 22:49:06 +0200 (CEST) Subject: bh: thuban ChangeLog,1.819,1.820 Message-ID: <20050701204906.79E5F101FB8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv11857 Modified Files: ChangeLog Log Message: First step towards unicode. With this roughly we're at step 1 string_representation.txt * Doc/technotes/string_representation.txt: New. Document how strings are represented in Thuban and how to get to a Unicode Thuban. * Thuban/__init__.py (set_internal_encoding) (unicode_from_internal, internal_from_unicode): New. The first few functions for the internal string representation * Thuban/UI/about.py (unicodeToLocale): Removed. Use internal_from_unicode instead. * Thuban/UI/__init__.py (install_wx_translation): Determine the encoding to use for the internal string representation. Also, change the translation function to return strings in internal representation even on unicode builds of wxPython * Thuban/Model/load.py (SessionLoader.check_attrs): Decode filenames too. (SessionLoader.start_clrange): Use check_attrs to decode and check the attributes. * Thuban/Model/xmlreader.py (XMLReader.encode): Use internal_from_unicode to convert unicode strings. * Thuban/Model/xmlwriter.py (XMLWriter.encode): Use unicode_from_internal when applicable * test/runtests.py (main): New command line option: internal-encoding to specify the internal string encoding to use in the tests. * test/support.py (initthuban): Set the internal encoding to latin-1 * test/test_load.py (TestSingleLayer.test, TestClassification.test) (TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_1_0.py (TestSingleLayer.test) (TestClassification.test, TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_9.py (TestSingleLayer.test) (TestClassification.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_8.py (TestUnicodeStrings.test): Use the internal string representation when dealing with non-ascii characters * test/test_save.py (XMLWriterTest.testEncode) (SaveSessionTest.testClassifiedLayer): Use the internal string representation when dealing with non-ascii characters where applicable Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.819 retrieving revision 1.820 diff -u -d -r1.819 -r1.820 --- ChangeLog 1 Jul 2005 17:42:04 -0000 1.819 +++ ChangeLog 1 Jul 2005 20:49:04 -0000 1.820 @@ -1,3 +1,63 @@ +2005-07-01 Bernhard Herzog + + First step towards unicode. With this roughly we're at step 1 + string_representation.txt + + * Doc/technotes/string_representation.txt: New. Document how + strings are represented in Thuban and how to get to a Unicode + Thuban. + + * Thuban/__init__.py (set_internal_encoding) + (unicode_from_internal, internal_from_unicode): New. The first few + functions for the internal string representation + + * Thuban/UI/about.py (unicodeToLocale): Removed. Use + internal_from_unicode instead. + + * Thuban/UI/__init__.py (install_wx_translation): Determine the + encoding to use for the internal string representation. Also, + change the translation function to return strings in internal + representation even on unicode builds of wxPython + + * Thuban/Model/load.py (SessionLoader.check_attrs): Decode + filenames too. + (SessionLoader.start_clrange): Use check_attrs to decode and check + the attributes. + + * Thuban/Model/xmlreader.py (XMLReader.encode): Use + internal_from_unicode to convert unicode strings. + + * Thuban/Model/xmlwriter.py (XMLWriter.encode): Use + unicode_from_internal when applicable + + * test/runtests.py (main): New command line option: + internal-encoding to specify the internal string encoding to use + in the tests. + + * test/support.py (initthuban): Set the internal encoding to + latin-1 + + * test/test_load.py (TestSingleLayer.test, TestClassification.test) + (TestLabelLayer.test): Use the internal string representation when + dealing with non-ascii characters + + * test/test_load_1_0.py (TestSingleLayer.test) + (TestClassification.test, TestLabelLayer.test): Use the internal + string representation when dealing with non-ascii characters + + * test/test_load_0_9.py (TestSingleLayer.test) + (TestClassification.test): Use the internal string representation + when dealing with non-ascii characters + + * test/test_load_0_8.py (TestUnicodeStrings.test): Use the + internal string representation when dealing with non-ascii + characters + + * test/test_save.py (XMLWriterTest.testEncode) + (SaveSessionTest.testClassifiedLayer): Use the internal string + representation when dealing with non-ascii characters where + applicable + 2005-06-30 Bernhard Herzog * test/runtests.py: Untabify. From cvs at intevation.de Fri Jul 1 22:49:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri, 1 Jul 2005 22:49:06 +0200 (CEST) Subject: bh: thuban/Doc/technotes string_representation.txt,NONE,1.1 Message-ID: <20050701204906.6CE9B101FB7@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Doc/technotes In directory doto:/tmp/cvs-serv11857/Doc/technotes Added Files: string_representation.txt Log Message: First step towards unicode. With this roughly we're at step 1 string_representation.txt * Doc/technotes/string_representation.txt: New. Document how strings are represented in Thuban and how to get to a Unicode Thuban. * Thuban/__init__.py (set_internal_encoding) (unicode_from_internal, internal_from_unicode): New. The first few functions for the internal string representation * Thuban/UI/about.py (unicodeToLocale): Removed. Use internal_from_unicode instead. * Thuban/UI/__init__.py (install_wx_translation): Determine the encoding to use for the internal string representation. Also, change the translation function to return strings in internal representation even on unicode builds of wxPython * Thuban/Model/load.py (SessionLoader.check_attrs): Decode filenames too. (SessionLoader.start_clrange): Use check_attrs to decode and check the attributes. * Thuban/Model/xmlreader.py (XMLReader.encode): Use internal_from_unicode to convert unicode strings. * Thuban/Model/xmlwriter.py (XMLWriter.encode): Use unicode_from_internal when applicable * test/runtests.py (main): New command line option: internal-encoding to specify the internal string encoding to use in the tests. * test/support.py (initthuban): Set the internal encoding to latin-1 * test/test_load.py (TestSingleLayer.test, TestClassification.test) (TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_1_0.py (TestSingleLayer.test) (TestClassification.test, TestLabelLayer.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_9.py (TestSingleLayer.test) (TestClassification.test): Use the internal string representation when dealing with non-ascii characters * test/test_load_0_8.py (TestUnicodeStrings.test): Use the internal string representation when dealing with non-ascii characters * test/test_save.py (XMLWriterTest.testEncode) (SaveSessionTest.testClassifiedLayer): Use the internal string representation when dealing with non-ascii characters where applicable --- NEW FILE: string_representation.txt --- Title: String Representation in Thuban Author: Bernhard Herzog Last-Modified: $Date: 2005/07/01 20:49:04 $ Version: $Revision: 1.1 $ Introduction Thuban originally assumed that text is represented by byte-strings encoded in ISO-8859-1 (latin-1). This is problematic when the default encoding in the user's locale is not in fact latin-1, but e.g. UTF-8. The solution is to use a more flexible representation that will also allow the switch to Unicode as the internal string representation at one point. Internal String Representation Thuban has an internal string representation. All textual data read by Thuban has to be converted to the internal representation. All data written by Thuban has to be converted into whatever form is used by the output device. Thuban provides functions to convert between the internal representation and other representations. E.g.: internal_from_unicode which converts from unicode and should be used when reading XML files, for instance and unicode_from_internal for the conversion to Unicode. The ultimate goal is to use Unicode objects as the internal string representation. It will be much work to get there because we will have to find all the places where we need to make the conversions. Therefore the internal representation will be byte strings in the user's default encoding. With byte strings and especially encodings like latin-1 we can get by without doing all the conversions correctly because basically all byte strings are valid latin-1 strings, even if they have the wrong encoding. In those cases, the text may look strange, but there won't be exceptions in most cases. With Unicode objects, exceptions are much more likely. And in the end it's better to see some incorrect characters than no data at all. All this boils down to the following steps: 1. Byte-Strings as Internal Representation The internal representation are byte strings in the user's default encoding as determined by the locale. The encoding is chosen so that such byte strings can be passed to wxPython without problems. This even works with Unicode builds if we take care to convert the translated strings (wxGetTranslation returns Unicode objects in a Unicode build). If no suitable encoding can be determined, use latin-1. It might be better to use ASCII instead, but latin 1 offers somewhat better backwards compatibility with older Thuban versions. Start implementing the conversion functions and use them wherever we have hard coded conversions to latin-1. It's not necessary to find all places where conversion has to be done at this point. Since we're using byte strings in the user's default encoding most byte-strings that are read by Thuban are already in the right form and in most cases it's also the right form for output. 2. Implement the conversion wherever necessary Start working toward Unicode as the internal representation. In this phase, we need to find all places where conversion has to be done. To help with this, there will be a command line option that sets the internal representation to Unicode so that it's easy to test. The most difficult areas for this are probably the various data sources. Some of them -- dbf files for instance -- q don't provide any information about the encodings used. 3. Switch to Unicode Finally, switch to Unicode as the internal string representation. For this step it might be best to wait until Unicode builds of wxPython are the default on the common platforms. From bh at intevation.de Fri Jul 1 23:02:32 2005 From: bh at intevation.de (Bernhard Herzog) Date: Fri, 01 Jul 2005 23:02:32 +0200 Subject: String representation in Thuban Message-ID: Hi all, As you may have seen I've checked in a bunch of changes in the way Thuban handles strings. So far, Thuban more or less assumed it was running in a locale with latin-1 as the string encoding. With the changes it uses the string encoding of the user's locale. This should take care of bugs like RT2980 and RT2258 in most cases. I've tested the new code with a non-unicode build wxPython/wxGTK 2.4/gtk 1.2 and a unicode build of wxPython/wxGTK 2.5.5/gtk 2.4. In both cases the locale used latin 1. That worked fine. A UTF8 locale might still make some problems, but hopefully not in the about box :). If you have a non-latin-1 locale, please test the new code and report any problems you have. The test suite now runs explicitly with latin 1 as the string encoding, but you can run it with other encodings using the new --internal-encoding parameter of runtests.py. Note that with an encoding != latin 1 two tests will fail because there is no way in Thuban yet to properly deal with DBF files that contain non-ascii characters. An overview of the new way string encoding is handled in Thuban and how we can get to unicode as the string representation is in the new technote string_representation.txt. Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://skencil.org/ Thuban http://thuban.intevation.org/ From cvs at intevation.de Tue Jul 5 18:00:50 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 18:00:50 +0200 (CEST) Subject: bh: thuban/Thuban/UI viewport.py,1.20,1.21 Message-ID: <20050705160050.33C0C1006C5@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/UI In directory doto:/tmp/cvs-serv22461/Thuban/UI Modified Files: viewport.py Log Message: (ViewPort.set_view_transform): Handle ZeroDivisionError exceptions. I don't know when they happen exactly. It probably happens when the projections aren't set properly. Index: viewport.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/viewport.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- viewport.py 24 Jan 2005 11:19:53 -0000 1.20 +++ viewport.py 5 Jul 2005 16:00:47 -0000 1.21 @@ -15,6 +15,7 @@ # $Source$ # $Id$ +import sys from math import hypot from wxproj import point_in_polygon_shape, shape_centroid @@ -410,8 +411,17 @@ # The window's center in projected coordinates assuming the new # scale/offset - pcenterx = (wwidth/2 - offset[0]) / scale - pcentery = (offset[1] - wheight/2) / scale + try: + pcenterx = (wwidth/2 - offset[0]) / scale + pcentery = (offset[1] - wheight/2) / scale + except ZeroDivisionError: + # scale was zero. Probably a problem with the projections. + # printing an error message and return immediately. The user + # will hopefully be informed by the UI which displays a + # message for at least some of the projection problems. + print >>sys.stderr, "ViewPort.set_view_transform:", \ + "ZeroDivisionError, scale =", repr(scale) + return min_scale, max_scale = self.calc_min_max_scales(scale) From cvs at intevation.de Tue Jul 5 18:00:50 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 18:00:50 +0200 (CEST) Subject: bh: thuban ChangeLog,1.820,1.821 Message-ID: <20050705160050.70E341006D7@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv22461 Modified Files: ChangeLog Log Message: (ViewPort.set_view_transform): Handle ZeroDivisionError exceptions. I don't know when they happen exactly. It probably happens when the projections aren't set properly. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.820 retrieving revision 1.821 diff -u -d -r1.820 -r1.821 --- ChangeLog 1 Jul 2005 20:49:04 -0000 1.820 +++ ChangeLog 5 Jul 2005 16:00:48 -0000 1.821 @@ -1,3 +1,10 @@ +2005-07-05 Bernhard Herzog + + * Thuban/UI/viewport.py (ViewPort.set_view_transform): Handle + ZeroDivisionError exceptions. I don't know when they happen + exactly. It probably happens when the projections aren't set + properly. + 2005-07-01 Bernhard Herzog First step towards unicode. With this roughly we're at step 1 From cvs at intevation.de Tue Jul 5 18:30:53 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 18:30:53 +0200 (CEST) Subject: bh: thuban/test test_layer.py,1.36,1.37 Message-ID: <20050705163053.8887D1005A0@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/test In directory doto:/tmp/cvs-serv22993/test Modified Files: test_layer.py Log Message: * Thuban/Model/layer.py (Layer.__mangle_bounding_box) (Layer.ClipBoundingBox): Rename ClipBoundingBox to __mangle_bounding_box. See the comments in the code and RT #2845 * test/test_layer.py (TestLayer.test_arc_layer_with_projection): Remove the explicit test of ClipBoundingBox. The method isn't public anymore and the direct call in the test wasn't necessary in the first place. If ClipBoundingBox (now __mangle_bounding_box) isn't called, the return value of ShapesInRegion will be different. Index: test_layer.py =================================================================== RCS file: /thubanrepository/thuban/test/test_layer.py,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- test_layer.py 23 Mar 2005 15:30:27 -0000 1.36 +++ test_layer.py 5 Jul 2005 16:30:51 -0000 1.37 @@ -1,4 +1,4 @@ -# Copyright (c) 2002, 2003, 2004 by Intevation GmbH +# Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # @@ -191,8 +191,9 @@ self.assertFloatSeqEqual(layer.ShapesBoundingBox([0]), (90.0, -8.90043373, 120, 11.1616263)) - self.assertFloatSeqEqual(layer.ClipBoundingBox((-180, -6, 100, +120)), - (90.0, -6, 100, 11.1616263)) + # Test a very large bounding box in the query. Naive inverse + # projection will create infs instead of proper coordinate + # values and a different result (an empty list instead of [0]) shapes = layer.ShapesInRegion((-180, -170, 200, +120)) self.assertEquals([s.ShapeID() for s in shapes],[0]) From cvs at intevation.de Tue Jul 5 18:30:53 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 18:30:53 +0200 (CEST) Subject: bh: thuban/Thuban/Model layer.py,1.65,1.66 Message-ID: <20050705163053.99EA41005DC@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/Model In directory doto:/tmp/cvs-serv22993/Thuban/Model Modified Files: layer.py Log Message: * Thuban/Model/layer.py (Layer.__mangle_bounding_box) (Layer.ClipBoundingBox): Rename ClipBoundingBox to __mangle_bounding_box. See the comments in the code and RT #2845 * test/test_layer.py (TestLayer.test_arc_layer_with_projection): Remove the explicit test of ClipBoundingBox. The method isn't public anymore and the direct call in the test wasn't necessary in the first place. If ClipBoundingBox (now __mangle_bounding_box) isn't called, the return value of ShapesInRegion will be different. Index: layer.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/layer.py,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- layer.py 6 May 2005 14:16:38 -0000 1.65 +++ layer.py 5 Jul 2005 16:30:51 -0000 1.66 @@ -1,4 +1,4 @@ -# Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH +# Copyright (c) 2001, 2002, 2003, 2004, 2005 by Intevation GmbH # Authors: # Bernhard Herzog # Jonathan Coles @@ -237,7 +237,7 @@ # Ensure that region lies within the layer's bounding box # Otherwise projection of the region would lead to incorrect # values. - clipbbox = self.ClipBoundingBox(bbox) + clipbbox = self.__mangle_bounding_box(bbox) bbox = self.projection.ForwardBBox(clipbbox) return self.store.ShapesInRegion(bbox) @@ -314,14 +314,20 @@ return (_("Layer '%s'") % self.Title(), items) - def ClipBoundingBox(self, bbox): - """ Clip bbox to layer's bounding box. - - Returns that part of bbox that lies within the layers bounding box. - If bbox is completely outside of the layers bounding box, bbox is - returned. It is assumed that bbox has sensible values, i.e. bminx - < bmaxx and bminy < bmaxy. - """ + def __mangle_bounding_box(self, bbox): + # FIXME: This method doesn't make much sense. + # See RT #2845 which effectively says: + # + # If this method, which was originally called ClipBoundingBox, + # is supposed to do clipping it shouldn't return the parameter + # unchanged when it lies completely outside of the bounding box. + # It would be better to return None and return an empty list in + # ShapesInRegion (the only caller) in that case. + # + # This method was introduced to fix a bug that IIRC had + # something todo with projections and bounding boxes containing + # NaN or INF when the parameter to ShapesInRegion covered the + # entire earth or something similarly large). bminx, bminy, bmaxx, bmaxy = bbox lminx, lminy, lmaxx, lmaxy = self.LatLongBoundingBox() if bminx > lmaxx or bmaxx < lminx: @@ -334,7 +340,7 @@ else: bottom = max(lminy, bminy) top = min(lmaxy, bmaxy) - + return (left, bottom, right, top) From cvs at intevation.de Tue Jul 5 18:30:53 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 18:30:53 +0200 (CEST) Subject: bh: thuban ChangeLog,1.821,1.822 Message-ID: <20050705163053.A9F531006C5@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv22993 Modified Files: ChangeLog Log Message: * Thuban/Model/layer.py (Layer.__mangle_bounding_box) (Layer.ClipBoundingBox): Rename ClipBoundingBox to __mangle_bounding_box. See the comments in the code and RT #2845 * test/test_layer.py (TestLayer.test_arc_layer_with_projection): Remove the explicit test of ClipBoundingBox. The method isn't public anymore and the direct call in the test wasn't necessary in the first place. If ClipBoundingBox (now __mangle_bounding_box) isn't called, the return value of ShapesInRegion will be different. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.821 retrieving revision 1.822 diff -u -d -r1.821 -r1.822 --- ChangeLog 5 Jul 2005 16:00:48 -0000 1.821 +++ ChangeLog 5 Jul 2005 16:30:51 -0000 1.822 @@ -1,5 +1,18 @@ 2005-07-05 Bernhard Herzog + * Thuban/Model/layer.py (Layer.__mangle_bounding_box) + (Layer.ClipBoundingBox): Rename ClipBoundingBox to + __mangle_bounding_box. See the comments in the code and RT #2845 + + * test/test_layer.py (TestLayer.test_arc_layer_with_projection): + Remove the explicit test of ClipBoundingBox. The method isn't + public anymore and the direct call in the test wasn't necessary in + the first place. If ClipBoundingBox (now __mangle_bounding_box) + isn't called, the return value of ShapesInRegion will be + different. + +2005-07-05 Bernhard Herzog + * Thuban/UI/viewport.py (ViewPort.set_view_transform): Handle ZeroDivisionError exceptions. I don't know when they happen exactly. It probably happens when the projections aren't set From cvs at intevation.de Tue Jul 5 21:38:41 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 21:38:41 +0200 (CEST) Subject: bh: thuban README,1.9,1.10 ChangeLog,1.822,1.823 Message-ID: <20050705193841.9ABF91005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv25598 Modified Files: README ChangeLog Log Message: gdal 1.1.8 is too old. 1.2.5 works. Index: README =================================================================== RCS file: /thubanrepository/thuban/README,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- README 5 Apr 2005 21:13:03 -0000 1.9 +++ README 5 Jul 2005 19:38:39 -0000 1.10 @@ -37,7 +37,7 @@ Optional software: - GDAL 1.1.8 http://www.remotesensing.org/gdal/ + GDAL 1.2.5 http://www.remotesensing.org/gdal/ for raster image (geo-tiff) support psycopg 1.0.x http://initd.org/software/psycopg Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.822 retrieving revision 1.823 diff -u -d -r1.822 -r1.823 --- ChangeLog 5 Jul 2005 16:30:51 -0000 1.822 +++ ChangeLog 5 Jul 2005 19:38:39 -0000 1.823 @@ -1,5 +1,9 @@ 2005-07-05 Bernhard Herzog + * README: gdal 1.1.8 is too old. 1.2.5 works. + +2005-07-05 Bernhard Herzog + * Thuban/Model/layer.py (Layer.__mangle_bounding_box) (Layer.ClipBoundingBox): Rename ClipBoundingBox to __mangle_bounding_box. See the comments in the code and RT #2845 From cvs at intevation.de Tue Jul 5 22:03:43 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:03:43 +0200 (CEST) Subject: bh: thuban/po de.po,1.5,1.6 Message-ID: <20050705200343.AA7A31005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/po In directory doto:/tmp/cvs-serv25874/po Modified Files: de.po Log Message: Updated. Index: de.po =================================================================== RCS file: /thubanrepository/thuban/po/de.po,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- de.po 23 Dec 2003 11:37:04 -0000 1.5 +++ de.po 5 Jul 2005 20:03:41 -0000 1.6 @@ -1,13 +1,13 @@ # German Translation for Thuban. # Copyright (C) 2003 Bjoern Broscheit -# Copyright (C) 2003 Intevation GmbH +# Copyright (C) 2003, 2005 Intevation GmbH # This file is distributed under the same license as the Thuban package. # Bjoern Broscheit , 2003. # msgid "" msgstr "" "Project-Id-Version: Thuban 1.0.0\n" -"POT-Creation-Date: 2003-12-23 12:27+0100\n" [...1807 lines suppressed...] + +#: ../Thuban/UI/rasterlayerproperties.py:93 +msgid "Mask Type" +msgstr "Maskentyp" + +#: ../Thuban/UI/rasterlayerproperties.py:99 +msgid "Opacity:" +msgstr "Opazität:" + #: ../Thuban/UI/tableview.py:372 msgid "Replace Selection" msgstr "Ersetze Selektion" @@ -1626,6 +1805,6 @@ msgid "Session" msgstr "Sitzung" -#: ../Thuban/UI/view.py:288 +#: ../Thuban/UI/view.py:292 msgid "Export Map" msgstr "Exportiere Karte" From cvs at intevation.de Tue Jul 5 22:04:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:04:37 +0200 (CEST) Subject: bh: thuban/Thuban/UI about.py,1.22,1.23 Message-ID: <20050705200437.AF2AE1005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Thuban/UI In directory doto:/tmp/cvs-serv25918/Thuban/UI Modified Files: about.py Log Message: (About.__init__): Extend copyright notice to 2005 Index: about.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/UI/about.py,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- about.py 1 Jul 2005 20:49:04 -0000 1.22 +++ about.py 5 Jul 2005 20:04:35 -0000 1.23 @@ -136,7 +136,7 @@ text_title = wxStaticText(self, -1, _("Thuban is a program for exploring geographic data.\n\n") + - "Copyright 2001-2004 Intevation GmbH.\n" + + "Copyright 2001-2005 Intevation GmbH.\n" + _("Thuban is licensed under the GNU GPL"), style=wxST_NO_AUTORESIZE|wxALIGN_CENTRE) From cvs at intevation.de Tue Jul 5 22:07:54 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:07:54 +0200 (CEST) Subject: bh: thuban MANIFEST.in,1.13,1.14 Message-ID: <20050705200754.143591005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv26141 Modified Files: MANIFEST.in Log Message: Add *.txt to files taken from Doc. Otherwise the technores won't be included Index: MANIFEST.in =================================================================== RCS file: /thubanrepository/thuban/MANIFEST.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- MANIFEST.in 5 Dec 2003 16:45:19 -0000 1.13 +++ MANIFEST.in 5 Jul 2005 20:07:52 -0000 1.14 @@ -12,6 +12,6 @@ recursive-include Resources/Locale/ *.mo include Resources/XML/*.dtd include Resources/Projections/*.proj -recursive-include Doc Makefile README *.xml *.png *.xcf *.sk *.ps +recursive-include Doc Makefile README *.xml *.png *.xcf *.sk *.ps *.txt include debian/changelog debian/control debian/copyright debian/docs -include debian/menu debian/rules debian/thuban.1 debian/watch \ No newline at end of file +include debian/menu debian/rules debian/thuban.1 debian/watch From cvs at intevation.de Tue Jul 5 22:18:14 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:18:14 +0200 (CEST) Subject: bh: thuban NEWS,1.4,1.5 Message-ID: <20050705201814.5F1BE1005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv26346 Modified Files: NEWS Log Message: Update for 1.1.0 Index: NEWS =================================================================== RCS file: /thubanrepository/thuban/NEWS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- NEWS 23 Dec 2003 13:53:47 -0000 1.4 +++ NEWS 5 Jul 2005 20:18:12 -0000 1.5 @@ -1,3 +1,83 @@ +Changes in Thuban 1.1.0 +======================= + + - Thuban rembers directories in file selection dialogs during a thuban + session + + - Add some support for wxPython 2.5 and 2.6. Thuban is still + compatible with wxPython 2.4. + + - Change the way thuban deals with non-ascii text. The internal + representation is now the user's default encoding. Thuban works a + bit better with a unicode build of wxPython but there are still + problems. (Bernhard Herzog) + + - Various raster data improvements. Among other things, translucent + images are now supported on a sufficiently recent wxWidgets (2.6). + Also, only the part of the window actually covered by the image is + drawn. (Jonathan Coles) + + - Improved PostGIS support (Bernhard Herzog): + + - support tables with multiple geometry columns. The user can + select which one to use + + - support tables with srids + + - tables don't have to have a column named "gid" anymore. The user + can select the column to use for ids + + - PostgreSQL views are supported too + + - support LINESTRING geometries + + - support more PostgreSQL versions. 7.4 works now. + + - Added support for sizable points (Jan-Oliver Wagner) + + - When loading a (moved) session where shapefiles cannot be found, ask + the user (Frank Koormann) + + - The middle mouse button can be used for panning now (Russell Nelson) + + - Give a warning when the projection selected for a layer is probably + wrong (Russell Nelson) + + - Updated shapelib + + - New or improved extensions: + + - A new extension which exports a map as SVG + (Markus Rechtien, Bernhard Reiter) + + - Improved WMS extension (Martin Schulze) + + - New Extension to dump bounding boxes of all shapes of the selected + layer (Frank Koormann) + + - New extension: umn_mapserver (Jan Schüngel) + + - New extension: OGR (Nina Hüffmeyer) + + - New Extension: mouseposition. Tool to collect mouse click positions + (map coordinates) in a dialog. (Frank Koormann) + + - Documentation: + + - Add some documentation of the internals of Thuban. + See Doc/technotes/ + + - The thuban manual has been partly translated to German + (Jan-Oliver Wagner) + + - Updated translations: + Russian (Alex Shevlakov) + + - New translations: + Brazilian Portuguese (Eduardo Patto Kanegae)xb + Hungarian (Norbert Solymosi) + + Changes in Thuban 1.0.0 ======================= From cvs at intevation.de Tue Jul 5 22:24:01 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:24:01 +0200 (CEST) Subject: bh: thuban/Resources/XML thuban-1.1.dtd,1.2,1.3 Message-ID: <20050705202401.224C01005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban/Resources/XML In directory doto:/tmp/cvs-serv26431/Resources/XML Modified Files: thuban-1.1.dtd Log Message: Add the opacity and masktype attributes. Index: thuban-1.1.dtd =================================================================== RCS file: /thubanrepository/thuban/Resources/XML/thuban-1.1.dtd,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- thuban-1.1.dtd 3 Oct 2004 20:38:54 -0000 1.2 +++ thuban-1.1.dtd 5 Jul 2005 20:23:59 -0000 1.3 @@ -1,7 +1,7 @@ From cvs at intevation.de Tue Jul 5 22:24:01 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:24:01 +0200 (CEST) Subject: bh: thuban ChangeLog,1.823,1.824 Message-ID: <20050705202401.3994E1005D7@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv26431 Modified Files: ChangeLog Log Message: Add the opacity and masktype attributes. Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.823 retrieving revision 1.824 diff -u -d -r1.823 -r1.824 --- ChangeLog 5 Jul 2005 19:38:39 -0000 1.823 +++ ChangeLog 5 Jul 2005 20:23:59 -0000 1.824 @@ -4,6 +4,11 @@ 2005-07-05 Bernhard Herzog + * Resources/XML/thuban-1.1.dtd (rasterlayer): Add the opacity and + masktype attributes. + +2005-07-05 Bernhard Herzog + * Thuban/Model/layer.py (Layer.__mangle_bounding_box) (Layer.ClipBoundingBox): Rename ClipBoundingBox to __mangle_bounding_box. See the comments in the code and RT #2845 From cvs at intevation.de Tue Jul 5 22:24:52 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:24:52 +0200 (CEST) Subject: bh: thuban setup.py,1.50,1.51 Message-ID: <20050705202452.6252D1005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv26487 Modified Files: setup.py Log Message: (setup call): Version 1.1.0 Index: setup.py =================================================================== RCS file: /thubanrepository/thuban/setup.py,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- setup.py 5 Apr 2005 17:26:58 -0000 1.50 +++ setup.py 5 Jul 2005 20:24:50 -0000 1.51 @@ -1134,7 +1134,7 @@ """ setup(name = "Thuban", - version = "1.0.0", + version = "1.1.0", description = "Geographic data viewer", long_description = long_description, license = "GPL", From cvs at intevation.de Tue Jul 5 22:26:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue, 5 Jul 2005 22:26:12 +0200 (CEST) Subject: bh: thuban ChangeLog,1.824,1.825 Message-ID: <20050705202612.7676E1005C8@lists.intevation.de> Author: bh Update of /thubanrepository/thuban In directory doto:/tmp/cvs-serv26510 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.824 retrieving revision 1.825 diff -u -d -r1.824 -r1.825 --- ChangeLog 5 Jul 2005 20:23:59 -0000 1.824 +++ ChangeLog 5 Jul 2005 20:26:10 -0000 1.825 @@ -1,5 +1,19 @@ 2005-07-05 Bernhard Herzog + * setup.py (setup call): Version 1.1.0 + + * NEWS: Update for 1.1.0 + + * MANIFEST.in: Add *.txt to files taken from Doc. Otherwise the + technores won't be included + + * Thuban/UI/about.py (About.__init__): Extend copyright notice to + 2005 + + * po/de.po: Updated. + +2005-07-05 Bernhard Herzog + * README: gdal 1.1.8 is too old. 1.2.5 works. 2005-07-05 Bernhard Herzog From bh at intevation.de Tue Jul 5 23:00:38 2005 From: bh at intevation.de (Bernhard Herzog) Date: Tue, 05 Jul 2005 23:00:38 +0200 Subject: Thuban 1.1.0 Message-ID: Hi all, we finally found some time to make a development release of Thuban. This is the first since 1.0, so it's version 1.1.0. So far only a tarball and a zip file is available from http://ftp.intevation.de/thuban/ This is a development release so while it has seen some more testing and preparation than a simple CVS snapshot, it does contain many new features in various stages of maturity. So take some care when using this release. Changes since 1.0.0: - Thuban rembers directories in file selection dialogs during a thuban session - Add some support for wxPython 2.5 and 2.6. Thuban is still compatible with wxPython 2.4. - Change the way thuban deals with non-ascii text. The internal representation is now the user's default encoding. Thuban works a bit better with a unicode build of wxPython but there are still problems. (Bernhard Herzog) - Various raster data improvements. Among other things, translucent images are now supported on a sufficiently recent wxWidgets (2.6). Also, only the part of the window actually covered by the image is drawn. (Jonathan Coles) - Improved PostGIS support (Bernhard Herzog): - support tables with multiple geometry columns. The user can select which one to use - support tables with srids - tables don't have to have a column named "gid" anymore. The user can select the column to use for ids - PostgreSQL views are supported too - support LINESTRING geometries - support more PostgreSQL versions. 7.4 works now. - Added support for sizable points (Jan-Oliver Wagner) - When loading a (moved) session where shapefiles cannot be found, ask the user (Frank Koormann) - The middle mouse button can be used for panning now (Russell Nelson) - Give a warning when the projection selected for a layer is probably wrong (Russell Nelson) - Updated shapelib - New or improved extensions: - A new extension which exports a map as SVG (Markus Rechtien, Bernhard Reiter) - Improved WMS extension (Martin Schulze) - New Extension to dump bounding boxes of all shapes of the selected layer (Frank Koormann) - New extension: umn_mapserver (Jan Sch?ngel) - New extension: OGR (Nina H?ffmeyer) - New Extension: mouseposition. Tool to collect mouse click positions (map coordinates) in a dialog. (Frank Koormann) - Documentation: - Add some documentation of the internals of Thuban. See Doc/technotes/ - The thuban manual has been partly translated to German (Jan-Oliver Wagner) - Updated translations: Russian (Alex Shevlakov) - New translations: Brazilian Portuguese (Eduardo Patto Kanegae)xb Hungarian (Norbert Solymosi) Bernhard -- Intevation GmbH http://intevation.de/ Skencil http://skencil.org/ Thuban http://thuban.intevation.org/ From jan at intevation.de Fri Jul 8 23:36:36 2005 From: jan at intevation.de (Jan-Oliver Wagner) Date: Fri, 8 Jul 2005 23:36:36 +0200 Subject: Thuban 1.1.0 In-Reply-To: References: Message-ID: <20050708213636.GA25092@intevation.de> Hi Bernhard, On Tue, Jul 05, 2005 at 11:00:38PM +0200, Bernhard Herzog wrote: > we finally found some time to make a development release of Thuban. > This is the first since 1.0, so it's version 1.1.0. So far only a > tarball and a zip file is available from > http://ftp.intevation.de/thuban/ I updated the web pages accordingly now. Next, I will update freshmeat as well. > Changes since 1.0.0: Shouldn't we restrict to the changes since 1.0.1? Also, 2 changes were missing: - Minimum version of GDAL now 1.2.5. - New: a registry for extensions. Should we fix this before sending the announcement to thuban-announce? Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ Kolab Konsortium http://kolab-konsortium.de/ FreeGIS http://freegis.org/ From bernhard at intevation.de Tue Jul 12 22:31:41 2005 From: bernhard at intevation.de (Bernhard Reiter) Date: Tue, 12 Jul 2005 22:31:41 +0200 Subject: Thuban 1.1.0 In-Reply-To: <20050708213636.GA25092@intevation.de> References: <20050708213636.GA25092@intevation.de> Message-ID: <20050712203141.GB18384@intevation.de> Am 8. Jul 2005 um 23:36:36 schrieb Jan-Oliver Wagner: > Hi Bernhard, > > On Tue, Jul 05, 2005 at 11:00:38PM +0200, Bernhard Herzog wrote: > > we finally found some time to make a development release of Thuban. > > This is the first since 1.0, so it's version 1.1.0. So far only a > > tarball and a zip file is available from > > http://ftp.intevation.de/thuban/ > > I updated the web pages accordingly now. I am missing a news though, the area looks a bit deserted. :) > Next, I will update freshmeat as well. Ah I saw it to day. http://freshmeat.net/projects/thuban/?branch_id=41483 I wonder if we should make a stable and development branch for freshmeat. > > Changes since 1.0.0: > > Shouldn't we restrict to the changes since 1.0.1? > > Also, 2 changes were missing: > > - Minimum version of GDAL now 1.2.5. > - New: a registry for extensions. > > Should we fix this before sending the announcement to thuban-announce? Yes. Also thuban-list needs an announcement as well. -------------- 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/20050712/abbf7be8/attachment.bin From thuban-bugs at intevation.de Mon Jul 18 18:16:19 2005 From: thuban-bugs at intevation.de (Request Tracker) Date: Mon, 18 Jul 2005 18:16:19 +0200 (CEST) Subject: [bug #3442] (thuban) Identify/Select to find more than one shape Message-ID: <20050718161619.A52661006C7@lists.intevation.de> this bug's URL: http://intevation.de/rt/webrt?serial_num=3442 ------------------------------------------------------------------------- Subject: Identify/Select to find more than one shape Currently Identify/Select Tools only select one (the top most?) shape of a layer. Would be helpful to have a multiselect tool to e.g. match all shapes at a given location. As an example this occurs when having numerous samples of photos taken from the same position ... -------------------------------------------- Managed by Request Tracker From jan at intevation.de Wed Jul 27 01:21:26 2005 From: jan at intevation.de (Jan-Oliver Wagner) Date: Wed, 27 Jul 2005 01:21:26 +0200 Subject: Remove symbol properties from layer element in .thuban files In-Reply-To: <20050629215345.GD31586@intevation.de> References: <20050627162659.GA22761@intevation.de> <20050629215345.GD31586@intevation.de> Message-ID: <20050726232126.GB25275@intevation.de> On Wed, Jun 29, 2005 at 11:53:45PM +0200, Jan-Oliver Wagner wrote: > On Mon, Jun 27, 2005 at 06:26:59PM +0200, Jan-Oliver Wagner wrote: > > I have come to the conclusion that it makes sense > > to remove symbol properties from layer element in .thuban files: > > (these are used for the default values) > > > > Actually, it seems to be better to have always a > > classification for a layer and then have > > a clnull element describing the defaults. > > Else the situation is a bit redundant. Also, the more > > complex the description of a symbol becomes the more > > the layer element is overloaded. The introduction of the > > size element showed this. > > > > Using always a classification would also fix the bug > > that labels for default (if there is only just a default > > and no classification) are not stored in the .thuban > > file. > > > > Opinions? > > Apparently not. So I will prepare a patch that removes > the default symbol attributes from layer element in .thuban > files ... the attached patch does most of the job. However, running test_save.py shows an error that has something to do with postgis stores not having a method ShapeType ... I'll try to solve this next. Best Jan -- Jan-Oliver Wagner http://intevation.de/~jan/ Intevation GmbH http://intevation.de/ Kolab Konsortium http://kolab-konsortium.de/ FreeGIS http://freegis.org/ -------------- next part -------------- Index: ChangeLog =================================================================== RCS file: /thubanrepository/thuban/ChangeLog,v retrieving revision 1.825 diff -r1.825 ChangeLog 0a1,23 > 2005-07-xx Jan-Oliver Wagner > > * Thuban/Model/classification.py (Classification.TreeItem.build_info): > Added output of size. > > * Thuban/Model/load.py (SessionLoader.start_classification): > Change attribute 'field' and 'field_type' from obligatory to > optional to allow empty classes (ie. only with a default=clnull). > > * Thuban/Model/save.py (SessionSaver.write_layer): Don't write > any attributes anymore for the layer element. > (SessionSaver.write_classification): Even if there is no > classification field, still write the classification because > the clnull (default) symbol will not be defined anymore as > part of the layer element. > > * test/test_load.py: ........ > > * test/test_save.py: ........ > > * Resources/XML/thuban-1.1.dtd: Make the attributes field > and field_type of classification optional. > Index: Resources/XML/thuban-1.1.dtd =================================================================== RCS file: /thubanrepository/thuban/Resources/XML/thuban-1.1.dtd,v retrieving revision 1.3 diff -r1.3 thuban-1.1.dtd 183,184c183,184 < < --- > > Index: Thuban/Model/classification.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/classification.py,v retrieving revision 1.39 diff -r1.39 classification.py 1c1 < # Copyright (c) 2001, 2003 by Intevation GmbH --- > # Copyright (c) 2001, 2003, 2005 by Intevation GmbH 3a4 > # Jan-Oliver Wagner (2005) 309a311,317 > > # Note: Size is owned by all properties, so > # a size will also appear where it does not > # make sense like for lines and polygons. > v = props.GetSize() > i.append(_("Size: %s") % v) > Index: Thuban/Model/load.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/load.py,v retrieving revision 1.56 diff -r1.56 load.py 527a528,529 > # field and field_type are optional because the classification > # can also be empty, ie. have only a default. 529,530c531,533 < [AttrDesc("field", True), < AttrDesc("field_type", True)]) --- > [AttrDesc("field", False), > AttrDesc("field_type", False)]) > 532a536,537 > > if field == "": return # no need to set classification column. Index: Thuban/Model/save.py =================================================================== RCS file: /thubanrepository/thuban/Thuban/Model/save.py,v retrieving revision 1.45 diff -r1.45 save.py 3c3 < # Jan-Oliver Wagner (2004) --- > # Jan-Oliver Wagner (2004-2005) 294,299d293 < < lc = layer.GetClassification() < attrs["stroke"] = lc.GetDefaultLineColor().hex() < attrs["stroke_width"] = str(lc.GetDefaultLineWidth()) < attrs["fill"] = lc.GetDefaultFill().hex() < 329,332c323,325 < # < # there isn't a classification of anything so do nothing < # < if field is None: return --- > if field is not None: > attrs["field"] = field > attrs["field_type"] = str(layer.GetFieldType(field)) 334,335d326 < attrs["field"] = field < attrs["field_type"] = str(layer.GetFieldType(field)) Index: test/test_load.py =================================================================== RCS file: /thubanrepository/thuban/test/test_load.py,v retrieving revision 1.47 diff -r1.47 test_load.py 204,206c204,210 < --- > > > > > > > 296,298c300 < --- > 371,372c373,379 < --- > > > > > > > 402c409 < --- > 458,459c465 < --- > 476,477c482 < --- > 549,550c554 < --- > 599,600c603 < --- > 615,616c618 < --- > 622a625,629 > > > > > 714,715c721,727 < --- > > > > > > > 764,765c776 < --- > 770a782,786 > > > > > 772,773c788 < --- > 778a794,798 > > > > > Index: test/test_save.py =================================================================== RCS file: /thubanrepository/thuban/test/test_save.py,v retrieving revision 1.37 diff -r1.37 test_save.py 159,160c159,166 < --- > > > > stroke_width="1"/> > > > 219,220c225 < --- > 226a232,237 > > > stroke_width="1"/> > > 354,355c365 < --- > 374,375c384 < --- > 489,490c498,505 < shapestore="D141915644" visible="true" < stroke="#000000" stroke_width="1" fill="None"/> --- > shapestore="D141915644" visible="true"> > > > stroke_width="1"/> > > > 552,553c567,574 < shapestore="roads" visible="true" < stroke="#000000" stroke_width="1" fill="None"/> --- > shapestore="roads" visible="true"> > > > stroke_width="1"/> > > > From cvs at intevation.de Wed Jul 27 23:44:18 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed, 27 Jul 2005 23:44:18 +0200 (CEST) Subject: jan: thuban/test test_load.py,1.47,1.48 Message-ID: <20050727214418.7C7E51005AF@lists.intevation.de> Author: jan Update of /thubanrepository/thuban/test In directory doto:/tmp/cvs-serv6516 Modified Files: test_load.py Log Message: (TestSingleLayer, TestNonAsciiColumnName, TestLayerVisibility, TestSymbolSize, TestClassification, TestLabels, TestLayerProjection, TestJoinedTable, TestLabelLayer): Removed attributes from layer element to classification clnull element. Index: test_load.py =================================================================== RCS file: /thubanrepository/thuban/test/test_load.py,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- test_load.py 1 Jul 2005 20:49:04 -0000 1.47 +++ test_load.py 27 Jul 2005 21:44:16 -0000 1.48 @@ -201,9 +201,13 @@ - + + + + + + + ''' @@ -293,9 +297,7 @@ - + @@ -368,8 +370,13 @@ - + + + + + + + ''' @@ -399,7 +406,7 @@ - + @@ -455,8 +462,7 @@ - + @@ -473,8 +479,7 @@ - + @@ -546,8 +551,7 @@ - + @@ -596,8 +600,7 @@ - + @@ -612,14 +615,18 @@ - + + + + + + @@ -711,8 +718,13 @@ - + + + + + + + ''' @@ -761,21 +773,29 @@ - + + + + + + - + + + + + +