- Timestamp:
- Apr 17, 2018 7:29:25 AM (7 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- 666454e, 1cf490b6, cd10013, c192960
- Parents:
- 94f074c4 (diff), 91552b5 (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. - git-author:
- Paul Butler <butlerpd@…> (04/17/18 07:29:25)
- git-committer:
- GitHub <noreply@…> (04/17/18 07:29:25)
- Location:
- src/sas
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/fit/pagestate.py
r9e6aeaf r3b070a0 646 646 name = value.split(':', 1)[1].strip() 647 647 file_value = "File name:" + name 648 #Truncating string so print doesn't complain of being outside margins 649 if sys.platform != "win32": 650 MAX_STRING_LENGHT = 50 651 if len(file_value) > MAX_STRING_LENGHT: 652 file_value = "File name:.."+file_value[-MAX_STRING_LENGHT+10:] 648 653 file_name = CENTRE % file_value 649 654 if len(title) == 0: … … 721 726 html_str, text_str, title = self._get_report_string() 722 727 # Allow 2 figures to append 723 image_links = [FEET_2%fig for fig in fig_urls] 724 728 #Constraining image width for OSX and linux, so print doesn't complain of being outside margins 729 if sys.platform == "win32": 730 image_links = [FEET_2%fig for fig in fig_urls] 731 else: 732 image_links = [FEET_2_unix%fig for fig in fig_urls] 725 733 # final report html strings 726 734 report_str = html_str + ELINE.join(image_links) 727 735 report_str += FEET_3 728 736 return report_str, text_str 729 737 … … 1368 1376 """ 1369 1377 FEET_2 = \ 1370 """<img src="%s" ></img> 1378 """<img src="%s"></img> 1379 """ 1380 FEET_2_unix = \ 1381 """<img src="%s" width="540"></img> 1371 1382 """ 1372 1383 FEET_3 = \ -
src/sas/sasgui/guiframe/report_dialog.py
r69a6897 r91552b5 27 27 class BaseReportDialog(wx.Dialog): 28 28 29 def __init__(self, report_list, *args, **kwds):29 def __init__(self, report_list, imgRAM, fig_urls, *args, **kwds): 30 30 """ 31 31 Initialization. The parameters added to Dialog are: … … 37 37 kwds["image"] = 'Dynamic Image' 38 38 39 #MemoryFSHandle for storing images 40 self.imgRAM = imgRAM 41 #Images location in urls 42 self.fig_urls = fig_urls 39 43 # title 40 44 self.SetTitle("Report") … … 75 79 hbox.Add(button_print) 76 80 77 button_save = wx.Button(self, wx.NewId(), "Save") 78 button_save.SetToolTipString("Save this report.") 79 button_save.Bind(wx.EVT_BUTTON, self.onSave, id=button_save.GetId()) 80 hbox.Add(button_save) 81 if sys.platform != "darwin": 82 button_save = wx.Button(self, wx.NewId(), "Save") 83 button_save.SetToolTipString("Save this report.") 84 button_save.Bind(wx.EVT_BUTTON, self.onSave, id=button_save.GetId()) 85 hbox.Add(button_save) 81 86 82 87 # panel for report page … … 111 116 printh.PrintText(self.report_html) 112 117 118 113 119 def OnClose(self, event=None): 114 120 """ … … 116 122 : event: Close button event 117 123 """ 124 for fig in self.fig_urls: 125 self.imgRAM.RemoveFile(fig) 126 118 127 self.Close() 119 128 -
src/sas/sasgui/perspectives/fitting/basepage.py
r1f4d708 r5818dae 641 641 # get the strings for report 642 642 report_str, text_str = self.state.report(fig_urls=refs) 643 644 643 # Show the dialog 645 644 report_list = [report_str, text_str, images] 646 dialog = ReportDialog(report_list, None, wx.ID_ANY, "")645 dialog = ReportDialog(report_list, imgRAM, refs, None, wx.ID_ANY, "") 647 646 dialog.Show() 648 647 … … 677 676 refs.append('memory:' + name) 678 677 imgRAM.AddFile(name, canvas.bitmap, wx.BITMAP_TYPE_PNG) 679 680 678 # append figs 681 679 images.append(fig) -
src/sas/sascalc/dataloader/file_reader_base_class.py
ra58b5a0 r4a8d55c 31 31 FIELDS_2D = ('data', 'qx_data', 'qy_data', 'q_data', 'err_data', 32 32 'dqx_data', 'dqy_data', 'mask') 33 33 DEPRECATION_MESSAGE = ("\rThe extension of this file suggests the data set migh" 34 "t not be fully reduced. Support for the reader associat" 35 "ed with this file type has been removed. An attempt to " 36 "load the file was made, but, should it be successful, " 37 "SasView cannot guarantee the accuracy of the data.") 34 38 35 39 class FileReader(object): … … 40 44 # List of allowed extensions 41 45 ext = ['.txt'] 46 # Deprecated extensions 47 deprecated_extensions = ['.asc', '.nxs'] 42 48 # Bypass extension check and try to load anyway 43 49 allow_all = False … … 87 93 if not self.f_open.closed: 88 94 self.f_open.close() 95 if any(filepath.lower().endswith(ext) for ext in 96 self.deprecated_extensions): 97 self.handle_error_message(DEPRECATION_MESSAGE) 89 98 if len(self.output) > 0: 90 99 # Sort the data that's been loaded … … 146 155 else: 147 156 logger.warning(msg) 157 raise NoKnownLoaderException(msg) 148 158 149 159 def send_to_output(self): -
src/sas/sascalc/dataloader/loader.py
rdc8d1c2 r4a8d55c 90 90 ascii_loader = ascii_reader.Reader() 91 91 return ascii_loader.read(path) 92 except NoKnownLoaderException: 93 pass # Try the Cansas XML reader 92 94 except DefaultReaderException: 93 95 pass # Loader specific error to try the cansas XML reader … … 100 102 cansas_loader = cansas_reader.Reader() 101 103 return cansas_loader.read(path) 104 except NoKnownLoaderException: 105 pass # Try the NXcanSAS reader 102 106 except DefaultReaderException: 103 107 pass # Loader specific error to try the NXcanSAS reader -
src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
r20fa5fe r2924532 185 185 try: 186 186 message = "Loading {}...\n".format(p_file) 187 self.load_update( output=output,message=message, info="info")187 self.load_update(message=message, info="info") 188 188 temp = self.loader.load(p_file, format) 189 189 if not isinstance(temp, list): … … 201 201 else: 202 202 file_errors[basename] = [error_message] 203 self.load_update(output=output, 204 message=error_message, info="warning") 205 206 self.load_update(output=output, 207 message="Loaded {}\n".format(p_file), 208 info="info") 203 204 self.load_update(message="Loaded {}\n".format(p_file), 205 info="info") 209 206 210 207 except NoKnownLoaderException as e: 211 208 exception_occurred = True 212 logger.error(e.message)213 214 209 error_message = "Loading data failed!\n" + e.message 215 self.load_update(output=None, message=e.message, info="warning") 210 self.load_complete(output=None, 211 message=error_message, 212 info="warning") 216 213 217 214 except Exception as e: 218 215 exception_occurred = True 219 logger.error(e.message)220 221 216 file_err = "The Data file you selected could not be " 222 217 file_err += "loaded.\nMake sure the content of your file" … … 225 220 file_err += " following:\n" 226 221 file_err += e.message 227 file_errors[basename] = [file_err] 222 self.load_complete(output=None, 223 message=file_err, 224 info="error") 228 225 229 226 if len(file_errors) > 0: 230 227 error_message = "" 231 228 for filename, error_array in file_errors.iteritems(): 232 error_message += "The following errors occured whilst "229 error_message += "The following issues were found whilst " 233 230 error_message += "loading {}:\n".format(filename) 234 231 for message in error_array: 235 232 error_message += message + "\n" 236 error_message += "\n" 237 if not exception_occurred: # Some data loaded but with errors 238 self.load_update(output=output, message=error_message, info="error") 239 240 if not exception_occurred: # Everything loaded as expected 233 error_message = error_message[:-1] 234 self.load_complete(output=output, 235 message=error_message, 236 info="error") 237 238 elif not exception_occurred: # Everything loaded as expected 241 239 self.load_complete(output=output, message="Loading data complete!", 242 240 info="info") … … 244 242 self.load_complete(output=None, message=error_message, info="error") 245 243 246 247 def load_update(self, output=None, message="", info="warning"): 244 def load_update(self, message="", info="warning"): 248 245 """ 249 246 print update on the status bar 250 247 """ 251 248 if message != "": 252 wx.PostEvent(self.parent, StatusEvent(status=message, info=info, 249 wx.PostEvent(self.parent, StatusEvent(status=message, 250 info=info, 253 251 type="progress")) 254 252 … … 257 255 post message to status bar and return list of data 258 256 """ 259 wx.PostEvent(self.parent, StatusEvent(status=message, info=info, 257 wx.PostEvent(self.parent, StatusEvent(status=message, 258 info=info, 260 259 type="stop")) 261 260 if output is not None:
Note: See TracChangeset
for help on using the changeset viewer.