- Timestamp:
- Jun 3, 2015 10:45:31 AM (9 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 9d5427f
- Parents:
- e1442d4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/local_perspectives/plotting/Plotter1D.py
r090e07e rb99a4552 217 217 return 218 218 if event.id in self.plots.keys(): 219 ctrl = event.ctrl 220 self.cursor_id = event.id 219 221 # Set line position and color 220 222 colors = ['red', 'purple'] 221 self.cursor_id = event.id 222 ctrl = event.ctrl 223 x_data = self.plots[self.cursor_id].x 224 values = [max(x_data.min(), float(ctrl[0].GetValue())), 225 min(x_data.max(), float(ctrl[1].GetValue()))] 223 226 if self.ly == None: 224 227 self.ly = [] 225 for ind_ly in range(len(colors)):226 self.ly.append(self.subplot.axvline(color=colors[ind_ly],227 lw=2.5, alpha=0.7))228 self.ly [ind_ly].set_rasterized(True)228 for c, v in zip(colors, values): 229 h = self.subplot.axvline(x=v, color=c, lw=2.5, alpha=0.7) 230 h.set_rasterized(True) 231 self.ly.append(h) 229 232 try: 230 233 # Display x,y in the status bar if possible … … 239 242 try: 240 243 is_moved = False 241 for idx in range(len(self.ly)): 242 val = float(ctrl[idx].GetValue()) 244 for h, v in zip(self.ly, values): 243 245 # check if vline moved 244 if self.ly[idx].get_xdata() != val:245 self.ly[idx].set_xdata(val)246 if h.get_xdata() != v: 247 h.set_xdata(v) 246 248 is_moved = True 247 249 if is_moved: … … 252 254 return 253 255 self.q_ctrl = ctrl 254 pos_x_min = float(self.q_ctrl[0].GetValue()) 255 pos_x_max = float(self.q_ctrl[1].GetValue()) 256 pos_x = [pos_x_min, pos_x_max] 257 for ind_ly in range(len(colors)): 258 self.ly[ind_ly].set_color(colors[ind_ly]) 259 self.ly[ind_ly].set_xdata(pos_x[ind_ly]) 256 for h, c, v in zip(self.ly, colors, values): 257 h.set_color(c) 258 h.set_xdata(v) 260 259 self.canvas.draw() 261 260 else:
Note: See TracChangeset
for help on using the changeset viewer.