|
1
|
|
|
#!/usr/bin/env python |
|
2
|
|
|
|
|
3
|
|
|
from typing import Optional |
|
4
|
|
|
from typing import Tuple |
|
5
|
|
|
from typing import FrozenSet |
|
6
|
|
|
|
|
7
|
|
|
from doorstop.core.types import Prefix |
|
8
|
|
|
from doorstop.core.types import UID |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class Action(): pass |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
class Action_ChangeProjectPath(Action): |
|
15
|
|
|
@property |
|
16
|
|
|
def project_path(self) -> str: |
|
17
|
|
|
return self.__project_path |
|
18
|
|
|
|
|
19
|
|
|
def __init__(self, project_path: str) -> None: |
|
20
|
|
|
self.__project_path = str(project_path) if project_path else "" |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
class Action_CloseProject(Action): pass |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
class Action_LoadProject(Action): pass |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
class Action_SaveProject(Action): pass |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
class Action_ChangeCWD(Action): |
|
33
|
|
|
@property |
|
34
|
|
|
def cwd(self) -> Optional[str]: |
|
35
|
|
|
return self.__cwd |
|
36
|
|
|
|
|
37
|
|
|
def __init__(self, cwd: Optional[str]) -> None: |
|
38
|
|
|
self.__cwd = cwd |
|
39
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
class Action_ChangeSelectedDocument(Action): |
|
42
|
|
|
@property |
|
43
|
|
|
def selected_document(self) -> Optional[Prefix]: |
|
44
|
|
|
return self.__selected_document |
|
45
|
|
|
|
|
46
|
|
|
def __init__(self, selected_document: Optional[Prefix]) -> None: |
|
47
|
|
|
self.__selected_document = selected_document |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
class Action_ChangeSelectedItem(Action): |
|
51
|
|
|
@property |
|
52
|
|
|
def selected_item(self) -> Tuple[UID, ...]: |
|
53
|
|
|
return self.__selected_item |
|
54
|
|
|
|
|
55
|
|
|
def __init__(self, selected_item: Tuple[UID, ...]) -> None: |
|
56
|
|
|
self.__selected_item = selected_item |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
class Action_ChangeItemText(Action): |
|
60
|
|
|
@property |
|
61
|
|
|
def item_uid(self) -> UID: |
|
62
|
|
|
return self.__item_uid |
|
63
|
|
|
|
|
64
|
|
|
@property |
|
65
|
|
|
def item_new_text(self) -> str: |
|
66
|
|
|
return self.__item_new_text |
|
67
|
|
|
|
|
68
|
|
|
def __init__(self, item_uid: UID, new_text: str) -> None: |
|
69
|
|
|
self.__item_uid = item_uid |
|
70
|
|
|
self.__item_new_text = new_text |
|
71
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
class Action_ChangeItemActive(Action): |
|
74
|
|
|
@property |
|
75
|
|
|
def item_uid(self) -> UID: |
|
76
|
|
|
return self.__item_uid |
|
77
|
|
|
|
|
78
|
|
|
@property |
|
79
|
|
|
def item_new_active(self) -> bool: |
|
80
|
|
|
return self.__item_new_active |
|
81
|
|
|
|
|
82
|
|
|
def __init__(self, item_uid: UID, new_active: bool) -> None: |
|
83
|
|
|
self.__item_uid = item_uid |
|
84
|
|
|
self.__item_new_active = new_active |
|
85
|
|
|
|
|
86
|
|
|
|
|
87
|
|
|
class Action_ChangeItemDerived(Action): |
|
88
|
|
|
@property |
|
89
|
|
|
def item_uid(self) -> UID: |
|
90
|
|
|
return self.__item_uid |
|
91
|
|
|
|
|
92
|
|
|
@property |
|
93
|
|
|
def item_new_derived(self) -> bool: |
|
94
|
|
|
return self.__item_new_derived |
|
95
|
|
|
|
|
96
|
|
|
def __init__(self, item_uid: UID, new_derived: bool) -> None: |
|
97
|
|
|
self.__item_uid = item_uid |
|
98
|
|
|
self.__item_new_derived = new_derived |
|
99
|
|
|
|
|
100
|
|
|
|
|
101
|
|
|
class Action_ChangeItemNormative(Action): |
|
102
|
|
|
@property |
|
103
|
|
|
def item_uid(self) -> UID: |
|
104
|
|
|
return self.__item_uid |
|
105
|
|
|
|
|
106
|
|
|
@property |
|
107
|
|
|
def item_new_normative(self) -> bool: |
|
108
|
|
|
return self.__item_new_normative |
|
109
|
|
|
|
|
110
|
|
|
def __init__(self, item_uid: UID, new_normative: bool) -> None: |
|
111
|
|
|
self.__item_uid = item_uid |
|
112
|
|
|
self.__item_new_normative = new_normative |
|
113
|
|
|
|
|
114
|
|
|
|
|
115
|
|
|
class Action_ChangeItemHeading(Action): |
|
116
|
|
|
@property |
|
117
|
|
|
def item_uid(self) -> UID: |
|
118
|
|
|
return self.__item_uid |
|
119
|
|
|
|
|
120
|
|
|
@property |
|
121
|
|
|
def item_new_heading(self) -> bool: |
|
122
|
|
|
return self.__item_new_heading |
|
123
|
|
|
|
|
124
|
|
|
def __init__(self, item_uid: UID, new_heading: bool) -> None: |
|
125
|
|
|
self.__item_uid = item_uid |
|
126
|
|
|
self.__item_new_heading = new_heading |
|
127
|
|
|
|
|
128
|
|
|
|
|
129
|
|
|
class Action_ChangeLinkInception(Action): |
|
130
|
|
|
@property |
|
131
|
|
|
def inception_link(self) -> str: |
|
132
|
|
|
return self.__inception_link |
|
133
|
|
|
|
|
134
|
|
|
def __init__(self, inception_link: str) -> None: |
|
135
|
|
|
self.__inception_link = inception_link |
|
136
|
|
|
|
|
137
|
|
|
|
|
138
|
|
|
class Action_ChangeItemAddLink(Action): |
|
139
|
|
|
@property |
|
140
|
|
|
def item_uid(self) -> UID: |
|
141
|
|
|
return self.__item_uid |
|
142
|
|
|
|
|
143
|
|
|
@property |
|
144
|
|
|
def new_link(self) -> UID: |
|
145
|
|
|
return self.__new_link |
|
146
|
|
|
|
|
147
|
|
|
def __init__(self, item_uid: UID, item_link: UID) -> None: |
|
148
|
|
|
self.__item_uid = item_uid |
|
149
|
|
|
self.__new_link = item_link |
|
150
|
|
|
|
|
151
|
|
|
|
|
152
|
|
|
class Action_ChangeSelectedLink(Action): |
|
153
|
|
|
@property |
|
154
|
|
|
def selected_link(self) -> FrozenSet[UID]: |
|
155
|
|
|
return self.__selected_link |
|
156
|
|
|
|
|
157
|
|
|
@property |
|
158
|
|
|
def unselected_link(self) -> FrozenSet[UID]: |
|
159
|
|
|
return self.__unselected_link |
|
160
|
|
|
|
|
161
|
|
|
def __init__(self, selected_link: FrozenSet[UID], unselected_link: FrozenSet[UID]) -> None: |
|
162
|
|
|
self.__selected_link = selected_link |
|
163
|
|
|
self.__unselected_link = unselected_link |
|
164
|
|
|
|
|
165
|
|
|
|
|
166
|
|
|
class Action_ChangeItemRemoveLink(Action): |
|
167
|
|
|
@property |
|
168
|
|
|
def item_uid(self) -> UID: |
|
169
|
|
|
return self.__item_uid |
|
170
|
|
|
|
|
171
|
|
|
@property |
|
172
|
|
|
def item_link(self) -> FrozenSet[UID]: |
|
173
|
|
|
return self.__item_link |
|
174
|
|
|
|
|
175
|
|
|
def __init__(self, item_uid: UID, item_link: FrozenSet[UID]) -> None: |
|
176
|
|
|
self.__item_uid = item_uid |
|
177
|
|
|
self.__item_link = item_link |
|
178
|
|
|
|
|
179
|
|
|
|
|
180
|
|
|
class Action_ChangeItemReference(Action): |
|
181
|
|
|
@property |
|
182
|
|
|
def item_uid(self) -> UID: |
|
183
|
|
|
return self.__item_uid |
|
184
|
|
|
|
|
185
|
|
|
@property |
|
186
|
|
|
def item_new_reference(self) -> str: |
|
187
|
|
|
return self.__item_new_reference |
|
188
|
|
|
|
|
189
|
|
|
def __init__(self, item_uid: UID, new_reference: str) -> None: |
|
190
|
|
|
self.__item_uid = item_uid |
|
191
|
|
|
self.__item_new_reference = new_reference |
|
192
|
|
|
|
|
193
|
|
|
|
|
194
|
|
|
class Action_ChangeExtendedName(Action): |
|
195
|
|
|
@property |
|
196
|
|
|
def extendedName(self) -> str: |
|
197
|
|
|
return self.__extendedName |
|
198
|
|
|
|
|
199
|
|
|
def __init__(self, extendedName: Optional[str]) -> None: |
|
200
|
|
|
self.__extendedName = "" if extendedName is None else extendedName |
|
201
|
|
|
|
|
202
|
|
|
|
|
203
|
|
|
class Action_ChangeExtendedValue(Action): |
|
204
|
|
|
@property |
|
205
|
|
|
def item_uid(self) -> UID: |
|
206
|
|
|
return self.__item_uid |
|
207
|
|
|
|
|
208
|
|
|
@property |
|
209
|
|
|
def extendedName(self) -> str: |
|
210
|
|
|
return self.__extendedName |
|
211
|
|
|
|
|
212
|
|
|
@property |
|
213
|
|
|
def extendedValue(self) -> Optional[str]: |
|
214
|
|
|
return self.__extendedValue |
|
215
|
|
|
|
|
216
|
|
|
def __init__(self, item_uid: UID, extendedName: str, extendedValue: Optional[str]) -> None: |
|
217
|
|
|
self.__item_uid = item_uid |
|
218
|
|
|
self.__extendedName = extendedName |
|
219
|
|
|
self.__extendedValue = extendedValue |
|
220
|
|
|
|
|
221
|
|
|
|
|
222
|
|
|
class Action_AddNewItemNextToSelection(Action): pass |
|
223
|
|
|
|
|
224
|
|
|
|
|
225
|
|
|
class Action_RemoveSelectedItem(Action): pass |
|
226
|
|
|
|
|
227
|
|
|
|
|
228
|
|
|
class Action_SelectedItem_Level_Indent(Action): pass |
|
229
|
|
|
|
|
230
|
|
|
|
|
231
|
|
|
class Action_SelectedItem_Level_Dedent(Action): pass |
|
232
|
|
|
|
|
233
|
|
|
|
|
234
|
|
|
class Action_SelectedItem_Level_Increment(Action): pass |
|
235
|
|
|
|
|
236
|
|
|
|
|
237
|
|
|
class Action_SelectedItem_Level_Decrement(Action): pass |
|
238
|
|
|
|
|
239
|
|
|
|
|
240
|
|
|
class Action_Import(Action): |
|
241
|
|
|
@property |
|
242
|
|
|
def document_prefix(self) -> Prefix: |
|
243
|
|
|
return self.__document_prefix |
|
244
|
|
|
|
|
245
|
|
|
@property |
|
246
|
|
|
def file_to_import(self) -> str: |
|
247
|
|
|
return self.__file_to_import |
|
248
|
|
|
|
|
249
|
|
|
def __init__(self, document_prefix: Prefix, file_to_import: str) -> None: |
|
250
|
|
|
self.__document_prefix = document_prefix |
|
251
|
|
|
self.__file_to_import = file_to_import |
|
252
|
|
|
|