source:
sasview/src/sas/sasgui/perspectives/calculator/__init__.py
@
cd10013
Last change on this file since cd10013 was 5a405bd, checked in by Paul Kienzle <pkienzle@…>, 7 years ago | |
---|---|
|
|
File size: 1.4 KB |
Line | |
---|---|
1 | PLUGIN_ID = "Calculator plug-in 1.0" |
2 | import os |
3 | from distutils.filelist import findall |
4 | from calculator import * |
5 | N_DIR = 12 |
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 | # Check for data path next to exe/zip file. |
14 | # If we are inside a py2exe zip file, we need to go up |
15 | # two levels to get to the directory containing the exe |
16 | # We will check if the exe and the xsf are in the same |
17 | # directory. |
18 | path = os.path.dirname(__file__) |
19 | #Look for maximum n_dir up of the current dir to find media |
20 | |
21 | #for i in range(n_dir): |
22 | i = 0 |
23 | while(i < N_DIR): |
24 | path, _ = os.path.split(path) |
25 | media_path = os.path.join(path, media) |
26 | if os.path.isdir(media_path): |
27 | module_media_path = os.path.join(media_path,'calculator_%s'% media) |
28 | if os.path.isdir(module_media_path): |
29 | return module_media_path |
30 | return media_path |
31 | i += 1 |
32 | |
33 | raise RuntimeError('Could not find calculator media files') |
34 | |
35 | def data_files(): |
36 | """ |
37 | Return the data files associated with media calculator. |
38 | |
39 | The format is a list of (directory, [files...]) pairs which can be |
40 | used directly in setup(...,data_files=...) for setup.py. |
41 | |
42 | """ |
43 | data_files = [] |
44 | data_files.append(('media/calculator_media', findall(get_data_path("media")))) |
45 | return data_files |
Note: See TracBrowser
for help on using the repository browser.