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

Apply ANSI Escape Colors To Print Statements #1

Closed
Frichetten opened this issue Dec 26, 2017 · 19 comments
Closed

Apply ANSI Escape Colors To Print Statements #1

Frichetten opened this issue Dec 26, 2017 · 19 comments

Comments

@Frichetten
Copy link
Owner

This is a good issue for beginners! There are some print statements in the code, particularly in the multiwallet, wallet, webserver, blockchain classes. I have some examples in the wallet class, but I would appreciate it if you went into some of those classes and added ANSI escape colors to some of the print statements that need them. For example, if you find a print statement that is telling the user something was successful, change it to be "print OK + 'Words go here' + END".

This would help me a ton and would be a great first step for a beginner. :) I'm also willing to help if you need it, feel free to comment.

@Justme764
Copy link
Contributor

@Frichetten I am totally new and a first timer. I have taken the classes and now want to contribute. Your issue look simple enough but i cant figure out where to start. I have looked through the code, have found the print some statements but not sure where to go from there. I saw your example but not understanding. Any help would be great if you have time. I know us newbie drive you pro's crazy. LOL

I do have 20+ years of IT but it was the hardware side and networking. Now I want to learn the other side. Again thanks.

@Frichetten
Copy link
Owner Author

@Justme764 Thanks for the interest! Here's what you'd want to do:

  • Pull the latest version (git pull origin master)
  • Go to the wallet.py class and find the ASCI Escape characters near the top
  • Copy those near the top of some of the other classes I mentioned (multiwallet, webserver, blockchain).
  • Then look through the print statements that sound either positive or negative. The ASCI Escape characters will change the color of the text (I think it should work on most platforms (Linux, Mac, Windows), but if it doesn't let me know!).
  • If you find a positive print statement (like, something was successfully created) change it so that the text has the OK ASCII Escape sequence at the beginning and END at the end. So it would look like print OK + 'Successfully created something + END
  • If you find a negative print statement (like, something failed or was aborted) change it so that the text has the FAIL ASCII Escape sequence at the beginning and END at the end. So it would look like print FAIL + 'Failed to do something' + END

Let me know if you have any additional questions! I'm happy to help! Also, if you don't mind me asking, how did you come to find this project? Through searching for tags?

@Justme764
Copy link
Contributor

@Frichetten Yes I found this project by searching the first timers only. Thanks for your input and I will see if I can figure it all out.

@Frichetten
Copy link
Owner Author

I'm sorry bud I forgot 2 important steps. You should fork the repo first. You can do this from the repository home page by clicking 'fork' in the top right corner. After you've done that, pull it to your local machine (git clone url of your fork).

From here you can make all the changes you like (the list I had above)

When you're done, just commit and push your changes to your repo. Then ask for a 'pull request'. This will send me your code and I will review it and let you know if I will add it.

@Justme764
Copy link
Contributor

I did the first part. added the ANSI escape colors to the top of page. Thank god it forked it for me. I now know that is the first thing you do when helping out. thanks for the heads up.

@Frichetten
Copy link
Owner Author

Thank you @Justme764! I will review your pull requests and merge them into the current code base. :)

I will leave the issue open in case you, or anyone else would like to continue with it. And thank you for letting me know that you found the project by the first-timers-only tag. I was looking for ways to draw people in and create a friendly environment for everyone :)

Frichetten added a commit that referenced this issue Dec 27, 2017
All additions are in line with the coding style and were requested through issue #1. I have accepted the merge.
Frichetten added a commit that referenced this issue Dec 27, 2017
All changes are in line with the coding style and were requested under Issue #1. I will approve the merge.
Frichetten added a commit that referenced this issue Dec 27, 2017
All changes are withing the coding style guidelines and were requested under issue #1. I will approve this merge.
@Justme764
Copy link
Contributor

Thank you @Frichetten for helping me get started. Like I said I am totally new to this side and appreciate your help.

@MagdaZawora
Copy link
Contributor

Hello @Frichetten! I'm also a total biginner looking for the oportunity to start as a "first-timer-only". I see the issue is still open, could you confirm that there's still something I could try to help with?

@Frichetten
Copy link
Owner Author

Hi @MagdaZawora! Yes, you are welcome to help :)

So, the goal is to add ANSI Escape sequences to the beginning and end of strings. @Justme764 helped by putting those sequences in the code in the following classes: multiwallet, webserver, and blockchain. What these sequences do is change the color of the text. OK will make it green and FAIL will make it red. If this doesn't work on your machine, feel free to open an issue :)

If you could, look through those classes and find print statements. (like, something was successfully created) change it so that the text has the OK ASCII Escape sequence at the beginning and END at the end. So it would look like print OK + 'Successfully created something + END

If you find a negative print statement (like, something failed or was aborted) change it so that the text has the FAIL ASCII Escape sequence at the beginning and END at the end. So it would look like print FAIL + 'Failed to do something' + END

If you find a neutral print statement, then you can ignore it because we don't need to color it.

To help, feel free to fork this repository. Then make all the changes you want, and commit them to your repo. When you're finished or you think you've done all that you'd like to do, then you can submit a Pull Request.

Let me know if you have any questions or need help! Feel free to refer back to previous messages in this comment thread for additional guidance if you need it.

@Justme764
Copy link
Contributor

@Frichetten is the below how the line of code should be written? If so I will go through the rest of the files and start working on this. again thanks.
print OK '\033[92m' + 'Generated Private Key' + '\033[92m' END

@Justme764
Copy link
Contributor

Also how do I test the changes I have made before i submit to you. Again thanks.

@Frichetten
Copy link
Owner Author

Hi @Justme764, you're close however it should be

print OK + 'Generated Private Key' + END

Here, OK and END are the variables you placed at the top of the file. I would recommend checking the CONTRIBUTING file in the repo for advice as to how to get started contributing. Additionally I was going to write some more detailed instructions on how you can generate your origin key and get started testing.

@Justme764
Copy link
Contributor

ahhhhh I see how it works now. I will look through the files. Again thank you for taking the time to help me get started,

Frichetten added a commit that referenced this issue Dec 28, 2017
Submitted code is inline with style guidelines and was requested under Issue #1. I will approve this merge.
@Justme764
Copy link
Contributor

thanks ahead of time for helping me get my origin key.

@Justme764
Copy link
Contributor

Do I just add the ANSI print statement to the files that only have class statement or all the print statements? hope that makes sense.

@Frichetten
Copy link
Owner Author

You can add them to any print statement you want, regardless if it is in a class. Be mindful to put them on print statements that have a positive or negative message. If they are neutral, don't add them.

Frichetten added a commit that referenced this issue Dec 28, 2017
Code is inline with the style guidelines and was requested under Issue #1. I will approve the merge.
@Justme764
Copy link
Contributor

I went to the install file and instruction. I was able to complete 1,2, and 3 but 4 and 5 has me lost. Below is the file I was using to install. where do I run from? Again thanks for helping me. As soon as I have specter installed properly I will continue with the print statements.

First: Install Pip (Depends on your operating system, see this)
Second: Be sure to install all the dependencies above (Those commands should help you install)
Third: Clone the repo to your local machine (git clone https://github.com/Frichetten/Specter.git)
Fourth: Run the webserver.py first so that you have a local node.
Fifth: Run the multiwallet.py to create a wallet.

@Justme764
Copy link
Contributor

@Frichetten I was able to get everything install. I installed 4 and 5 by double clicking on the 2 files located in the cloned file and it created a node and a wallet. whats next for the install or use?

Frichetten added a commit that referenced this issue Dec 29, 2017
Code is in line with style guidelines and was requested under issue #1. I will approve the merge.
Frichetten pushed a commit that referenced this issue Dec 29, 2017
updating files to match yours
Frichetten added a commit that referenced this issue Dec 29, 2017
Code is in line with the style guidelines and was requested under issue #1. I will approve the merge.
Frichetten added a commit that referenced this issue Dec 29, 2017
Code is in line with style guidelines and was requested under Issue #1. I will approve the merge.
@Frichetten
Copy link
Owner Author

I feel confident that this issue has been handled. If anyone has additional questions or thoughts, feel free to comment below. I will add more issues as they become available.

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

No branches or pull requests

3 participants