Exemple #1
0
 def _add_styles_from_idml(self, idml_package):
     """Append styles to their groups or add the group in the Styles file. """
     styles = Style(self)
     styles.working_copy_path = self.working_copy_path
     styles_root_elt = styles.get_root()
     for group_to_insert in idml_package.style_groups:
         group_host = styles_root_elt.xpath(group_to_insert.tag)
         # Either the group exists.
         if group_host:
             for style_to_insert in group_to_insert.iterchildren():
                 group_host[0].append(copy.deepcopy(style_to_insert))
         # or not.
         else:
             styles_root_elt.append(copy.deepcopy(group_to_insert))
     styles.synchronize()
Exemple #2
0
 def _add_styles_from_idml(self, idml_package):
     """Append styles to their groups or add the group in the Styles file. """
     styles = Style(self)
     styles.working_copy_path = self.working_copy_path
     styles_root_elt = styles.get_root()
     for group_to_insert in idml_package.style_groups:
         group_host = styles_root_elt.xpath(group_to_insert.tag)
         # Either the group exists.
         if group_host:
             for style_to_insert in group_to_insert.iterchildren():
                 group_host[0].append(copy.deepcopy(style_to_insert))
         # or not.
         else:
             styles_root_elt.append(copy.deepcopy(group_to_insert))
     styles.synchronize()