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

table_display.py example now uses tableformatter instead of tabulate #456

Merged
merged 14 commits into from
Jun 29, 2018

Conversation

tleonhardt
Copy link
Member

@tleonhardt tleonhardt commented Jun 26, 2018

Changed the table_display.py example to use the tableformatter module which resuls in nicer looking tables.

This closes #450

Changed the table_display.py example to use the tableformatter module which resuls in nicer looking tables.
@tleonhardt tleonhardt added this to the 0.9.2 milestone Jun 26, 2018
@tleonhardt tleonhardt self-assigned this Jun 26, 2018
@tleonhardt tleonhardt requested a review from anselor June 26, 2018 07:45
@codecov
Copy link

codecov bot commented Jun 26, 2018

Codecov Report

Merging #456 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #456   +/-   ##
=======================================
  Coverage   90.18%   90.18%           
=======================================
  Files          10       10           
  Lines        2741     2741           
=======================================
  Hits         2472     2472           
  Misses        269      269
Impacted Files Coverage Δ
cmd2/cmd2.py 90.43% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d5cacbf...21f45c4. Read the comment docs.

@tleonhardt
Copy link
Member Author

@anselor Please feel free to make any changes you would recommend. I'm just trying to demonstrate the basics of how to make a nice looking table within cmd2.

anselor and others added 2 commits June 26, 2018 10:14
… the same table entries formatted as both an iterable of iterable as well as an iterable of objects.
… unicode capability

- Mandarin, Urdu, and Turkish all seem to be working fine
- But something is up with Hindi - the table/colum width calculation is messed up for Mumbai
@tleonhardt
Copy link
Member Author

I pushed some unicode updates to make the unicode features very obvious. Unfortunately, my improvements appear to have unearthed a bug in the wcwidth module:
jquast/wcwidth#25

@anselor
Copy link
Contributor

anselor commented Jun 27, 2018

I can see why it would return 9 instead of 5. It's probably assuming each of those Hindi characters renders at 2 characters wide.

@tleonhardt
Copy link
Member Author

The Hindi discrepancy appears to occur on macOS but not Linux

Changed to use Hindi name for Mumbai based on Google Translate instead of a Google search and the table width and underlying wide character width calculation appears to be working fine.
@tleonhardt
Copy link
Member Author

I switched to get the Hindi translation of Mumbai based on Google Translate instead of a Google search which gave a different result and the width is working correctly now.

Also:
- Improved some comments
- Put the argparse args for selecting grid style in a mutually exclusive group
@tleonhardt
Copy link
Member Author

tleonhardt commented Jun 27, 2018

@anselor I added the ability to choose the grid style based on argparse arguments to the commands.

I am now done with all of the changes I wanted to make to this. As long as you are happy with it, I think it is good to merge.

If we can figure out how to auto-color text in a row red if the population density is crazy high, then that would be gravy - but that can be done later, probably after we make some minor API changes in tableformatter.

- Set date for 0.9.2 release to today
- Added comment about how we have improved the table_display.py example with the use of the new tableformatter module
@tleonhardt tleonhardt merged commit e03c6c2 into master Jun 29, 2018
@tleonhardt tleonhardt deleted the table_display branch June 29, 2018 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify the table_display.py example to use new tableformatter module
2 participants