Changeset 8fa3fb8 in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Mar 1, 2017 9:46:54 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:
- a97aebd
- Parents:
- cb1e9a5 (diff), 775e0b7 (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
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/CategoryInstaller.py
r212bfc2 rddbac66 123 123 compile it and install 124 124 :param homefile: Override the default home directory 125 :param model_list: List of model names except customized models 125 :param model_list: List of model names except those in Plugin Models 126 which are user supplied. 126 127 """ 127 128 _model_dict = { model.name: model for model in model_list} -
src/sas/sasgui/guiframe/customdir.py
r212bfc2 r73cbeec 34 34 if not os.path.isfile(config_file): 35 35 shutil.copyfile(os.path.join(path, "custom_config.py"), config_file) 36 37 #Adding SAS_OPENCL if it doesn't exist in the config file 38 # - to support backcompability 39 if not "SAS_OPENCL" in open(config_file).read(): 40 open(config_file,"a+").write("SAS_OPENCL = \"None\"\n") 36 41 except: 37 42 # Check for data path next to exe/zip file. -
src/sas/sasgui/guiframe/dataFitting.py
r9b6d62d r68adf86 17 17 """ 18 18 """ 19 def __init__(self, x=None, y=None, dx=None, dy=None): 19 20 def __init__(self, x=None, y=None, dx=None, dy=None, lam=None, dlam=None, isSesans=False): 20 21 """ 21 22 """ … … 24 25 if y is None: 25 26 y = [] 26 PlotData1D.__init__(self, x, y, dx, dy) 27 LoadData1D.__init__(self, x, y, dx, dy) 27 self.isSesans = isSesans 28 PlotData1D.__init__(self, x, y, dx, dy, lam, dlam) 29 LoadData1D.__init__(self, x, y, dx, dy, lam, dlam, isSesans) 30 28 31 self.id = None 29 32 self.list_group_id = [] … … 32 35 self.path = None 33 36 self.xtransform = None 37 if self.isSesans: 38 self.xtransform = "x" 34 39 self.ytransform = None 40 if self.isSesans: 41 self.ytransform = "y" 35 42 self.title = "" 36 43 self.scale = None … … 68 75 # First, check the data compatibility 69 76 dy, dy_other = self._validity_check(other) 70 result = Data1D(x=[], y=[], dx=None, dy=None)77 result = Data1D(x=[], y=[], lam=[], dx=None, dy=None, dlam=None) 71 78 result.clone_without_data(length=len(self.x), clone=self) 72 79 result.copy_from_datainfo(data1d=self) … … 115 122 # First, check the data compatibility 116 123 self._validity_check_union(other) 117 result = Data1D(x=[], y=[], dx=None, dy=None)124 result = Data1D(x=[], y=[], lam=[], dx=None, dy=None, dlam=None) 118 125 tot_length = len(self.x) + len(other.x) 119 126 result = self.clone_without_data(length=tot_length, clone=result) 127 if self.dlam == None or other.dlam is None: 128 result.dlam = None 129 else: 130 result.dlam = numpy.zeros(tot_length) 120 131 if self.dy == None or other.dy is None: 121 132 result.dy = None … … 141 152 result.y = numpy.append(self.y, other.y) 142 153 result.y = result.y[ind] 154 result.lam = numpy.append(self.lam, other.lam) 155 result.lam = result.lam[ind] 156 if result.dlam != None: 157 result.dlam = numpy.append(self.dlam, other.dlam) 158 result.dlam = result.dlam[ind] 143 159 if result.dy != None: 144 160 result.dy = numpy.append(self.dy, other.dy) … … 260 276 # First, check the data compatibility 261 277 self._validity_check_union(other) 262 result = Data1D(x=[], y=[], dx=None, dy=None)278 result = Data1D(x=[], y=[], lam=[], dx=None, dy=None, dlam=[]) 263 279 tot_length = len(self.x)+len(other.x) 264 280 result.clone_without_data(length=tot_length, clone=self) 281 if self.dlam == None or other.dlam is None: 282 result.dlam = None 283 else: 284 result.dlam = numpy.zeros(tot_length) 265 285 if self.dy == None or other.dy is None: 266 286 result.dy = None … … 285 305 result.y = numpy.append(self.y, other.y) 286 306 result.y = result.y[ind] 307 result.lam = numpy.append(self.lam, other.lam) 308 result.lam = result.lam[ind] 287 309 if result.dy != None: 288 310 result.dy = numpy.append(self.dy, other.dy) -
src/sas/sasgui/guiframe/data_manager.py
rd85c194 r2ffe241 61 61 62 62 if issubclass(Data2D, data.__class__): 63 new_plot = Data2D(image=None, err_image=None) 64 else: 65 new_plot = Data1D(x=[], y=[], dx=None, dy=None) 66 63 new_plot = Data2D(image=None, err_image=None) # For now, isSesans for 2D data is always false 64 else: 65 new_plot = Data1D(x=[], y=[], dx=None, dy=None, lam=None, dlam=None, isSesans=data.isSesans) 66 67 68 #elif data.meta_data['loader'] == 'SESANS': 69 # new_plot = Data1D(x=[], y=[], dx=None, dy=None, lam=None, dlam=None, isSesans=True) 70 #else: 71 # new_plot = Data1D(x=[], y=[], dx=None, dy=None, lam=None, dlam=None) #SESANS check??? 72 67 73 new_plot.copy_from_datainfo(data) 68 74 data.clone_without_data(clone=new_plot) -
src/sas/sasgui/guiframe/gui_manager.py
rc8e1996 r73cbeec 152 152 SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 153 153 SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 154 SAS_OPENCL = config.SAS_OPENCL 154 155 if not WELCOME_PANEL_ON: 155 156 WELCOME_PANEL_SHOW = False … … 176 177 else: 177 178 DEFAULT_OPEN_FOLDER = PATH_APP 179 SAS_OPENCL = custom_config.SAS_OPENCL 178 180 except: 179 181 DATALOADER_SHOW = True … … 190 192 CLEANUP_PLOT = False 191 193 DEFAULT_OPEN_FOLDER = PATH_APP 192 194 SAS_OPENCL = None 193 195 DEFAULT_STYLE = config.DEFAULT_STYLE 194 196 … … 225 227 CHILD_FRAME = wx.Frame 226 228 229 #Initiliaze enviromental variable with custom setting but only if variable not set 230 if SAS_OPENCL and not "SAS_OPENCL" in os.environ: 231 os.environ["SAS_OPENCL"] = SAS_OPENCL 227 232 228 233 class ViewerFrame(PARENT_FRAME): … … 1950 1955 item, _, _ = value 1951 1956 item.Check(True) 1952 self._data_panel.on_remove(None, False)1953 1957 1954 1958 wx.PostEvent(self, StatusEvent(status="Loading Project file...")) … … 1963 1967 # Reset to a base state 1964 1968 self._on_reset_state() 1969 self._data_panel.on_remove(None, False) 1965 1970 # Load the project file 1966 1971 self.load_state(path=path, is_project=True) … … 1990 1995 wx.PostEvent(self, 1991 1996 StatusEvent(status="Completed saving.")) 1992 except :1997 except Exception: 1993 1998 msg = "Error occurred while saving: " 1999 msg += traceback.format_exc() 1994 2000 msg += "To save, the application panel should have a data set.." 1995 2001 wx.PostEvent(self, StatusEvent(status=msg)) … … 2040 2046 logging.warning(msg) 2041 2047 wx.PostEvent(self, StatusEvent(status=msg, info="error")) 2042 except :2048 except Exception: 2043 2049 msg = "Error occurred while saving: " 2050 msg += traceback.format_exc() 2044 2051 msg += "To save, at least one application panel " 2045 2052 msg += "should have a data set.." … … 2102 2109 Quit the application 2103 2110 """ 2111 #IF SAS_OPENCL is set, settings are stored in the custom config file 2112 self._write_opencl_config_file() 2104 2113 logging.info(" --- SasView session was closed --- \n") 2105 2114 wx.Exit() 2106 2115 sys.exit() 2116 2117 def _write_opencl_config_file(self): 2118 """ 2119 Writes OpenCL settings to custom config file, so they can be remmbered 2120 from session to session 2121 """ 2122 if custom_config is not None: 2123 sas_opencl = os.environ.get("SAS_OPENCL",None) 2124 new_config_lines = [] 2125 config_file = open(custom_config.__file__) 2126 config_lines = config_file.readlines() 2127 for line in config_lines: 2128 if "SAS_OPENCL" in line: 2129 if sas_opencl: 2130 new_config_lines.append("SAS_OPENCL = \""+sas_opencl+"\"") 2131 else: 2132 new_config_lines.append("SAS_OPENCL = None") 2133 else: 2134 new_config_lines.append(line) 2135 config_file.close() 2136 2137 #If custom_config is None, settings will not be remmbered 2138 new_config_file = open(custom_config.__file__,"w") 2139 new_config_file.writelines(new_config_lines) 2140 new_config_file.close() 2141 else: 2142 logging.info("Failed to save OPENCL settings in custom config file") 2143 2107 2144 2108 2145 def _check_update(self, event=None): … … 2456 2493 group_id=group_id, 2457 2494 action='remove')) 2458 # remove res plot: Todo: improve2459 2495 wx.CallAfter(self._remove_res_plot, new_plot.id) 2460 2496 self._data_manager.delete_data(data_id=data_id, -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r245ae18 r29e872e 65 65 # context menu 66 66 self._slicerpop = None 67 68 67 self._available_data = [] 69 68 self._symbol_labels = self.get_symbol_label() … … 732 731 self.subplot.set_ylim(y_range) 733 732 self.subplot.figure.canvas.draw_idle() 733 self.is_zoomed = True 734 734 d.Destroy() 735 735 -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
r1a696bf rb2b36932 316 316 317 317 slicerpop.AppendSeparator() 318 if len(self.data2D.detector) == 1:318 if len(self.data2D.detector) <= 1: 319 319 item_list = self.parent.get_current_context_menu(self) 320 320 if (not item_list == None) and (not len(item_list) == 0) and\ -
src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
r6ffa0dd rca224b1 134 134 """ 135 135 for group_id in self.plot_panels.keys(): 136 panel = self.plot_panels[group_id] 137 panel.graph.reset() 138 self.hide_panel(group_id) 136 self.clear_panel_by_id(group_id) 139 137 self.plot_panels = {} 140 138 -
src/sas/sasgui/guiframe/startup_configuration.py
rd85c194 r73cbeec 31 31 'CLEANUP_PLOT':False, 32 32 'DEFAULT_PERSPECTIVE':'Fitting', 33 'DEFAULT_OPEN_FOLDER': None} 33 'DEFAULT_OPEN_FOLDER': None, 34 'SAS_OPENCL': None} 34 35 try: 35 36 CURRENT_STRINGS = {'GUIFRAME_WIDTH':CURRENT.GUIFRAME_WIDTH, … … 45 46 'CLEANUP_PLOT':CURRENT.CLEANUP_PLOT, 46 47 'DEFAULT_PERSPECTIVE':CURRENT.DEFAULT_PERSPECTIVE, 47 'DEFAULT_OPEN_FOLDER':CURRENT.DEFAULT_OPEN_FOLDER} 48 'DEFAULT_OPEN_FOLDER':CURRENT.DEFAULT_OPEN_FOLDER, 49 'SAS_OPENCL': None} 48 50 except: 49 51 CURRENT_STRINGS = DEFAULT_STRINGS -
src/sas/sasgui/guiframe/data_panel.py
rc8e1996 rcb1e9a5 520 520 Add a listcrtl in the panel 521 521 """ 522 tree_ctrl_label = wx.StaticText(self, -1, "Data") 523 tree_ctrl_label.SetForegroundColour('blue') 524 self.tree_ctrl = DataTreeCtrl(parent=self, style=wx.SUNKEN_BORDER) 522 # Add splitter 523 w, h = self.parent.GetSize() 524 splitter = wx.SplitterWindow(self) 525 splitter.SetMinimumPaneSize(50) 526 splitter.SetSashGravity(1.0) 527 528 file_sizer = wx.BoxSizer(wx.VERTICAL) 529 file_sizer.SetMinSize(wx.Size(w/13, h*2/5)) 530 theory_sizer = wx.BoxSizer(wx.VERTICAL) 531 theory_sizer.SetMinSize(wx.Size(w/13, h*2/5)) 532 533 self.tree_ctrl = DataTreeCtrl(parent=splitter, style=wx.SUNKEN_BORDER) 534 525 535 self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) 526 536 self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_MENU, self.on_right_click_data) … … 557 567 wx.EVT_MENU(self, self.editmask_id, self.on_edit_data) 558 568 559 tree_ctrl_theory_label = wx.StaticText(self, -1, "Theory") 560 tree_ctrl_theory_label.SetForegroundColour('blue') 561 self.tree_ctrl_theory = DataTreeCtrl(parent=self, 569 self.tree_ctrl_theory = DataTreeCtrl(parent=splitter, 562 570 style=wx.SUNKEN_BORDER) 563 571 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, … … 565 573 self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU, 566 574 self.on_right_click_theory) 567 self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10) 568 self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND | wx.ALL, 10) 569 self.sizer1.Add(tree_ctrl_theory_label, 0, wx.LEFT, 10) 570 self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND | wx.ALL, 10) 575 self.tree_ctrl.InsertItem(self.tree_ctrl.root, -1, " Data") 576 self.tree_ctrl_theory.InsertItem(self.tree_ctrl_theory.root, 577 -1, " Theory") 578 splitter.SplitHorizontally(self.tree_ctrl, self.tree_ctrl_theory) 579 self.sizer1.Add(splitter, 1, wx.EXPAND | wx.ALL, 10) 571 580 572 581 def on_right_click_theory(self, event):
Note: See TracChangeset
for help on using the changeset viewer.