ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 73c200a was
631be82,
checked in by Gervaise Alina <gervyh@…>, 14 years ago
|
update path to find icons for guiframe
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | |
---|
2 | |
---|
3 | import os |
---|
4 | from distutils.filelist import findall |
---|
5 | |
---|
6 | def get_data_path(media): |
---|
7 | """ |
---|
8 | """ |
---|
9 | # Check for data path in the package |
---|
10 | path = os.path.join(os.path.dirname(__file__), media) |
---|
11 | if os.path.isdir(path): |
---|
12 | return path |
---|
13 | |
---|
14 | # Check for data path next to exe/zip file. |
---|
15 | # If we are inside a py2exe zip file, we need to go up |
---|
16 | # to get to the directory containing |
---|
17 | # the media for this module |
---|
18 | path = os.path.dirname(__file__) |
---|
19 | #Look for maximum n_dir up of the current dir to find media |
---|
20 | n_dir = 12 |
---|
21 | for i in range(n_dir): |
---|
22 | path, _ = os.path.split(path) |
---|
23 | media_path = os.path.join(path, media) |
---|
24 | if os.path.isdir(media_path): |
---|
25 | module_media_path = os.path.join(media_path, 'icons') |
---|
26 | if os.path.isdir(module_media_path): |
---|
27 | return module_media_path |
---|
28 | return media_path |
---|
29 | |
---|
30 | raise RuntimeError('Could not find guiframe images files') |
---|
31 | |
---|
32 | def data_files(): |
---|
33 | """ |
---|
34 | Return the data files associated with guiframe images . |
---|
35 | |
---|
36 | The format is a list of (directory, [files...]) pairs which can be |
---|
37 | used directly in setup(...,data_files=...) for setup.py. |
---|
38 | |
---|
39 | """ |
---|
40 | data_files = [] |
---|
41 | path = get_data_path(media="images") |
---|
42 | for f in findall(path): |
---|
43 | data_files.append(('images/icons', [f])) |
---|
44 | return data_files |
---|
Note: See
TracBrowser
for help on using the repository browser.