def add_layer(self, page, layer_name=''): if not layer_name: layer_name = _('Layer') + ' %i' % (page.layer_counter + 1) layer = model.Layer(self.config, page, layer_name) page.childs.append(layer) page.layer_counter += 1 return layer
def insert_layer(self, page, layer_name='', index=0): if not layer_name: layer_name = _('Layer') + ' %i' % (page.layer_counter + 1) layer = model.Layer(self.config, page) layer.name = "" + layer_name if index < len(page.childs): page.childs.insert(index, layer) else: page.childs.append(layer) page.layer_counter += 1 return layer
def create_new_doc(config): doc = model.Document(config) layer = model.Layer(config) page = model.Page(config) add_child(page, layer) page.layer_counter += 1 pages = model.Pages(config) add_child(pages, page) pages.page_counter += 1 dl = model.DesktopLayers(config) ml = model.MasterLayers(config) gl = model.GridLayer(config) guide = model.GuideLayer(config) add_childs(doc, [pages, dl, ml, gl, guide]) return doc