source: sasview/invariantview/perspectives/invariant/__init__.py @ 1c271f2

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 1c271f2 was 698a734, checked in by Gervaise Alina <gervyh@…>, 15 years ago

working on bundle html files

  • Property mode set to 100644
File size: 1.3 KB
Line 
1PLUGIN_ID = "Invariant plug-in 1.0"
2from invariant import *
3
4import os
5from distutils.filelist import findall
6
7def get_data_path(media):
8    """
9    """
10    # Check for data path in the package
11    path = os.path.join(os.path.dirname(__file__), media)
12    if os.path.isdir(path):
13        return path
14
15    # Check for data path next to exe/zip file.
16    # If we are inside a py2exe zip file, we need to go up
17    # two levels to get to the directory containing the exe
18    # We will check if the exe and the xsf are in the same
19    # directory.
20    path= os.path.dirname(__file__)
21    n_dir = 4
22    for i in range(n_dir):
23        path,_ = os.path.split(path)
24
25    path = os.path.join(path, '', media,'invariant_media' )
26    if os.path.isdir(path):
27        return path
28    path = os.path.join(path, '', media)
29    if os.path.isdir(path):
30        return path
31    raise RuntimeError('Could not find invariant media files')
32
33def data_files():
34    """
35    Return the data files associated with media invariant.
36   
37    The format is a list of (directory, [files...]) pairs which can be
38    used directly in setup(...,data_files=...) for setup.py.
39
40    """
41    data_files =[]
42    path = get_data_path(media="media")
43    for f in findall(path):
44        data_files.append(('media/invariant_media', [f]))
45    return data_files
Note: See TracBrowser for help on using the repository browser.