Changeset 34dbaf4 in sasview
- 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
- Location:
- src/sans
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/guiframe/gui_manager.py
r2498b9c r34dbaf4 1564 1564 'Paste parameter values') 1565 1565 wx.EVT_MENU(self, GUIFRAME_ID.PASTE_ID, self.on_paste_panel) 1566 1567 self._edit_menu.AppendSeparator() 1568 1569 self._edit_menu_copyas = wx.Menu() 1570 #Sub menu for Copy As... 1571 self._edit_menu_copyas.Append(GUIFRAME_ID.COPYEX_ID, 'Copy current tab to Excel', 1572 'Copy parameter values in tabular format') 1573 wx.EVT_MENU(self, GUIFRAME_ID.COPYEX_ID, self.on_copy_panel) 1574 1575 self._edit_menu_copyas.Append(GUIFRAME_ID.COPYLAT_ID, 'Copy current tab to LaTeX', 1576 'Copy parameter values in tabular format') 1577 wx.EVT_MENU(self, GUIFRAME_ID.COPYLAT_ID, self.on_copy_panel) 1578 1579 1580 self._edit_menu.AppendMenu(GUIFRAME_ID.COPYAS_ID, 'Copy Params as...', self._edit_menu_copyas, 1581 'Copy parameter values in various formats') 1582 1583 1566 1584 self._edit_menu.AppendSeparator() 1567 1585 … … 2736 2754 self._edit_menu.Enable(GUIFRAME_ID.PASTE_ID, flag) 2737 2755 2756 #Copy menu 2757 flag = self.cpanel_on_focus.get_copy_flag() 2758 #self._edit_menu.ENABLE(GUIFRAME_ID.COPYAS_ID,flag) 2759 self._edit_menu_copyas.Enable(GUIFRAME_ID.COPYEX_ID, flag) 2760 self._edit_menu_copyas.Enable(GUIFRAME_ID.COPYLAT_ID, flag) 2761 2738 2762 flag = self.cpanel_on_focus.get_preview_flag() 2739 2763 self._edit_menu.Enable(GUIFRAME_ID.PREVIEW_ID, flag) … … 2746 2770 self._edit_menu.Enable(GUIFRAME_ID.COPY_ID, flag) 2747 2771 self._edit_menu.Enable(GUIFRAME_ID.PASTE_ID, flag) 2748 2772 #self._edit_menu.Enable(GUIFRAME_ID.COPYEX_ID, flag) 2773 #self._edit_menu.Enable(GUIFRAME_ID.COPYLAT_ID, flag) 2774 #self._edit_menu.Enable(GUIFRAME_ID.COPYAS_ID, flag) 2749 2775 self._edit_menu.Enable(GUIFRAME_ID.PREVIEW_ID, flag) 2750 2776 self._edit_menu.Enable(GUIFRAME_ID.RESET_ID, flag) -
src/sans/guiframe/gui_style.py
r5777106 r34dbaf4 37 37 CURRENT_APPLICATION = wx.NewId() 38 38 CURVE_SYMBOL_NUM = 13 39 39 COPYEX_ID = wx.NewId() 40 COPYLAT_ID = wx.NewId() 41 COPYAS_ID = wx.NewId() 42 43 40 44 class GUIFRAME_ICON: 41 45 PATH = get_data_path(media='images') -
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.