Subject: [Thuban-list] Some errors on version 1.0.1

From: Lorenzo Moretti <[email-masked]>
Date: Sun, 16 Jan 2005 00:11:02 +0100

I have built a Thuban 1.0.1 for OS X. This 
version is a double clic app very fast and it's 
possible to open Thuban from a double clic on a 
xxxx.thuban session file.

But I have some errors. This is a list. After I 
will submit the bugs in the bugtracker

THUBAN 1.0.1 BUGS ON MAC OS X

-- 1 -- Critical
Generating class - Quantiles for table (not work)
I select classes number from range, press Generate and I have this error:
Si è verificata una eccezione non prevista:

(per piacere segnala l'errore a http://thuban.intevation.org/bugtracker.html)

Traceback (most recent call last):
   File "/Applications/Grass/Thuban 
1.0.1.app/Contents/Resources/Python/site-packages/Thuban/UI/classgen.py", 
line 263, in OnOK
   File "/Applications/Grass/Thuban 
1.0.1.app/Contents/Resources/Python/site-packages/Thuban/UI/classgen.py", 
line 866, in GetRange
AssertionError

-- 2 -- Serious
Toolbar is not drawing on OS X. (file mainwindow.py)
In OS X the Menu is Up and it's not in the application window like Win or Unix.
The same commands are in the Map menu.

-- 3 -- Serious
I only import geotiff files with GDAL installed: 
other gdal formats are not displayed.
Is it a bug or is this a feature?

-- 4 -- Serious
Sometime Legend window is locked with display 
window and it's always not resizeble.
This is the error when I resize the legend window over the display window:
Si è verificata una eccezione non prevista:

(per piacere segnala l'errore a http://thuban.intevation.org/bugtracker.html)

Traceback (most recent call last):
   File "/Applications/Grass/Thuban 
1.0.1.app/Contents/Resources/Python/site-packages/Thuban/UI/dock.py", 
line 490, in _OnSashDragged
AssertionError

-- 5 -- Small
Generating class - Uniform distribuition
When you choose Groups number (1,2,3,4 or more) 
and you generate classes, the area with the exact 
last value is not colored but it's white (or your 
default color). I have to grow the last value and 
the area is colored.

-- 6 -- Small
Help menu is disabled (file mainwindow.py)

---

From: Jan-Oliver Wagner <[email-masked]>
Date: Tue, 18 Jan 2005 17:25:07 +0100

On Sun, Jan 16, 2005 at 12:11:02AM +0100, Lorenzo Moretti wrote:
> (per piacere segnala l'errore a 
> http://thuban.intevation.org/bugtracker.html)
> 

Can you run "python runtests.py" in the test directory and see
whether everthing works. Send error message is such occur.
Note that you can add option -v for more verbose output and
als run the failing tests directly to get more information.

> The same commands are in the Map menu.

strange. I would be glad if Mac OS X people could try to track this.
I have no access to this operating system.

> Is it a bug or is this a feature?

Thats a feature ;-)

Currently Nina works on a more general integration
of GDAL, but focusses the vector formats.
In fact, it shoulnd be too difficult to support
more then geotiff - takers?

> (per piacere segnala l'errore a 
> http://thuban.intevation.org/bugtracker.html)
> 

Hm, does not happen on GNU/Linux or Windows, see -- 2 --.

> default color). I have to grow the last value and 

Can you send a .thuban file based on iceland that demonstrates
the problem?

> Help menu is disabled (file mainwindow.py)

Strange. See -- 4 --.

Best

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

Intevation GmbH                      http://intevation.de/
FreeGIS                                http://freegis.org/

---

From: Lorenzo Moretti <[email-masked]>
Date: Wed, 19 Jan 2005 15:51:14 +0100

Hi Jan

>als run the failing tests directly to get more information.

I run every test with -v and you find the results in

http://wwwamb.bologna.enea.it/forthuban/files/errors_thuban101-1_osx_runtest.txt

My bugs are only in Quantiles, Toolbar, Legend 
Locked and not resizeble. Thuban in OS X run fast 
and I open every thuban file with a double clic 
(like .doc for Office).

>I have no access to this operating system.

New user have downloaded Thuban today ...

>more then geotiff - takers?

OK.
One question: I have seen that it's not possible 
to create a gtiff mosaic (many tiff linked) 
because every tiff delete the tiff below.
Is the transparence a future feature ?

"/Thuban 1.0.1.app/Contents/Resources/Python/site-packages/thuban.pyc"

Another thing: in OS X I have created a double 
clic app but now it opens 1 session only.
Is it possible in the future opens more sessions with only 1 app open?

Now if I want open more session I must open more Thuban from inside app:
/Thuban 1.0.1.app/Contents/Resources/Python/site-packages/thuban.pyc.
This file is open from a Python session via terminal like GTK.

>Can you send a .thuban file based on iceland that demonstrates

I will send a .thuban file

>>  Help menu is disabled (file mainwindow.py)

Bye and thanx

-- 
________________________________________________________________________
||      Lorenzo Moretti        e-mail: [email-masked]     
||/|/|  ENEA prot/idr          Web: http://wwwamb.bologna.enea.it/    
||   |  via Don Fiammelli, 2   FTP: ftp://ftpamb.bologna.enea.it/ (ris.)
~~~~~~  40128 BOLOGNA - ITALY  Ph: +39-0516098086  Fax: +39-0516098131
________________________________________________________________________

---

From: "Daniel Calvelo Aros" <[email-masked]>
Date: Wed, 19 Jan 2005 15:05:14 -0500

Hi

The problem with quantiles under OSX comes from these handlers:

[UI/classgen.py, lines 857-858]
...
        EVT_TEXT(self, ID_QUANTILES_RANGE, self.OnRangeText)
        EVT_BUTTON(self, ID_QUANTILES_RETRIEVE, self.OnRetrieve)
...

OnRetrieve is triggered by the "Retrieve" button. It retrieves the range and
does write it in the text field, but that does not trigger EVT_TEXT. I'd say
it does in the other platforms since all this works.

User workaround: If you *edit* the retrieved range (e.g. by deleting and
retyping one digit), OnRangeText is called and everything's fine.

Code workaround: I'd suggest force-calling OnRangeText within OnRetrieve,
(insert 'self.OnRangeText(0)' in line 906 before the 'finally'; what do you
think? I tried and it works, but is ugly. The real problem is inconsistency
between wx platforms; should this be submitted to the wx people?

Daniel.

---

From: Lorenzo Moretti <[email-masked]>
Date: Thu, 20 Jan 2005 10:55:43 +0100

Daniel Calvelo Aros wrote

>between wx platforms; should this be submitted to the wx people?

Hi Daniel

Your tip works... GOOD

The bug is resolved

UI/classgen.py 904-907

             try:
                 min, max = table.ValueRange(self.fieldName)
                 self.text_range.SetValue("[" + str(min) + ";" + str(max) + "]")
+                self.OnRangeText(0)
             finally:

Why you say "is ugly"?

Is this workaround good for CVS only for OS X with IF platform?

Thanx

---

From: Bernhard Reiter <[email-masked]>
Date: Thu, 20 Jan 2005 12:21:48 +0100

> between wx platforms; should this be submitted to the wx people?

It should be submitted to the wx people.
Can you reproduce it with any wx demo?

I guess that we need to make Thuban fully work with wx 2.5.x
to have better change to get those bugs fixed by them.

---

From: Bernhard Herzog <[email-masked]>
Date: Thu, 20 Jan 2005 12:30:00 +0100

> it does in the other platforms since all this works.

Thuban calls the SetValue method of the wxTextCtrl object.  According to
the docs (wx 2.4):

   Note that this function will generate a wxEVT_COMMAND_TEXT_UPDATED
   event.

wxEVT_COMMAND_TEXT_UPDATED is the event that is handled with EVT_TEXT.
So if that event is not sent on OSX, it's a bug in wxWidgets.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/

---

From: Bernhard Reiter <[email-masked]>
Date: Thu, 20 Jan 2005 12:32:59 +0100

>                 self.text_range.SetValue("[" + str(min) + ";" + str(max) + 

I cannot immedeatly see how this could hurt otherwise, 
so I commited this to CVS HEAD for now.

> Is this workaround good for CVS only for OS X with IF platform?

Conditionals for certain platform should be avoided if possible,
as they make the code really hard to maintain.

---

From: "Daniel Calvelo Aros" <[email-masked]>
Date: Thu, 20 Jan 2005 13:07:05 -0500

From: Bernhard Reiter <[email-masked]>
> so I commited this to CVS HEAD for now.

I said ugly because OnRangeText is supposed to be an event handler, not a
regular function... Oh, never mind, it's just nitpicky. 

It works well for the other platforms too, BTW.

I've also been looking at the other OSX problems. Most are wx's fault. For
example, the sash assertion exception is triggered by the fact that the sash's
GetChildren() returns a triplet [scrollbar,scrollbar,panel] in OSX instead of
[panel,panel]. I suspect this is linked to the toolbar not displaying, the
legend scrollbar not always working, and docking/undocking not resizing
properly the sash. Events not triggered and panel wierdnesses...

I'm afraid we should aim for wx2.5 in order to have OSX as a supported
platform. Will look into it a little: try to spot these problems in the wx
demo and look into wx bug reports, I hope they are fixed in 2.5.

Lorenzo, could you describe your development environment (python modules, wx
installation,...) in order to duplicate it here? I only have your dmg
installed. And a great piece of work it is.

Daniel.

---

From: Bernhard Reiter <[email-masked]>
Date: Thu, 20 Jan 2005 19:18:49 +0100

On Thu, Jan 20, 2005 at 01:07:05PM -0500, Daniel Calvelo Aros wrote:
> I've also been looking at the other OSX problems. Most are wx's fault. 

Ah, thanks for doing so, as Jan already wrote, 
we rarely have access to that platform to test.

> demo and look into wx bug reports, I hope they are fixed in 2.5.

I agree that we should make Thuban work well with wx2.5,
help and contributions welcome on thuban-devel.
(That is where we should go for the glory technical details I guess.)

	Bernhard R.

---

From: Lorenzo Moretti <[email-masked]>
Date: Fri, 21 Jan 2005 12:50:58 +0100

Daniel wrote

Hi Daniel

Ok I understand

>properly the sash. Events not triggered and panel wierdnesses...

Yes I think so. Legend, dock, icon problems are linked to the toolbar.
I've seen Thuban on Win and Linux. The toolbar is integrated with 
menu in this way. Only 1 window (WINDOW A) with this sequence:
- Menu	(row 1 of WINDOW A)
- Toolbar (row 2 - icons on WINDOW A)
- Legend + Display (row 3 new window, WINDOW B + WINDOW C nested in WINDOW A)

I have built Thuban also in FINK with X11 (OS X is Unix) and it works 
with all icons like Win and Linux: there is 1 window only.

But in OS X native (not X11) the gui is different. I have not 1 
window only but the menu go up and it is broken from the rest and 
toolbar goes out. I have:
- Menu (always up, not in a window)
- Toolbar (missing because it doesn't find WINDOW A for icons)
- Legend + Display (row 3 new in a window, WINDOW B + WINDOW C)

The resizing problem is linked to this one: WINDOW A is not present.

The map work because they are on WINDOW C

In OSX the Toolbar must to go on a new window (row 1) and below 
Legend window + Dispay window (row 2)

>demo and look into wx bug reports, I hope they are fixed in 2.5.

Now wxpython on Mac is 2.5.3.1
wxWindows is 2.5.3

but I have used:
wxpython on Mac 2.4.2.0
wxWindows 2.4.2

In Thuban OS X the only problems are in quantiles and toolbar

Your workaround for quantiles is good and it works.

About toolbar

I have seen the demo files in 2.4.2 and they work in OS X.
Example: pysketch is interesting
Inside the samples/pySketch folder I have entered in terminal:
% pythonw pySketch.pyw
and the program is started without problems:
the menu is up and I have a window with:
- row 1: 7 icons (toolbar)
- row 2: icons at left and display at right

Thuban is would be like this one (in OS X version)

Inside the pysketch code:

Menu up
>         # Setup our menu bar.
>
>         menuBar = wxMenuBar()
>
>         self.fileMenu = wxMenu()
>         self.fileMenu.Append(wxID_NEW,    "New\tCTRL-N")
>         self.fileMenu.Append(wxID_OPEN,   "Open...\tCTRL-O")
>         self.fileMenu.Append(wxID_CLOSE,  "Close\tCTRL-W")
>         self.fileMenu.AppendSeparator()
>         .....

row 1
>         # Create our toolbar.
>
>         self.toolbar = self.CreateToolBar(wxTB_HORIZONTAL |
>                                           wxNO_BORDER | wxTB_FLAT)
>
>         self.toolbar.AddSimpleTool(wxID_NEW,
>                                    wxBitmap("images/new.bmp",
>                                             wxBITMAP_TYPE_BMP),
>                                    "New")
>         self.toolbar.AddSimpleTool(wxID_OPEN,
>                                    wxBitmap("images/open.bmp",
>                                             wxBITMAP_TYPE_BMP),
>         .....

row 2 (left side)
>         # Setup our tool palette, with all our drawing tools and option icons.
>
>         self.toolPalette = wxBoxSizer(wxVERTICAL)
>
>         self.selectIcon  = ToolPaletteIcon(self.topPanel, id_SELECT,
>                                            "select", "Selection Tool")
>         self.lineIcon    = ToolPaletteIcon(self.topPanel, id_LINE,
>                                            "line", "Line Tool")
>         self.rectIcon    = ToolPaletteIcon(self.topPanel, id_RECT,
>                                            "rect", "Rectangle Tool")
>         .....

Now Thuban code in Thuban/UI/mainwindow.py

># Map menu
>_method_command("map_projection", _("Pro&jection..."), "MapProjection",
>                 helptext = _("Set or change the map projection"))
>
>_tool_command("map_zoom_in_tool", _("&Zoom in"), "ZoomInTool", "ZoomInTool",
>               helptext = _("Switch to map-mode 'zoom-in'"), icon = "zoom_in",
>               sensitive = _has_visible_map)
>_tool_command("map_zoom_out_tool", _("Zoom &out"), "ZoomOutTool", 
>"ZoomOutTool",
>               helptext = _("Switch to map-mode 'zoom-out'"), icon = 
>"zoom_out",
>               sensitive = _has_visible_map)
>
>.......

The icons are with menu because they go on WINDOW A but this is wrong 
for OS X. WINDOW A is not present.

The source code like pysketch is good for the total compatibility 
between platforms.

>installed. And a great piece of work it is.

This is the method.

I have installed in OS X 10.3 (Python 2.3 is included):

- XCode 1.5 (Developer software free from Apple http://connect.apple.com)
- addon for Python 2.3 for Panther 
(http://homepages.cwi.nl/~jack/macpython/download.html)
- wxWindows 2.4.2 for the Mac (http://www.wxwindows.org/)
	(it's old but now it's better for Thuban)
- wxPython on Mac 2.4.2.0 for Python 2.3 (http://www.wxpython.org/)
	(it's old but now it's better for Thuban)
- SQLite 2.8.15
- PySQLite 0.5.1
- Proj 4.4.9 (installed in /usr/local/thubanlib)
- GDAL 1.2.5 (built without python and installed in 
/usr/local/thubanlib and after the I have built python module)
- PostgreSQL + PostGIS (7.4.3 + 0.8.1)
- mxDateTime 2.0.5 (http://www.egenix.com/files/python/mxDateTime.html)
- Pyscopg 1.1.14 (http://www.python.org/topics/database/modules.html)
this is a bit complex because it requires a folder 
/postgresql-7.4.1/src/include/catalog/ not present in binary 
PostgreSQL. You must build PostgreSQL + PostGIS and after you must 
copy this folder on your bin build:
% cp -r /src/postgresql-7.4.1/src/include/catalog/ /usr/local/pgsql/include/
After you can build Pyscopg 1.1.14 with:
./configure \
--with-postgres-libraries=/usr/local/pgsql/lib \
--with-postgres-includes=/usr/local/pgsql/include \
--with-mxdatetime-includes=/Library/Python/2.3/mx/DateTime/mxDateTime

- Thuban
in setup.py you must change the path for proj, gdal_config and wx.

Now Thuban is built like a normal UNIX app in /usr/local/lib/thuban 
and I can open it from terminal .... but I want an OS X program with 
a simple double clic and with all libs linked internally.

There are many and many libraries linked to Thuban.
I have an help as you seen on my ReadMe file:

- py2app (http://undefined.org/python/#py2app)

It's like py2exe in Win and it's fantastic.

Drag and drop and I have created in 5 sec an app with some libs linked.

It doesn't run ....

Now inside the package I have seen the code and I have entered in 
some folders all wx and wxpython needs for Thuban. I check the code 
and I have seen that the only external libs need for Thuban are:
- libwx_mac-2.4.*.dylib and libwx_mac_gl-2.4.*.dylib (4 files + 4 sym 
links) installed in /usr/local/lib;
- proj and gdal installed in /usr/local/thunalib (new folder creates from me)

This libs don't overwrite libs installed in OS X. If you have newer 
versions of wxPython or wxWindows you can use them because they have 
another name.

Inside the package there are all python extensions and other libs 
need for Python.

I wanted to build a simple app without installer but I must install 
these few libs and I have create a double clic pkg file for all users 
without external download. (DMG file is 17 MB compressed but the app 
is about 50 MB and the libs in /usr/local about 11 MB)

Advantage
- mac package is different from other platforms because it doesn't 
require external download. Normal user wants a simple app with a 
double clic on file and thuban do it. I do a double clic on .thuban 
file and it is opened in Thuban;
- you can change the Thuban code inside the package (eg: your 
workaround on Quantiles is easy to apply in Thuban: see 
http://wwwamb.bologna.enea.it/forthuban)
- it always work with any other libs installes from other software 
because it uses only few external libs in a new directory thubanlib.

What I want to see on Thuban:
- better raster support (eg geotiff loaded as mosaic: now every 
raster delete the raster below);
- gdal-ogr support;
- grass support (raster-vect);
- text label more easy (now I must enter the label one by one);
- printing better (SVG now is good but not for all users);
- importAPR (it's a fantastic idea - this a big step for many users)

-------------------------------------------
NOTE FOR JAN
Notes are wrong on 
http://thuban.intevation.org/download.html#bin_macosx. The notes are 
old.

New notes:

Please first read the file ReadMe inside the package
Notes:
Mac OS X 10.3 or higher is required (Python 2.3 is included in OS X 10.3)
Thuban is built in OS X and it's fast. It's a normal Mac app and it 
opens .thuban file with a simple double click and inside the ReadMe 
file you can see how to load the extensions.
Known Bugs:
Toolbar is not present but you can select the same commands from Map menu.
Quantiles class not work.
Sometime Legend window is locked: exit and reopen Thuban and after 
press the button "UnDock" in the Legend window.

Bye and good work

-- 
________________________________________________________________________
||      Lorenzo Moretti        e-mail: [email-masked]     
||/|/|  ENEA prot/idr          Web: http://wwwamb.bologna.enea.it/    
||   |  via Don Fiammelli, 2   FTP: ftp://ftpamb.bologna.enea.it/ (res.)
~~~~~~  40128 BOLOGNA - ITALY  Ph: +39-0516098086  Fax: +39-0516098131
			Download GRASS for MAC OS X:    
	           http://wwwamb.bologna.enea.it/forgrass/
________________________________________________________________________

---

From: Jan-Oliver Wagner <[email-masked]>
Date: Fri, 21 Jan 2005 15:55:26 +0100

On Fri, Jan 21, 2005 at 12:50:58PM +0100, Lorenzo Moretti wrote:
> - better raster support (eg geotiff loaded as mosaic: now every raster delete
> the raster below);

yes, that would be really helpful.
So far, the implementation is not scheduled yet.

> - gdal-ogr support;

Being worked on by Nina. OGR is going to be an
extension, a first working version for shapefiles
is already in CVS HEAD.

> - grass support (raster-vect);

Yes, something that is on the wishlist for quite some time.
But here also so far not scheduled yet.

> - text label more easy (now I must enter the label one by one);

What do you have in mind here?

> - printing better (SVG now is good but not for all users);

What do you have in mind?

> - importAPR (it's a fantastic idea - this a big step for many users)

a fulll implementation will never be possible since Thuban
will always differ in some ways from ArcView. But I try to
improve it step by step (note that I do this without
haveing ArcView available ;-).

Best

	Jan

---

From: Bernhard Reiter <[email-masked]>
Date: Fri, 21 Jan 2005 17:54:39 +0100

> So far, the implementation is not scheduled yet.

If I am not completely wrong Jonathan today checked in new raster
code that does not delete everything, so basic mosaicing can work.
However the edges are not sharp yet.

;)

---

From: Jonathan Coles <[email-masked]>
Date: Fri, 21 Jan 2005 12:32:03 -0500

> However the edges are not sharp yet.

i wasn't going to comment on this until i have a working implementation
of the raster layer dialog, but i will since you bring it up again.

if by mosaic you mean loading several raster layers where the images are
not (or partially) overlapping then yes, this should work in theory, but
i don't have proper data to test it. if you have data that you're
willing to share, please send it to me directly, or post a link to it.

why do you say that the edges are not sharp? i believe that the code i
checked in had masking enabled by default, so only the "good" data
should get drawn, which means that the projected edges of the image
should be perfect. if i'm mistaken please correct me, and also, if you
have it, send me test files.

--jonathan

-- 
=====================================================================
 Jonathan Coles                               http://www.jpcoles.com
 [email-masked]                    GnuPG Key: /gpg_pub_key.asc
=====================================================================

---

From: Bernhard Reiter <[email-masked]>
Date: Sat, 22 Jan 2005 16:15:35 +0100

On Fri, Jan 21, 2005 at 12:32:03PM -0500, Jonathan Coles wrote:
> not (or partially) overlapping then yes, this should work in theory
> 

Cool!

> have it, send me test files.

I was just guessing rom the discussions I have had with Bernhard H.
and what I have geathered from the list and the code.
Also have not done a test.

---

From: Bernhard Reiter <[email-masked]>
Date: Sat, 22 Jan 2005 19:18:46 +0100

> > have it, send me test files.

You could use gdal_translate to cut the island.tif in pieces. ;)
Works with other images, too.