equal
deleted
inserted
replaced
158 """ |
158 """ |
159 Return raw value at given index for string variables |
159 Return raw value at given index for string variables |
160 @param index: Variable value index |
160 @param index: Variable value index |
161 @return: Variable data type |
161 @return: Variable data type |
162 """ |
162 """ |
163 if (self.VariableType in ["STRING", "WSTRING"] and |
163 if self.VariableType in ["STRING", "WSTRING"] and index < len(self.RawData): |
164 index < len(self.RawData)): |
|
165 return self.RawData[index][0] |
164 return self.RawData[index][0] |
166 return "" |
165 return "" |
167 |
166 |
168 def GetValueRange(self): |
167 def GetValueRange(self): |
169 """ |
168 """ |
307 """ |
306 """ |
308 Update value. |
307 Update value. |
309 @param value: New value |
308 @param value: New value |
310 """ |
309 """ |
311 # Remove quote and double quote surrounding string value to get raw value |
310 # Remove quote and double quote surrounding string value to get raw value |
312 if (self.VariableType == "STRING" and |
311 if self.VariableType == "STRING" and value.startswith("'") and value.endswith("'") or \ |
313 value.startswith("'") and value.endswith("'") or |
312 self.VariableType == "WSTRING" and value.startswith('"') and value.endswith('"'): |
314 self.VariableType == "WSTRING" and |
|
315 value.startswith('"') and value.endswith('"')): |
|
316 value = value[1:-1] |
313 value = value[1:-1] |
317 |
314 |
318 # Store variable value |
315 # Store variable value |
319 if self.Value != value: |
316 if self.Value != value: |
320 self.Value = value |
317 self.Value = value |
374 |
371 |
375 # Get nearest data from tick |
372 # Get nearest data from tick |
376 idx = numpy.argmin(abs(ticks - tick)) |
373 idx = numpy.argmin(abs(ticks - tick)) |
377 |
374 |
378 # Adjust data index according to constraint |
375 # Adjust data index according to constraint |
379 if (adjust < 0 and ticks[idx] > tick and idx > 0 or |
376 if adjust < 0 and ticks[idx] > tick and idx > 0 or \ |
380 adjust > 0 and ticks[idx] < tick and idx < len(ticks)): |
377 adjust > 0 and ticks[idx] < tick and idx < len(ticks): |
381 idx += adjust |
378 idx += adjust |
382 |
379 |
383 return idx |
380 return idx |