Changeset 23ccf07 in sasview for sansview/perspectives


Ignore:
Timestamp:
Apr 26, 2011 1:20:22 PM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
60642b4
Parents:
168a845
Message:

find the path for media

Location:
sansview/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/help_panel.py

    r389c991 r23ccf07  
    55from wx.lib.splitter import MultiSplitterWindow 
    66import os 
     7import sys 
    78 
    8  
     9     
    910class HelpWindow(wx.Frame): 
    1011    """ 
     
    1516        contains help info 
    1617        """ 
    17        
     18        path = os.path.dirname(__file__) 
     19        temp_path = os.path.join(path,'images') 
     20        ico_file = os.path.join(temp_path,'ball.ico') 
     21        if os.path.isfile(ico_file): 
     22            self.SetIcon(wx.Icon(ico_file, wx.BITMAP_TYPE_ICO)) 
     23        else: 
     24            temp_path = os.path.join(os.getcwd(),'images') 
     25            ico_file = os.path.join(temp_path,'ball.ico') 
     26            if os.path.isfile(ico_file): 
     27                self.SetIcon(wx.Icon(ico_file, wx.BITMAP_TYPE_ICO)) 
     28            else: 
     29                ico_file = os.path.join(os.path.dirname(os.path.sys.path[0]), 
     30                             'images', 'ball.ico') 
     31                if os.path.isfile(ico_file): 
     32                    self.SetIcon(wx.Icon(ico_file, wx.BITMAP_TYPE_ICO)) 
     33                     
    1834        splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) 
    1935        rpanel = wx.Panel(splitter, -1) 
     
    5268        # get the media path 
    5369        path = models.get_data_path(media='media') 
     70        if not os.path.isdir(path): 
     71             path = os.path.dirname(os.path.sys.path[0]) 
    5472        self.path = os.path.join(path,"model_functions.html") 
    5573        self.path_pd = os.path.join(path,"pd_help.html") 
     
    6179            </body> 
    6280            </html>""" 
    63         page="""<html> 
     81         
     82        if not os.path.isfile(os.path.join(path, "change_scale_help.html")): 
     83            path = os.path.join(os.path.dirname(os.path.sys.path[0]), 'media') 
     84        page = """<html> 
    6485            <body> 
    6586            <ul> 
    66             <li><a href ="media/change_scale_help.html" target ="showframe">Change Scale</a><br></li> 
    67             <li><a href ="media/reset_Graph_help.html" target ="showframe">Graph Help</a><br></li> 
    68             <li><a href ="media/status_bar_help.html" target ="showframe">Status Bar Help</a><br></li> 
    69             <li><a href ="media/load_data_help.html" target ="showframe">Load a File</a><br></li> 
    70             <li><a href ="media/simultaneous_fit_help.html" target ="showframe">Simultaneous Fit</a><br></li> 
    71             <li><a href ="media/single_fit_help.html" target ="showframe">Single Fit</a><br></li> 
    72             <li><a href ="media/model_use_help.html" target ="showframe">Visualize Model</a><br></li> 
    73             <li><a href ="media/averaging_help.html" target ="showframe">Data Averaging</a><br></li> 
     87            <li><a href ="%s" target ="showframe">Change Scale</a><br></li> 
     88            """ % str(os.path.join(path, "change_scale_help.html")) 
     89        page += """ 
     90            <li><a href ="%s" target ="showframe">Graph Help</a><br></li> 
     91            """ % str(os.path.join(path,  "reset_Graph_help.html")) 
     92        page += """ 
     93            <li><a href ="%s" target ="showframe">Status Bar Help</a><br></li> 
     94            """ % str(os.path.join(path,  "status_bar_help.html")) 
     95        page += """ 
     96            <li><a href ="%s" target ="showframe">Load a File</a><br></li> 
     97            """ % str(os.path.join(path, "load_data_help.html")) 
     98        page += """ 
     99            <li><a href ="%s"  
     100            target ="showframe">Simultaneous Fit</a><br></li> 
     101            """ % str(os.path.join(path, "simultaneous_fit_help.html")) 
     102        page += """ 
     103            <li><a href ="%s"  
     104            target ="showframe">Single Fit</a><br></li> 
     105            """ % str(os.path.join(path,  "single_fit_help.html")) 
     106        page += """ 
     107            <li><a href ="%s"  
     108            target ="showframe">Visualize Model</a><br></li> 
     109            """ % str(os.path.join(path, "model_use_help.html")) 
     110        page += """ 
     111            <li><a href ="%s"  
     112            target ="showframe">Data Averaging</a><br></li> 
     113            """ % str(os.path.join(path,  "averaging_help.html")) 
     114        page += """ 
    74115            <li><a href ="%s" target ="showframe">Model Functions</a><br></li> 
    75             <li><a href ="%s" target ="showframe">Polydispersion Distributions</a><br></li> 
     116            """ % str(self.path) 
     117        page += """<li><a href ="%s" target ="showframe"> 
     118                Polydispersion Distributions</a><br></li> 
     119                """ % str(self.path_pd) 
     120        page += """ 
    76121            <li><a href ="%s" target ="showframe">Smear Computation</a><br></li> 
    77             <li><a href ="media/key_help.html" target ="showframe">Key Combination</a><br></li> 
     122            """ % str(self.path_sm) 
     123        page += """<li><a href ="%s"  
     124        target ="showframe">Key Combination</a><br></li> 
    78125            </ul> 
    79126            </body> 
    80             </html>""" % (self.path, self.path_pd, self.path_sm) 
     127            </html>""" % str(os.path.join(path,  "key_help.html")) 
    81128         
    82129        self.rhelp.SetPage(page1) 
  • sansview/perspectives/fitting/models.py

    r5901bb9 r23ccf07  
    99# Time is needed by the log method 
    1010import time 
     11import logging 
    1112 
    1213from sans.guiframe.events import StatusEvent   
     
    1718    
    1819PLUGIN_DIR = 'plugins'  
     20path = os.path.dirname(os.path.sys.path[0]) 
     21file = os.path.join(path, "plugins.log") 
     22 
    1923 
    2024def log(message): 
    2125    """ 
    2226    """ 
    23     out = open("plugins.log", 'a') 
     27    out = open(file, 'a') 
    2428    out.write("%10g:  %s\n" % (time.clock(), message)) 
    2529    out.close() 
     
    107111    except: 
    108112        # Don't deal with bad plug-in imports. Just skip. 
     113        msg = "Could not import model plugin: %s\n" % sys.exc_value 
     114        log(msg) 
    109115        pass 
    110116    return plugins 
     
    172178        in the directory if file were modified 
    173179        """ 
     180        temp = {} 
    174181        if self.is_changed(): 
    175182            #always recompile the folder plugin 
    176183            import compileall 
    177             compileall.compile_dir(dir=PLUGIN_DIR, force=1) 
    178             dir = os.path.join(os.getcwd(), 'plugins') 
    179             log("looking for models in: %s" % str(dir)) 
    180             return _findModels(PLUGIN_DIR) 
    181         return  {} 
    182         
    183      
     184            if os.path.isdir(os.path.abspath(PLUGIN_DIR)): 
     185                dir = os.path.abspath(PLUGIN_DIR) 
     186            else: 
     187                dir = os.path.join(os.path.dirname(os.path.sys.path[0]), 'plugins') 
     188            if not os.path.isdir(dir): 
     189                log("Could not locate models plugins in: %s" % str(dir)) 
     190            else: 
     191                log("looking for models in: %s" % str(dir)) 
     192                compileall.compile_dir(dir=dir, ddir=dir, force=1, quiet=True) 
     193                return  _findModels(dir) 
     194        logging.info("pluging model : %s\n" % str(temp)) 
     195        return temp 
     196         
    184197    def _getModelList(self): 
    185198        """ 
Note: See TracChangeset for help on using the changeset viewer.