def _on_change_aspect(self, combobox): "Update the image's resize setting on change." if self.__updating: return el = self.get_selected_element() el.aspect = theme.get_aspect_const(combobox.get_active_text()) self._set_changed()
def __init__(self, pres, value=None): self.pres = pres self._content = [] self.title = '' self._theme = None if etree.iselement(value): self.title = value.get("title", '') self._theme = value.get("theme", '') for el in value: k = {} k['margin'] = el.get('margin', 0) k['pos'] = [0,0,0,0] k['pos'][0] = float(el.get('x1', 0.0)) k['pos'][1] = float(el.get('y1', 0.0)) k['pos'][2] = float(el.get('x2', 1.0)) k['pos'][3] = float(el.get('y2', 1.0)) align = theme.get_align_const(el.get('align')) if align != -1: k['align'] = align valign = theme.get_valign_const(el.get('valign')) if valign != -1: k['valign'] = valign if el.tag == 'text': k['markup'] = unescape(element_contents(el, True)) self._content.append(theme.Text(**k)) elif el.tag == 'image': if el.get('src'): k['src'] = os.path.join(IMAGE_PATH, el.get('src')) else: k['src'] = '' k['aspect'] = theme.get_aspect_const(el.get('aspect'), theme.ASPECT_FIT) self._content.append(theme.Image(**k)) self._set_id(value) _abstract.Presentation.Slide.__init__(self, pres, value)