save window layout

def save_layout(vehname):
    '''save window layout'''
    global display_size
    global window_list
    global vehiclename
    if display_size is None:
        print("No layouts to save")
        return
    vehiclename = vehname
    fname = layout_filename(False)
    if fname is None:
        print("No file to save layout to")
        return
    layout = {}
    try:
        # include previous layout, so we retain layouts for widows not
        # currently displayed
        layout = pickle.load(open(fname,"rb"))
    except Exception:
        pass
    count = 0
    for name in window_list:
        layout[name] = window_list[name].layout
        count += 1
    pickle.dump(layout, open(fname,"wb"))
    print("Saved layout for %u windows" % count)