Changeset f4c0513 in sasview for src/sas


Ignore:
Timestamp:
Jun 29, 2015 4:13:16 PM (10 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
60d08fd
Parents:
eddf6af5 (diff), 5a73356a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of github.com:sasview/sasview

Location:
src/sas
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/sas/guiframe/acknowledgebox.py

    r0ea31ca rc8d22ec  
    2121      (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): 
    2222        fObj, path, descr = imp.find_module('local_config', [path]) 
    23         config = imp.load_module('local_config', fObj, path, descr)   
     23        config = imp.load_module('local_config', fObj, path, descr) 
    2424    else: 
    2525        # Try simply importing local_config 
    2626        import local_config as config 
    2727except: 
    28     # Didn't find local config, load the default  
     28    # Didn't find local config, load the default 
    2929    import config 
    30      
     30 
    3131 
    3232class DialogAcknowledge(wx.Dialog): 
    3333    """ 
    3434    "Acknowledgement" Dialog Box 
    35      
     35 
    3636    Shows the current method for acknowledging SasView in 
    3737    scholarly publications. 
    38      
     38 
    3939    """ 
    40      
     40 
    4141    def __init__(self, *args, **kwds): 
    42          
     42 
    4343        kwds["style"] = wx.DEFAULT_DIALOG_STYLE 
    4444        wx.Dialog.__init__(self, *args, **kwds) 
    45          
     45 
    4646        self.ack = wx.TextCtrl(self, style=wx.TE_LEFT|wx.TE_MULTILINE|wx.TE_BESTWRAP|wx.TE_READONLY|wx.TE_NO_VSCROLL) 
    4747        self.ack.SetValue(config._acknowledgement_publications) 
    48         self.ack.SetMinSize((-1,55)) 
     48        self.ack.SetMinSize((-1, 55)) 
    4949        self.preamble = wx.StaticText(self, -1, config._acknowledgement_preamble) 
    5050        items = [config._acknowledgement_preamble_bullet1, 
    5151                 config._acknowledgement_preamble_bullet2, 
    52                  config._acknowledgement_preamble_bullet3] 
     52                 config._acknowledgement_preamble_bullet3, 
     53                 config._acknowledgement_preamble_bullet4] 
    5354        self.list1 = wx.StaticText(self, -1, "\t(1) " + items[0]) 
    5455        self.list2 = wx.StaticText(self, -1, "\t(2) " + items[1]) 
    5556        self.list3 = wx.StaticText(self, -1, "\t(3) " + items[2]) 
     57        self.list4 = wx.StaticText(self, -1, "\t(4) " + items[3]) 
    5658        self.static_line = wx.StaticLine(self, 0) 
    5759        self.__set_properties() 
    5860        self.__do_layout() 
    59          
     61 
    6062    def __set_properties(self): 
    6163        """ 
     64        :TODO - add method documentation 
    6265        """ 
    6366        # begin wxGlade: DialogAbout.__set_properties 
     
    7073    def __do_layout(self): 
    7174        """ 
     75        :TODO - add method documentation 
    7276        """ 
    7377        # begin wxGlade: DialogAbout.__do_layout 
     
    7882        sizer_titles.Add(self.list2, 0, wx.ALL|wx.EXPAND, 5) 
    7983        sizer_titles.Add(self.list3, 0, wx.ALL|wx.EXPAND, 5) 
     84        sizer_titles.Add(self.list4, 0, wx.ALL|wx.EXPAND, 5) 
    8085        sizer_titles.Add(self.static_line, 0, wx.ALL|wx.EXPAND, 0) 
    8186        sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 5) 
     
    8691        self.Centre() 
    8792        # end wxGlade 
    88          
     93 
    8994 
    9095##### testing code ############################################################ 
    9196class MyApp(wx.App): 
    9297    """ 
     98    Class for running module as stand alone for testing 
    9399    """ 
    94100    def OnInit(self): 
    95101        """ 
     102        Defines an init when running as standalone 
    96103        """ 
    97104        wx.InitAllImageHandlers() 
  • src/sas/guiframe/config.py

    r0ea31ca r5846bb5  
    99__version__ = '0.0.0' 
    1010__build__ = '1' 
    11 __download_page__ = 'http://sourceforge.net/projects/sasview/files/' 
    12 __update_URL__ = ['svn.code.sf.net',  
    13                   '/p/sasview/code/trunk/sasview.latestversion'] 
     11__download_page__ = 'https://github.com/SasView/sasview/releases' 
     12__update_URL__ = ['raw.githubusercontent.com', 
     13                  '/SasView/sasview/master/sasview.latestversion'] 
    1414 
    1515 
     
    2121 
    2222# Debug message should be written to a file? 
    23 __EVT_DEBUG_2_FILE__   = False 
     23__EVT_DEBUG_2_FILE__ = False 
    2424__EVT_DEBUG_FILENAME__ = "debug.log" 
    2525 
     
    3636'''Reference the following website: http://www.sasview.org''' 
    3737_acknowledgement_preamble_bullet3 =\ 
    38 '''Send us your reference for our records: sansdanse@gmail.com''' 
     38'''Reference the model you used if appropriate (see documentation for refs)''' 
     39_acknowledgement_preamble_bullet4 =\ 
     40'''Send us your reference for our records: developers@sasview.org''' 
    3941_acknowledgement_publications = \ 
    40 '''This work benefited from the use of the SasView application, originally  
     42'''This work benefited from the use of the SasView application, originally 
    4143developed under NSF award DMR-0520547. 
    4244''' 
    4345_acknowledgement =  \ 
    4446'''This work originally developed as part of the DANSE project funded by the NSF 
    45 under grant DMR-0520547, and currently maintained by NIST, UMD, ORNL, ISIS, ESS  
     47under grant DMR-0520547, and currently maintained by NIST, UMD, ORNL, ISIS, ESS 
    4648and ILL. 
    4749 
     
    8587PLUGINS_WLIST = [] 
    8688PLUGIN_STATE_EXTENSIONS = [] 
    87 SPLASH_SCREEN_PATH = "images/danse_logo.png"      
     89SPLASH_SCREEN_PATH = "images/danse_logo.png" 
    8890DEFAULT_STYLE = GUIFRAME.SINGLE_APPLICATION 
    8991SPLASH_SCREEN_WIDTH = 500 
    9092SPLASH_SCREEN_HEIGHT = 300 
    91 WELCOME_PANEL_ON  = False 
     93WELCOME_PANEL_ON = False 
    9294TUTORIAL_PATH = None 
    9395SS_MAX_DISPLAY_TIME = 1500 
     
    125127 
    126128def printEVT(message): 
     129    """ 
     130    :TODO - need method documentation 
     131    """ 
    127132    if __EVT_DEBUG__: 
    128133        print "%g:  %s" % (time.clock(), message) 
    129          
     134     
    130135        if __EVT_DEBUG_2_FILE__: 
    131136            out = open(__EVT_DEBUG_FILENAME__, 'a') 
  • src/sas/guiframe/data_processor.py

    rc85b0ae re54dbc3e  
    141141        self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftClick) 
    142142        self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightClick) 
    143         self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnLeftDoubleClick) 
     143        #self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnLeftDoubleClick) 
    144144        self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self.OnRangeSelect) 
    145145        self.Bind(wx.grid.EVT_GRID_ROW_SIZE, self.OnRowSize) 
     
    187187        if self.GetNumberCols() > 0: 
    188188            self.default_col_width = self.GetColSize(0) 
    189         self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
    190         self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
    191         self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.on_selected_cell) 
    192         self.Bind(wx.grid.EVT_GRID_CMD_CELL_CHANGE, self.on_edit_cell) 
    193         self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.onContextMenu) 
    194  
     189        #self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
     190        #self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
     191        #self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.on_selected_cell) 
     192        #self.Bind(wx.grid.EVT_GRID_CMD_CELL_CHANGE, self.on_edit_cell) 
     193        #self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.onContextMenu) 
     194 
     195    def OnLeftClick(self, event): 
     196        sheet.CSheet.OnLeftClick(self, event) 
     197        self.on_selected_cell(event) 
     198         
    195199    def on_edit_cell(self, event): 
    196200        """ 
     
    211215        row, col = event.GetRow(), event.GetCol() 
    212216        cell = (row, col) 
    213         event.Skip() 
    214217        if not flag and not flag_shift: 
    215218            self.selected_cols = [] 
     
    273276            if cell_row > 0 and cell_row < self.max_row_touse: 
    274277                self.axis_value.append(self.GetCellValue(cell_row, cell_col)) 
     278        event.Skip() 
    275279 
    276280    def on_left_click(self, event): 
     
    278282        Catch the left click on label mouse event 
    279283        """ 
    280         event.Skip() 
    281284        flag = event.CmdDown() or event.ControlDown() 
    282285 
     
    317320            if not self.axis_label: 
    318321                self.axis_label = " " 
     322        event.Skip() 
    319323 
    320324    def on_right_click(self, event): 
     
    13851389        wx.EVT_MENU(self, self.save_menu.GetId(), self.on_save_page) 
    13861390 
     1391        # To add the edit menu, call add_edit_menu() here. 
     1392        self.edit = None 
     1393        self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open) 
     1394         
     1395        self.Bind(wx.EVT_CLOSE, self.on_close) 
     1396 
     1397    def add_edit_menu(self, menubar): 
    13871398        self.edit = wx.Menu() 
    13881399 
     
    14141425        self.remove_menu = self.edit.Append(-1, 'Remove Column', hint) 
    14151426        wx.EVT_MENU(self, self.remove_menu.GetId(), self.on_remove_column) 
    1416  
    1417         self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open) 
    14181427        menubar.Append(self.edit, "&Edit") 
    1419         self.Bind(wx.EVT_CLOSE, self.on_close) 
    14201428 
    14211429    def on_copy(self, event): 
  • src/sas/guiframe/documentation_window.py

    re82a901 r7a508b6  
     1""" 
     2documentation module provides a simple means to add help throughout the 
     3application. It checks for the existence of html2 package needed to support 
     4fully html panel which supports css.  The class defined here takes a title for 
     5the particular help panel, a pointer to the html documentation file of interest 
     6within the documentation tree along with a 'command' string such as a page 
     7anchor or a query string etc.  The path to the doc directory is retrieved 
     8automatically by the class itself.  Thus with these three pieces of information 
     9the class generates a panel with the appropriate title bar and help file 
     10formatted according the style sheets called in the html file.  Finally, if an 
     11old version of Python is running and the html2 package is not available the 
     12class brings up the default browser and passes the file:/// string to it.  In 
     13this case however the instruction portion is usually not passed for security 
     14reasons. 
     15""" 
    116import os 
    217import logging 
     
    419import webbrowser 
    520import urllib 
     21import sys 
    622 
    7 wx_supports_html2 = True 
     23SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     24WX_SUPPORTS_HTML2 = True 
    825try: 
    926    import wx.html2 as html 
    1027except: 
    11     wx_supports_html2 = False 
     28    WX_SUPPORTS_HTML2 = False 
     29 
    1230 
    1331from gui_manager import get_app_dir 
     
    1533 
    1634class DocumentationWindow(wx.Frame): 
    17     def __init__(self, parent, id, path, url_instruction, title, size=(850, 540)): 
    18         wx.Frame.__init__(self, parent, id, title, size=size) 
     35    """ 
     36    DocumentationWindow inherits from wx.Frame and provides a centralized 
     37    coherent framework for all help documentation.  Help files must be html 
     38    files stored in an properly organized tree below the top 'doc' folder.  In 
     39    order to display the appropriate help file from anywhere in the gui, the 
     40    code simply needs to know the location below the top level where the 
     41    help file resides along with the name of the help file. 
     42    called 
     43    (self, parent, dummy_id, path, url_instruction, title, size=(850, 540)) 
    1944 
    20         SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     45    :param path: path to html file beginning AFTER /doc/ and ending in the 
     46    file.html 
     47    :param url_instructions: anchor string or other query e.g. '#MyAnchor 
     48    :param title - text to place in the title bar of the help panel 
     49    """ 
     50    def __init__(self, parent, dummy_id, path, url_instruction, title, size=(850, 540)): 
     51        wx.Frame.__init__(self, parent, dummy_id, title, size=size) 
     52 
    2153        if SPHINX_DOC_ENV in os.environ: 
    2254            docs_path = os.path.join(os.environ[SPHINX_DOC_ENV]) 
     
    2759            docs_path = os.path.join(get_app_dir(), "doc") 
    2860 
     61        #note that filepath for mac OS, at least in bundle starts with a 
     62        #forward slash as /Application, while the PC string begins C:\ 
     63        #It seems that mac OS is happy with four slashes as in file:////App... 
     64        #Two slashes is not sufficient to indicate path from root.  Thus for now 
     65        #we use "file:///" +... If the mac behavior changes may need to make the 
     66        #file:/// be another constant at the beginning that yields // for Mac 
     67        #and /// for PC. 
     68        #Note added June 21, 2015     PDB 
    2969        file_path = os.path.join(docs_path, path) 
    30         url = "file:///" + urllib.quote(file_path,'\:')+ url_instruction 
     70        url = "file:///" + urllib.quote(file_path, r'/\:')+ url_instruction 
    3171 
    3272        if not os.path.exists(file_path): 
    3373            logging.error("Could not find Sphinx documentation at %s \ 
    3474            -- has it been built?", file_path) 
    35         elif wx_supports_html2: 
     75        elif WX_SUPPORTS_HTML2: 
    3676            # Complete HTML/CSS support! 
    3777            self.view = html.WebView.New(self) 
    3878            self.view.LoadURL(url) 
    3979            self.Show() 
    40         else:  
     80        else: 
    4181            logging.error("No html2 support, popping up a web browser") 
    4282            #For cases that do not build against current version dependency 
    43             # Wx 3.0 we provide a webbrowser call - this is particularly for  
     83            # Wx 3.0 we provide a webbrowser call - this is particularly for 
    4484            #Red hat used at SNS for which Wx 3.0 is not available.  This 
    45             #does not deal with issue of math in docs of course.  
     85            #does not deal with issue of math in docs of course. 
    4686            webbrowser.open_new_tab(url) 
    4787 
    4888def main(): 
     89    """ 
     90    main loop function if running alone for testing. 
     91    """ 
    4992    app = wx.App() 
    5093    DocumentationWindow(None, -1, "index.html", "", "Documentation",) 
  • src/sas/guiframe/gui_manager.py

    r7801df8 raceae8c  
    2424import logging 
    2525import httplib 
     26import traceback 
    2627 
    2728 
     
    12961297        #replace or add a new menu for the current plugin 
    12971298        pos = self._menubar.FindMenu(str(self._applications_menu_name)) 
     1299        if pos == -1 and self._applications_menu_pos > 0: 
     1300            pos = self._applications_menu_pos 
    12981301        if pos != -1: 
    12991302            menu_list = self._current_perspective.populate_menu(self) 
     
    13021305                    self._menubar.Replace(pos, menu, name) 
    13031306                    self._applications_menu_name = name 
     1307                self._applications_menu_pos = pos 
    13041308            else: 
    13051309                self._menubar.Remove(pos) 
    13061310                self._applications_menu_name = None 
    1307             #get the position of the menu when it first added 
    1308             self._applications_menu_pos = pos 
     1311                self._applications_menu_pos = -1 
    13091312        else: 
    13101313            menu_list = self._current_perspective.populate_menu(self) 
     
    13161319                        if help_pos == -1: 
    13171320                            self._menubar.Append(menu, name) 
     1321                            self._applications_menu_pos = -1 
    13181322                        else: 
    13191323                            self._menubar.Insert(help_pos-1, menu, name) 
     1324                            self._applications_menu_pos = help_pos - 1 
    13201325                    else: 
    13211326                        self._menubar.Insert(self._applications_menu_pos, menu, name) 
     
    20362041        """ 
    20372042        try: 
    2038             conn = httplib.HTTPConnection(config.__update_URL__[0], 
     2043            conn = httplib.HTTPSConnection(config.__update_URL__[0], 
    20392044                                          timeout=3.0) 
    20402045            conn.request("GET", config.__update_URL__[1]) 
     
    20422047            content = res.read() 
    20432048            conn.close() 
     2049            logging.info("connected to GitHub. sasview.latestversion = %s" 
     2050                         % (content)) 
    20442051        except: 
     2052            msg = traceback.format_exc() 
     2053            logging.info(msg) 
     2054            logging.info("failed to connect to GitHub") 
    20452055            content = "0.0.0" 
    20462056 
    20472057        version = content.strip() 
     2058        logging.info("Latest SasView version number: %s" % (version)) 
    20482059        if len(re.findall('\d+\.\d+\.\d+$', version)) < 0: 
    20492060            content = "0.0.0" 
     
    21662177        # different place than they would otherwise. 
    21672178        from documentation_window import DocumentationWindow 
    2168         DocumentationWindow(self, -1, "index.html", "", "SasView Documentation") 
     2179        _TreeLocation = "user/user.html" 
     2180        DocumentationWindow(self, -1, _TreeLocation, "", "SasView Documentation") 
    21692181 
    21702182    def set_manager(self, manager): 
  • src/sas/models/media/model_functions.rst

    r5e880fe1 ree9fa94  
    2020 
    2121 
    22 .. note::  The contents of this document are awaiting proof reading. Feb2015 
     22.. note::  The contents of this document are presented in good faith and are  
     23           believed to be mostly correct and accurate, however they have not  
     24           yet been rigorously checked for errors. June2015 
    2325 
    2426 
     
    8385======================= 
    8486 
    85 Contents 
    86 -------- 
    87 1. Background_ 
    88  
    89 2. Model_ Functions 
    90  
    91  2.1 Shape-based_ Functions 
    92   
    93  2.2 Shape-independent_ Functions 
    94   
    95  2.3 Structure-factor_ Functions 
    96   
    97  2.4 Customised_ Functions 
    98  
    99 3. References_ 
    100  
    101  
    102  
    103 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    104  
    105  
    106  
    10787.. _Background: 
    10888 
     
    290270- sph_bessel_jn_ 
    291271 
     272Also see the documentation on :ref:`Adding_your_own_models` under Fitting Data.  
     273 
    292274 
    293275 
  • src/sas/perspectives/fitting/basepage.py

    r7116dffd r2c8dc19  
    28502850        if self.model != None: 
    28512851            name = self.formfactorbox.GetValue() 
    2852             _PageAnchor = '#' + name 
     2852            _PageAnchor = '#' + name.lower() 
    28532853            _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, 
    2854                                               _PageAnchor, name + "Help") 
     2854                                              _PageAnchor, name + " Help") 
    28552855        else: 
    28562856            _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "", 
  • src/sas/perspectives/fitting/fitpage.py

    rf3dc56c r2b58fa5  
    31153115                    mag_on_button.Show(True) 
    31163116                mag_help_button.Show(False) 
     3117                mag_angle_help_button.Show(False) 
    31173118                if mag_on_button.IsShown(): 
    31183119                    if self.magnetic_on: 
  • src/sas/perspectives/fitting/media/fitting.rst

    rb404a3de rd896039  
    1717   Polarisation/Magnetic Scattering <mag_help> 
    1818 
    19    Information on the SasView Optimisers - Local <optimizer.rst> 
    20  
    21    Information on the SasView Optimisers - Web <https://github.com/bumps/bumps/blob/master/doc/guide/optimizer.rst> 
     19   Information on the SasView Optimisers <optimizer.rst> 
    2220    
  • src/sas/perspectives/fitting/pagestate.py

    racf8e4a5 ra15e754  
    545545                    paramval_string += CENTRE % param + "\n" 
    546546 
    547         text_string = "\n\n\n" + title + "\n\n" + file + \ 
    548                       "\n" + q_name + \ 
    549                       "\n" + chi2 + \ 
    550                       "\n\n" + paramval 
     547        text_string = "\n\n\n%s\n\n%s\n%s\n%s\n\n%s" % (title, file, q_name, chi2, paramval) 
    551548 
    552549        title_name = self._check_html_format(title_name) 
  • src/sas/perspectives/fitting/report_dialog.py

    r2f4b430 ra15e754  
    4444                self.report_html = self.report_list[0] % \ 
    4545                                    "memory:img_fit0.png" 
    46             elif len(self.report_list) == 2: 
     46            elif len(self.report_list[2]) == 2: 
    4747                self.report_html = self.report_list[0] % \ 
    4848                                    ("memory:img_fit0.png", 
Note: See TracChangeset for help on using the changeset viewer.