OSX quantiles [Re: [Thuban-list] Some errors on version 1.0.1]

Lorenzo Moretti lorenzo.moretti at bologna.enea.it
Fri Jan 21 12:50:58 CET 2005

Daniel wrote

>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.

Hi Daniel

Ok I understand

>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...

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)

>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.

Now wxpython on Mac is
wxWindows is 2.5.3

but I have used:
wxpython on Mac
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", 
>               helptext = _("Switch to map-mode 'zoom-out'"), icon = 
>               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.

>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.

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 
- wxWindows 2.4.2 for the Mac (http://www.wxwindows.org/)
	(it's old but now it's better for Thuban)
- wxPython on Mac 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 \

- 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)

- 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 
- 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)

Notes are wrong on 
http://thuban.intevation.org/download.html#bin_macosx. The notes are 

New notes:

Please first read the file ReadMe inside the package
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: lorenzo.moretti at bologna.enea.it     
||/|/|  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:    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.intevation.de/pipermail/thuban-list/attachments/20050121/cde0d9d5/attachment.html

More information about the Thuban-list mailing list

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