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
```

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())