Changes in / [4699761:348bc8b] in sasview
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
build_tools/jenkins_win64_build.bat
rab06de7 rb636c0ba 4 4 set INNO="C:\util\inno\ISCC.exe" 5 5 set GIT_SED=C:\"Program Files"\Git\bin\sed.exe 6 7 6 set SAS_COMPILER=tinycc 8 set WORKSPACE=C:\build9 7 10 8 set PYTHONPATH=%WORKSPACE%\sasview\utils … … 23 21 %GIT_SED% -i.bak "s/GIT_COMMIT/%githash%/g" __init__.py 24 22 25 26 27 23 :: MAKE DIR FOR EGGS ################################################## 28 24 cd %WORKSPACE% … … 30 26 MD sasview-install 31 27 MD utils 28 29 :: TINYCC build #################################################### 30 cd %WORKSPACE% 31 cd tinycc 32 %PYTHON% setup.py build 33 xcopy /S build\lib\* %WORKSPACE%\sasview\utils\ 32 34 33 35 … … 37 39 %PYTHON% setup.py build 38 40 39 40 41 41 :: SASMODELS doc ###################################################### 42 42 cd doc 43 43 make html 44 45 44 46 45 :: SASMODELS build egg ################################################ … … 48 47 cd sasmodels 49 48 %PYTHON% setup.py bdist_egg 50 51 49 52 50 :: SASMODELS install egg ############################################## … … 79 77 80 78 81 :: TINYCC build ####################################################82 cd %WORKSPACE%83 cd tinycc84 %PYTHON% setup.py build85 xcopy /S build\lib\* %WORKSPACE%\sasview\utils\86 87 79 :: SASVIEW INSTALLER ################################################## 88 80 cd %WORKSPACE% -
docs/sphinx-docs/build_sphinx.py
reff1a8fc r8096b446 35 35 #/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 36 36 SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 37 SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism") 38 SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism", "mag_img") 37 39 SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "models") 38 40 SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model") … … 43 45 SASMODELS_DEST_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "source", "user", "models") 44 46 SASMODELS_DEST_IMG = os.path.join(CURRENT_SCRIPT_DIR, "source", "user", "model-imgs", "new-models") 47 SASMODELS_DEST_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "source", "user", "mag_img") 45 48 SASMODELS_DEST_BUILDIMG = os.path.join(CURRENT_SCRIPT_DIR, "source", "user", "models", "img") 46 49 … … 136 139 137 140 copy_tree(docs, dest_dir) 138 141 139 142 # Now pickup testdata_help.rst 140 143 # print os.path.abspath(SASVIEW_TEST) … … 143 146 if os.path.exists(SASVIEW_TEST): 144 147 print "Found docs folder at ", SASVIEW_TEST 145 shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST) 146 147 print "=== And the Sasmodels Docs ===" 148 shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST) 149 150 print "=== And the Sasmodels Docs ===" 148 151 # Make sure we have the relevant images for the new sasmodels documentation 149 152 # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build) … … 174 177 shutil.copy(fromhere,tohere) 175 178 else: print "no source directorty",SASMODELS_SOURCE_AUTOIMG ,"was found" 176 179 177 180 # And the rst prolog with the unit substitutions 178 181 if os.path.exists(SASMODELS_SOURCE_PROLOG): … … 186 189 tohere=os.path.join(SASMODELS_DEST_PROLOG,files) 187 190 shutil.copy(fromhere,tohere) 191 192 if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 193 print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM 194 if os.path.exists(SASMODELS_DEST_REF_MODELS): 195 print "Found docs folder SASMODELS_DEST_REF_MODELS at ", SASMODELS_DEST_REF_MODELS 196 print "Copying sasmodels model toctree files..." 197 for files in os.listdir(SASMODELS_SOURCE_MAGNETISM): 198 if files.endswith(".rst"): 199 fromhere=os.path.join(SASMODELS_SOURCE_MAGNETISM,files) 200 tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 201 shutil.copy(fromhere,tohere) 202 203 if os.path.exists(SASMODELS_SOURCE_MAGIMG): 204 print "Found img folder SASMODELS_SOURCE_MAGIMG at ", SASMODELS_SOURCE_MAGIMG 205 if not os.path.exists(SASMODELS_DEST_MAGIMG): 206 print "Missing docs folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG 207 os.makedirs(SASMODELS_DEST_MAGIMG) 208 print "created SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG 209 print "Copying sasmodels model auto-generated image files..." 210 for files in os.listdir(SASMODELS_SOURCE_MAGIMG): 211 fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files) 212 tohere=os.path.join(SASMODELS_DEST_MAGIMG,files) 213 shutil.copy(fromhere,tohere) 214 else: print "no source directorty",SASMODELS_SOURCE_MAGIMG ,"was found" 188 215 189 216 if os.path.exists(SASMODELS_SOURCE_REF_MODELS): -
sasview/setup_exe.py
rc3e4e213 r98d89df 243 243 data_files.append(('.', [f])) 244 244 245 # atlas DLL required by matplotlib 11.1 246 # ** REVISIT WHEN MOVING TO ANACONDA ** 247 f = "c:\\python27\\lib\\site-packages\\numpy\\core\\numpy-atlas.dll" 248 if os.path.isfile(f): 249 data_files.append(('.', [f])) 250 245 # numerical libraries 246 def dll_check(dll_path, dlls): 247 dll_includes = [os.path.join(dll_path, dll+'.dll') for dll in dlls] 248 return [dll for dll in dll_includes if os.path.exists(dll)] 249 250 python_root = os.path.dirname(os.path.abspath(sys.executable)) 251 # Check for ATLAS 252 dll_path = os.path.join(python_root, 'lib', 'site-packages', 'numpy', 'core') 253 dlls = ['numpy-atlas'] 254 atlas_dlls = dll_check(dll_path, dlls) 255 256 # Check for MKL 257 dll_path = os.path.join(python_root, 'Library', 'bin') 258 dlls = ['mkl_core', 'mkl_def', 'libiomp5md'] 259 mkl_dlls = dll_check(dll_path, dlls) 260 261 if atlas_dlls: 262 data_files.append(('.', atlas_dlls)) 263 elif mkl_dlls: 264 data_files.append(('.', mkl_dlls)) 265 251 266 if os.path.isfile("BUILD_NUMBER"): 252 267 data_files.append(('.', ["BUILD_NUMBER"])) -
src/sas/sasgui/guiframe/data_panel.py
rb5c44f0 re767897 2 2 #This software was developed by the University of Tennessee as part of the 3 3 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 4 #project funded by the US National Science Foundation. 4 #project funded by the US National Science Foundation. 5 5 # 6 6 #See the license text in license.txt … … 41 41 as QucikPlotDialog 42 42 import sas.sasgui.guiframe.config as config 43 43 44 44 extension_list = [] 45 45 if config.APPLICATION_STATE_EXTENSION is not None: 46 46 extension_list.append(config.APPLICATION_STATE_EXTENSION) 47 EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS + extension_list 47 EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS + extension_list 48 48 PLUGINS_WLIST = config.PLUGINS_WLIST 49 49 APPLICATION_WLIST = config.APPLICATION_WLIST 50 50 51 #Control panel width 51 #Control panel width 52 52 if sys.platform.count("win32") > 0: 53 53 PANEL_WIDTH = 235 … … 67 67 STYLE_FLAG = wx.RAISED_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\ 68 68 wx.WANTS_CHARS|CT.TR_HAS_VARIABLE_ROW_HEIGHT 69 70 69 70 71 71 class DataTreeCtrl(CT.CustomTreeCtrl): 72 72 """ … … 97 97 CT.CustomTreeCtrl.__init__(self, parent, *args, **kwds) 98 98 self.root = self.AddRoot("Available Data") 99 99 100 100 def OnCompareItems(self, item1, item2): 101 """ 102 Overrides OnCompareItems in wx.TreeCtrl. 103 Used by the SortChildren method. 101 """ 102 Overrides OnCompareItems in wx.TreeCtrl. 103 Used by the SortChildren method. 104 104 """ 105 105 # Get the item data … … 113 113 else: 114 114 return 0 115 115 116 116 class DataPanel(ScrolledPanel, PanelBase): 117 117 """ 118 This panel displays data available in the application and widgets to 118 This panel displays data available in the application and widgets to 119 119 interact with data. 120 120 """ … … 123 123 ## Title to appear on top of the window 124 124 window_caption = "Data Explorer" 125 #type of window 125 #type of window 126 126 window_type = "Data Panel" 127 127 ## Flag to tell the GUI manager that this panel is not 128 128 # tied to any perspective 129 129 #ALWAYS_ON = True 130 def __init__(self, parent, 130 def __init__(self, parent, 131 131 list=None, 132 132 size=(PANEL_WIDTH, PANEL_HEIGHT), … … 138 138 PanelBase.__init__(self, parent) 139 139 self.SetupScrolling() 140 #Set window's font size 140 #Set window's font size 141 141 self.SetWindowVariant(variant=FONT_VARIANT) 142 self.loader = Loader() 142 self.loader = Loader() 143 143 #Default location 144 self._default_save_location = None 144 self._default_save_location = None 145 145 self.all_data1d = True 146 146 self.parent = parent.parent … … 188 188 if self.parent is not None: 189 189 self.parent.Bind(EVT_DELETE_PLOTPANEL, self._on_delete_plot_panel) 190 190 191 191 def do_layout(self): 192 192 """ … … 198 198 self.layout_batch() 199 199 self.layout_button() 200 200 201 201 def disable_app_combo(self, enable): 202 202 """ … … 204 204 """ 205 205 self.perspective_cbox.Enable(enable) 206 206 207 207 def define_panel_structure(self): 208 208 """ … … 213 213 self.sizer1 = wx.BoxSizer(wx.VERTICAL) 214 214 self.sizer1.SetMinSize(wx.Size(w/13, h*2/5)) 215 215 216 216 self.sizer2 = wx.BoxSizer(wx.VERTICAL) 217 217 self.sizer3 = wx.FlexGridSizer(9, 2, 4, 1) 218 218 self.sizer4 = wx.BoxSizer(wx.VERTICAL) 219 219 self.sizer5 = wx.BoxSizer(wx.VERTICAL) 220 220 221 221 self.vbox.Add(self.sizer5, 0, wx.EXPAND|wx.ALL, 1) 222 222 self.vbox.Add(self.sizer1, 1, wx.EXPAND|wx.ALL, 0) … … 224 224 self.vbox.Add(self.sizer3, 0, wx.EXPAND|wx.ALL, 10) 225 225 #self.vbox.Add(self.sizer4, 0, wx.EXPAND|wx.ALL,5) 226 226 227 227 self.SetSizer(self.vbox) 228 228 229 229 def layout_selection(self): 230 230 """ … … 244 244 self.selection_cbox.SetValue('Select all Data') 245 245 wx.EVT_COMBOBOX(self.selection_cbox, -1, self._on_selection_type) 246 self.sizer5.AddMany([(select_txt, 0, wx.ALL, 5), 246 self.sizer5.AddMany([(select_txt, 0, wx.ALL, 5), 247 247 (self.selection_cbox, 0, wx.ALL,5)]) 248 248 self.enable_selection() 249 250 249 250 251 251 def _on_selection_type(self, event): 252 252 """ … … 254 254 :param event: UI event 255 255 """ 256 def check_item_and_children(control, check_value=True): 257 self.tree_ctrl.CheckItem(data_ctrl, check_value) 258 if data_ctrl.HasChildren(): 259 if check_value == True and not control.IsExpanded(): 260 # Only select children if control is expanded 261 # Always deselect children, regardless (see ticket #259) 262 return 263 for child_ctrl in data_ctrl.GetChildren(): 264 self.tree_ctrl.CheckItem(child_ctrl, check_value) 265 256 266 option = self.selection_cbox.GetValue() 257 267 258 268 pos = self.selection_cbox.GetSelection() 259 269 if pos == wx.NOT_FOUND: 260 return 270 return 261 271 option = self.selection_cbox.GetString(pos) 262 272 for item in self.list_cb_data.values(): 263 273 data_ctrl, _, _, _, _, _, _, _ = item 264 _, data_class, _ = self.tree_ctrl.GetItemPyData(data_ctrl) 274 _, data_class, _ = self.tree_ctrl.GetItemPyData(data_ctrl) 265 275 if option == 'Select all Data': 266 self.tree_ctrl.CheckItem(data_ctrl, True)276 check_item_and_children(data_ctrl, check_value=True) 267 277 elif option == 'Unselect all Data': 268 self.tree_ctrl.CheckItem(data_ctrl,False)278 check_item_and_children(data_ctrl, check_value=False) 269 279 elif option == 'Select all Data 1D': 270 280 if data_class == 'Data1D': 271 self.tree_ctrl.CheckItem(data_ctrl, True)281 check_item_and_children(data_ctrl, check_value=True) 272 282 elif option == 'Unselect all Data 1D': 273 283 if data_class == 'Data1D': 274 self.tree_ctrl.CheckItem(data_ctrl, False) 275 elif option == 'Select all Data 1D': 276 if data_class == 'Data1D': 277 self.tree_ctrl.CheckItem(data_ctrl, True) 284 check_item_and_children(data_ctrl, check_value=False) 278 285 elif option == 'Select all Data 2D': 279 286 if data_class == 'Data2D': 280 self.tree_ctrl.CheckItem(data_ctrl, True)287 check_item_and_children(data_ctrl, check_value=True) 281 288 elif option == 'Unselect all Data 2D': 282 289 if data_class == 'Data2D': 283 self.tree_ctrl.CheckItem(data_ctrl, False)290 check_item_and_children(data_ctrl, check_value=False) 284 291 self.enable_append() 285 292 self.enable_freeze() … … 287 294 self.enable_import() 288 295 self.enable_remove() 289 296 290 297 def layout_button(self): 291 298 """ … … 293 300 """ 294 301 #Load Data Button 295 self.bt_add = wx.Button(self, wx.NewId(), "Load Data", 302 self.bt_add = wx.Button(self, wx.NewId(), "Load Data", 296 303 size=(BUTTON_WIDTH, -1)) 297 304 self.bt_add.SetToolTipString("Load data files") 298 305 wx.EVT_BUTTON(self, self.bt_add.GetId(), self._load_data) 299 306 300 307 #Delete Data Button 301 308 self.bt_remove = wx.Button(self, wx.NewId(), "Delete Data", … … 303 310 self.bt_remove.SetToolTipString("Delete data from the application") 304 311 wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) 305 312 306 313 #Send data to perspective button 307 314 self.bt_import = wx.Button(self, wx.NewId(), "Send To", … … 309 316 self.bt_import.SetToolTipString("Send Data set to active perspective") 310 317 wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import) 311 318 312 319 #Choose perspective to be send data to combo box 313 320 self.perspective_cbox = wx.ComboBox(self, -1, … … 315 322 if not IS_MAC: 316 323 self.perspective_cbox.SetMinSize((BUTTON_WIDTH*1.6, -1)) 317 wx.EVT_COMBOBOX(self.perspective_cbox, -1, 324 wx.EVT_COMBOBOX(self.perspective_cbox, -1, 318 325 self._on_perspective_selection) 319 326 320 327 #Append data to current Graph Button 321 328 self.bt_append_plot = wx.Button(self, wx.NewId(), "Append Plot To", … … 324 331 "Plot the selected data in the active panel") 325 332 wx.EVT_BUTTON(self, self.bt_append_plot.GetId(), self.on_append_plot) 326 333 327 334 #Create a new graph and send data to that new graph button 328 self.bt_plot = wx.Button(self, wx.NewId(), "New Plot", 335 self.bt_plot = wx.Button(self, wx.NewId(), "New Plot", 329 336 size=(BUTTON_WIDTH, -1)) 330 337 self.bt_plot.SetToolTipString("To trigger plotting") 331 338 wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) 332 339 333 340 #Freeze current theory button - becomes a data set and stays on graph 334 self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze Theory", 341 self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze Theory", 335 342 size=(BUTTON_WIDTH, -1)) 336 343 freeze_tip = "To trigger freeze a theory: making a copy\n" … … 339 346 self.bt_freeze.SetToolTipString(freeze_tip) 340 347 wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze) 341 348 342 349 #select plot to send to combo box (blank if no data) 343 350 if sys.platform == 'darwin': 344 self.cb_plotpanel = wx.ComboBox(self, -1, 351 self.cb_plotpanel = wx.ComboBox(self, -1, 345 352 style=wx.CB_READONLY) 346 353 else: 347 self.cb_plotpanel = wx.ComboBox(self, -1, 354 self.cb_plotpanel = wx.ComboBox(self, -1, 348 355 style=wx.CB_READONLY|wx.CB_SORT) 349 356 wx.EVT_COMBOBOX(self.cb_plotpanel, -1, self._on_plot_selection) 350 357 self.cb_plotpanel.Disable() 351 358 352 359 #Help button 353 360 self.bt_help = wx.Button(self, wx.NewId(), "HELP", … … 365 372 ((10, 10)), 366 373 (self.bt_append_plot), 367 (self.cb_plotpanel, 374 (self.cb_plotpanel, 368 375 wx.EXPAND|wx.ADJUST_MINSIZE, 5), 369 376 ((5, 5)), 370 377 ((5, 5)), 371 378 (self.bt_import, 0, wx.EXPAND|wx.RIGHT, 5), 372 (self.perspective_cbox, 379 (self.perspective_cbox, 373 380 wx.EXPAND|wx.ADJUST_MINSIZE, 5), 374 381 ((10, 10)), … … 385 392 self.enable_freeze() 386 393 self.enable_remove_plot() 387 394 388 395 def layout_batch(self): 389 396 """ … … 397 404 self.Bind(wx.EVT_RADIOBUTTON, self.on_batch_mode, 398 405 id=self.rb_batch_mode.GetId()) 399 406 400 407 self.rb_single_mode.SetValue(not self.parent.batch_on) 401 408 self.rb_batch_mode.SetValue(self.parent.batch_on) 402 409 self.sizer4.AddMany([(self.rb_single_mode, 0, wx.ALL, 4), 403 410 (self.rb_batch_mode, 0, wx.ALL, 4)]) 404 411 405 412 def on_single_mode(self, event): 406 413 """ … … 410 417 if self.parent is not None: 411 418 wx.PostEvent(self.parent, NewBatchEvent(enable=False)) 412 419 413 420 def on_batch_mode(self, event): 414 421 """ … … 417 424 """ 418 425 if self.parent is not None: 419 wx.PostEvent(self.parent, 426 wx.PostEvent(self.parent, 420 427 NewBatchEvent(enable=True)) 421 422 def _get_data_selection(self, event): 428 429 def _get_data_selection(self, event): 423 430 """ 424 431 Get data selection from the right click … … 435 442 data = theory_list.values()[0][0] 436 443 return data 437 444 438 445 def on_edit_data(self, event): 439 446 """ … … 443 450 from sas.sasgui.guiframe.local_perspectives.plotting.masking \ 444 451 import MaskPanel as MaskDialog 445 446 panel = MaskDialog(parent=self.parent, base=self, 452 453 panel = MaskDialog(parent=self.parent, base=self, 447 454 data=data, id=wx.NewId()) 448 455 panel.ShowModal() 449 456 450 457 def on_plot_3d(self, event): 451 458 """ … … 455 462 from sas.sasgui.guiframe.local_perspectives.plotting.masking \ 456 463 import FloatPanel as Float3dDialog 457 458 panel = Float3dDialog(base=self, data=data, 464 465 panel = Float3dDialog(base=self, data=data, 459 466 dimension=3, id=wx.NewId()) 460 panel.ShowModal() 461 467 panel.ShowModal() 468 462 469 def on_quick_plot(self, event): 463 470 """ … … 468 475 dimension = 2 469 476 else: 470 dimension = 1 471 #panel = QucikPlotDialog(base=self, data=data, 477 dimension = 1 478 #panel = QucikPlotDialog(base=self, data=data, 472 479 # dimension=dimension, id=wx.NewId()) 473 480 frame = QucikPlotDialog(self, -1, "Plot " + data.name, 'log_{10}') … … 477 484 frame.Show(True) 478 485 frame.SetFocus() 479 #panel.ShowModal() 480 486 #panel.ShowModal() 487 481 488 def on_data_info(self, event): 482 489 """ … … 488 495 else: 489 496 self.parent.show_data1d(data, data.name) 490 497 491 498 def on_save_as(self, event): 492 499 """ … … 506 513 else: 507 514 print "unable to save this type of data" 508 515 509 516 def layout_data_list(self): 510 517 """ … … 523 530 self.data_menu.Append(id, name, msg) 524 531 wx.EVT_MENU(self, id, self.on_data_info) 525 532 526 533 id = wx.NewId() 527 534 name = "Save As" … … 529 536 self.data_menu.Append(id, name, msg) 530 537 wx.EVT_MENU(self, id, self.on_save_as) 531 538 532 539 quickplot_id = wx.NewId() 533 540 name = "Quick Plot" … … 535 542 self.data_menu.Append(quickplot_id, name, msg) 536 543 wx.EVT_MENU(self, quickplot_id, self.on_quick_plot) 537 544 538 545 self.plot3d_id = wx.NewId() 539 546 name = "Quick 3DPlot (Slow)" … … 541 548 self.data_menu.Append(self.plot3d_id, name, msg) 542 549 wx.EVT_MENU(self, self.plot3d_id, self.on_plot_3d) 543 550 544 551 self.editmask_id = wx.NewId() 545 552 name = "Edit Mask" … … 547 554 self.data_menu.Append(self.editmask_id, name, msg) 548 555 wx.EVT_MENU(self, self.editmask_id, self.on_edit_data) 549 556 550 557 tree_ctrl_theory_label = wx.StaticText(self, -1, "Theory") 551 558 tree_ctrl_theory_label.SetForegroundColour('blue') 552 self.tree_ctrl_theory = DataTreeCtrl(parent=self, 559 self.tree_ctrl_theory = DataTreeCtrl(parent=self, 553 560 style=wx.SUNKEN_BORDER) 554 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, 561 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, 555 562 self.on_check_item) 556 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU, 563 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU, 557 564 self.on_right_click_theory) 558 565 self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10) … … 560 567 self.sizer1.Add(tree_ctrl_theory_label, 0, wx.LEFT, 10) 561 568 self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND|wx.ALL, 10) 562 569 563 570 def on_right_click_theory(self, event): 564 571 """ … … 575 582 self.data_menu.Enable(self.editmask_id, False) 576 583 self.data_menu.Enable(self.plot3d_id, menu_enable) 577 self.PopupMenu(self.data_menu) 578 584 self.PopupMenu(self.data_menu) 585 579 586 def on_right_click_data(self, event): 580 587 """ … … 596 603 self.data_menu.Enable(self.editmask_id, maskmenu_enable) 597 604 self.data_menu.Enable(self.plot3d_id, menu_enable) 598 self.PopupMenu(self.data_menu) 599 600 def onContextMenu(self, event): 605 self.PopupMenu(self.data_menu) 606 607 def onContextMenu(self, event): 601 608 """ 602 609 Retrieve the state selected state … … 606 613 pos = event.GetPosition() 607 614 pos = self.ScreenToClient(pos) 608 self.PopupMenu(self.popUpMenu, pos) 609 610 615 self.PopupMenu(self.popUpMenu, pos) 616 617 611 618 def on_check_item(self, event): 612 619 """ … … 614 621 """ 615 622 item = event.GetItem() 616 item.Check(not item.IsChecked()) 623 item.Check(not item.IsChecked()) 617 624 self.enable_append() 618 625 self.enable_freeze() … … 621 628 self.enable_remove() 622 629 event.Skip() 623 630 624 631 def fill_cbox_analysis(self, plugin): 625 632 """ … … 635 642 if plug.get_perspective(): 636 643 self.perspective_cbox.Append(plug.sub_menu, plug) 637 644 638 645 curr_pers = self.parent.get_current_perspective() 639 646 if curr_pers: 640 647 self.perspective_cbox.SetStringSelection(curr_pers.sub_menu) 641 648 self.enable_import() 642 649 643 650 def load_data_list(self, list): 644 651 """ … … 654 661 data_run = str(data.run) 655 662 data_class = data.__class__.__name__ 656 path = dstate.get_path() 663 path = dstate.get_path() 657 664 process_list = data.process 658 665 data_id = data.id … … 661 668 #new state 662 669 data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root, 663 0, data_name, ct_type=1, 670 0, data_name, ct_type=1, 664 671 data=(data_id, data_class, state_id)) 665 672 data_c.Check(True) 666 673 d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 667 d_t_c = self.tree_ctrl.AppendItem(d_i_c, 674 d_t_c = self.tree_ctrl.AppendItem(d_i_c, 668 675 'Title: %s' % data_title) 669 r_n_c = self.tree_ctrl.AppendItem(d_i_c, 676 r_n_c = self.tree_ctrl.AppendItem(d_i_c, 670 677 'Run: %s' % data_run) 671 i_c_c = self.tree_ctrl.AppendItem(d_i_c, 678 i_c_c = self.tree_ctrl.AppendItem(d_i_c, 672 679 'Type: %s' % data_class) 673 680 p_c_c = self.tree_ctrl.AppendItem(d_i_c, 674 681 "Path: '%s'" % s_path) 675 682 d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') 676 683 677 684 for process in process_list: 678 685 process_str = str(process).replace('\n',' ') … … 680 687 process_str = process_str[:20]+' [...]' 681 688 self.tree_ctrl.AppendItem(d_p_c, process_str) 682 theory_child = self.tree_ctrl.AppendItem(data_c, 689 theory_child = self.tree_ctrl.AppendItem(data_c, 683 690 "THEORIES") 684 self.list_cb_data[state_id] = [data_c, 691 self.list_cb_data[state_id] = [data_c, 685 692 d_i_c, 686 693 d_t_c, … … 695 702 data_c, d_i_c, d_t_c, r_n_c, i_c_c, p_c_c, d_p_c, _ \ 696 703 = data_ctrl_list 697 self.tree_ctrl.SetItemText(data_c, data_name) 704 self.tree_ctrl.SetItemText(data_c, data_name) 698 705 temp = (data_id, data_class, state_id) 699 self.tree_ctrl.SetItemPyData(data_c, temp) 700 self.tree_ctrl.SetItemText(i_c_c, 706 self.tree_ctrl.SetItemPyData(data_c, temp) 707 self.tree_ctrl.SetItemText(i_c_c, 701 708 'Type: %s' % data_class) 702 self.tree_ctrl.SetItemText(p_c_c, 703 'Path: %s' % s_path) 704 self.tree_ctrl.DeleteChildren(d_p_c) 709 self.tree_ctrl.SetItemText(p_c_c, 710 'Path: %s' % s_path) 711 self.tree_ctrl.DeleteChildren(d_p_c) 705 712 for process in process_list: 706 713 if not process.is_empty(): … … 710 717 # Sort by data name 711 718 if self.tree_ctrl.root: 712 self.tree_ctrl.SortChildren(self.tree_ctrl.root) 719 self.tree_ctrl.SortChildren(self.tree_ctrl.root) 713 720 self.enable_remove() 714 721 self.enable_import() … … 716 723 self.enable_freeze() 717 724 self.enable_selection() 718 725 719 726 def _uncheck_all(self): 720 727 """ … … 723 730 for item in self.list_cb_data.values(): 724 731 data_ctrl, _, _, _, _, _, _, _ = item 725 self.tree_ctrl.CheckItem(data_ctrl, False) 732 self.tree_ctrl.CheckItem(data_ctrl, False) 726 733 self.enable_append() 727 734 self.enable_freeze() … … 729 736 self.enable_import() 730 737 self.enable_remove() 731 738 732 739 def append_theory(self, state_id, theory_list): 733 740 """ … … 736 743 """ 737 744 if not theory_list: 738 return 745 return 739 746 if state_id not in self.list_cb_data.keys(): 740 747 root = self.tree_ctrl_theory.root … … 746 753 tree = self.tree_ctrl 747 754 if root is not None: 748 wx.CallAfter(self.append_theory_helper, tree=tree, root=root, 749 state_id=state_id, 755 wx.CallAfter(self.append_theory_helper, tree=tree, root=root, 756 state_id=state_id, 750 757 theory_list=theory_list) 751 752 758 759 753 760 def append_theory_helper(self, tree, root, state_id, theory_list): 754 761 """ … … 778 785 name, ct_type=1, data=temp) 779 786 t_i_c = tree.AppendItem(t_child, 'Info') 780 i_c_c = tree.AppendItem(t_i_c, 787 i_c_c = tree.AppendItem(t_i_c, 781 788 'Type: %s' % theory_class) 782 789 t_p_c = tree.AppendItem(t_i_c, 'Process') 783 790 784 791 for process in theory_data.process: 785 792 tree.AppendItem(t_p_c, process.__str__()) 786 theory_list_ctrl[theory_id] = [t_child, 787 i_c_c, 793 theory_list_ctrl[theory_id] = [t_child, 794 i_c_c, 788 795 t_p_c] 789 796 else: 790 797 #replace theory 791 798 t_child, i_c_c, t_p_c = theory_list_ctrl[theory_id] 792 tree.SetItemText(t_child, name) 793 tree.SetItemPyData(t_child, temp) 794 tree.SetItemText(i_c_c, 'Type: %s' % theory_class) 795 tree.DeleteChildren(t_p_c) 799 tree.SetItemText(t_child, name) 800 tree.SetItemPyData(t_child, temp) 801 tree.SetItemText(i_c_c, 'Type: %s' % theory_class) 802 tree.DeleteChildren(t_p_c) 796 803 for process in theory_data.process: 797 804 tree.AppendItem(t_p_c, process.__str__()) 798 805 799 806 else: 800 807 #data didn't have a theory associated it before … … 807 814 theory_id = theory_data.id 808 815 #if theory_state is not None: 809 # name = theory_state.model.name 816 # name = theory_state.model.name 810 817 temp = (theory_id, theory_class, state_id) 811 818 t_child = tree.AppendItem(root, 812 name, ct_type=1, 819 name, ct_type=1, 813 820 data=(theory_data.id, theory_class, state_id)) 814 821 t_i_c = tree.AppendItem(t_child, 'Info') 815 i_c_c = tree.AppendItem(t_i_c, 822 i_c_c = tree.AppendItem(t_i_c, 816 823 'Type: %s' % theory_class) 817 824 t_p_c = tree.AppendItem(t_i_c, 'Process') 818 825 819 826 for process in theory_data.process: 820 827 tree.AppendItem(t_p_c, process.__str__()) 821 828 822 829 theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c] 823 830 #self.list_cb_theory[data_id] = theory_list_ctrl 824 831 self.list_cb_theory[state_id] = theory_list_ctrl 825 826 827 832 833 834 828 835 def set_data_helper(self): 829 836 """ … … 840 847 if state_id not in state_to_plot: 841 848 state_to_plot.append(state_id) 842 849 843 850 for theory_dict in self.list_cb_theory.values(): 844 851 for _, value in theory_dict.iteritems(): … … 850 857 state_to_plot.append(state_id) 851 858 return data_to_plot, theory_to_plot, state_to_plot 852 859 853 860 def remove_by_id(self, id): 854 861 """ … … 857 864 for item in self.list_cb_data.values(): 858 865 data_c, _, _, _, _, _, _, _ = item 859 data_id, _, state_id = self.tree_ctrl.GetItemPyData(data_c) 866 data_id, _, state_id = self.tree_ctrl.GetItemPyData(data_c) 860 867 if id == data_id: 861 868 self.tree_ctrl.Delete(data_c) 862 869 del self.list_cb_data[state_id] 863 870 del self.list_cb_theory[data_id] 864 871 865 872 def load_error(self, error=None): 866 873 """ 867 874 Pop up an error message. 868 875 869 876 :param error: details error message to be displayed 870 877 """ 871 878 if error is not None or str(error).strip() != "": 872 dial = wx.MessageDialog(self.parent, str(error), 879 dial = wx.MessageDialog(self.parent, str(error), 873 880 'Error Loading File', 874 881 wx.OK | wx.ICON_EXCLAMATION) 875 dial.ShowModal() 876 882 dial.ShowModal() 883 877 884 def _load_data(self, event): 878 885 """ … … 881 888 if self.parent is not None: 882 889 wx.PostEvent(self.parent, NewLoadDataEvent()) 883 890 884 891 885 892 def on_remove(self, event): 886 893 """ 887 894 Get a list of item checked and remove them from the treectrl 888 Ask the parent to remove reference to this item 895 Ask the parent to remove reference to this item 889 896 """ 890 897 msg = "This operation will delete the data sets checked " … … 893 900 if msg_box.ShowModal() != wx.ID_OK: 894 901 return 895 902 896 903 data_to_remove, theory_to_remove, _ = self.set_data_helper() 897 904 data_key = [] … … 906 913 theory_list_ctrl = self.list_cb_theory[d_key] 907 914 theory_to_remove += theory_list_ctrl.keys() 908 # Remove theory from treectrl 915 # Remove theory from treectrl 909 916 for _, theory_dict in self.list_cb_theory.iteritems(): 910 917 for key, value in theory_dict.iteritems(): … … 916 923 pass 917 924 theory_key.append(key) 918 925 919 926 #Remove data and related theory references 920 927 for key in data_key: … … 934 941 pass 935 942 del theory_dict[key] 936 937 943 944 938 945 self.parent.remove_data(data_id=data_to_remove, 939 946 theory_id=theory_to_remove) … … 941 948 self.enable_freeze() 942 949 self.enable_remove_plot() 943 950 944 951 def on_import(self, event=None): 945 952 """ … … 951 958 temp = data_id + state_id 952 959 self.parent.set_data(data_id=temp, theory_id=theory_id) 953 960 954 961 def on_append_plot(self, event=None): 955 962 """ … … 958 965 self._on_plot_selection() 959 966 data_id, theory_id, state_id = self.set_data_helper() 960 self.parent.plot_data(data_id=data_id, 967 self.parent.plot_data(data_id=data_id, 961 968 state_id=state_id, 962 969 theory_id=theory_id, 963 970 append=True) 964 971 965 972 def on_plot(self, event=None): 966 973 """ … … 968 975 """ 969 976 data_id, theory_id, state_id = self.set_data_helper() 970 self.parent.plot_data(data_id=data_id, 977 self.parent.plot_data(data_id=data_id, 971 978 state_id=state_id, 972 979 theory_id=theory_id, 973 980 append=False) 974 981 self.enable_remove_plot() 975 982 976 983 def on_close_page(self, event=None): 977 984 """ … … 982 989 # send parent to update menu with no show nor hide action 983 990 self.parent.show_data_panel(action=False) 984 991 985 992 def on_freeze(self, event): 986 993 """ … … 995 1002 msg = "Freeze Theory: Requires at least one theory checked." 996 1003 wx.PostEvent(self.parent, StatusEvent(status=msg)) 997 1004 998 1005 def set_active_perspective(self, name): 999 1006 """ … … 1002 1009 self.perspective_cbox.SetStringSelection(name) 1003 1010 self.enable_import() 1004 1011 1005 1012 def _on_delete_plot_panel(self, event): 1006 1013 """ 1007 get an event with attribute name and caption to delete existing name 1014 get an event with attribute name and caption to delete existing name 1008 1015 from the combobox of the current panel 1009 1016 """ … … 1011 1018 caption = event.caption 1012 1019 if self.cb_plotpanel is not None: 1013 pos = self.cb_plotpanel.FindString(str(caption)) 1020 pos = self.cb_plotpanel.FindString(str(caption)) 1014 1021 if pos != wx.NOT_FOUND: 1015 1022 self.cb_plotpanel.Delete(pos) 1016 1023 self.enable_append() 1017 1024 1018 1025 def set_panel_on_focus(self, name=None): 1019 1026 """ … … 1031 1038 self.enable_append() 1032 1039 self.enable_remove_plot() 1033 1040 1034 1041 def set_plot_unfocus(self): 1035 1042 """ … … 1037 1044 """ 1038 1045 return 1039 1046 1040 1047 def _on_perspective_selection(self, event=None): 1041 1048 """ … … 1047 1054 perspective.on_perspective(event=None) 1048 1055 self.parent.check_multimode(perspective=perspective) 1049 1056 1050 1057 def _on_plot_selection(self, event=None): 1051 1058 """ … … 1061 1068 if combo.GetValue() != 'None': 1062 1069 panel = combo.GetClientData(selection) 1063 self.parent.on_set_plot_focus(panel) 1064 1070 self.parent.on_set_plot_focus(panel) 1071 1065 1072 def on_close_plot(self, event): 1066 1073 """ 1067 1074 clseo the panel on focus 1068 """ 1075 """ 1069 1076 self.enable_append() 1070 1077 selection = self.cb_plotpanel.GetSelection() … … 1072 1079 panel = self.cb_plotpanel.GetClientData(selection) 1073 1080 if self.parent is not None and panel is not None: 1074 wx.PostEvent(self.parent, 1081 wx.PostEvent(self.parent, 1075 1082 NewPlotEvent(group_id=panel.group_id, 1076 1083 action="delete")) 1077 1084 self.enable_remove_plot() 1078 1085 1079 1086 def set_frame(self, frame): 1080 1087 """ 1081 1088 """ 1082 1089 self.frame = frame 1083 1090 1084 1091 def get_frame(self): 1085 1092 """ 1086 1093 """ 1087 return self.frame 1088 1094 return self.frame 1095 1089 1096 def on_help(self, event): 1090 1097 """ … … 1115 1122 """ 1116 1123 self.parent.show_data_panel(event) 1117 1124 1118 1125 def set_schedule_full_draw(self, panel=None, func='del'): 1119 1126 """ … … 1121 1128 """ 1122 1129 self.parent.set_schedule_full_draw(panel, func) 1123 1130 1124 1131 def enable_remove_plot(self): 1125 1132 """ … … 1131 1138 #else: 1132 1139 # self.bt_close_plot.Enable() 1133 1140 1134 1141 def enable_remove(self): 1135 1142 """ … … 1142 1149 else: 1143 1150 self.bt_remove.Enable() 1144 1151 1145 1152 def enable_import(self): 1146 1153 """ … … 1160 1167 else: 1161 1168 self.perspective_cbox.Enable() 1162 1169 1163 1170 def enable_plot(self): 1164 1171 """ 1165 1172 enable or disable plot button 1166 1173 """ 1167 n_t = 0 1174 n_t = 0 1168 1175 n_t_t = 0 1169 1176 if self.tree_ctrl != None: … … 1176 1183 self.bt_plot.Enable() 1177 1184 self.enable_append() 1178 1185 1179 1186 def enable_append(self): 1180 1187 """ 1181 1188 enable or disable append button 1182 1189 """ 1183 n_t = 0 1190 n_t = 0 1184 1191 n_t_t = 0 1185 1192 if self.tree_ctrl != None: … … 1187 1194 if self.tree_ctrl_theory != None: 1188 1195 n_t_t = self.tree_ctrl_theory.GetCount() 1189 if n_t + n_t_t <= 0: 1196 if n_t + n_t_t <= 0: 1190 1197 self.bt_append_plot.Disable() 1191 1198 self.cb_plotpanel.Disable() … … 1196 1203 self.bt_append_plot.Enable() 1197 1204 self.cb_plotpanel.Enable() 1198 1205 1199 1206 def check_theory_to_freeze(self): 1200 1207 """ … … 1214 1221 else: 1215 1222 self.bt_freeze.Disable() 1216 1223 1217 1224 def enable_selection(self): 1218 1225 """ … … 1229 1236 else: 1230 1237 self.selection_cbox.Disable() 1231 1238 1232 1239 def show_data_button(self): 1233 1240 """ 1234 show load data and remove data button if 1241 show load data and remove data button if 1235 1242 dataloader on else hide them 1236 1243 """ … … 1238 1245 gui_style = self.parent.get_style() 1239 1246 style = gui_style & GUIFRAME.DATALOADER_ON 1240 if style == GUIFRAME.DATALOADER_ON: 1247 if style == GUIFRAME.DATALOADER_ON: 1241 1248 #self.bt_remove.Show(True) 1242 self.bt_add.Show(True) 1249 self.bt_add.Show(True) 1243 1250 else: 1244 1251 #self.bt_remove.Hide() 1245 1252 self.bt_add.Hide() 1246 except: 1253 except: 1247 1254 #self.bt_remove.Hide() 1248 self.bt_add.Hide() 1249 1255 self.bt_add.Hide() 1256 1250 1257 1251 1258 … … 1264 1271 self.list_of_ctrl = [] 1265 1272 if not data_list: 1266 return 1273 return 1267 1274 self._sizer_main = wx.BoxSizer(wx.VERTICAL) 1268 1275 self._sizer_txt = wx.BoxSizer(wx.VERTICAL) … … 1273 1280 self._panel.SetupScrolling() 1274 1281 self.__do_layout(data_list, text=text) 1275 1282 1276 1283 def __do_layout(self, data_list, text=''): 1277 1284 """ … … 1279 1286 """ 1280 1287 if not data_list or len(data_list) <= 1: 1281 return 1288 return 1282 1289 #add text 1283 1290 1284 1291 text = "Deleting these file reset some panels.\n" 1285 1292 text += "Do you want to proceed?\n" … … 1315 1322 wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) 1316 1323 static_line = wx.StaticLine(self, -1) 1317 1324 1318 1325 self._sizer_txt.Add(self._panel, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5) 1319 1326 self._sizer_main.Add(self._sizer_txt, 1, wx.EXPAND|wx.ALL, 10) 1320 #self._sizer_main.Add(self._data_text_ctrl, 0, 1327 #self._sizer_main.Add(self._data_text_ctrl, 0, 1321 1328 # wx.EXPAND|wx.LEFT|wx.RIGHT, 10) 1322 1329 self._sizer_main.Add(static_line, 0, wx.EXPAND, 0) … … 1324 1331 self.SetSizer(self._sizer_main) 1325 1332 self.Layout() 1326 1333 1327 1334 def get_data(self): 1328 1335 """ … … 1335 1342 temp.append(data) 1336 1343 return temp 1337 1344 1338 1345 class DataFrame(wx.Frame): 1339 1346 """ … … 1347 1354 # tied to any perspective 1348 1355 ALWAYS_ON = True 1349 1356 1350 1357 def __init__(self, parent=None, owner=None, manager=None, size=(300, 800), 1351 1358 list_of_perspective=[], list=[], *args, **kwds): … … 1357 1364 self.owner = owner 1358 1365 self._manager = manager 1359 self.panel = DataPanel(parent=self, 1366 self.panel = DataPanel(parent=self, 1360 1367 manager=manager, 1361 1368 list_of_perspective=list_of_perspective) 1362 1369 1363 1370 def load_data_list(self, list=[]): 1364 1371 """ … … 1366 1373 """ 1367 1374 self.panel.load_data_list(list=list) 1368 1369 1370 1375 1376 1377 1371 1378 from sas.sasgui.guiframe.dataFitting import Theory1D 1372 1379 from sas.sasgui.guiframe.data_state import DataState … … 1383 1390 self.msg += "name value\n" 1384 1391 return self.msg 1385 1392 1386 1393 def set_data_state(data=None, path=None, theory=None, state=None): 1387 1394 """ … … 1391 1398 dstate.set_path(path=path) 1392 1399 dstate.set_theory(theory, state) 1393 1400 1394 1401 return dstate 1395 1402 1396 1403 if __name__ == "__main__": 1397 1404 1398 1405 app = wx.App() 1399 1406 try: … … 1477 1484 #raise 1478 1485 print "error", sys.exc_value 1479 1480 app.MainLoop() 1481 1482 1486 1487 app.MainLoop() -
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
rd85c194 r895c9cb 527 527 self.subplot.set_xlim((xlo, xhi)) 528 528 self.subplot.set_ylim((ylo, yhi)) 529 self.graph.selected_plottable = None 529 530 530 531 … … 555 556 self._slicerpop.set_graph(self.graph) 556 557 ids = iter(self._menu_ids) 557 if not self.graph.selected_plottable in self.plots: 558 559 560 561 562 563 564 565 566 567 568 569 570 571 558 559 # Various plot options 560 wx_id = ids.next() 561 self._slicerpop.Append(wx_id, '&Save Image', 'Save image as PNG') 562 wx.EVT_MENU(self, wx_id, self.onSaveImage) 563 wx_id = ids.next() 564 self._slicerpop.Append(wx_id, '&Print Image', 'Print image ') 565 wx.EVT_MENU(self, wx_id, self.onPrint) 566 567 wx_id = ids.next() 568 self._slicerpop.Append(wx_id, '&Copy to Clipboard', 569 'Copy to the clipboard') 570 wx.EVT_MENU(self, wx_id, self.OnCopyFigureMenu) 571 572 self._slicerpop.AppendSeparator() 572 573 573 574 for plot in self.plots.values(): … … 592 593 item_list = self.parent.get_current_context_menu(self) 593 594 if (not item_list == None) and (not len(item_list) == 0): 594 # Note: reusing menu ids in submenu. This code works because 595 # IdItems is set up as a lazy iterator returning each id in 596 # sequence, creating new ids as needed so it never runs out. 597 # zip() is set up to stop when any iterator is empty, so it 598 # only asks for the number of ids in item_list. 599 for item, wx_id in zip(item_list, self._menu_ids): 595 for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 600 596 601 597 try: … … 609 605 610 606 if self.parent.ClassName.count('wxDialog') == 0: 611 wx_id = ids.next() 612 plot_menu.Append(wx_id, '&Linear Fit', name) 613 wx.EVT_MENU(self, wx_id, self.onFitting) 614 plot_menu.AppendSeparator() 607 if plot.id != 'fit': 608 wx_id = ids.next() 609 plot_menu.Append(wx_id, '&Linear Fit', name) 610 wx.EVT_MENU(self, wx_id, self.onFitting) 611 plot_menu.AppendSeparator() 615 612 616 613 wx_id = ids.next() … … 646 643 # Option to hide 647 644 # TODO: implement functionality to hide a plottable (legend click) 648 if not self.graph.selected_plottable in self.plots: 645 646 self._slicerpop.AppendSeparator() 647 loc_menu = wx.Menu() 648 for label in self._loc_labels: 649 wx_id = ids.next() 650 loc_menu.Append(wx_id, str(label), str(label)) 651 wx.EVT_MENU(self, wx_id, self.onChangeLegendLoc) 652 653 wx_id = ids.next() 654 self._slicerpop.Append(wx_id, '&Modify Graph Appearance', 655 'Modify graph appearance') 656 wx.EVT_MENU(self, wx_id, self.modifyGraphAppearance) 657 self._slicerpop.AppendSeparator() 658 659 660 if self.position != None: 661 wx_id = ids.next() 662 self._slicerpop.Append(wx_id, '&Add Text') 663 wx.EVT_MENU(self, wx_id, self._on_addtext) 664 wx_id = ids.next() 665 self._slicerpop.Append(wx_id, '&Remove Text') 666 wx.EVT_MENU(self, wx_id, self._on_removetext) 649 667 self._slicerpop.AppendSeparator() 650 loc_menu = wx.Menu() 651 for label in self._loc_labels: 652 wx_id = ids.next() 653 loc_menu.Append(wx_id, str(label), str(label)) 654 wx.EVT_MENU(self, wx_id, self.onChangeLegendLoc) 655 656 wx_id = ids.next() 657 self._slicerpop.Append(wx_id, '&Modify Graph Appearance', 658 'Modify graph appearance') 659 wx.EVT_MENU(self, wx_id, self.modifyGraphAppearance) 660 self._slicerpop.AppendSeparator() 661 662 663 if self.position != None: 664 wx_id = ids.next() 665 self._slicerpop.Append(wx_id, '&Add Text') 666 wx.EVT_MENU(self, wx_id, self._on_addtext) 667 wx_id = ids.next() 668 self._slicerpop.Append(wx_id, '&Remove Text') 669 wx.EVT_MENU(self, wx_id, self._on_removetext) 670 self._slicerpop.AppendSeparator() 671 wx_id = ids.next() 672 self._slicerpop.Append(wx_id, '&Change Scale') 673 wx.EVT_MENU(self, wx_id, self._onProperties) 668 wx_id = ids.next() 669 self._slicerpop.Append(wx_id, '&Change Scale') 670 wx.EVT_MENU(self, wx_id, self._onProperties) 671 self._slicerpop.AppendSeparator() 672 wx_id = ids.next() 673 self._slicerpop.Append(wx_id, '&Set Graph Range') 674 wx.EVT_MENU(self, wx_id, self.onSetRange) 675 wx_id = ids.next() 676 self._slicerpop.Append(wx_id, '&Reset Graph Range') 677 wx.EVT_MENU(self, wx_id, self.onResetGraph) 678 679 if self.parent.ClassName.count('wxDialog') == 0: 674 680 self._slicerpop.AppendSeparator() 675 681 wx_id = ids.next() 676 self._slicerpop.Append(wx_id, '&Reset Graph Range') 677 wx.EVT_MENU(self, wx_id, self.onResetGraph) 678 679 if self.parent.ClassName.count('wxDialog') == 0: 680 self._slicerpop.AppendSeparator() 681 wx_id = ids.next() 682 self._slicerpop.Append(wx_id, '&Window Title') 683 wx.EVT_MENU(self, wx_id, self.onChangeCaption) 682 self._slicerpop.Append(wx_id, '&Window Title') 683 wx.EVT_MENU(self, wx_id, self.onChangeCaption) 684 684 try: 685 685 pos_evt = event.GetPosition() … … 689 689 pos = (pos_x, pos_y + 5) 690 690 self.PopupMenu(self._slicerpop, pos) 691 692 def onSetRange(self, event): 693 # Display dialog 694 # self.subplot.set_xlim((low, high)) 695 # self.subplot.set_ylim((low, high)) 696 from sas.sasgui.plottools.RangeDialog import RangeDialog 697 d = RangeDialog(self, -1) 698 xlim = self.subplot.get_xlim() 699 ylim = self.subplot.get_ylim() 700 d.SetXRange(xlim) 701 d.SetYRange(ylim) 702 if d.ShowModal() == wx.ID_OK: 703 x_range = d.GetXRange() 704 y_range = d.GetYRange() 705 if x_range is not None and y_range is not None: 706 self.subplot.set_xlim(x_range) 707 self.subplot.set_ylim(y_range) 708 self.subplot.figure.canvas.draw_idle() 709 d.Destroy() 691 710 692 711 def onFreeze(self, event): … … 776 795 int(curr_symbol))), curr_label) 777 796 self.appD.Bind(wx.EVT_CLOSE, self.on_AppDialog_close) 797 self.graph.selected_plottable = None 778 798 779 799 def on_AppDialog_close(self, event): -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
rd85c194 r1a696bf 293 293 294 294 wx_id = ids.next() 295 slicerpop.Append(wx_id, '&Save Image' )295 slicerpop.Append(wx_id, '&Save Image', 'Save image as png') 296 296 wx.EVT_MENU(self, wx_id, self.onSaveImage) 297 297 … … 320 320 if (not item_list == None) and (not len(item_list) == 0) and\ 321 321 self.data2D.name.split(" ")[0] != 'Residuals': 322 # The line above; Not for trunk 323 # Note: reusing menu ids for the sub-menus. See Plotter1D. 324 for item, wx_id in zip(item_list, self._menu_ids): 322 for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 325 323 try: 326 324 slicerpop.Append(wx_id, item[0], item[1]) -
src/sas/sasgui/guiframe/local_perspectives/plotting/SimplePlot.py
rd85c194 r25b9707a 188 188 """ 189 189 def __init__(self, parent, id, title, scale='log_{10}', 190 size=wx.Size(550, 470) ):190 size=wx.Size(550, 470), show_menu_icons=True): 191 191 """ 192 192 comment … … 202 202 self._default_save_location = None 203 203 self.scale = scale 204 self._show_menu_icons = show_menu_icons 204 205 self.plotpanel = SimplePlotPanel(self, -1) 205 206 self._build_menubar() … … 213 214 quit_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUIT, wx.ART_TOOLBAR, tsize) 214 215 print_bmp = wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR, tsize) 215 preview_bmp = wx.ArtProvider.GetBitmap(wx.ART_REPORT_VIEW, wx.ART_TOOLBAR, tsize)216 216 copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize) 217 217 menu_bar = wx.MenuBar() … … 219 219 menu = wx.Menu() 220 220 id = wx.NewId() 221 item = wx.MenuItem(menu, id, "&Save Image") 222 item.SetBitmap(save_bmp) 223 menu.AppendItem(item) 221 save_item = wx.MenuItem(menu, id, "&Save Image") 222 menu.AppendItem(save_item) 224 223 wx.EVT_MENU(self, id, self.on_save_file) 225 224 226 225 id = wx.NewId() 227 item = wx.MenuItem(menu, id, "&Print Image") 228 item.SetBitmap(print_bmp) 229 menu.AppendItem(item) 226 print_item = wx.MenuItem(menu, id, "&Print Image") 227 menu.AppendItem(print_item) 230 228 wx.EVT_MENU(self, id, self.on_print_image) 231 229 232 230 menu.AppendSeparator() 233 231 id = wx.NewId() 234 item = wx.MenuItem(menu, id, "&Quit") 235 item.SetBitmap(quit_bmp) 236 menu.AppendItem(item) 232 quit_item = wx.MenuItem(menu, id, "&Quit") 233 menu.AppendItem(quit_item) 237 234 238 235 menu_bar.Append(menu, "&File") … … 241 238 menu_edit = wx.Menu() 242 239 id = wx.NewId() 243 item = wx.MenuItem(menu_edit, id, "&Copy") 244 item.SetBitmap(copy_bmp) 245 menu_edit.AppendItem(item) 240 copy_item = wx.MenuItem(menu_edit, id, "&Copy") 241 menu_edit.AppendItem(copy_item) 246 242 wx.EVT_MENU(self, id, self.on_copy_image) 243 244 if self._show_menu_icons: 245 save_item.SetBitmap(save_bmp) 246 print_item.SetBitmap(print_bmp) 247 quit_item.SetBitmap(quit_bmp) 248 copy_item.SetBitmap(copy_bmp) 247 249 248 250 menu_bar.Append(menu_edit, "&Edit") … … 324 326 except: 325 327 self.Destroy() 326 -
src/sas/sasgui/guiframe/media/data_explorer_help.rst
rd85c194 rb64b87c 20 20 21 21 *NOTE! When* Data Explorer *is hidden, all data loaded will be sent directly 22 to the current active analysis perspective, if possible. When* Data Explorer *is22 to the current active analysis, if possible. When* Data Explorer *is 23 23 shown, data go first to the* Data Explorer. 24 24 … … 116 116 117 117 Click on the *Send To* button to send the currently selected data to one of the 118 perspectives (for*Fitting*, *P(r) Inversion*, or *Invariant* calculation).118 available types of analysis (*Fitting*, *P(r) Inversion*, or *Invariant* calculation). 119 119 120 The *Single*/*Batch* mode radio buttons only apply to the *Fitting* perspective.120 The *Single*/*Batch* mode radio buttons only apply to *Fitting*. 121 121 122 122 *Batch mode* provides serial (batch) fitting with one model function, that is, -
src/sas/sasgui/guiframe/media/graph_help.rst
rf93b473f r318427a9 94 94 * PNG (portable network graphics) 95 95 * PS (postscript) 96 * RAW/RGBA (bitmap )96 * RAW/RGBA (bitmap, stored as 935x635 pixels of depth 8) 97 97 * SVG/SVGA (scalable vector graphics) 98 98 * TIF/TIFF (tagged iamge file) 99 100 The PGF image type option requires a LaTeX compiler: xelatex (default), 101 lualatex, or pdflatex. These are not shipped with SasView. 99 102 100 103 Printing a plot -
src/sas/sasgui/perspectives/calculator/data_operator.py
re871a2d r0e760e9 15 15 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 16 16 17 #Control panel width 17 #Control panel width 18 18 if sys.platform.count("win32") > 0: 19 19 PANEL_TOP = 0 … … 156 156 157 157 wx.EVT_TEXT_ENTER(self.data_namectr, -1, self.on_name) 158 wx.EVT_TEXT _ENTER(self.numberctr, -1, self.on_number)158 wx.EVT_TEXT(self.numberctr, -1, self.on_number) 159 159 wx.EVT_COMBOBOX(self.data1_cbox, -1, self.on_select_data1) 160 160 wx.EVT_COMBOBOX(self.operator_cbox, -1, self.on_select_operator) … … 235 235 self.name_sizer.Layout() 236 236 237 def on_number(self, event=None ):237 def on_number(self, event=None, control=None): 238 238 """ 239 239 On selecting Number for Data2 240 240 """ 241 241 self.send_warnings('') 242 item = event.GetEventObject() 242 item = control 243 if item is None and event is not None: 244 item = event.GetEventObject() 245 elif item is None: 246 raise ValueError("Event or control must be supplied") 243 247 text = item.GetValue().strip() 244 248 if self.numberctr.IsShown(): … … 251 255 except: 252 256 self._set_textctrl_color(self.numberctr, 'pink') 253 msg = "DataOperation: Number requires a float number." 254 self.send_warnings(msg, 'error') 255 return 257 if event is None: 258 msg = "DataOperation: Number requires a float number." 259 self.send_warnings(msg, 'error') 260 return False 256 261 else: 257 262 self._set_textctrl_color(self.numberctr, self.color) … … 263 268 self.draw_output(self.output) 264 269 self.Refresh() 270 return True 265 271 266 272 def on_select_data1(self, event=None): … … 607 613 wx.MessageBox(msg, 'Error') 608 614 return 615 if self.numberctr.IsEnabled() and self.numberctr.IsShown(): 616 valid_num = self.on_number(control=self.numberctr) 617 if not valid_num: 618 return 609 619 # send data to data manager 610 620 self.output.name = name … … 731 741 #add plot 732 742 self.graph.add(plot) 733 #draw 743 #draw 734 744 self.graph.render(self) 735 745 … … 985 995 window = DataOperatorWindow(parent=None, data=[], title="Data Editor") 986 996 app.MainLoop() 987 -
src/sas/sasgui/perspectives/calculator/image_viewer.py
rd0248bd r25b9707a 73 73 parent.put_icon(plot_frame) 74 74 except: 75 print "parent", parent76 75 err_msg += "Failed to load '%s'.\n" % basename 77 76 if err_msg: … … 109 108 """ 110 109 # Initialize the Frame object 111 PlotFrame.__init__(self, parent, id, title, scale, size) 110 PlotFrame.__init__(self, parent, id, title, scale, size, 111 show_menu_icons=False) 112 112 self.parent = parent 113 113 self.data = image … … 437 437 ImageView(None).load() 438 438 app.MainLoop() 439 -
src/sas/sasgui/perspectives/fitting/basepage.py
r5213d22 re4c897b 2942 2942 """ 2943 2943 2944 _TreeLocation = "user/ sasgui/perspectives/fitting/mag_help.html"2944 _TreeLocation = "user/magnetism.html" 2945 2945 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 2946 2946 "Polarized Beam/Magnetc Help") -
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
r20846be rb64b87c 15 15 16 16 17 Fitting Perspective18 ======= ============17 Fitting 18 ======= 19 19 20 20 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 24 24 25 25 To fit some data you must first load some data, activate one or more data sets, 26 send those data sets to the fitting perspective, and select a model to fit to 27 each data set. 26 send those data sets to fitting, and select a model to fit to each data set. 28 27 29 28 Instructions on how to load and activate data are in the section :ref:`Loading_data`. … … 331 330 This mode fits one data set. 332 331 333 When data is sent to the fitting perspective it is plotted in a graph window as 334 markers. 332 When data is sent to the fitting it is plotted in a graph window as markers. 335 333 336 334 If a graph does not appear, or a graph window appears but is empty, then the data -
src/sas/sasgui/perspectives/fitting/media/pd_help.rst
r7805458 rb64b87c 105 105 106 106 The median value for the distribution will be the value given for the respective 107 size parameter in the *Fit ting Perspective*, for example, radius = 60.107 size parameter in the *FitPage*, for example, radius = 60. 108 108 109 109 The polydispersity is given by |sigma| … … 172 172 173 173 SasView only uses these array values during the computation, therefore any mean 174 value of the parameter represented by *x* present in the *Fit ting Perspective*174 value of the parameter represented by *x* present in the *FitPage* 175 175 will be ignored. 176 176 -
src/sas/sasgui/perspectives/invariant/media/invariant_help.rst
r70305bd2 rb64b87c 4 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 5 6 Invariant Calculation Perspective7 ===================== ============6 Invariant Calculation 7 ===================== 8 8 9 9 Description … … 45 45 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 46 46 47 Using the perspective48 --------------------- 47 Using invariant analysis 48 ------------------------ 49 49 50 50 1) Select *Invariant* from the *Analysis* menu on the SasView toolbar. … … 53 53 54 54 3) Select a dataset and use the *Send To* button on the *Data Explorer* to load 55 the dataset into the *Invariant* p erspective.55 the dataset into the *Invariant* panel. 56 56 57 4) Use the *Customised Input* boxes on the *Invariant* p erspectiveto subtract57 4) Use the *Customised Input* boxes on the *Invariant* panel to subtract 58 58 any background, specify the contrast (i.e. difference in SLDs - this must be 59 59 specified for the eventual value of Q*\ to be on an absolute scale), or to … … 73 73 74 74 8) If the value of Q*\ calculated with the extrapolated regions is invalid, a 75 red warning will appear at the top of the *Invariant* p erspective panel.75 red warning will appear at the top of the *Invariant* panel. 76 76 77 77 The details of the calculation are available by clicking the *Details* -
src/sas/sasgui/perspectives/pr/media/pr_help.rst
r7805458 rb64b87c 4 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 5 6 P(r) Inversion Perspective7 ================ ==========6 P(r) Calculation 7 ================ 8 8 9 9 Description … … 32 32 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 33 33 34 Using the perspective35 -------------------- -34 Using P(r) inversion 35 -------------------- 36 36 37 37 The user must enter -
src/sas/sasgui/plottools/PlotPanel.py
rdd5bf63 r1a8e2e8e 15 15 import os 16 16 import transform 17 from plottables import Data1D18 17 #TODO: make the plottables interactive 19 18 from binder import BindArtist … … 151 150 #List of texts currently on the plot 152 151 self.textList = [] 152 self.selectedText = None 153 153 #User scale 154 154 if xtransform != None: … … 190 190 191 191 # new data for the fit 192 from sas.sasgui.guiframe.dataFitting import Data1D 192 193 self.fit_result = Data1D(x=[], y=[], dy=None) 193 194 self.fit_result.symbol = 13 … … 352 353 self.leftdown = True 353 354 ax = event.inaxes 355 for text in self.textList: 356 if text.contains(event)[0]: # If user has clicked on text 357 self.selectedText = text 358 return 359 354 360 if ax != None: 355 361 self.xInit, self.yInit = event.xdata, event.ydata … … 373 379 self.mousemotion = False 374 380 self.leftup = True 381 self.selectedText = None 375 382 376 383 #release the legend … … 448 455 self._on_legend_motion(event) 449 456 return 457 458 if self.leftdown and self.selectedText is not None: 459 # User has clicked on text and is dragging 460 ax = event.inaxes 461 if ax != None: 462 # Only move text if mouse is within axes 463 self.selectedText.set_position((event.xdata, event.ydata)) 464 self._dragHelper(0, 0) 465 else: 466 # User has dragged outside of axes 467 self.selectedText = None 468 return 469 450 470 if self.enable_toolbar: 451 471 #Disable dragging without the toolbar to allow zooming with toolbar … … 646 666 dlg.setFitRange(self.xminView, self.xmaxView, 647 667 self.xmin, self.xmax) 668 else: 669 xlim = self.subplot.get_xlim() 670 ylim = self.subplot.get_ylim() 671 dlg.setFitRange(xlim[0], xlim[1], ylim[0], ylim[1]) 648 672 # It would be nice for this to NOT be modal (i.e. Show). 649 673 # Not sure about other ramifications - for example … … 713 737 if dial.ShowModal() == wx.ID_OK: 714 738 self.xLabel, self.yLabel, self.viewModel = dial.getValues() 715 if self.viewModel == "Linear y vs x":716 self.xLabel = "x"717 self.yLabel = "y"718 self.viewModel = "--"719 dial.setValues(self.xLabel, self.yLabel, self.viewModel)720 if self.viewModel == "Guinier lny vs x^(2)":721 self.xLabel = "x^(2)"722 self.yLabel = "ln(y)"723 self.viewModel = "--"724 dial.setValues(self.xLabel, self.yLabel, self.viewModel)725 if self.viewModel == "XS Guinier ln(y*x) vs x^(2)":726 self.xLabel = "x^(2)"727 self.yLabel = "ln(y*x)"728 self.viewModel = "--"729 dial.setValues(self.xLabel, self.yLabel, self.viewModel)730 if self.viewModel == "Porod y*x^(4) vs x^(4)":731 self.xLabel = "x^(4)"732 self.yLabel = "y*x^(4)"733 self.viewModel = "--"734 dial.setValues(self.xLabel, self.yLabel, self.viewModel)735 739 self._onEVT_FUNC_PROPERTY() 736 740 dial.Destroy() … … 1211 1215 1212 1216 # Properties defined by plot 1213 1217 1214 1218 # Ricardo: 1215 # A empty label "$$" will prevent the panel from displaying! 1216 1219 # A empty label "$$" will prevent the panel from displaying! 1217 1220 if prop["xlabel"]: 1218 1221 self.subplot.set_xlabel(r"$%s$"%prop["xlabel"]) … … 1220 1223 self.subplot.set_ylabel(r"$%s$"%prop["ylabel"]) 1221 1224 self.subplot.set_title(prop["title"]) 1222 1225 1223 1226 1224 1227 def clear(self): … … 1564 1567 bins=[self.y_bins, self.x_bins], 1565 1568 weights=self.data) 1566 # Now, normalize the image by weights only for weights>1: 1569 # Now, normalize the image by weights only for weights>1: 1567 1570 # If weight == 1, there is only one data point in the bin so 1568 1571 # that no normalization is required. … … 1746 1749 if remove_fit: 1747 1750 self.graph.delete(self.fit_result) 1751 if hasattr(self, 'plots'): 1752 if 'fit' in self.plots.keys(): 1753 del self.plots['fit'] 1748 1754 self.ly = None 1749 1755 self.q_ctrl = None … … 1759 1765 _yscale = 'linear' 1760 1766 for item in list: 1767 if item.id == 'fit': 1768 continue 1761 1769 item.setLabel(self.xLabel, self.yLabel) 1762 1763 1770 # control axis labels from the panel itself 1764 1771 yname, yunits = item.get_yaxis() … … 1790 1797 if self.xLabel == "ln(x)": 1791 1798 item.transformX(transform.toLogX, transform.errToLogX) 1792 self.graph._xaxis_transformed("\ln \\ %s" % xname, "%s" % xunits)1799 self.graph._xaxis_transformed("\ln{(%s)}" % xname, "%s" % xunits) 1793 1800 if self.xLabel == "log10(x)": 1794 1801 item.transformX(transform.toX_pos, transform.errToX_pos) … … 1802 1809 if self.yLabel == "ln(y)": 1803 1810 item.transformY(transform.toLogX, transform.errToLogX) 1804 self.graph._yaxis_transformed("\ln \\ %s" % yname, "%s" % yunits)1811 self.graph._yaxis_transformed("\ln{(%s)}" % yname, "%s" % yunits) 1805 1812 if self.yLabel == "y": 1806 1813 item.transformY(transform.toX, transform.errToX) … … 1818 1825 yunits = convert_unit(-1, yunits) 1819 1826 self.graph._yaxis_transformed("1/%s" % yname, "%s" % yunits) 1827 if self.yLabel == "y*x^(2)": 1828 item.transformY(transform.toYX2, transform.errToYX2) 1829 xunits = convert_unit(2, self.xaxis_unit) 1830 self.graph._yaxis_transformed("%s \ \ %s^{2}" % (yname, xname), 1831 "%s%s" % (yunits, xunits)) 1820 1832 if self.yLabel == "y*x^(4)": 1821 1833 item.transformY(transform.toYX4, transform.errToYX4) … … 1831 1843 if self.yLabel == "ln(y*x)": 1832 1844 item.transformY(transform.toLogXY, transform.errToLogXY) 1833 self.graph._yaxis_transformed("\ln (%s \ \ %s)" % (yname, xname),1845 self.graph._yaxis_transformed("\ln{(%s \ \ %s)}" % (yname, xname), 1834 1846 "%s%s" % (yunits, self.xaxis_unit)) 1835 1847 if self.yLabel == "ln(y*x^(2))": … … 1849 1861 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname), 1850 1862 "%s%s" % (yunits, xunits)) 1851 if self.viewModel == "Guinier lny vs x^(2)":1852 item.transformX(transform.toX2, transform.errToX2)1853 xunits = convert_unit(2, xunits)1854 self.graph._xaxis_transformed("%s^{2}" % xname, "%s" % xunits)1855 item.transformY(transform.toLogX, transform.errToLogX)1856 self.graph._yaxis_transformed("\ln\ \ %s" % yname, "%s" % yunits)1857 if self.viewModel == "Porod y*x^(4) vs x^(4)":1858 item.transformX(transform.toX4, transform.errToX4)1859 xunits = convert_unit(4, self.xaxis_unit)1860 self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits)1861 item.transformY(transform.toYX4, transform.errToYX4)1862 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname),1863 "%s%s" % (yunits, xunits))1864 1863 item.transformView() 1865 1864 … … 1899 1898 1900 1899 """ 1900 xlim = self.subplot.get_xlim() 1901 ylim = self.subplot.get_ylim() 1902 1901 1903 # Saving value to redisplay in Fit Dialog when it is opened again 1902 1904 self.Avalue, self.Bvalue, self.ErrAvalue, \ … … 1922 1924 self.graph.render(self) 1923 1925 self._offset_graph() 1926 if hasattr(self, 'plots'): 1927 # Used by Plotter1D 1928 fit_id = 'fit' 1929 self.fit_result.id = fit_id 1930 self.fit_result.title = 'Fit' 1931 self.fit_result.name = 'Fit' 1932 self.plots[fit_id] = self.fit_result 1933 self.subplot.set_xlim(xlim) 1934 self.subplot.set_ylim(ylim) 1924 1935 self.subplot.figure.canvas.draw_idle() 1925 1936 -
src/sas/sasgui/plottools/PropertyDialog.py
r3409a90 r5129686 23 23 iy += 1 24 24 ix = 1 25 self.xvalue = wx.ComboBox(self, -1 )25 self.xvalue = wx.ComboBox(self, -1, style=wx.CB_READONLY) 26 26 x_size += self.xvalue.GetSize()[0] 27 sizer.Add(self.xvalue, (iy, ix), (1, 1), wx. EXPAND | wx.ADJUST_MINSIZE, 0)27 sizer.Add(self.xvalue, (iy, ix), (1, 1), wx.ADJUST_MINSIZE, 0) 28 28 29 29 ix += 2 30 self.yvalue = wx.ComboBox(self, -1 )30 self.yvalue = wx.ComboBox(self, -1, style=wx.CB_READONLY) 31 31 x_size += self.yvalue.GetSize()[0] 32 sizer.Add(self.yvalue, (iy, ix), (1, 1), wx. EXPAND | wx.ADJUST_MINSIZE, 0)32 sizer.Add(self.yvalue, (iy, ix), (1, 1), wx.ADJUST_MINSIZE, 0) 33 33 34 34 ix += 2 35 self.view = wx.ComboBox(self, -1) 35 self.view = wx.ComboBox(self, -1, style=wx.CB_READONLY) 36 self.view.Bind(wx.EVT_COMBOBOX, self.viewChanged) 36 37 x_size += self.view.GetSize()[0] 37 38 self.view.SetMinSize((160, 30)) … … 64 65 self.yvalue.Insert("ln(y)", 2) 65 66 self.yvalue.Insert("y^(2)", 3) 66 self.yvalue.Insert("y*x^(4)", 4) 67 self.yvalue.Insert("1/sqrt(y)", 5) 68 self.yvalue.Insert("log10(y)", 6) 69 self.yvalue.Insert("ln(y*x)", 7) 70 self.yvalue.Insert("ln(y*x^(2))", 8) 71 self.yvalue.Insert("ln(y*x^(4))", 9) 72 self.yvalue.Insert("log10(y*x^(4))", 10) 67 self.yvalue.Insert("y*x^(2)", 4) 68 self.yvalue.Insert("y*x^(4)", 5) 69 self.yvalue.Insert("1/sqrt(y)", 6) 70 self.yvalue.Insert("log10(y)", 7) 71 self.yvalue.Insert("ln(y*x)", 8) 72 self.yvalue.Insert("ln(y*x^(2))", 9) 73 self.yvalue.Insert("ln(y*x^(4))", 10) 74 self.yvalue.Insert("log10(y*x^(4))", 11) 73 75 # type of view or model used 74 76 self.view.SetValue("--") … … 78 80 self.view.Insert("XS Guinier ln(y*x) vs x^(2)", 3) 79 81 self.view.Insert("Porod y*x^(4) vs x^(4)", 4) 80 # This did not work in 3.1.2 and does not work now. 81 # prefer to fix (should not be too hard) but for the moment 82 # am removing as an option the user sees so they don't get 83 # disappointed. PDB 7/10/2016 84 # self.view.Insert("Kratky y*x^(2) vs x", 5) 82 self.view.Insert("Kratky y*x^(2) vs x", 5) 85 83 self.SetSizer(vbox) 86 84 self.Fit() 87 85 self.Centre() 86 87 def viewChanged(self, event): 88 event.Skip() 89 view = self.view.GetValue() 90 if view == "Linear y vs x": 91 self.xvalue.SetValue("x") 92 self.yvalue.SetValue("y") 93 elif view == "Guinier lny vs x^(2)": 94 self.xvalue.SetValue("x^(2)") 95 self.yvalue.SetValue("ln(y)") 96 elif view == "XS Guinier ln(y*x) vs x^(2)": 97 self.xvalue.SetValue("x^(2)") 98 self.yvalue.SetValue("ln(y*x)") 99 elif view == "Porod y*x^(4) vs x^(4)": 100 self.xvalue.SetValue("x^(4)") 101 self.yvalue.SetValue("y*x^(4)") 102 elif view == "Kratky y*x^(2) vs x": 103 self.xvalue.SetValue("x") 104 self.yvalue.SetValue("y*x^(2)") 88 105 89 106 def setValues(self, x, y, view): -
src/sas/sasgui/plottools/transform.py
rd7bb526 r8abd96d 291 291 292 292 293 def errToYX2( x, y, dx=None, dy=None):293 def errToYX2(y, x, dy=None, dx=None): 294 294 """ 295 295 """ … … 325 325 326 326 327 def errToLogYX2( x, y, dx=None, dy=None):327 def errToLogYX2(y, x, dy=None, dx=None): 328 328 """ 329 329 calculate error of Log(yx**2) … … 375 375 376 376 377 def errToLogYX4( x, y=None, dx=None, dy=None):377 def errToLogYX4(y, x, dy=None, dx=None): 378 378 """ 379 379 error for ln(y*x^(4)) … … 396 396 397 397 398 def errToYX4( x, y=None, dx=None, dy=None):398 def errToYX4(y, x, dy=None, dx=None): 399 399 """ 400 400 error for (y*x^(4))
Note: See TracChangeset
for help on using the changeset viewer.