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

Pause UI with <SPACE> #106

Merged
merged 2 commits into from
Jan 10, 2020
Merged

Pause UI with <SPACE> #106

merged 2 commits into from
Jan 10, 2020

Conversation

zhangxp1998
Copy link
Collaborator

@zhangxp1998 zhangxp1998 commented Jan 10, 2020

An attempt to issue #74
Xnip2020-01-09_21-04-15

Xnip2020-01-09_21-03-16

When the UI is paused, text will turn yellow, and there will be a "[PAUSED]" string displayed

@imsnif
Copy link
Owner

imsnif commented Jan 10, 2020

Hah! This looks cool :)
I only gave it a quick glance - will look at it more thoroughly over the weekend, but for now if you want to continue, things to add:

  1. Tests (essentially, a test where the SPACE key is pressed and we make sure traffic is not updated - the test should fail without this feature).
  2. Do you think we can maybe communicate this to the user somehow? My idea right now is to write something like "Press SPACE to pause/resume" on the upper right corner. What do you think?

@ebroto
Copy link
Collaborator

ebroto commented Jan 10, 2020

Do you think we can maybe communicate this to the user somehow?

What about a help section a la top? Maybe not for now, but if we add more interaction the UI could end up cluttered otherwise

Copy link
Contributor

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

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

Nice 🎉

} else {
Text::styled(
format!(
" Total Rate Up / Down: {} / {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems rather verbose. Shouldn't we optionally append the [PAUSED] string if self.paused?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately rust requires that format strings must be literals... Plus, the color argument will have to be different, so I just expanded this expression

@zhangxp1998
Copy link
Collaborator Author

Hah! This looks cool :)
I only gave it a quick glance - will look at it more thoroughly over the weekend, but for now if you want to continue, things to add:

  1. Tests (essentially, a test where the SPACE key is pressed and we make sure traffic is not updated - the test should fail without this feature).
  2. Do you think we can maybe communicate this to the user somehow? My idea right now is to write something like "Press SPACE to pause/resume" on the upper right corner. What do you think?

Added a test case for this... Regarding communicating this to user, I'm worried about cluttering the UI. This needs some discussion

@ebroto ebroto self-requested a review January 10, 2020 18:14
Copy link
Collaborator

@ebroto ebroto 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 neat!

I left a couple comments, the rest LGTM!

src/display/components/total_bandwidth.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@zhangxp1998 zhangxp1998 merged commit f1a984f into imsnif:master Jan 10, 2020
@zhangxp1998 zhangxp1998 deleted the pause branch January 10, 2020 22:05
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.

4 participants