From: Kevin A. <al...@se...> - 2004-05-20 18:33:16
|
Below is the updated childWindow function in model.py that should be able to find the resource file for a given background module based on the module name. The code is for release 0.7.3.1. The function starts on line 138 in model.py. You still need to include your .rsrc.py files in the data_files list your py2exe setup.py script. The code below assumes that the module is in the library.zip file, so it won't work for the McMillan installer or bundlebuilder or freeze, so for those tools you'll need to continue to provide the path or loaded Resource for a child window in a standalone. ka --- def childWindow(parent, frameClass, filename=None, rsrc=None): if filename is None: if rsrc is None: if util.main_is_frozen(): # KEA 2004-05-20 # running standalone # need to support py2exe differently than bundlebuilder and mcmillan probably # but this is the py2exe 0.5 way # figure out the .rsrc.py filename based on the module name stored in library.zip filename = os.path.split(sys.modules[frameClass.__module__].__file__)[1] filename = os.path.join(parent.stack.app.applicationDirectory, filename) else: # figure out the .rsrc.py filename based on the module name filename = sys.modules[frameClass.__module__].__file__ # chop the .pyc or .pyo from the end base, ext = os.path.splitext(filename) filename = internationalResourceName(base) rsrc = res.ResourceFile(filename).getResource() elif isinstance(rsrc, dict): rsrc = res.Resource(rsrc) else: rsrc = res.ResourceFile(filename).getResource() return frameClass(parent, rsrc.stack.backgrounds[0]) ka |