Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Qwheeledit hide of edition widget and returnPressed forwarding #832

Merged
merged 9 commits into from
Jul 22, 2019

Conversation

MikeFalowski
Copy link

Our scientist asked for few things in the TaurusWheelEdit:

  1. Values should be applied not only with an enter, but also with a custom button.
  2. When edition widget is shown, it should not disappear on focusOut.
  3. Accepting value from the edition widget should also write an attribute.

To achieve this I had to change the way the edition widget is hide in qwheel module. First of all variable _editing is set in method hiding and showing editing widget now, because earlier there were some cases, where this variable didn't changed properly (edition widget was hidden but _editing was set to True) and I didn't want to change it in the application, as it is supposed to be private. I think it should be now more consistent.

3rd point: I make this with emitting QWheelEdit.returnPressed when edition widget's returnPressed is emitted.

2nd and 3rd points are disabled by default.

In the application I made a button connected to 3 methods

    set_button = QtGui.QPushButton()
    set_button.setText("Apply")

    set_button.clicked.connect(taurus_wheel_edit.editingFinished)
    set_button.clicked.connect(taurus_wheel_edit.returnPressed)
    set_button.clicked.connect(taurus_wheel_edit.hideEditWidget)

Can you tell me if this approach is ok? Anyway, if anyone will find this useful and it's ok, feel free to merge it.

@cpascual cpascual added this to the Jan19 milestone Dec 10, 2018
@cpascual
Copy link
Member

Hi @MikeFalowski ,
Thanks a lot for contributing!

I have one question regarding the "WIP" in the title of the PR: by convention, we treat WIP PRs as not-ready-for-merging-yet (i.e. if you keep the "WIP" prefix in the title you indicate that there is still work you intend to do on the branch before a reviewer considers it for merging, and that you are just creating the PR to get some early advice/discussion on the implementation).

This is different from a "normal" PR which the author considers "ready" (without precluding that some further commits be done if issues arise during the review process)

So, should we understand that it is still under development?
Or should we already review it (if so, please remove the "WIP")?

@cpascual
Copy link
Member

Regarding this part of your message...

In the application I made a button connected to 3 methods
(...)
Can you tell me if this approach is ok?

... I understand that this is in order to fulfil requirement "1" from your scientist and that this only applies to your own application, so it is up to you how you implement it.
I just have the impression that the connection totaurus_wheel_edit.returnPressed should not be necessary, and it could be handled by the connection to editingFinished

If the reason for having it is that you want the changes to be written to the control system when using a TaurusWheelEdit, I think that a more explicit call to TaurusWheelEdit.writeValue() would be better.

But as I said, it is totally up to you since that is not part of taurus but of your own app.

@cpascual
Copy link
Member

So, should we understand that it is still under development?
Or should we already review it (if so, please remove the "WIP")?

(bump) @MikeFalowski

@cpascual
Copy link
Member

cpascual commented Feb 1, 2019

Since we got no reply from @MikeFalowski and we are about to close the Jan19 milestone, I am moving this for the Jul19 milestone

@cpascual cpascual modified the milestones: Jan19, Jul19 Feb 1, 2019
@MikeFalowski
Copy link
Author

Sorry for no reply. Moving it to next milestone is the best option, as I had to postpone it. I can take care of it at the end of February or in March.

@cpascual
Copy link
Member

(bump) @MikeFalowski any news on this?

@MikeFalowski
Copy link
Author

Hey, sorry for the delay.

Ok, so I set the WIP status, because I weren't sure is it good approach to achieve my goals that way and was thinking about changing it but for now I didn't found a better solution. I'm removing WIP.

@MikeFalowski MikeFalowski changed the title WIP: Qwheeledit hide of edition widget and returnPressed forwarding Qwheeledit hide of edition widget and returnPressed forwarding May 6, 2019
@cpascual
Copy link
Member

cpascual commented May 6, 2019

Hi @MikeFalowski , thanks for the update.

I'm removing WIP.

I'll re-enter this into the queue for reviewing ;)

Copy link
Author

@MikeFalowski MikeFalowski left a comment

Choose a reason for hiding this comment

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

Regarding this part of your message...

In the application I made a button connected to 3 methods
(...)
Can you tell me if this approach is ok?

... I understand that this is in order to fulfil requirement "1" from your scientist and that this only applies to your own application, so it is up to you how you implement it.
I just have the impression that the connection totaurus_wheel_edit.returnPressed should not be necessary, and it could be handled by the connection to editingFinished

If the reason for having it is that you want the changes to be written to the control system when using a TaurusWheelEdit, I think that a more explicit call to TaurusWheelEdit.writeValue() would be better.

But as I said, it is totally up to you since that is not part of taurus but of your own app.

Exactly, I was using returnPressed to apply value to the control system. Connecting writeValue seems to be more clear, so I will use it. Thanks for the advice!

MikeFalowski and others added 4 commits May 29, 2019 13:38
Refactor QwheelEdit to use editingFinished instead of a custom focusOut
event handler and a focusOut signal.
Substitute 2 buttons for a checkbox and simplify implementation of demo.
@cpascual
Copy link
Member

cpascual commented Jul 22, 2019

With the latest changes, I think that this is ready to go into the Jul19 release.
I'll merge when I get green light from Travis.
Thanks @MikeFalowski for the patience and the contribution!

@cpascual cpascual merged commit 62bdfdb into taurus-org:develop Jul 22, 2019
@MikeFalowski
Copy link
Author

With the latest changes, I think that this is ready to go into the Jul19 release.
I'll merge when I get green light from Travis.
Thanks @MikeFalowski for the patience and the contribution!

And thanks a lot for merging it and the help with changes!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants