def do_synchronize(layout_mod): master_vo = layout_mod.layout.layout_dict.get(master_tile.tile_id) if not master_vo: log.warn('No master_tile_id in layout_data.layout_dict for %s', master_tile) raise layouts.LayoutModificationImpossible() changed = False for tile_id, vo in layout_mod.layout.layout_dict.iteritems(): props = layout_mod.layout.get_tile_props(tile_id) if tile_id != master_tile.tile_id and \ props.get('master_id') == master_tile.tile_id: if vo['width'] != master_vo['width']: vo['width'] = master_vo['width'] changed = True if vo['height'] != master_vo['height']: vo['height'] = master_vo['height'] changed = True if not changed: raise layouts.LayoutModificationImpossible() layouts.repack_mod()(layout_mod) layouts.pack_upwards_mod()(layout_mod)
def pack(self, ldict): return layouts.apply_mods_for_noninserted_layout( [layouts.pack_upwards_mod()], layouts.Layout(deepcopy(ldict))).new_layout.layout_dict