Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Changes widgets/Cursor: #5952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

ispielman
Copy link

(1) added option so that a left click enables dragging of cursors

(2) Changed behavior so cursor starts in the center of the window.

(3) Added method self.coord() that returns the coordinates of the cursor.

(4) When cursor leaves the axis containing the cursor, the cursor is left at its final position rather than being erased.

These changes are designed to make this cursor useful for selecting some point on the graph. We use this type of behavior all the time is our current data analysis workflow in Igor pro (for example, you might use a cursor to select the location of a peak in a data trace to define where to start a fit).

Added class Cursors:

Similar to Cursor, but many cursors.

(1) added option so that a right click enables dragging of cursors

(2) Changed behavior so cursor starts in the center of the window.

(3) Added method self.coord() that returns the coordinates of the cursor.

(4) When cursor leaves the axis containing the cursor, the cursor is left at its final position rather than being erased.

These changes are designed to make this cursor useful for selecting some point on the figure.

Added class Cursors:

Similar to Cursor, but many cursors.
@tacaswell
Copy link
Member

This sounds very useful.

Does this work clash with #5786 ?

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Feb 1, 2016
@ispielman
Copy link
Author

It seems that #5786 is a pretty comprehensive set of graph interaction tools with more broad impact than my simple change + extension to the existing cursor functionality. It is possible that this should be merged into the proposed set of interactive drawing classes, but in my view this simply fleshes out the functionality of the existing Cursor class.

@ispielman
Copy link
Author

Note: added commit to my branch cleaning up PEP8 stuff that may or may not have lead to the failure of the Travis CI build.

@tacaswell
Copy link
Member

It looks like the needclear logic has been (effectively) removed. Was this intentional? I think you can just remove it altogether. It looks like it was always intended to be internal state so can be removed with no deprecation.

visible=False,
**prop)

self.__selected = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only need one of this or L1162

@tacaswell
Copy link
Member

Can you restore the old behavior that if the hit is not in the axes to hide the cursor in non-draggable mode?


for prop, new_prop in zip(properties, self.properties):
new_prop['visible'] = True
new_prop['horizOn'] = prop.pop('horizOn', True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are going to pop, make a copy first. Keeping functions pure is a general a good thing. The use case this supports is passing the same list of properties to several Cursors each on a different axes.

@tacaswell
Copy link
Member


The following code will add three cursors to an existing axis

csr = Cursors(ax, [{'color':'red'}, {'color':'blue'}, {'color':'black'}],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you format this as a rst code section so that the docs render nicely?

@tacaswell
Copy link
Member

Over all 👍

@tacaswell
Copy link
Member

I also threw a PR at your branch fixing a bunch of pep8 issues (sorry, couldn't help my self when I was reading the code...)

@tacaswell
Copy link
Member

Please do not merge the master branch into your feature branch. If there are no conflicts do not worry about it and if there are conflicts please rebase.

@tacaswell tacaswell modified the milestone: 2.1 (next point release) Aug 29, 2017
@jklymak jklymak added this to the unassigned milestone Jul 14, 2020
@jklymak
Copy link
Member

jklymak commented Sep 8, 2020

I'll close this as orphaned....

@jklymak jklymak closed this Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants