def move(self, src_index, dest_index): """ Move the object at src_index to the dest_index Args ---- src_index : int or str or iterable The source index. Index must be either an integer index, an iterable list of integer indices or an index notation of the style 'i:j:k' where indices are separated by colons dest_index : int or str or iterable The destination index """ import items src_index = items.parse_index(src_index) dest_index = items.parse_index(dest_index) if type(self[src_index]) == items.Slide: dest_index = dest_index[0:1] elif type(self[src_index]) in [items.ListItem, items.EnumItem]: dest_index = dest_index[0:3] else: dest_index = dest_index[0:2] item = self.pop(src_index) self.add_item(item, dest_index) self.reindex_fig_files()
def __call__(self, item, cat=None, index=[], **kwargs): """ Adds an item to the last slide Args ---- items : various item to add to slide, can be str, fig, ... cat : str Category of item. If none is given, it will be determined through the type function index : int or str or iterable or [] Index must be either an integer index, an iterable list of integer indices or an index notation of the style 'i:j:k' where indices are separated by colons. If index an empty list, the item will be appended to the last element. **kwargs : keyword arguments Args like figsize etc """ if cat == None: cat = find_category(item) if cat in ['figure', 'figurepage'] and self.workdir is None: print 'Cannot add figure until working directory is set' return item = items.TYPES[cat](item, workdir=self.workdir, **kwargs) index = items.parse_index(index) if cat == 'figurepage': item = items.Slide("").add_item(item) index = index[0:1] elif cat == 'slide': index = index[0:1] self.add_item(item, index)
def __call__(self, item, cat=None, index=[], **kwargs): """ Adds an item to the last slide Args ---- items : various item to add to slide, can be str, fig, ... cat : str Category of item. If none is given, it will be determined through the type function index : int or str or iterable or [] Index must be either an integer index, an iterable list of integer indices or an index notation of the style 'i:j:k' where indices are separated by colons. If index an empty list, the item will be appended to the last element. **kwargs : keyword arguments Args like figsize etc """ if cat == None: cat = find_category(item) if cat in ["figure", "figurepage"] and self.workdir is None: print "Cannot add figure until working directory is set" return item = items.TYPES[cat](item, workdir=self.workdir, **kwargs) index = items.parse_index(index) if cat == "figurepage": item = items.Slide("").add_item(item) index = index[0:1] elif cat == "slide": index = index[0:1] self.add_item(item, index)