Ejemplo n.º 1
0
 def _get_alignment(self):
     """
     Return alignment type of this paragraph, e.g. ``PP.ALIGN_CENTER``.
     Can return |None|, meaning the paragraph has no alignment setting and
     its effective value is inherited from a higher-level object.
     """
     algn = self.__p.get_algn()
     return ParagraphAlignment.from_text_align_type(algn)
Ejemplo n.º 2
0
 def test_from_text_align_type_return_value(self):
     """ParagraphAlignment.from_text_align_type() returns correct value"""
     # verify -----------------------
     for alignment, text_align_type in self.cases:
         assert_that(
             ParagraphAlignment.from_text_align_type(text_align_type),
             is_(equal_to(alignment))
         )
Ejemplo n.º 3
0
 def alignment(self):
     """
     Horizontal alignment of this paragraph, represented by a constant
     value like ``PP.ALIGN_CENTER``. Its value can be |None|, meaning the
     paragraph has no alignment setting and its effective value is
     inherited from a higher-level object.
     """
     return ParagraphAlignment.from_text_align_type(self._pPr.algn)
Ejemplo n.º 4
0
 def _get_alignment(self):
     """
     Return alignment type of this paragraph, e.g. ``PP.ALIGN_CENTER``.
     Can return |None|, meaning the paragraph has no alignment setting and
     its effective value is inherited from a higher-level object.
     """
     algn = self.__p.get_algn()
     return ParagraphAlignment.from_text_align_type(algn)
Ejemplo n.º 5
0
 def _set_alignment(self, alignment):
     """
     Set alignment of this paragraph to *alignment*, a constant value like
     ``PP.ALIGN_CENTER``. If *alignment* is None, any alignment setting is
     cleared and its effective value is inherited from a higher-level
     object.
     """
     algn = ParagraphAlignment.to_text_align_type(alignment)
     self.__p.set_algn(algn)
Ejemplo n.º 6
0
 def _set_alignment(self, alignment):
     """
     Set alignment of this paragraph to *alignment*, a constant value like
     ``PP.ALIGN_CENTER``. If *alignment* is None, any alignment setting is
     cleared and its effective value is inherited from a higher-level
     object.
     """
     algn = ParagraphAlignment.to_text_align_type(alignment)
     self.__p.set_algn(algn)
Ejemplo n.º 7
0
 def test_to_text_align_type_raises_on_bad_alignment(self):
     """ParagraphAlignment.to_text_align_type raises on bad value in"""
     with self.assertRaises(KeyError):
         ParagraphAlignment.to_text_align_type('foobar')
Ejemplo n.º 8
0
 def test_from_text_align_type_raises_on_bad_key(self):
     """ParagraphAlignment.from_text_align_type raises on bad key"""
     with self.assertRaises(KeyError):
         ParagraphAlignment.from_text_align_type('foobar')
Ejemplo n.º 9
0
 def alignment(self, alignment):
     algn = ParagraphAlignment.to_text_align_type(alignment)
     self._pPr.algn = algn