- Timestamp:
- Oct 27, 2017 3:42:57 AM (7 years ago)
- Branches:
- 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
- Children:
- 99ea1b0
- Parents:
- b0b09b9
- Location:
- src/sas
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/logger_config.py
rf4a1433 r895e7359 49 49 ''' 50 50 for handler in logger.handlers or logger.parent.handlers: 51 handler.setLevel(logging.DEBUG) 51 #handler.setLevel(logging.DEBUG) 52 handler.setLevel(logging.WARNING) 52 53 for name, _ in logging.Logger.manager.loggerDict.items(): 53 logging.getLogger(name).setLevel(logging.DEBUG) 54 #logging.getLogger(name).setLevel(logging.DEBUG) 55 logging.getLogger(name).setLevel(logging.WARNING) 54 56 55 57 def _find_config_file(self, filename="logging.ini"): -
src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 158 158 """ Prepare datasets to be added to DataExplorer and DataManager """ 159 159 new_item = GuiUtils.createModelItemWithPlot( 160 QtCore.QVariant(self.output),160 self.output, 161 161 name=self.txtOutputData.text()) 162 162 -
src/sas/qtgui/MainWindow/GuiManager.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 308 308 self.communicate.statusBarUpdateSignal.emit(msg) 309 309 310 elif cmp(version, LocalConfig.__version__) > 0:310 elif version.__gt__(LocalConfig.__version__): 311 311 msg = "Version %s is available! " % str(version) 312 312 if "download_url" in version_info: -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 156 156 """ 157 157 for i, item in enumerate(model_header_captions): 158 #model.setHeaderData(i, QtCore.Qt.Horizontal, QtCore.QVariant(item))159 158 model.setHeaderData(i, QtCore.Qt.Horizontal, item) 160 159 -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 989 989 if not dict: 990 990 return 991 if self._model_model.rowCount() == 0: 992 return 991 993 992 994 def iterateOverMagnetModel(func): … … 1000 1002 # Utility function for main model update 1001 1003 # internal so can use closure for param_dict 1004 if self._magnet_model.item(row, 0) is None: 1005 return 1002 1006 param_name = str(self._magnet_model.item(row, 0).text()) 1003 1007 if param_name not in list(param_dict.keys()): -
src/sas/qtgui/Perspectives/Fitting/ModelThread.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 53 53 self.starttime = time.time() 54 54 # Determine appropriate q range 55 if self.qmin ==None:55 if self.qmin is None: 56 56 self.qmin = 0 57 if self.qmax ==None:58 if self.data !=None:57 if self.qmax is None: 58 if self.data is not None: 59 59 newx = math.pow(max(math.fabs(self.data.xmax), 60 60 math.fabs(self.data.xmin)), 2) -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 297 297 298 298 # Add the plot to the model item 299 # variant_item = QtCore.QVariant(self._plotter)300 variant_item = QtCore.QVariant(extrapolated_data)301 302 299 # This needs to run in the main thread 303 300 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 304 self._model_item, variant_item, title)301 self._model_item, extrapolated_data, title) 305 302 306 303 if self._high_extrapolate: … … 322 319 323 320 # Add the plot to the model item 324 # variant_item = QtCore.QVariant(self._plotter)325 variant_item = QtCore.QVariant(high_out_data)326 321 # This needs to run in the main thread 327 322 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 328 self._model_item, variant_item, title)323 self._model_item, high_out_data, title) 329 324 330 325 item = QtGui.QStandardItem(str(float('%.5g'% volume_fraction))) … … 561 556 # Extract data on 1st child - this is the Data1D/2D component 562 557 data = GuiUtils.dataFromItem(self._model_item) 563 self.model.item(WIDGETS.W_FILENAME).setData( QtCore.QVariant(self._model_item.text()))558 self.model.item(WIDGETS.W_FILENAME).setData(self._model_item.text()) 564 559 565 560 ##### DEBUG #### -
src/sas/qtgui/Plotting/Arrow3D.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 29 29 self.base = base 30 30 31 if base !=None:31 if base is not None: 32 32 # To turn the updating off during dragging 33 33 base.canvas.mpl_connect('button_press_event', self.on_left_down) -
src/sas/qtgui/Plotting/Binder.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 233 233 """ 234 234 # TODO: sort by zorder of axes then by zorder within axes 235 self._artists.sort(cmp=lambda x, y: cmp(y.zorder, x.zorder)) 235 #self._artists.sort(cmp=lambda x, y: cmp(y.zorder, x.zorder)) 236 #self._artists.sort(cmp=lambda x, y: y.zorder.__gt__(x.zorder)) 236 237 found = Selection() 237 238 for artist in self._artists: -
src/sas/qtgui/Plotting/ConvertUnits.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 4 4 """ 5 5 import re 6 import string7 6 8 7 def convertUnit(power, unit): … … 11 10 """ 12 11 if power != 0: 13 if string.find(unit,"^") != -1: # if the unit contains a powerer ^12 if unit.find("^") != -1: # if the unit contains a powerer ^ 14 13 toks = re.split("\^", unit) 15 if string.find(toks[0],"/") != -1 or \16 string.find(toks[0],"-") != -1:14 if toks[0].find("/") != -1 or \ 15 toks[0].find("-") != -1: 17 16 if power == 1: 18 17 unit = unit … … 20 19 unit = "(" + unit + ")" + "^{" + str(power) + "}" 21 20 else: 22 if string.find(toks[1],"{") != -1: # if found a {21 if toks[1].find("{") != -1: # if found a { 23 22 find_power_toks = re.split("{", toks[1]) 24 if string.find(find_power_toks[1],"}") != -1: # found }23 if find_power_toks[1].find("}") != -1: # found } 25 24 unit_toks = re.split("}", find_power_toks[1]) 26 if string.find(unit_toks[0],".") != -1:25 if unit_toks[0].find(".") != -1: 27 26 powerer = float(unit_toks[0]) * power 28 elif string.find(unit_toks[0],"/") != -1:27 elif unit_toks[0].find("/") != -1: 29 28 power_toks = re.split("/", unit_toks[0]) 30 29 powerer = power * int(power_toks[0])\ -
src/sas/qtgui/Plotting/DataTransform.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 162 162 163 163 """ 164 if dx ==None:164 if dx is None: 165 165 dx = 0 166 166 return dx … … 175 175 176 176 """ 177 if dx ==None:177 if dx is None: 178 178 dx = 0 179 179 return dx … … 188 188 189 189 """ 190 if dx !=None:190 if dx is not None: 191 191 err = 2 * x * dx 192 192 return math.fabs(err) … … 204 204 """ 205 205 if x > 0: 206 if dx !=None:206 if dx is not None: 207 207 err = dx / (2 * math.sqrt(x)) 208 208 else: … … 222 222 223 223 """ 224 if dx !=None:224 if dx is not None: 225 225 err = 4 * math.pow(x, 3) * dx 226 226 return math.fabs(err) … … 238 238 """ 239 239 if x > 0: 240 if dx !=None:240 if dx is not None: 241 241 err = dx / (4 * math.pow(x, 3 / 4)) 242 242 else: … … 256 256 257 257 """ 258 if dx ==None:258 if dx is None: 259 259 dx = 0 260 260 … … 280 280 281 281 """ 282 if dx ==None:282 if dx is None: 283 283 dx = 0 284 284 … … 294 294 """ 295 295 """ 296 if dx ==None:297 dx = 0 298 if dy ==None:296 if dx is None: 297 dx = 0 298 if dy is None: 299 299 dy = 0 300 300 err = math.sqrt((2 * x * y * dx) ** 2 + ((x ** 2) * dy) ** 2) … … 314 314 raise ValueError(msg) 315 315 if x != 0 and y != 0: 316 if dx ==None:316 if dx is None: 317 317 dx = 0 318 if dy ==None:318 if dy is None: 319 319 dy = 0 320 320 err = (dx / x) ** 2 + (dy / y) ** 2 … … 337 337 raise ValueError(msg) 338 338 if x > 0 and y > 0: 339 if dx ==None:339 if dx is None: 340 340 dx = 0 341 if dy ==None:341 if dy is None: 342 342 dy = 0 343 343 err = (2.0 * dx / x) ** 2 + (dy / y) ** 2 … … 353 353 """ 354 354 if x != 0: 355 if dx ==None:355 if dx is None: 356 356 dx = 0 357 357 err = dx / x ** 2 … … 367 367 """ 368 368 if x > 0: 369 if dx ==None:369 if dx is None: 370 370 dx = 0 371 371 err = -1 / 2 * math.pow(x, -3.0 / 2.0) * dx … … 388 388 msg += " that are consistent with zero." 389 389 raise ValueError(msg) 390 if dx ==None:391 dx = 0 392 if dy ==None:390 if dx is None: 391 dx = 0 392 if dy is None: 393 393 dy = 0 394 394 err = math.sqrt((4.0 * dx / x) ** 2 + (dy / y) ** 2) … … 406 406 # within errors 407 407 408 if dx ==None:409 dx = 0 410 if dy ==None:408 if dx is None: 409 dx = 0 410 if dy is None: 411 411 dy = 0 412 412 err = math.sqrt((dy * pow(x, 4)) ** 2 + (4 * y * dx * math.pow(x, 3)) ** 2) -
src/sas/qtgui/Plotting/Fittings.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 22 22 self.model = model 23 23 self.name = name 24 if not value ==None:24 if value is not None: 25 25 self.model.setParam(self.name, value) 26 26 -
src/sas/qtgui/Plotting/PlotUtilities.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 161 161 """ 162 162 # No image matrix given 163 if image ==None or numpy.ndim(image) != 2 \163 if image is None or numpy.ndim(image) != 2 \ 164 164 or numpy.isfinite(image).all() \ 165 or weights ==None:165 or weights is None: 166 166 return image 167 167 # Get bin size in y and x directions -
src/sas/qtgui/Plotting/Plottables.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 227 227 if p.hidden == True: 228 228 continue 229 if not p.x ==None:229 if not p.x is None: 230 230 for x_i in p.x: 231 if min_value ==None or x_i < min_value:231 if min_value is None or x_i < min_value: 232 232 min_value = x_i 233 if max_value ==None or x_i > max_value:233 if max_value is None or x_i > max_value: 234 234 max_value = x_i 235 235 return min_value, max_value … … 560 560 Returns True if there is no data stored in the plottable 561 561 """ 562 if not self.x ==None and len(self.x) == 0 \563 and not self.y ==None and len(self.y) == 0:562 if not self.x is None and len(self.x) == 0 \ 563 and not self.y is None and len(self.y) == 0: 564 564 return True 565 565 return False … … 795 795 tempy = [] 796 796 tempdy = [] 797 if self.dx ==None:797 if self.dx is None: 798 798 self.dx = numpy.zeros(len(self.x)) 799 if self.dy ==None:799 if self.dy is None: 800 800 self.dy = numpy.zeros(len(self.y)) 801 801 if self.xLabel == "log10(x)": … … 825 825 tempy = [] 826 826 tempdy = [] 827 if self.dx ==None:827 if self.dx is None: 828 828 self.dx = numpy.zeros(len(self.x)) 829 if self.dy ==None:829 if self.dy is None: 830 830 self.dy = numpy.zeros(len(self.y)) 831 831 if self.yLabel == "log10(y)": … … 858 858 tempy = [] 859 859 tempdy = [] 860 if self.dx ==None:860 if self.dx is None: 861 861 self.dx = numpy.zeros(len(self.x)) 862 if self.dy ==None:862 if self.dy is None: 863 863 self.dy = numpy.zeros(len(self.y)) 864 if xmin != None and xmax !=None:864 if xmin is not None and xmax is not None: 865 865 for i in range(len(self.x)): 866 866 if self.x[i] >= xmin and self.x[i] <= xmax: … … 1202 1202 """ 1203 1203 """ 1204 if self._chisq ==None:1204 if self._chisq is None: 1205 1205 chisqTxt = r'$\chi^2=$' 1206 1206 else: -
src/sas/qtgui/Plotting/Plotter.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 614 614 """ 615 615 ax = event.inaxes 616 if ax ==None:616 if ax is None: 617 617 return 618 618 # Event occurred inside a plotting area … … 649 649 step = event.step 650 650 651 if ax !=None:651 if ax is not None: 652 652 # Event occurred inside a plotting area 653 653 lo, hi = ax.get_xlim() -
src/sas/qtgui/Plotting/Plotter2D.py
rf4a1433 r895e7359 281 281 new_plot.id = "Circ avg " + self.data.name 282 282 new_plot.is_data = True 283 variant_plot = QtCore.QVariant(new_plot) 284 GuiUtils.updateModelItemWithPlot(self._item, variant_plot, new_plot.id) 283 GuiUtils.updateModelItemWithPlot(self._item, new_plot, new_plot.id) 285 284 self.manager.communicator.plotUpdateSignal.emit([new_plot]) 286 285 -
src/sas/qtgui/Plotting/PlotterData.py
- Property mode changed from 100755 to 100644
rfef38e8 r895e7359 71 71 result.clone_without_data(length=len(self.x), clone=self) 72 72 result.copy_from_datainfo(data1d=self) 73 if self.dxw ==None:73 if self.dxw is None: 74 74 result.dxw = None 75 75 else: 76 76 result.dxw = numpy.zeros(len(self.x)) 77 if self.dxl ==None:77 if self.dxl is None: 78 78 result.dxl = None 79 79 else: … … 118 118 tot_length = len(self.x) + len(other.x) 119 119 result = self.clone_without_data(length=tot_length, clone=result) 120 if self.dy ==None or other.dy is None:120 if self.dy is None or other.dy is None: 121 121 result.dy = None 122 122 else: 123 123 result.dy = numpy.zeros(tot_length) 124 if self.dx ==None or other.dx is None:124 if self.dx is None or other.dx is None: 125 125 result.dx = None 126 126 else: 127 127 result.dx = numpy.zeros(tot_length) 128 if self.dxw ==None or other.dxw is None:128 if self.dxw is None or other.dxw is None: 129 129 result.dxw = None 130 130 else: 131 131 result.dxw = numpy.zeros(tot_length) 132 if self.dxl ==None or other.dxl is None:132 if self.dxl is None or other.dxl is None: 133 133 result.dxl = None 134 134 else: … … 141 141 result.y = numpy.append(self.y, other.y) 142 142 result.y = result.y[ind] 143 if result.dy !=None:143 if result.dy is not None: 144 144 result.dy = numpy.append(self.dy, other.dy) 145 145 result.dy = result.dy[ind] … … 238 238 result.ymin = self.ymin 239 239 result.ymax = self.ymax 240 if self.dqx_data == None or self.dqy_data ==None:240 if self.dqx_data is None or self.dqy_data is None: 241 241 result.dqx_data = None 242 242 result.dqy_data = None … … 301 301 result.ymin = self.ymin 302 302 result.ymax = self.ymax 303 if self.dqx_data == None or self.dqy_data ==None or \304 other.dqx_data == None or other.dqy_data ==None :303 if self.dqx_data is None or self.dqy_data is None or \ 304 other.dqx_data is None or other.dqy_data is None : 305 305 result.dqx_data = None 306 306 result.dqy_data = None -
src/sas/qtgui/Plotting/SlicerModel.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 23 23 item2 = QtGui.QStandardItem(GuiUtils.formatNumber(parameters[parameter])) 24 24 self._model.appendRow([item1, item2]) 25 self._model.setHeaderData(0, QtCore.Qt.Horizontal, QtCore.QVariant("Parameter"))26 self._model.setHeaderData(1, QtCore.Qt.Horizontal, QtCore.QVariant("Value"))25 self._model.setHeaderData(0, QtCore.Qt.Horizontal, "Parameter") 26 self._model.setHeaderData(1, QtCore.Qt.Horizontal, "Value") 27 27 28 28 def setParamsFromModel(self, item): -
src/sas/qtgui/Plotting/Slicers/AnnulusSlicer.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 145 145 new_plot.xtransform = "x" 146 146 new_plot.ytransform = "y" 147 variant_plot = QtCore.QVariant(new_plot) 148 GuiUtils.updateModelItemWithPlot(self._item, variant_plot, new_plot.id) 147 GuiUtils.updateModelItemWithPlot(self._item, new_plot, new_plot.id) 149 148 self.base.manager.communicator.plotUpdateSignal.emit([new_plot]) 150 149 -
src/sas/qtgui/Plotting/Slicers/Arc.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 70 70 x = [] 71 71 y = [] 72 if theta1 !=None:72 if theta1 is not None: 73 73 self.theta1 = theta1 74 if theta2 !=None:74 if theta2 is not None: 75 75 self.theta2 = theta2 76 76 while self.theta2 < self.theta1: … … 80 80 npts = int((self.theta2 - self.theta1) / (math.pi / 120)) 81 81 82 if r ==None:82 if r is None: 83 83 self.radius = math.sqrt(math.pow(self._mouse_x, 2) + \ 84 84 math.pow(self._mouse_y, 2)) -
src/sas/qtgui/Plotting/Slicers/BoxSlicer.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 190 190 new_plot.id = (self.averager.__name__) + self.base.data.name 191 191 new_plot.is_data = True 192 variant_plot = QtCore.QVariant(new_plot) 193 GuiUtils.updateModelItemWithPlot(self._item, variant_plot, new_plot.id) 192 GuiUtils.updateModelItemWithPlot(self._item, new_plot, new_plot.id) 194 193 195 194 if self.update_model: -
src/sas/qtgui/Plotting/Slicers/BoxSum.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 110 110 parameters = self.getParams() 111 111 # Crete/overwrite model items 112 self._model.setData(self._model.index(0, 0), 113 QtCore.QVariant(formatNumber(parameters['Height']))) 114 self._model.setData(self._model.index(0, 1), 115 QtCore.QVariant(formatNumber(parameters['Width']))) 116 self._model.setData(self._model.index(0, 2), 117 QtCore.QVariant(formatNumber(parameters['center_x']))) 118 self._model.setData(self._model.index(0, 3), 119 QtCore.QVariant(formatNumber(parameters['center_y']))) 112 self._model.setData(self._model.index(0, 0), formatNumber(parameters['Height'])) 113 self._model.setData(self._model.index(0, 1), formatNumber(parameters['Width'])) 114 self._model.setData(self._model.index(0, 2), formatNumber(parameters['center_x'])) 115 self._model.setData(self._model.index(0, 3), formatNumber(parameters['center_y'])) 120 116 121 117 self.setReadOnlyParametersFromModel() … … 130 126 """ 131 127 parameters = self.getParams() 132 self._model.setData(self._model.index(0, 4), 133 QtCore.QVariant(formatNumber(parameters['avg']))) 134 self._model.setData(self._model.index(0, 5), 135 QtCore.QVariant(formatNumber(parameters['avg_error']))) 136 self._model.setData(self._model.index(0, 6), 137 QtCore.QVariant(formatNumber(parameters['sum']))) 138 self._model.setData(self._model.index(0, 7), 139 QtCore.QVariant(formatNumber(parameters['sum_error']))) 140 self._model.setData(self._model.index(0, 8), 141 QtCore.QVariant(formatNumber(parameters['num_points']))) 128 self._model.setData(self._model.index(0, 4), formatNumber(parameters['avg'])) 129 self._model.setData(self._model.index(0, 5), formatNumber(parameters['avg_error'])) 130 self._model.setData(self._model.index(0, 6), formatNumber(parameters['sum'])) 131 self._model.setData(self._model.index(0, 7), formatNumber(parameters['sum_error'])) 132 self._model.setData(self._model.index(0, 8), formatNumber(parameters['num_points'])) 142 133 143 134 def setParamsFromModel(self): … … 362 353 Draw the new roughness on the graph. 363 354 """ 364 if center_x !=None:355 if center_x is not None: 365 356 self.x = center_x 366 if center_y !=None:357 if center_y is not None: 367 358 self.y = center_y 368 359 self.center_marker.set(xdata=[self.x], ydata=[self.y]) -
src/sas/qtgui/Plotting/Slicers/SectorSlicer.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 125 125 data = self.base.data 126 126 # If we have no data, just return 127 if data ==None:127 if data is None: 128 128 return 129 129 # Averaging … … 132 132 phimin = -self.left_line.phi + self.main_line.theta 133 133 phimax = self.left_line.phi + self.main_line.theta 134 if nbins ==None:134 if nbins is None: 135 135 nbins = 20 136 136 sect = SectorQ(r_min=0.0, r_max=radius, … … 168 168 new_plot.id = "SectorQ" + self.base.data.name 169 169 new_plot.is_data = True 170 variant_plot = QtCore.QVariant(new_plot) 171 GuiUtils.updateModelItemWithPlot(self._item, variant_plot, new_plot.id) 170 GuiUtils.updateModelItemWithPlot(self._item, new_plot, new_plot.id) 172 171 self.base.manager.communicator.plotUpdateSignal.emit([new_plot]) 173 172 … … 349 348 self.left_moving = left 350 349 theta3 = 0 351 if phi !=None:350 if phi is not None: 352 351 self.phi = phi 353 if delta ==None:352 if delta is None: 354 353 delta = 0 355 354 if right: … … 361 360 self.theta = mline.theta + self.phi 362 361 363 if mline !=None:362 if mline is not None: 364 363 if delta != 0: 365 364 self.theta2 = mline + delta … … 509 508 """ 510 509 511 if theta !=None:510 if theta is not None: 512 511 self.theta = theta 513 512 x1 = self.radius * numpy.cos(self.theta) -
src/sas/qtgui/Plotting/UnitTesting/BoxSumTest.py
r464cd07 r895e7359 23 23 parameters = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] 24 24 for index, parameter in enumerate(parameters): 25 model.setData(model.index(0, index), 26 QtCore.QVariant(parameter)) 25 model.setData(model.index(0, index),parameter) 27 26 self.widget = BoxSum(None, model=model) 28 27 -
src/sas/qtgui/UnitTesting/TestUtils.py
r092a3d9 r895e7359 54 54 55 55 def signal(self, index=None): 56 if index ==None:56 if index is None: 57 57 return self._signal 58 58 else: -
src/sas/qtgui/Utilities/CategoryInstaller.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 129 129 130 130 serialized_file = None 131 if homedir ==None:131 if homedir is None: 132 132 serialized_file = CategoryInstaller.get_user_file() 133 133 else: -
src/sas/qtgui/Utilities/GuiUtils.py
- Property mode changed from 100755 to 100644
rb0b09b9 r895e7359 239 239 """ 240 240 Adds a checkboxed row named "name" to QStandardItem 241 Adds QVariant'update_data' to that row.241 Adds 'update_data' to that row. 242 242 """ 243 243 assert isinstance(item, QtGui.QStandardItem) 244 #assert isinstance(update_data, QtCore.QVariant)245 #py_update_data = update_data.toPyObject()246 244 py_update_data = update_data 247 245 … … 269 267 """ 270 268 Creates a checkboxed QStandardItem named "name" 271 Adds QVariant'update_data' to that row.269 Adds 'update_data' to that row. 272 270 """ 273 271 #assert isinstance(update_data, QtCore.QVariant) … … 532 530 with open(path,'w') as out: 533 531 has_errors = True 534 if data.dy ==None or data.dy == []:532 if data.dy is None or data.dy == []: 535 533 has_errors = False 536 534 # Sanity check … … 552 550 if has_errors: 553 551 if data.dx is not None and data.dx != []: 554 if data.dx[i] !=None:552 if data.dx[i] is not None: 555 553 out.write("%g %g %g %g\n" % (data.x[i], 556 554 data.y[i], -
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
rf4a1433 r895e7359 102 102 test_item = QtGui.QStandardItem() 103 103 test_list = ['aa','11'] 104 update_data = QtCore.QVariant(test_list)104 update_data = test_list 105 105 name = "Black Sabbath" 106 106 … … 133 133 checkbox_item.setCheckState(QtCore.Qt.Checked) 134 134 test_item0 = QtGui.QStandardItem() 135 test_item0.setData( QtCore.QVariant(test_list0))135 test_item0.setData(test_list0) 136 136 137 137 # Checked item 1 … … 140 140 test_item1.setCheckState(QtCore.Qt.Checked) 141 141 object_item = QtGui.QStandardItem() 142 object_item.setData( QtCore.QVariant(test_list1))142 object_item.setData(test_list1) 143 143 test_item1.setChild(0, object_item) 144 144 … … 151 151 test_item2.setCheckState(QtCore.Qt.Unchecked) 152 152 object_item = QtGui.QStandardItem() 153 object_item.setData( QtCore.QVariant(test_list2))153 object_item.setData(test_list2) 154 154 test_item2.setChild(0, object_item) 155 155 checkbox_item.appendRow(test_item2) -
src/sas/sascalc/dataloader/readers/danse_reader.py
raf3e9f5 r895e7359 191 191 x_vals = np.tile(x_vals, (size_y, 1)).flatten() 192 192 y_vals = np.tile(y_vals, (size_x, 1)).T.flatten() 193 if (np.all(self.current_dataset.err_data ==None)193 if (np.all(self.current_dataset.err_data is None) 194 194 or np.any(self.current_dataset.err_data <= 0)): 195 195 new_err_data = np.sqrt(np.abs(self.current_dataset.data)) -
src/sas/sasgui/guiframe/local_perspectives/plotting/AnnulusSlicer.py
r83eb5208 r895e7359 147 147 new_plot.xtransform = "x" 148 148 new_plot.ytransform = "y" 149 variant_plot = QtCore.QVariant(new_plot) 150 GuiUtils.updateModelItemWithPlot(self._item, variant_plot, new_plot.id) 149 GuiUtils.updateModelItemWithPlot(self._item, new_plot, new_plot.id) 151 150 self.base.manager.communicator.plotUpdateSignal.emit([new_plot]) 152 151 -
src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py
rc416a17 r895e7359 126 126 data = self.base.data 127 127 # If we have no data, just return 128 if data ==None:128 if data is None: 129 129 return 130 130 # Averaging … … 133 133 phimin = -self.left_line.phi + self.main_line.theta 134 134 phimax = self.left_line.phi + self.main_line.theta 135 if nbins ==None:135 if nbins is None: 136 136 nbins = 20 137 137 sect = SectorQ(r_min=0.0, r_max=radius, … … 169 169 new_plot.id = "SectorQ" + self.base.data.name 170 170 new_plot.is_data = True 171 variant_plot = QtCore.QVariant(new_plot) 172 GuiUtils.updateModelItemWithPlot(self._item, variant_plot, new_plot.id) 171 GuiUtils.updateModelItemWithPlot(self._item, new_plot, new_plot.id) 173 172 self.base.manager.communicator.plotUpdateSignal.emit([new_plot]) 174 173 … … 356 355 if phi != None: 357 356 self.phi = phi 358 if delta ==None:357 if delta is None: 359 358 delta = 0 360 359 if right: -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py
r83eb5208 r895e7359 190 190 new_plot.id = (self.averager.__name__) + self.base.data.name 191 191 new_plot.is_data = True 192 variant_plot = QtCore.QVariant(new_plot) 193 GuiUtils.updateModelItemWithPlot(self._item, variant_plot, new_plot.id) 192 GuiUtils.updateModelItemWithPlot(self._item, new_plot, new_plot.id) 194 193 195 194 if self.update_model: -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSum.py
rc416a17 r895e7359 110 110 parameters = self.getParams() 111 111 # Crete/overwrite model items 112 self._model.setData(self._model.index(0, 0), 113 QtCore.QVariant(formatNumber(parameters['Height']))) 114 self._model.setData(self._model.index(0, 1), 115 QtCore.QVariant(formatNumber(parameters['Width']))) 116 self._model.setData(self._model.index(0, 2), 117 QtCore.QVariant(formatNumber(parameters['center_x']))) 118 self._model.setData(self._model.index(0, 3), 119 QtCore.QVariant(formatNumber(parameters['center_y']))) 112 self._model.setData(self._model.index(0, 0), formatNumber(parameters['Height'])) 113 self._model.setData(self._model.index(0, 1), formatNumber(parameters['Width'])) 114 self._model.setData(self._model.index(0, 2), formatNumber(parameters['center_x'])) 115 self._model.setData(self._model.index(0, 3), formatNumber(parameters['center_y'])) 120 116 121 117 self.setReadOnlyParametersFromModel() … … 130 126 """ 131 127 parameters = self.getParams() 132 self._model.setData(self._model.index(0, 4), 133 QtCore.QVariant(formatNumber(parameters['avg']))) 134 self._model.setData(self._model.index(0, 5), 135 QtCore.QVariant(formatNumber(parameters['avg_error']))) 136 self._model.setData(self._model.index(0, 6), 137 QtCore.QVariant(formatNumber(parameters['sum']))) 138 self._model.setData(self._model.index(0, 7), 139 QtCore.QVariant(formatNumber(parameters['sum_error']))) 140 self._model.setData(self._model.index(0, 8), 141 QtCore.QVariant(formatNumber(parameters['num_points']))) 128 self._model.setData(self._model.index(0, 4), formatNumber(parameters['avg'])) 129 self._model.setData(self._model.index(0, 5), formatNumber(parameters['avg_error'])) 130 self._model.setData(self._model.index(0, 6), formatNumber(parameters['sum'])) 131 self._model.setData(self._model.index(0, 7), formatNumber(parameters['sum_error'])) 132 self._model.setData(self._model.index(0, 8), formatNumber(parameters['num_points'])) 142 133 143 134 def setParamsFromModel(self):
Note: See TracChangeset
for help on using the changeset viewer.