Skip to content

Conversation

plugyawn
Copy link
Collaborator

@plugyawn plugyawn commented May 6, 2022

What does this PR do?
Shows the detected platform on startup and in the About pop-up.

Tries to fix #1216.

Tested?

  • Manually
  • Existing tests (adapted, if necessary)
  • New tests added (for any new behavior)
  • Passed linting & tests (each commit)

Commit flow

  • Add platform information on startup
  • Add platform information to About menu

Notes & Questions

Interactions

Visual changes
image
image

@zulipbot zulipbot added the size: XS [Automatic label added by zulipbot] label May 6, 2022
@zulipbot
Copy link
Member

zulipbot commented May 6, 2022

Hello @plugyawn, it seems like you have referenced #1216 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #1216..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

To learn how to write a great commit message, please refer to our guide.

@plugyawn plugyawn requested a review from neiljp May 6, 2022 14:29
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

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

@plugyawn Thanks for adding this, when ready it should be helpful for debugging in future 👍

Generally it may be useful to use something along the lines of Detected Platform instead of the 'Running' and 'Platform' you currently have, both for consistency, and since this is what ZT determines is the platform - we can't know for sure.

This doesn't currently address the idea of showing extra text if the platform is unsupported, from the original issue; you didn't mention skipping it for now in the PR description, so I assume you missed that.

I think I mentioned this in another PR review, but I'd recommend reading your PRs in GitHub and maybe also something like tig or another local viewer, to ensure that the commit text and contents looks like what you'd expect.

)
contents = [
("Application", [("Zulip Terminal", zt_version)]),
("Application", [("Zulip Terminal", zt_version), ("Platform", PLATFORM)]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks OK, though I had originally envisaged it being in a separate section below the others, rather than in the Application section.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I assumed the version and the platform would go together? I'll put it in a separate section, that does sound better.

@neiljp neiljp added area: UI General user interface update PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels May 6, 2022
@plugyawn
Copy link
Collaborator Author

plugyawn commented May 8, 2022

@plugyawn Thanks for adding this, when ready it should be helpful for debugging in future 👍

Generally it may be useful to use something along the lines of Detected Platform instead of the 'Running' and 'Platform' you currently have, both for consistency, and since this is what ZT determines is the platform - we can't know for sure.

This doesn't currently address the idea of showing extra text if the platform is unsupported, from the original issue; you didn't mention skipping it for now in the PR description, so I assume you missed that.

I think I mentioned this in another PR review, but I'd recommend reading your PRs in GitHub and maybe also something like tig or another local viewer, to ensure that the commit text and contents looks like what you'd expect.

I missed the part about checking if the platform is unsupported, sorry -- I'm adding it right now.

@zulipbot zulipbot added size: S [Automatic label added by zulipbot] and removed size: XS [Automatic label added by zulipbot] labels May 8, 2022
@plugyawn plugyawn force-pushed the T1216_platform branch 5 times, most recently from ccede63 to 16f92fe Compare May 9, 2022 02:31
@zulipbot zulipbot added size: M [Automatic label added by zulipbot] and removed size: S [Automatic label added by zulipbot] labels May 9, 2022
plugyawn added 2 commits May 9, 2022 08:08
Shows PLATFORM from platform_code.py on the About Pop-Up.
Adds tests for checking what platform
is detected.
@zulipbot zulipbot added size: S [Automatic label added by zulipbot] and removed size: M [Automatic label added by zulipbot] labels May 9, 2022
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

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

@plugyawn You didn't mark this for review, but here's some feedback since you mentioned updating it in the stream. Please do toggle the labels if you're seeking review.

if PLATFORM:
print("Detected Platform: " + PLATFORM)
else:
print("Running on undetected platform.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this intended to be for unsupported platforms, or something else?

Please make sure you're aware what values this can take :)

You're not testing this result, in any case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this intended to be for unsupported platforms, or something else?

Please make sure you're aware what values this can take :)

You're not testing this result, in any case.

I'll look into that; I'm still not exactly sure how to check for unsupported platforms, though.

"Application",
[
("Zulip Terminal", zt_version),
("Platform detected", PLATFORM if PLATFORM else "Invalid platform"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This condition shouldn't arise - again, check the values of PLATFORM.

captured = capsys.readouterr()
lines = captured.out.strip().split("\n")
expected_lines = [
f"Detected Platform: {PLATFORM}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason you used different code here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

None, I'll change it to the same code as the others.


lines = captured.out.strip().split("\n")
expected_lines = [
"Detected Platform: " + PLATFORM,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note that this will be the platform that the tests are running on. We may want to mock this instead to ensure we get some known output (and avoid the running vs testing confusion for readers).

It's good to keep tests in the same commit as the code that changes, as it's a unit of change, so here combined with one of the other commits.

We may want a specific test to handle how this output should vary on different platforms, including unsupported.

@plugyawn plugyawn closed this Jun 17, 2022
@plugyawn plugyawn reopened this Jun 17, 2022
@zulipbot
Copy link
Member

Heads up @plugyawn, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

@neiljp
Copy link
Collaborator

neiljp commented Nov 6, 2023

@plugyawn Thanks for your work on this 👍 I recently merged #1435, which includes the About popup element, so I'm closing this now.

@neiljp neiljp closed this Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UI General user interface update has conflicts PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback PR replaced by another PR size: S [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show detected platform on startup and in About popup
3 participants