Changeset 34dbaf4 in sasview for src/sans/perspectives
- Timestamp:
- Apr 3, 2014 5:15:56 PM (11 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 27b7acc
- Parents:
- 2005bb5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/perspectives/fitting/basepage.py
reddb6ec r34dbaf4 22 22 from sans.guiframe.dataFitting import Data1D 23 23 from sans.guiframe.dataFitting import check_data_validity 24 from sans.guiframe.gui_style import GUIFRAME_ID 24 25 from sans.dataloader.data_info import Detector 25 26 from sans.dataloader.data_info import Source … … 772 773 event.Skip() 773 774 # It seems MAC needs wxCallAfter 774 wx.CallAfter(self.get_copy) 775 if event.GetId() == GUIFRAME_ID.COPYEX_ID: 776 print "copy excel" 777 wx.CallAfter(self.get_copy_excel) 778 elif event.GetId() == GUIFRAME_ID.COPYLAT_ID: 779 print "copy latex" 780 wx.CallAfter(self.get_copy_latex) 781 else: 782 wx.CallAfter(self.get_copy) 783 775 784 776 785 def on_paste(self, event): … … 3157 3166 else: 3158 3167 return False 3159 3168 3169 def get_copy_excel(self): 3170 """ 3171 Get copy params to clipboard 3172 """ 3173 content = self.get_copy_params_excel() 3174 flag = self.set_clipboard(content) 3175 self._copy_info(flag) 3176 return flag 3177 3178 def get_copy_params_excel(self): 3179 """ 3180 Get the string copies of the param names and values in the tap 3181 """ 3182 content = '' 3183 3184 crlf = chr(13) + chr(10) 3185 tab = chr(9) 3186 3187 # Do it if params exist 3188 if self.parameters != []: 3189 3190 for param in self.parameters: 3191 content += param[1] #parameter name 3192 content += tab 3193 content += param[1]+"_err" 3194 content += tab 3195 3196 content += crlf 3197 3198 #row of values and errors... 3199 for param in self.parameters: 3200 content += param[2].GetValue() #value 3201 content +=tab 3202 content += param[4].GetValue() #error 3203 content +=tab 3204 3205 return content 3206 else: 3207 return False 3208 3209 3210 def get_copy_latex(self): 3211 """ 3212 Get copy params to clipboard 3213 """ 3214 content = self.get_copy_params_latex() 3215 flag = self.set_clipboard(content) 3216 self._copy_info(flag) 3217 return flag 3218 3219 def get_copy_params_latex(self): 3220 """ 3221 Get the string copies of the param names and values in the tap 3222 """ 3223 content = '\\begin{table}' 3224 content += '\\begin{tabular}[h]' 3225 3226 crlf = chr(13) + chr(10) 3227 tab = chr(9) 3228 3229 # Do it if params exist 3230 if self.parameters != []: 3231 3232 content += '{|' 3233 for param in self.parameters: 3234 content += 'l|l|' 3235 content += '}\hline' 3236 content += crlf 3237 3238 for index, param in enumerate(self.parameters): 3239 content += param[1].replace('_','\_') #parameter name 3240 content += ' & ' 3241 content += param[1].replace('_','\_')+"\_err" 3242 if index < len(self.parameters)-1: 3243 content += ' & ' 3244 content += '\\\\ \\hline' 3245 content += crlf 3246 3247 #row of values and errors... 3248 for index, param in enumerate(self.parameters): 3249 content += param[2].GetValue() #parameter value 3250 content += ' & ' 3251 content += param[4].GetValue() #parameter error 3252 if index < len(self.parameters)-1: 3253 content += ' & ' 3254 content += '\\\\ \\hline' 3255 content += crlf 3256 3257 content += '\\end{tabular}' 3258 content += '\\end{table}' 3259 return content 3260 else: 3261 return False 3262 3263 3160 3264 def set_clipboard(self, content=None): 3161 3265 """
Note: See TracChangeset
for help on using the changeset viewer.