def test_get_draw_connector_by_id(self):
     body = self.content.get_body()
     page = body.get_draw_page_by_position(0)
     connector = odf_create_connector(shape_id=u'an id')
     page.append_element(connector)
     connector = page.get_draw_connector_by_id(ur'an id')
     expected = '<draw:connector draw:id="an id"/>\n'
     self.assertEqual(connector.serialize(pretty=True), expected)
 def test_get_draw_orphans_connector(self):
     body = self.content.get_body()
     page = body.get_draw_page_by_position(0)
     orphan_connector = odf_create_connector()
     orphan_connector.append_element(odf_create_paragraph(u'Orphan c'))
     body.append_element(orphan_connector)
     connectors = body.get_draw_orphans_connectors()
     self.assertEqual(len(connectors), 1)
Beispiel #3
0
 def test_get_draw_orphans_connector(self):
     body = self.content.get_body()
     page = body.get_draw_page()
     orphan_connector = odf_create_connector()
     orphan_connector.append(odf_create_paragraph(u'Orphan c'))
     body.append(orphan_connector)
     connectors = body.get_orphan_draw_connectors()
     self.assertEqual(len(connectors), 1)
Beispiel #4
0
 def test_get_draw_connector_by_id(self):
     body = self.content.get_body()
     page = body.get_draw_page()
     connector = odf_create_connector(shape_id=u'an id')
     page.append(connector)
     connector = page.get_draw_connector(id=ur'an id')
     expected = '<draw:connector draw:id="an id"/>\n'
     self.assertEqual(connector.serialize(pretty=True), expected)
Beispiel #5
0
 def test_create_connector(self):
     page = odf_create_draw_page('Page1')
     rectangle = odf_create_rectangle(size=('2cm', '1cm'),
                                      position=('3cm', '4cm'),
                                      shape_id='rectangle')
     ellipse = odf_create_ellipse(size=('2cm', '1cm'),
                                  position=('3cm', '4cm'),
                                  shape_id='ellipse')
     connector = odf_create_connector(connected_shapes=(rectangle, ellipse),
                                      glue_points=(1, 2))
     page.append(rectangle)
     page.append(ellipse)
     page.append(connector)
     expected = ('<draw:page draw:id="Page1">\n'
                 '  <draw:rect draw:id="rectangle" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:ellipse draw:id="ellipse" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:connector draw:start-shape="rectangle" '
                 'draw:end-shape="ellipse" draw:start-glue-point="1" '
                 'draw:end-glue-point="2"/>\n'
                 '</draw:page>\n')
     self.assertEqual(page.serialize(pretty=True), expected)
 def test_create_connector(self):
     page = odf_create_draw_page('Page1')
     rectangle = odf_create_rectangle(size=('2cm', '1cm'),
                                      position=('3cm', '4cm'),
                                      shape_id='rectangle')
     ellipse = odf_create_ellipse(size=('2cm', '1cm'),
                                  position=('3cm', '4cm'),
                                  shape_id='ellipse')
     connector = odf_create_connector(connected_shapes=(rectangle,
                                                        ellipse),
                                      glue_points=(1, 2))
     page.append_element(rectangle)
     page.append_element(ellipse)
     page.append_element(connector)
     expected = ('<draw:page draw:id="Page1">\n'
                 '  <draw:rect draw:id="rectangle" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:ellipse draw:id="ellipse" svg:width="2cm" '
                 'svg:height="1cm" svg:x="3cm" svg:y="4cm"/>\n'
                 '  <draw:connector draw:start-shape="rectangle" '
                 'draw:end-shape="ellipse" draw:start-glue-point="1" '
                 'draw:end-glue-point="2"/>\n'
                 '</draw:page>\n')
     self.assertEqual(page.serialize(pretty=True), expected)
Beispiel #7
0
# Square
square = odf_create_rectangle(shape_id=u"square",
                              size=('8cm', '8cm'),
                              position=('17cm', '2.5cm'),
                              style=u"colored")
page3.append(square)

# Circle
circle = odf_create_ellipse(shape_id=u"circle",
                            size=('8cm', '8cm'),
                            position=('2cm', '10cm'),
                            style=u"colored")
page3.append(circle)

# Line
line = odf_create_line(p1=('8cm', '5cm'), p2=('20cm', '17.5cm'))
page3.append(line)

# Connector
connector = odf_create_connector(connected_shapes=(square, circle),
                                 glue_points=('1', '3'))

# Add a transition for this frame
page3.set_transition("fade", "fadeOverColor")

# Save
filename = 'presentation.odp'
document.save(filename, pretty=True)
print 'Document "%s" generated.' % filename
Beispiel #8
0
# Last page
page3 = odf_create_draw_page(u"page3")
body.append(page3)

# Square
square = odf_create_rectangle(shape_id=u"square", size=('8cm', '8cm'),
                              position=('17cm', '2.5cm'),
                              style=u"colored")
page3.append(square)

# Circle
circle = odf_create_ellipse(shape_id=u"circle", size=('8cm', '8cm'),
                            position=('2cm', '10cm'), style=u"colored")
page3.append(circle)

# Line
line = odf_create_line(p1=('8cm', '5cm'), p2=('20cm', '17.5cm'))
page3.append(line)

# Connector
connector = odf_create_connector(connected_shapes=(square, circle),
                                 glue_points=('1', '3'))

# Add a transition for this frame
page3.set_transition("fade", "fadeOverColor")

# Save
filename = 'presentation.odp'
document.save(filename, pretty=True)
print 'Document "%s" generated.' % filename