cosme12 / cheatsheet-maker

Cheetsheet (cheat sheet or quick reference) generator. Use it for guides, instructions or study. Made in Python 3
MIT License
117 stars 27 forks source link

Crash when color style input is invalid #5

Closed pylipp closed 7 years ago

pylipp commented 7 years ago

Hej there, I was fiddling around a bit and put a random text when asked for the color style. Eventually, cheatsheet-maker throws an error. See my input history below:

Choose your language:
1. English
2. Español (NOT CODED YET)
1
##################################################################
#                                                                #
#                                                                #
#                 Welcome to CheatSheet Maker 1.0                #
#                                                                #
#                                                                #
##################################################################
Type the number to choose your option.
1. Create sheet
2. Export (NOT CODED YET)
3. Help (NOT CODED YET)
4. Exit
1
##################################################################
Building the basic layout... answer the next questions.
1. What is your sheet title? ('CheatSheet' is added automatically)
foo
How many columns your sheet will have?
1. 1 main column
2. 2 main columns
3. 3 main columns
1
Which color style do you prefer?
1. Orange
2. Black and white
fdsaölkj
Invalid input. Try again.
##################################################################
Building the basic layout... answer the next questions.
1. What is your sheet title? ('CheatSheet' is added automatically)
foo
How many columns your sheet will have?
1. 1 main column
2. 2 main columns
3. 3 main columns
1
Which color style do you prefer?
1. Orange
2. Black and white
1
##################################################################
Building the header... answer the next questions.
1. What is the author name?
pylipp
##################################################################
Building the footer... answer the next questions.
1. What is the author picture url?

1. What is the author website url? (use http://)
http://github.com/pylipp
1. What is the sponsor name?
Beer
1. What is the sponsor webite url? (use http://)

##################################################################
Building the blocks... answer the next questions.
0. Done
1. Create text block
2. Create block with rows
0
##################################################################
Thanks for using CheatSheet Maker. Feel free to share your ideas at http://github.com/cosme12/cheasheet-maker
Press any key to exit
Traceback (most recent call last):
  File "sheetmaker/sheetmaker.py", line 27, in <module>
    sys.exit(main())
  File "sheetmaker/sheetmaker.py", line 23, in main
    new_wizard.main_menu()
  File "/home/<user>/code/python/cheatsheet-maker/sheetmaker/sheet_wizard.py", line 91, in main_menu
    self.config_sheet()
  File "/home/<user>/code/python/cheatsheet-maker/sheetmaker/sheet_wizard.py", line 137, in config_sheet
    self.NewSheet.set_style(color)
  File "/home/<user>/code/python/cheatsheet-maker/sheetmaker/html_builder.py", line 172, in set_style
    }}""".format(color_main[self.color], color_secundary[self.color])        
KeyError: 'fdsaölkj'
cosme12 commented 7 years ago

Thanks for the very clear report! I will check it out

cosme12 commented 7 years ago

Here is it fixed https://github.com/cosme12/cheatsheet-maker/commit/ffa06abc4b62ad05fa625b31bfa04364f8613999. Will come togheter with the next update.

mik30s commented 7 years ago

@cosme12 You can go ahead and close this issue now. To automatically close issues use: Fixes #issue_number in you commit messages. Github will automatically close it. Good job btw.

cosme12 commented 7 years ago

Thanks for the tip @mike168m