Roger Lovelock wrote:
> Have been trying to get a py2exe script together for a ClassDesigner 
> generated app (the one generated by the AppWizard version of my program is 
> working fine).
> I have modified the AppWizard generated script  (see below), but while it 
> generates my screen OK no data is loaded and the buttons (in particular the 
> close button) do not work. I suspect that this is because the 
> membershipTypes-code.py (ie screen related code)  routine in ui is not being 
> picked up by py2exe (as this routine contains the navigation and bizObj code).
>     Maybe there is something simple missing from my setup script. Can anyone 
> help?

First, figure out if the file is included or not. The .exe is a zip file that 
you can 
expand into its constituent files. The dist directory contains all your "data 
files". 
If you don't find that code.py file anywhere, then you need to help py2exe to 
include it.

First, and this is probably "wrong" (because code files aren't data, and should 
be 
compiled first instead of placed in the app bundle in plain text) but easiest 
to get 
working: add it to the data_files directive, following the other examples.

If that works, then next try the "includes" directive.

Use the file globbing like is shown in the AppWizard example.

Paul


> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
> 
> import os
> import sys
> import glob
> from distutils.core import setup
> import py2exe
> import dabo
> import dabo.icons
> 
> dabo.ui.loadUI("wx")
> 
> 
> daboDir = os.path.split(dabo.__file__)[0]
> 
> 
> # Find the location of the dabo icons:
> iconDir = os.path.split(dabo.icons.__file__)[0]
> iconSubDirs = []
> def getIconSubDir(arg, dirname, fnames):
>  if ".svn" not in dirname and dirname[-1] != "\\":
>   icons = glob.glob(os.path.join(dirname, "*.png"))
>   if icons:
>    subdir = (os.path.join("resources", dirname[len(arg)+1:]), icons)
>    iconSubDirs.append(subdir)
> os.path.walk(iconDir, getIconSubDir, iconDir)
> 
> # locales:
> localeDir = "%s%slocale" % (daboDir, os.sep)
> #locales = [("dabo.locale", (os.path.join(daboDir, "locale", "dabo.pot"),))]
> locales = []
> def getLocales(arg, dirname, fnames):
>   if ".svn" not in dirname and dirname[-1] != "\\":
>     #po_files = tuple(glob.glob(os.path.join(dirname, "*.po")))
>     mo_files = tuple(glob.glob(os.path.join(dirname, "*.mo")))
>     if mo_files:
>       subdir = os.path.join("dabo.locale", dirname[len(arg)+1:])
>       locales.append((subdir, mo_files))
> os.path.walk(localeDir, getLocales, localeDir)
> 
> 
> 
> # Set your app icon here:
> _appIcon = None
> #_appIcon = "./resources/stock_addressbook.ico"
> 
> _script = "membershipTypes.py"
> 
> 
> class Target:
>  def __init__(self, **kw):
>   self.__dict__.update(kw)
>   self.script=_script
>   self.other_resources=[]
>   if _appIcon is not None:
>    self.icon_resources=[(1, _appIcon)]
> 
> 
> data_files=[(".", ("LodgeBooks.db3",)),
>   (".", ("membershipTypes.exe.manifest",)),
>   ("db", ["db/LodgeBooks.cnxml"]),
>   ("ui", ["ui/membershipTypes.cdxml"]),
>   ("resources", glob.glob(os.path.join(iconDir, "*.ico"))),
>   ("resources", glob.glob("resources/*")),
>   ("reports", glob.glob("reports/*"))]
> data_files.extend(iconSubDirs)
> data_files.extend(locales)
> 
> import py2exe
> setup(name=_script,
>   options={"py2exe": {"packages": ["wx.gizmos", "wx.lib.calendar"],
>     "optimize": 2,
>     "excludes": ["Tkconstants","Tkinter","tcl", 
>     "_imagingtk", "PIL._imagingtk",
>     "ImageTk", "PIL.ImageTk", "FixTk"]}},
>   packages=["ui", "biz", "db"],
>   zipfile=None,
>   windows=[Target()],
>   data_files=data_files
>  )
> 
> 
> 
> 
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
>   text/plain (text body -- kept)
>   text/html
> ---
> 
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to