def qbsave(connection, name, cost=None, *description): fname = qb_fname(name) if not fname: return 'Invalid save name. Only alphanumeric characters allowed.' if not connection.qb_recorded: return 'Nothing is recorded yet!' shift = map(min, zip(*connection.qb_recorded.iterkeys())) origin = [-x for x in shift] info = {'colored': connection.qb_record_colors, 'origin': origin} if cost is not None: info['cost'] = int(cost) if description: info['description'] = ' '.join(description) qb_update_info(fname + '.txt', info) recorded = dict(shift_origin_all(connection.qb_recorded, shift)) AVX.fromsparsedict(recorded, info['colored']).save(fname) return 'Saved buffer to %s.avx' % name
def qbsave(connection, name, cost = None, *description): fname = qb_fname(name) if not fname: return 'Invalid save name. Only alphanumeric characters allowed.' if not connection.qb_recorded: return 'Nothing is recorded yet!' shift = map(min, zip(*connection.qb_recorded.iterkeys())) origin = [-x for x in shift] info = {'colored': connection.qb_record_colors , 'origin': origin} if cost is not None: info['cost'] = int(cost) if description: info['description'] = ' '.join(description) qb_update_info(fname + '.txt', info) recorded = dict(shift_origin_all(connection.qb_recorded, shift)) AVX.fromsparsedict(recorded, info['colored']).save(fname) return 'Saved buffer to %s.avx' % name