Changeset 2387abc in sasview for src/sas/sasgui/guiframe/local_perspectives
- Timestamp:
- Aug 19, 2016 11:02:55 AM (8 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 6f343e3
- Parents:
- 32c5983 (diff), 45d7662 (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/local_perspectives
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
rfaa3ae7 ra674d0b 162 162 logging.error("Loader returned an invalid object:\n %s" % str(item)) 163 163 data_error = True 164 164 165 165 data = self.parent.create_gui_data(item, p_file) 166 166 output[data.id] = data … … 170 170 """ 171 171 """ 172 message = "" 173 log_msg = '' 172 file_errors = {} 174 173 output = {} 175 any_error = False 176 data_error = False 177 error_message = "" 174 exception_occurred = False 175 178 176 for p_file in path: 179 info = "info"180 177 basename = os.path.basename(p_file) 181 178 _, extension = os.path.splitext(basename) 182 179 if extension.lower() in EXTENSIONS: 183 any_error = True184 180 log_msg = "Data Loader cannot " 185 log_msg += "load: %s\n" % str(p_file) 186 log_msg += """Please try to open that file from "open project" """ 187 log_msg += """or "open analysis" menu\n""" 188 error_message = log_msg + "\n" 181 log_msg += "load: {}\n".format(str(p_file)) 182 log_msg += "Please try to open that file from \"open project\"" 183 log_msg += "or \"open analysis\" menu." 189 184 logging.info(log_msg) 185 file_errors[basename] = [log_msg] 190 186 continue 191 187 192 188 try: 193 message = "Loading Data... " + str(p_file) + "\n"194 self.load_update(output=output, message=message, info= info)189 message = "Loading {}...\n".format(p_file) 190 self.load_update(output=output, message=message, info="info") 195 191 temp = self.loader.load(p_file, format) 196 if temp.__class__.__name__ == "list": 197 for item in temp: 198 output, error_message, data_error = \ 199 self._process_data_and_errors(item, 200 p_file, 201 output, 202 error_message) 203 else: 192 if not isinstance(temp, list): 193 temp = [temp] 194 for item in temp: 195 error_message = "" 204 196 output, error_message, data_error = \ 205 self._process_data_and_errors(temp, 206 p_file, 207 output, 208 error_message) 197 self._process_data_and_errors(item, 198 p_file, 199 output, 200 error_message) 201 if data_error: 202 if basename in file_errors.keys(): 203 file_errors[basename] += [error_message] 204 else: 205 file_errors[basename] = [error_message] 206 self.load_update(output=output, 207 message=error_message, info="warning") 208 209 self.load_update(output=output, 210 message="Loaded {}\n".format(p_file), 211 info="info") 212 209 213 except: 210 214 logging.error(sys.exc_value) 211 any_error = True 212 if any_error or error_message != "": 213 if error_message == "": 214 error = "Error: " + str(sys.exc_info()[1]) + "\n" 215 error += "while loading Data: \n%s\n" % str(basename) 216 error_message += "The data file you selected could not be loaded.\n" 217 error_message += "Make sure the content of your file" 218 error_message += " is properly formatted.\n\n" 219 error_message += "When contacting the SasView team, mention the" 220 error_message += " following:\n%s" % str(error) 221 elif data_error: 222 base_message = "Errors occurred while loading " 223 base_message += "{0}\n".format(basename) 224 base_message += "The data file loaded but with errors.\n" 225 error_message = base_message + error_message 226 else: 227 error_message += "%s\n" % str(p_file) 228 info = "error" 229 230 if any_error or error_message: 231 self.load_update(output=output, message=error_message, info=info) 232 else: 233 message = "Loading Data Complete! " 234 message += log_msg 235 self.load_complete(output=output, error_message=error_message, 236 message=message, path=path, info='info') 215 216 error_message = "The Data file you selected could not be loaded.\n" 217 error_message += "Make sure the content of your file" 218 error_message += " is properly formatted.\n" 219 error_message += "When contacting the SasView team, mention the" 220 error_message += " following:\n" 221 error_message += "Error: " + str(sys.exc_info()[1]) 222 file_errors[basename] = [error_message] 223 self.load_update(output=output, message=error_message, info="warning") 224 225 if len(file_errors) > 0: 226 error_message = "" 227 for filename, error_array in file_errors.iteritems(): 228 error_message += "The following errors occured whilst " 229 error_message += "loading {}:\n".format(filename) 230 for message in error_array: 231 error_message += message + "\n" 232 error_message += "\n" 233 self.load_update(output=output, message=error_message, info="error") 234 235 self.load_complete(output=output, message="Loading data complete!", 236 info="info") 237 237 238 238 def load_update(self, output=None, message="", info="warning"): … … 254 254 # self.load_error(error_message) 255 255 self.parent.add_data(data_list=output) 256 257 258 -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
ra47d0c8 r2387abc 552 552 self.subplot.set_xlim((xlo, xhi)) 553 553 self.subplot.set_ylim((ylo, yhi)) 554 self.graph.selected_plottable = None 554 555 555 556 … … 629 630 630 631 if self.parent.ClassName.count('wxDialog') == 0: 631 wx_id = ids.next() 632 plot_menu.Append(wx_id, '&Linear Fit', name) 633 wx.EVT_MENU(self, wx_id, self.onFitting) 634 plot_menu.AppendSeparator() 632 if plot.id != 'fit': 633 wx_id = ids.next() 634 plot_menu.Append(wx_id, '&Linear Fit', name) 635 wx.EVT_MENU(self, wx_id, self.onFitting) 636 plot_menu.AppendSeparator() 635 637 636 638 wx_id = ids.next() … … 694 696 self._slicerpop.AppendSeparator() 695 697 wx_id = ids.next() 698 self._slicerpop.Append(wx_id, '&Set Graph Range') 699 wx.EVT_MENU(self, wx_id, self.onSetRange) 700 wx_id = ids.next() 696 701 self._slicerpop.Append(wx_id, '&Reset Graph Range') 697 702 wx.EVT_MENU(self, wx_id, self.onResetGraph) … … 710 715 self.PopupMenu(self._slicerpop, pos) 711 716 717 def onSetRange(self, event): 718 # Display dialog 719 # self.subplot.set_xlim((low, high)) 720 # self.subplot.set_ylim((low, high)) 721 from sas.sasgui.plottools.RangeDialog import RangeDialog 722 d = RangeDialog(self, -1) 723 xlim = self.subplot.get_xlim() 724 ylim = self.subplot.get_ylim() 725 d.SetXRange(xlim) 726 d.SetYRange(ylim) 727 if d.ShowModal() == wx.ID_OK: 728 x_range = d.GetXRange() 729 y_range = d.GetYRange() 730 if x_range is not None and y_range is not None: 731 self.subplot.set_xlim(x_range) 732 self.subplot.set_ylim(y_range) 733 self.subplot.figure.canvas.draw_idle() 734 d.Destroy() 735 712 736 def onFreeze(self, event): 713 737 """ … … 796 820 int(curr_symbol))), curr_label) 797 821 self.appD.Bind(wx.EVT_CLOSE, self.on_AppDialog_close) 822 self.graph.selected_plottable = None 798 823 799 824 def on_AppDialog_close(self, event):
Note: See TracChangeset
for help on using the changeset viewer.