Re: [Matplotlib-users] MPL, py2exe and fonts

2008-05-07 Thread Michael Droettboom
Chris Barker wrote:
 Hi all,

 I'm successfully getting all the MPL data files into spy2exe with:

 DATA_FILES = matplotlib.get_py2exe_datafiles()

 The problem is that that dumps a LOT of stuff, and I don't need most of 
 it. I've already added to my script a few lines that delete the images 
 dir, but I'd like to trim down the fonts to just those I need.

 I'm using the wxAgg back-end, with all default fonts -- does anyone know 
 which those are?
   
The default text font is Vera.ttf.  (If you want to support bold and 
italic etc, you'll also need VeraBd.tff, VeraBI.ttf and VeraIt.ttf).

If you need to support mathtext, the default font is the Computer Modern 
family, and you'll want all of the cm*.ttf fonts.

Alternatively, you can change the default fonts in the matplotlibrc to 
ones that are included with Windows (e.g. Arial) -- but that won't 
address the mathtext issue.
 MPL version: 0.91.2 on Windows (duh!)

 by the way, is there any way to dump that data into the exe itself, 
 rather than requiring it to be carried alongside?

 This makes me really appreciate application bundles on the Mac!
   
There are ways, but they're pretty involved -- plus they would require fixing 
the parts of matplotlib that read in data files: they all implicitly assume 
that they are real files on a real file system.  See:

http://www.py2exe.org/index.cgi/SingleFileExecutable

I once worked on a commercial project that had a fairly complex network 
installer written in Python and distributed in a similar way.  Not for the 
faint of heart.

Cheers,
Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] MPL, py2exe and fonts

2008-05-07 Thread Chris Barker
Michael Droettboom wrote:
 Chris Barker wrote:
 I'm successfully getting all the MPL data files into spy2exe with:

 DATA_FILES = matplotlib.get_py2exe_datafiles()

 The problem is that that dumps a LOT of stuff, and I don't need most 
 of it.

 The default text font is Vera.ttf.  (If you want to support bold and 
 italic etc, you'll also need VeraBd.tff, VeraBI.ttf and VeraIt.ttf).

I removed all other fonts, and it works fine, thanks!

 Alternatively, you can change the default fonts in the matplotlibrc to 
 ones that are included with Windows (e.g. Arial) -- 

I took a look in matplotlibrc, and saw what looks like a html-ish 
cascade of fonts to look for, and Arial was in there. So I tried 
removing all the fonts, and behold, the system fonts were used. So now 
all I have in the mpl-data dir is matplotlibrc.

Then I thought, I haven't changed any defaults in matplotlibrc, either, 
so I pulled that out. Now it runs fine, but when I close, I get an error 
box:

see the logfile: 

and indeed there is a

pH.exe.log file, and in there is:

C:\Documents and Settings\chris.barker\My 
Documents\HAZMAT\SmallTools\phCalculator\trunk\dist\pH.exe\matplotlib\__init__.py:520:
 
UserWarning: Could not find matplotlibrc; using defaults
C:\Documents and Settings\chris.barker\My 
Documents\HAZMAT\SmallTools\phCalculator\trunk\dist\pH.exe\matplotlib\__init__.py:566:
 
UserWarning: could not find rc file; returning defaults


Is there a way to supress those warnings and not write the logfile? I've 
never really liked matplotlibrc -- it's kind of nice not to have it at 
all, and it doesn't seem to be required. Maybe this is a wx issue -- how 
to bury that warning.

So then I tried removing mpl-data, but the app wouldn't run, I got an 
error, and the logfile says:

Traceback (most recent call last):
   File pH.py, line 8, in module
   File zipextimporter.pyo, line 82, in load_module
   File Lib\Gui.pyo, line 15, in module
   File wxaddons\__init__.pyo, line 180, in import_hook
   File zipextimporter.pyo, line 82, in load_module
   File matplotlib\__init__.pyo, line 639, in module
   File matplotlib\__init__.pyo, line 562, in rc_params
   File matplotlib\__init__.pyo, line 517, in matplotlib_fname
   File matplotlib\__init__.pyo, line 207, in wrapper
   File matplotlib\__init__.pyo, line 447, in _get_data_path_cached
   File matplotlib\__init__.pyo, line 443, in _get_data_path
RuntimeError: Could not find the matplotlib data files

since I'm not, in fact needing any of the files in mpl-data, it might be 
nice if this error could be moved to when it's actually needed. I do 
notice that there is already a if getattr(sys,'frozen',None) stanza, 
so maybe we could tweak something there.

This may all be a pain, and I suppose this approach would only work with 
the simplest of MPL apps (like mine), but it would be nice to clean up 
MPL so that it plays better with py2exe and the like.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] MPL, py2exe and fonts

2008-05-06 Thread Chris Barker
Hi all,

I'm successfully getting all the MPL data files into spy2exe with:

DATA_FILES = matplotlib.get_py2exe_datafiles()

The problem is that that dumps a LOT of stuff, and I don't need most of 
it. I've already added to my script a few lines that delete the images 
dir, but I'd like to trim down the fonts to just those I need.

I'm using the wxAgg back-end, with all default fonts -- does anyone know 
which those are?

MPL version: 0.91.2 on Windows (duh!)

by the way, is there any way to dump that data into the exe itself, 
rather than requiring it to be carried alongside?

This makes me really appreciate application bundles on the Mac!

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users