Changeset cd57c7d4 in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Sep 11, 2017 10:12:16 AM (7 years ago)
Author:
krzywon
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
b1f20d1
Parents:
c9ecd1b (diff), e2b2473 (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' into 4_1_issues

# Conflicts:
# src/sas/sascalc/dataloader/readers/cansas_reader.py

Location:
src/sas/sasgui/guiframe
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r235f514 rdcb91cf  
    1111 
    1212from sas.sascalc.dataloader.loader import Loader 
     13from sas.sascalc.dataloader.loader_exceptions import NoKnownLoaderException 
    1314from sas.sasgui.guiframe.plugin_base import PluginBase 
    1415from sas.sasgui.guiframe.events import StatusEvent 
     
    4142APPLICATION_WLIST = config.APPLICATION_WLIST 
    4243 
     44 
    4345class Plugin(PluginBase): 
    4446 
     
    5658        """ 
    5759        # menu for data files 
    58         menu_list = [] 
    5960        data_file_hint = "load one or more data in the application" 
    6061        menu_list = [('&Load Data File(s)', data_file_hint, self.load_data)] 
    6162        gui_style = self.parent.get_style() 
    6263        style = gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 
    63         style1 = gui_style & GUIFRAME.DATALOADER_ON 
    6464        if style == GUIFRAME.MULTIPLE_APPLICATIONS: 
    6565            # menu for data from folder 
     
    102102        self.get_data(file_list) 
    103103 
    104  
    105104    def can_load_data(self): 
    106105        """ 
     
    108107        """ 
    109108        return True 
    110  
    111109 
    112110    def _load_folder(self, event): 
     
    140138        """ 
    141139        if error is not None or str(error).strip() != "": 
    142             dial = wx.MessageDialog(self.parent, str(error), 'Error Loading File', 
     140            dial = wx.MessageDialog(self.parent, str(error), 
     141                                    'Error Loading File', 
    143142                                    wx.OK | wx.ICON_EXCLAMATION) 
    144143            dial.ShowModal() 
     
    149148        """ 
    150149        if os.path.isdir(path): 
    151             return [os.path.join(os.path.abspath(path), filename) for filename in os.listdir(path)] 
     150            return [os.path.join(os.path.abspath(path), filename) for filename 
     151                    in os.listdir(path)] 
    152152 
    153153    def _process_data_and_errors(self, item, p_file, output, message): 
     
    178178        for p_file in path: 
    179179            basename = os.path.basename(p_file) 
     180            # Skip files that start with a period 
     181            if basename.startswith("."): 
     182                msg = "The folder included a potential hidden file - %s." \ 
     183                      % basename 
     184                msg += " Do you wish to load this file as data?" 
     185                msg_box = wx.MessageDialog(None, msg, 'Warning', 
     186                                           wx.OK | wx.CANCEL) 
     187                if msg_box.ShowModal() == wx.ID_CANCEL: 
     188                    continue 
    180189            _, extension = os.path.splitext(basename) 
    181190            if extension.lower() in EXTENSIONS: 
     
    213222                info="info") 
    214223 
    215             except: 
    216                 logger.error(sys.exc_value) 
    217  
    218                 error_message = "The Data file you selected could not be loaded.\n" 
    219                 error_message += "Make sure the content of your file" 
    220                 error_message += " is properly formatted.\n" 
    221                 error_message += "When contacting the SasView team, mention the" 
    222                 error_message += " following:\n" 
    223                 error_message += "Error: " + str(sys.exc_info()[1]) 
    224                 file_errors[basename] = [error_message] 
    225                 self.load_update(output=output, message=error_message, info="warning") 
     224            except NoKnownLoaderException as e: 
     225                exception_occurred = True 
     226                logger.error(e.message) 
     227 
     228                error_message = "Loading data failed!\n" + e.message 
     229                self.load_update(output=None, message=e.message, info="warning") 
     230 
     231            except Exception as e: 
     232                exception_occurred = True 
     233                logger.error(e.message) 
     234 
     235                file_err = "The Data file you selected could not be " 
     236                file_err += "loaded.\nMake sure the content of your file" 
     237                file_err += " is properly formatted.\n" 
     238                file_err += "When contacting the SasView team, mention the" 
     239                file_err += " following:\n" 
     240                file_err += e.message 
     241                file_errors[basename] = [file_err] 
    226242 
    227243        if len(file_errors) > 0: 
     
    233249                    error_message += message + "\n" 
    234250                error_message += "\n" 
    235             self.load_update(output=output, message=error_message, info="error") 
    236  
    237         self.load_complete(output=output, message="Loading data complete!", 
    238             info="info") 
     251            if not exception_occurred: # Some data loaded but with errors 
     252                self.load_update(output=output, message=error_message, info="error") 
     253 
     254        if not exception_occurred: # Everything loaded as expected 
     255            self.load_complete(output=output, message="Loading data complete!", 
     256                               info="info") 
     257        else: 
     258            self.load_complete(output=None, message=error_message, info="error") 
     259 
    239260 
    240261    def load_update(self, output=None, message="", info="warning"): 
     
    245266            wx.PostEvent(self.parent, StatusEvent(status=message, info=info, 
    246267                                                  type="progress")) 
    247     def load_complete(self, output, message="", error_message="", path=None, 
    248                       info="warning"): 
    249         """ 
    250          post message to  status bar and return list of data 
    251         """ 
    252         wx.PostEvent(self.parent, StatusEvent(status=message, 
    253                                               info=info, 
     268 
     269    def load_complete(self, output, message="", info="warning"): 
     270        """ 
     271         post message to status bar and return list of data 
     272        """ 
     273        wx.PostEvent(self.parent, StatusEvent(status=message, info=info, 
    254274                                              type="stop")) 
    255         # if error_message != "": 
    256         #    self.load_error(error_message) 
    257         self.parent.add_data(data_list=output) 
     275        if output is not None: 
     276            self.parent.add_data(data_list=output) 
  • src/sas/sasgui/guiframe/config.py

    ra1b8fee rce2819b  
    4848'''This work benefited from the use of the SasView application, originally developed under NSF Award DMR-0520547. SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project Grant No 654000.''' 
    4949_acknowledgement_citation = \ 
    50 '''M. Doucet et al. SasView Version 4.1, Zenodo, 10.5281/zenodo.438138''' 
     50'''M. Doucet et al. SasView Version 4.1.2, Zenodo, 10.5281/zenodo.825675''' 
    5151 
    5252_acknowledgement =  \ 
  • src/sas/sasgui/guiframe/documentation_window.py

    r959eb01 r6a455cd3  
    7575            logger.error("Could not find Sphinx documentation at %s \ 
    7676            -- has it been built?", file_path) 
    77         elif WX_SUPPORTS_HTML2: 
    78             # Complete HTML/CSS support! 
    79             self.view = html.WebView.New(self) 
    80             self.view.LoadURL(url) 
    81             self.Show() 
     77        #Commenting following 5 lines, so default browser is forced 
     78        #This is due to CDN mathjax discontinuation of service, intenal help 
     79        #browser should be back with qt version 
     80        #Note added by Wojtek Potrzebowski, July 4th 2017 
     81        # elif WX_SUPPORTS_HTML2: 
     82        #     # Complete HTML/CSS support! 
     83        #     self.view = html.WebView.New(self) 
     84        #     self.view.LoadURL(url) 
     85        #     self.Show() 
    8286        else: 
    8387            logger.error("No html2 support, popping up a web browser") 
Note: See TracChangeset for help on using the changeset viewer.