예제 #1
0
 def test_register_family(self):
     register_element_class('office:dummy3', self.dummy_element,
             family='graphics')
     element = odf_create_element('<office:dummy3/>')
     self.assert_(type(element) is odf_element)
     element = odf_create_element('<office:dummy3 '
             'style:family="graphics"/>')
     self.assert_(type(element) is self.dummy_element)
     element = odf_create_element('<office:dummy4 '
             'style:family="graphics"/>')
     self.assert_(type(element) is odf_element)
예제 #2
0
 def test_register_family(self):
     register_element_class('office:dummy3',
                            self.dummy_element,
                            family='graphics')
     element = odf_create_element('<office:dummy3/>')
     self.assert_(type(element) is odf_element)
     element = odf_create_element('<office:dummy3 '
                                  'style:family="graphics"/>')
     self.assert_(type(element) is self.dummy_element)
     element = odf_create_element('<office:dummy4 '
                                  'style:family="graphics"/>')
     self.assert_(type(element) is odf_element)
예제 #3
0

def odf_create_chart_axis_title_style(name, angle):
    """
    Create a basic style for an axis title

    name - str (name used in chart to use this style)
    """

    s = odf_create_chart_style(name)
    s.set_auto_position("true")
    s.set_rotation_angle(angle)
    s.set_font_size("9pt")
    return s


def odf_create_chart_wall_style(name):
    """
    Create a basic style for a wall

    name - str (name used in chart to use this style)
    """
    s = odf_create_chart_style(name)
    s.set_stroke("solid", "#b3b3b3")
    s.set_fill("none", "#e6e6e6")
    return s


# register
register_element_class("style:style", odf_chart_style, family="chart")
예제 #4
0
파일: chart.py 프로젝트: dave62/lpod-Chart
    manifest.add_full_path(name+'/meta.xml' , "text/xml")

    return name

def attach_chart_to_cell(name_obj, cell):
    """
    create a frame in 'cell' in order to display the chart 'name_obj'
    name_obj - str
    cell - odf_cell
    """
    #We need a frame
    frame = odf_create_frame(size=("10cm", "10cm"))

    #We need a draw:object element
    element = odf_create_element("draw:object")
    element.set_attribute("xlink:href", "./"+name_obj)
    element.set_attribute("xlink:type", "simple")
    element.set_attribute("xlink:show", "embed")
    element.set_attribute("xlink:actuate", "onLoad")
                     
    frame.append(element)
    cell.append(frame)

    return cell



#register
register_element_class('chart:chart', odf_chart)
register_element_class('chart:plot-area', odf_plot_area)
예제 #5
0
 def test_register(self):
     register_element_class('office:dummy1', self.dummy_element)
     element = odf_create_element('office:dummy1')
     self.assert_(type(element) is self.dummy_element)
예제 #6
0
 def test_register(self):
     register_element_class('office:dummy1', self.dummy_element)
     element = odf_create_element('office:dummy1')
     self.assert_(type(element) is self.dummy_element)
예제 #7
0
    manifest.add_full_path(name + '/meta.xml', "text/xml")

    return name


def attach_chart_to_cell(name_obj, cell):
    """
    create a frame in 'cell' in order to display the chart 'name_obj'
    name_obj - str
    cell - odf_cell
    """
    #We need a frame
    frame = odf_create_frame(size=("10cm", "10cm"))

    #We need a draw:object element
    element = odf_create_element("draw:object")
    element.set_attribute("xlink:href", "./" + name_obj)
    element.set_attribute("xlink:type", "simple")
    element.set_attribute("xlink:show", "embed")
    element.set_attribute("xlink:actuate", "onLoad")

    frame.append(element)
    cell.append(frame)

    return cell


#register
register_element_class('chart:chart', odf_chart)
register_element_class('chart:plot-area', odf_plot_area)
예제 #8
0

def odf_create_chart_axis_title_style(name, angle):
    """
    Create a basic style for an axis title

    name - str (name used in chart to use this style)
    """

    s = odf_create_chart_style(name)
    s.set_auto_position("true")
    s.set_rotation_angle(angle)
    s.set_font_size("9pt")
    return s


def odf_create_chart_wall_style(name):
    """
    Create a basic style for a wall

    name - str (name used in chart to use this style)
    """
    s = odf_create_chart_style(name)
    s.set_stroke("solid", "#b3b3b3")
    s.set_fill("none", "#e6e6e6")
    return s


#register
register_element_class('style:style', odf_chart_style, family='chart')