Debian Codegraph @

envisage/ui/tasks/tests/data/create_pickles.py

raw
1 # (C) Copyright 2007-2025 Enthought, Inc., Austin, TX
2 # All rights reserved.
3 #
4 # This software is provided without warranty under the terms of the BSD
5 # license included in LICENSE.txt and may be redistributed only under
6 # the conditions described in the aforementioned license. The license
7 # is also available online at http://www.enthought.com/licenses/BSD.txt
8 #
9 # Thanks for using Enthought open source!
10
11 """
12 Script to recreate the test pickles in this directory.
13
14 No arguments are required. Run with::
15
16 $ python create_pickles.py
17 """
18
19 import pathlib
20 import pickle
21
22 from pyface.tasks.api import TaskWindowLayout
23
24 from envisage.ui.tasks.api import TasksApplicationState
25
26 state = TasksApplicationState(
27 version=1,
28 window_layouts=[],
29 previous_window_layouts=[
30 TaskWindowLayout(size=(492, 743)),
31 ],
32 )
33
34 v2_pkl = pathlib.Path("application_memento_v2.pkl")
35 v3_pkl = pathlib.Path("application_memento_v3.pkl")
36
37 v2_pkl.write_bytes(pickle.dumps(state, protocol=2))
38 v3_pkl.write_bytes(pickle.dumps(state, protocol=3))