Skip to content

Commit

Permalink
Merge pull request #94 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Cleaned up output
  • Loading branch information
seamm authored Oct 30, 2023
2 parents e98f79e + b34fcdc commit 99e70b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
=======
History
=======
2023.10.30 -- Cleaned up output
* Nothing large, just made the output properly indented, etc.

2023.7.25 -- Bug fix and Enhancements
* Fixed bug with reading table using a variable for the filename, but asking for the
Expand Down
15 changes: 9 additions & 6 deletions table_step/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,14 @@ def run(self):
table_handle = self.get_variable(tablename)
table = table_handle["table"]
index = table_handle["index column"]
printer.job("\nTable '{}':".format(tablename))
if index is None:
printer.job(table.to_string(header=True, index=False))
text = table.to_string(header=True, index=False)
else:
printer.job(table.to_string(header=True, index=True))
text = table.to_string(header=True, index=True)

for line in text.splitlines():
printer.normal(4 * " " + line)
printer.normal("")

elif P["method"] == "Print the current row of":
table_handle = self.get_variable(tablename)
Expand All @@ -405,10 +408,10 @@ def run(self):
self.logger.debug("-----")

if index == 0:
printer.job("\nTable '{}':".format(tablename))
printer.job("\n".join(lines.splitlines()[0:2]))
printer.normal("\n Table '{}':".format(tablename))
printer.normal("\n ".join(lines.splitlines()[0:2]))
else:
printer.job(lines.splitlines()[index + 1])
printer.normal(4 * " " + lines.splitlines()[index + 1])

elif P["method"] == "Append a row to":
if not self.variable_exists(tablename):
Expand Down

0 comments on commit 99e70b9

Please sign in to comment.