Changeset 0268aed in sasview for src/sas/qtgui/Plotter.py
- Timestamp:
- Mar 29, 2017 8:02:34 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:
- 7d077d1
- Parents:
- 6fd4e36
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotter.py
r6fd4e36 r0268aed 530 530 """ 531 531 # Check that the LEFT button was pressed 532 if event.button == 1:533 self.leftdown = True534 ax = event.inaxes 535 for text in self.textList:536 if text.contains(event)[0]: # If user has clicked on text537 self.selectedText =text538 return539 540 if ax !=None:541 self.xInit, self.yInit = event.xdata, event.ydata542 543 544 545 546 532 if event.button != 1: 533 return 534 535 self.leftdown = True 536 for text in self.textList: 537 if text.contains(event)[0]: # If user has clicked on text 538 self.selectedText = text 539 return 540 if event.inaxes is None: 541 return 542 try: 543 self.x_click = float(event.xdata) # / size_x 544 self.y_click = float(event.ydata) # / size_y 545 except: 546 self.position = None 547 547 548 548 def onMplMouseUp(self, event): … … 556 556 if event.button == 1: 557 557 self.leftdown = False 558 #self.leftup = True559 558 self.selectedText = None 560 559 … … 572 571 return 573 572 574 if self.leftdown and self.selectedText is not None: 575 # User has clicked on text and is dragging 576 ax = event.inaxes 577 if ax != None: 578 # Only move text if mouse is within axes 579 self.selectedText.set_position((event.xdata, event.ydata)) 580 self.canvas.draw_idle() 581 else: 582 # User has dragged outside of axes 583 self.selectedText = None 584 return 573 #if self.leftdown and self.selectedText is not None: 574 if self.leftdown or self.selectedText is None: 575 return 576 # User has clicked on text and is dragging 577 if event.inaxes is None: 578 # User has dragged outside of axes 579 self.selectedText = None 580 else: 581 # Only move text if mouse is within axes 582 self.selectedText.set_position((event.xdata, event.ydata)) 583 self.canvas.draw_idle() 584 return 585 585 586 586 def onMplPick(self, event): … … 589 589 """ 590 590 legend = self.legend 591 if event.artist == legend: 592 # Get the box of the legend. 593 bbox = self.legend.get_window_extent() 594 # Get mouse coordinates at time of pick. 595 self.mouse_x = event.mouseevent.x 596 self.mouse_y = event.mouseevent.y 597 # Get legend coordinates at time of pick. 598 self.legend_x = bbox.xmin 599 self.legend_y = bbox.ymin 600 # Indicate we picked up the legend. 601 self.gotLegend = 1 602 603 #self.legend.legendPatch.set_alpha(0.5) 591 if event.artist != legend: 592 return 593 # Get the box of the legend. 594 bbox = self.legend.get_window_extent() 595 # Get mouse coordinates at time of pick. 596 self.mouse_x = event.mouseevent.x 597 self.mouse_y = event.mouseevent.y 598 # Get legend coordinates at time of pick. 599 self.legend_x = bbox.xmin 600 self.legend_y = bbox.ymin 601 # Indicate we picked up the legend. 602 self.gotLegend = 1 603 604 #self.legend.legendPatch.set_alpha(0.5) 604 605 605 606 def onLegendMotion(self, event):
Note: See TracChangeset
for help on using the changeset viewer.