Skip to content
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

Replybox richtext placeholder with modified behavior #597

Merged
merged 10 commits into from
Nov 8, 2019

Conversation

deeplow
Copy link
Contributor

@deeplow deeplow commented Oct 28, 2019

The commit is fully functional. I just have some questions regarding tests.

Description

Tweaks reply box according to #594:

  • placeholder It should be removed as soon as soon as textbox is active.
  • added formatting to placeholder: "Compose a reply to [source name]" (with color)

Fixes #594

reply

Test Plan

  1. Login to client
  2. Check the reply box has text Compose a message to [source name]
  3. Click on text box and verify placeholder is cleared
  4. Click outside text box and verify that the placeholder comes back
  5. Log out and check appropriate behavior (placeholder with other text)

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

Comments

The implementation uses a QLabel to act as a fake placeholder. Another alternative was to use the QTextEdit.setPlaceholderText(), given the constraints that:

  • Reply box should not accept rich text (Reply box accepts rich text input #539) -> making it a PlainTextEdit solves it
  • QTextEdit.setPlaceholderText() does NOT allow html as input
  • QTextEdit.setText() allows for html but for some reason it does not work if we wanted to set it as a "placeholder" (meaning that we cannot setText as soon as the text box is created)

@deeplow deeplow force-pushed the 594-replybox-placeholder branch from 48396fc to d8d57b9 Compare October 28, 2019 20:44
Copy link
Contributor

@sssoleileraaa sssoleileraaa left a comment

Choose a reason for hiding this comment

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

This is looking great. I followed the test plan and it works as advertised. Looks like tests still need to be added, I would suggest looking at this test for reference on how to trigger a mocked event (for you it'll be for focus).

Since you're adding rich text formatting, it would make sense to also update the text for offline mode to include the blue and bold "Sign in" text as you see here: https://app.zeplin.io/project/5c807ea562f734bd2756b243/screen/5cd3b87518e9f734ae0218bb

The design of offline mode is still being discussed and reviewed and being tracked here so it would be sufficient for now to update the text so that:

  • "You need to log in to send replies." -> "Sign in to compose or send a reply."
  • "to compose or send a reply." is 18px, Montserrat-Regular, rgba(42, 49, 157, 0.6)
  • "Sign in" is Montserrat-Bold, 18px, #2a319d, with letter-spacing 0.25px

@deeplow deeplow force-pushed the 594-replybox-placeholder branch from e6010b3 to 2938bf2 Compare October 29, 2019 20:37
@deeplow
Copy link
Contributor Author

deeplow commented Oct 29, 2019

Since you're adding rich text formatting, it would make sense to also update the text for offline mode to include the blue and bold "Sign in" text

This has been added now, but with a few problems: (the greyed out background is not part of the commit)

reply-new

problems:

  • letter-spacing 0.25px not implemented: property does not exist in Qt css and also would require another label (in total two labels side-by-side) so that we ca apply the css property individually to each chunk of text
  • Click on "Sign in" feature not implemented - this would probably require also two labels.

Having two labels (one for "Sign in" and the other one for the rest) will probably have problems with the localization because one needs to start where the other one ends.

I think these two problems are issues on their own and should be left for another PR @creviera


I'll finish the tests later

@sssoleileraaa sssoleileraaa self-requested a review October 29, 2019 20:48
Copy link
Contributor

@sssoleileraaa sssoleileraaa left a comment

Choose a reason for hiding this comment

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

letter-spacing 0.25px not implemented: property does not exist in Qt css and also would require another label (in total two labels side-by-side) so that we ca apply the css property individually to each chunk of text

See comment on how to do this here: #503 (comment) (you'll need to use setLetterSpacing which you can see an example of in various widgets in widgets.py)

I think these two problems are issues on their own and should be left for another PR @creviera

Sounds good to me. Could you please add followup issues?

@deeplow deeplow force-pushed the 594-replybox-placeholder branch from 7a8302d to 69f12b5 Compare October 30, 2019 16:12
Previous test was overly complicated and was more an integration
test than a unit test. So it was refactored to accommodate the
changes of the PR.
@sssoleileraaa sssoleileraaa self-requested a review November 5, 2019 00:23
Copy link
Contributor

@sssoleileraaa sssoleileraaa left a comment

Choose a reason for hiding this comment

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

There is a bug in the code that I just came across where after you send a reply and click outside of the ReplyBox, the Compose a reply message no longer appears, even when you click on another source in the source list and then return back to the original source. The ReplyBox remains blank.

To get the default text to show up again you have to click into the reply box and then click out of it again.

@deeplow
Copy link
Contributor Author

deeplow commented Nov 5, 2019

There is a bug in the code that I just came across where after you send a reply and click outside of the ReplyBox, the Compose a reply message no longer appears, even when you click on another source in the source list and then return back to the original source. The ReplyBox remains blank.

To get the default text to show up again you have to click into the reply box and then click out of it again.

Yeah, you're right. I had not thought of that. I'll add a fix shortly

@deeplow
Copy link
Contributor Author

deeplow commented Nov 5, 2019

Cross-posting as it might be relevant here: UX pilot of offline mode is finished #593 (comment)

@sssoleileraaa
Copy link
Contributor

Cross-posting as it might be relevant here: UX pilot of offline mode is finished #593 (comment)

If you decide to resolve this issue in this PR, just remember to add a "resolves [issue #]" comment

@sssoleileraaa
Copy link
Contributor

There is a bug in the code that I just came across where after you send a reply and click outside of the ReplyBox, the Compose a reply message no longer appears, even when you click on another source in the source list and then return back to the original source. The ReplyBox remains blank.

To get the default text to show up again you have to click into the reply box and then click out of it again.

I made a fix for this, and added a regression test to make sure setText is called when we send a reply so that we will see the "Compose a reply" placeholder again.

I also updated the tests like I suggested in the PR comment since it was a small change.

This is ready for a review from someone other than me since I made some changes.

@eloquence eloquence changed the title [wip] Replybox richtext placeholder with modified behavior Replybox richtext placeholder with modified behavior Nov 8, 2019
@sssoleileraaa sssoleileraaa self-requested a review November 8, 2019 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format placeholder text and hide on focus
3 participants