Changeset cd57c7d4 in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Sep 11, 2017 10:12:16 AM (7 years ago)
- 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. - 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 11 11 12 12 from sas.sascalc.dataloader.loader import Loader 13 from sas.sascalc.dataloader.loader_exceptions import NoKnownLoaderException 13 14 from sas.sasgui.guiframe.plugin_base import PluginBase 14 15 from sas.sasgui.guiframe.events import StatusEvent … … 41 42 APPLICATION_WLIST = config.APPLICATION_WLIST 42 43 44 43 45 class Plugin(PluginBase): 44 46 … … 56 58 """ 57 59 # menu for data files 58 menu_list = []59 60 data_file_hint = "load one or more data in the application" 60 61 menu_list = [('&Load Data File(s)', data_file_hint, self.load_data)] 61 62 gui_style = self.parent.get_style() 62 63 style = gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 63 style1 = gui_style & GUIFRAME.DATALOADER_ON64 64 if style == GUIFRAME.MULTIPLE_APPLICATIONS: 65 65 # menu for data from folder … … 102 102 self.get_data(file_list) 103 103 104 105 104 def can_load_data(self): 106 105 """ … … 108 107 """ 109 108 return True 110 111 109 112 110 def _load_folder(self, event): … … 140 138 """ 141 139 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', 143 142 wx.OK | wx.ICON_EXCLAMATION) 144 143 dial.ShowModal() … … 149 148 """ 150 149 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)] 152 152 153 153 def _process_data_and_errors(self, item, p_file, output, message): … … 178 178 for p_file in path: 179 179 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 180 189 _, extension = os.path.splitext(basename) 181 190 if extension.lower() in EXTENSIONS: … … 213 222 info="info") 214 223 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] 226 242 227 243 if len(file_errors) > 0: … … 233 249 error_message += message + "\n" 234 250 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 239 260 240 261 def load_update(self, output=None, message="", info="warning"): … … 245 266 wx.PostEvent(self.parent, StatusEvent(status=message, info=info, 246 267 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, 254 274 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 48 48 '''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.''' 49 49 _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''' 51 51 52 52 _acknowledgement = \ -
src/sas/sasgui/guiframe/documentation_window.py
r959eb01 r6a455cd3 75 75 logger.error("Could not find Sphinx documentation at %s \ 76 76 -- 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() 82 86 else: 83 87 logger.error("No html2 support, popping up a web browser")
Note: See TracChangeset
for help on using the changeset viewer.