Repository: pri22296/beautifultable

Issue:
Allow setting alignment, etc for all columns more easily
The following syntax could be used to align all columns with a simple statement.

```
table.column_alignments = beautifultable.ALIGN_LEFT
```

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/pri22296/beautifultable/pull/64?src=pr&el=h1) Report
> Merging [#64](https://codecov.io/gh/pri22296/beautifultable/pull/64?src=pr&el=desc) into [master](https://codecov.io/gh/pri22296/beautifultable/commit/c9638f73dff4bb1f341c9ee783e4e47f26efba0b?src=pr&el=desc) will **decrease** coverage by `0.45%`.
> The diff coverage is `25%`.

[![Impacted file tree graph](https://codecov.io/gh/pri22296/beautifultable/pull/64/graphs/tree.svg?width=650&token=JGEoYMIaay&height=150&src=pr)](https://codecov.io/gh/pri22296/beautifultable/pull/64?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master      #64      +/-   ##
==========================================
- Coverage   80.24%   79.79%   -0.46%     
==========================================
  Files          12       12              
  Lines         967      975       +8     
  Branches      144      148       +4     
==========================================
+ Hits          776      778       +2     
- Misses        142      145       +3     
- Partials       49       52       +3
```


| [Impacted Files](https://codecov.io/gh/pri22296/beautifultable/pull/64?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [beautifultable/beautifultable.py](https://codecov.io/gh/pri22296/beautifultable/pull/64/diff?src=pr&el=tree#diff-YmVhdXRpZnVsdGFibGUvYmVhdXRpZnVsdGFibGUucHk=) | `73.4% <25%> (-0.87%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pri22296/beautifultable/pull/64?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pri22296/beautifultable/pull/64?src=pr&el=footer). Last update [c9638f7...ec0ea71](https://codecov.io/gh/pri22296/beautifultable/pull/64?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/.gitignore b/.gitignore
index 4527dcd..e70f354 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ dist/
 build/
 .tox/
 *.pyc
+.coverage
diff --git a/README.rst b/README.rst
index 16aadd1..c26bea2 100644
--- a/README.rst
+++ b/README.rst
@@ -133,6 +133,8 @@ Unreleased
 
 * Dropped support for Python 3.3
 * Added support for streaming tables using a generator for cases  where data retrieval is slow
+* Alignment, padding, width can now be set for all columns using a simplified syntax like
+  ``table.column_alignments = beautifultable.ALIGN_LEFT``
 
 ==========
 v0.7.0
diff --git a/beautifultable/beautifultable.py b/beautifultable/beautifultable.py
index ae4041f..3f54c51 100644
--- a/beautifultable/beautifultable.py
+++ b/beautifultable/beautifultable.py
@@ -332,6 +332,8 @@ class BeautifulTable(object):
 
     @column_widths.setter
     def column_widths(self, value):
+        if isinstance(value, int):
+            value = [value] * self._column_count
         width = self._validate_row(value)
         self._column_widths = PositiveIntegerMetaData(self, width)
 
@@ -366,6 +368,8 @@ class BeautifulTable(object):
 
     @column_alignments.setter
     def column_alignments(self, value):
+        if isinstance(value, enums.Alignment):
+            value = [value] * self._column_count
         alignment = self._validate_row(value)
         self._column_alignments = AlignmentMetaData(self, alignment)
 
@@ -380,6 +384,8 @@ class BeautifulTable(object):
 
     @left_padding_widths.setter
     def left_padding_widths(self, value):
+        if isinstance(value, int):
+            value = [value] * self._column_count
         pad_width = self._validate_row(value)
         self._left_padding_widths = PositiveIntegerMetaData(self, pad_width)
 
@@ -394,6 +400,8 @@ class BeautifulTable(object):
 
     @right_padding_widths.setter
     def right_padding_widths(self, value):
+        if isinstance(value, int):
+            value = [value] * self._column_count
         pad_width = self._validate_row(value)
         self._right_padding_widths = PositiveIntegerMetaData(self, pad_width)
 


Test patch:
diff --git a/test.py b/test.py
index c0fa342..8deb0a5 100644
--- a/test.py
+++ b/test.py
@@ -245,6 +245,23 @@ class TableOperationsTestCase(unittest.TestCase):
 | Sophia   |  2   |   girl |
 +----------+------+--------+
 | Michael  |  3   |    boy |
++----------+------+--------+"""
+        self.assertEqual(string, self.table.get_string())
+
+    def test_align_all(self):
+        self.table.column_alignments = self.table.ALIGN_LEFT
+        string = """+----------+------+--------+
+| name     | rank | gender |
++----------+------+--------+
+| Jacob    | 1    | boy    |
++----------+------+--------+
+| Isabella | 1    | girl   |
++----------+------+--------+
+| Ethan    | 2    | boy    |
++----------+------+--------+
+| Sophia   | 2    | girl   |
++----------+------+--------+
+| Michael  | 3    | boy    |
 +----------+------+--------+"""
         self.assertEqual(string, self.table.get_string())