anycubic-cloud-api 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anycubic_cloud_api/__init__.py +62 -0
- anycubic_cloud_api/anycubic_api.py +7 -0
- anycubic_cloud_api/api/base.py +400 -0
- anycubic_cloud_api/api/functions.py +2055 -0
- anycubic_cloud_api/api/mqtt.py +449 -0
- anycubic_cloud_api/const/api_endpoints.py +106 -0
- anycubic_cloud_api/const/const.py +47 -0
- anycubic_cloud_api/const/enums.py +97 -0
- anycubic_cloud_api/const/mqtt.py +13 -0
- anycubic_cloud_api/data_models/consumable.py +116 -0
- anycubic_cloud_api/data_models/files.py +429 -0
- anycubic_cloud_api/data_models/gcode_file.py +107 -0
- anycubic_cloud_api/data_models/orders.py +369 -0
- anycubic_cloud_api/data_models/print_response.py +71 -0
- anycubic_cloud_api/data_models/print_speed_mode.py +61 -0
- anycubic_cloud_api/data_models/printer.py +2753 -0
- anycubic_cloud_api/data_models/printer_properties.py +1107 -0
- anycubic_cloud_api/data_models/printing_settings.py +130 -0
- anycubic_cloud_api/data_models/project.py +1234 -0
- anycubic_cloud_api/exceptions/error_strings.py +340 -0
- anycubic_cloud_api/exceptions/exceptions.py +91 -0
- anycubic_cloud_api/helpers/helpers.py +240 -0
- anycubic_cloud_api/models/auth.py +396 -0
- anycubic_cloud_api/models/cloud_upload.py +249 -0
- anycubic_cloud_api/models/http.py +29 -0
- anycubic_cloud_api/resources/anycubic_mqqt_tls_ca.crt +24 -0
- anycubic_cloud_api/resources/anycubic_mqqt_tls_client.crt +24 -0
- anycubic_cloud_api/resources/anycubic_mqqt_tls_client.key +28 -0
- anycubic_cloud_api-0.1.0.dist-info/METADATA +79 -0
- anycubic_cloud_api-0.1.0.dist-info/RECORD +33 -0
- anycubic_cloud_api-0.1.0.dist-info/WHEEL +5 -0
- anycubic_cloud_api-0.1.0.dist-info/licenses/LICENSE +674 -0
- anycubic_cloud_api-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Any
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from .printer_properties import AnycubicMaterialMapping
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AnycubicBaseOrderRequest:
|
|
10
|
+
__slots__ = (
|
|
11
|
+
"_order_id",
|
|
12
|
+
"_printer_id",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
order_id: int | None = None,
|
|
18
|
+
printer_id: int | None = None,
|
|
19
|
+
) -> None:
|
|
20
|
+
if order_id is None:
|
|
21
|
+
raise Exception("AnycubicBaseOrderRequest missing order_id")
|
|
22
|
+
|
|
23
|
+
if printer_id is None:
|
|
24
|
+
raise Exception("AnycubicBaseOrderRequest missing printer_id")
|
|
25
|
+
|
|
26
|
+
self._order_id: int = int(order_id)
|
|
27
|
+
self._printer_id: int = int(printer_id)
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def order_request_data(self) -> dict[str, Any]:
|
|
31
|
+
return {
|
|
32
|
+
'order_id': self._order_id,
|
|
33
|
+
'printer_id': self._printer_id,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def __repr__(self) -> str:
|
|
37
|
+
return (
|
|
38
|
+
f"AnycubicBaseOrderRequest("
|
|
39
|
+
f"order_id={self._order_id}, "
|
|
40
|
+
f"printer_id={self._printer_id})"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class AnycubicBaseProjectOrderRequest(AnycubicBaseOrderRequest):
|
|
45
|
+
__slots__ = (
|
|
46
|
+
"_project_id",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def __init__(
|
|
50
|
+
self,
|
|
51
|
+
project_id: int,
|
|
52
|
+
**kwargs: Any,
|
|
53
|
+
) -> None:
|
|
54
|
+
super().__init__(**kwargs)
|
|
55
|
+
self._project_id = int(project_id)
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def order_request_data(self) -> dict[str, Any]:
|
|
59
|
+
return {
|
|
60
|
+
**super().order_request_data,
|
|
61
|
+
'project_id': self._project_id,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
def __repr__(self) -> str:
|
|
65
|
+
return (
|
|
66
|
+
f"AnycubicBaseProjectOrderRequest("
|
|
67
|
+
f"order_id={self._order_id}, "
|
|
68
|
+
f"printer_id={self._printer_id}, "
|
|
69
|
+
f"project_id={self._project_id})"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class AnycubicProjectOrderRequest(AnycubicBaseProjectOrderRequest):
|
|
74
|
+
__slots__ = (
|
|
75
|
+
"_order_data",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
def __init__(
|
|
79
|
+
self,
|
|
80
|
+
order_data: dict[str, Any] = {},
|
|
81
|
+
**kwargs: Any,
|
|
82
|
+
) -> None:
|
|
83
|
+
super().__init__(**kwargs)
|
|
84
|
+
self._order_data = order_data
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def order_request_data(self) -> dict[str, Any]:
|
|
88
|
+
return {
|
|
89
|
+
**super().order_request_data,
|
|
90
|
+
'data': self._order_data,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
def __repr__(self) -> str:
|
|
94
|
+
return (
|
|
95
|
+
f"AnycubicProjectOrderRequest("
|
|
96
|
+
f"order_id={self._order_id}, "
|
|
97
|
+
f"printer_id={self._printer_id}, "
|
|
98
|
+
f"project_id={self._project_id}, "
|
|
99
|
+
f"order_data={self._order_data})"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class AnycubicProjectCtrlOrderRequest(AnycubicProjectOrderRequest):
|
|
104
|
+
__slots__ = (
|
|
105
|
+
"_ams_info",
|
|
106
|
+
"_print_settings",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def __init__(
|
|
110
|
+
self,
|
|
111
|
+
ams_box_mapping: list[AnycubicMaterialMapping] | None = None,
|
|
112
|
+
print_settings: dict[str, Any] | None = None,
|
|
113
|
+
**kwargs: Any,
|
|
114
|
+
) -> None:
|
|
115
|
+
super().__init__(**kwargs)
|
|
116
|
+
self._ams_info: dict[str, Any] | None = None
|
|
117
|
+
self._set_ams_info(ams_box_mapping)
|
|
118
|
+
self._print_settings: dict[str, Any] | None = print_settings
|
|
119
|
+
|
|
120
|
+
def _set_ams_info(self, ams_box_mapping: list[AnycubicMaterialMapping] | None) -> None:
|
|
121
|
+
if ams_box_mapping:
|
|
122
|
+
self._ams_info = {
|
|
123
|
+
'ams_box_mapping': [
|
|
124
|
+
x.as_box_mapping_data()
|
|
125
|
+
for x in ams_box_mapping
|
|
126
|
+
],
|
|
127
|
+
'use_ams': (
|
|
128
|
+
True
|
|
129
|
+
if len(ams_box_mapping) > 0 else
|
|
130
|
+
False
|
|
131
|
+
),
|
|
132
|
+
}
|
|
133
|
+
else:
|
|
134
|
+
self._ams_info = None
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
def order_request_data(self) -> dict[str, Any]:
|
|
138
|
+
return {
|
|
139
|
+
**super().order_request_data,
|
|
140
|
+
'ams_info': self._ams_info,
|
|
141
|
+
'settings': self._print_settings,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
def __repr__(self) -> str:
|
|
145
|
+
return (
|
|
146
|
+
f"AnycubicProjectCtrlOrderRequest("
|
|
147
|
+
f"order_id={self._order_id}, "
|
|
148
|
+
f"printer_id={self._printer_id}, "
|
|
149
|
+
f"project_id={self._project_id}, "
|
|
150
|
+
f"order_data={self._order_data}, "
|
|
151
|
+
f"ams_info={self._ams_info}, "
|
|
152
|
+
f"print_settings={self._print_settings})"
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class AnycubicBaseStartPrintRequest:
|
|
157
|
+
__slots__ = (
|
|
158
|
+
"_file_key",
|
|
159
|
+
"_file_name",
|
|
160
|
+
"_filetype",
|
|
161
|
+
"_task_setting_ai_detect",
|
|
162
|
+
"_task_setting_camera_timelapse",
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def __init__(
|
|
166
|
+
self,
|
|
167
|
+
file_key: str = "",
|
|
168
|
+
file_name: str = "",
|
|
169
|
+
filetype: int = 0,
|
|
170
|
+
task_setting_ai_detect: int = 0,
|
|
171
|
+
task_setting_camera_timelapse: int = 0,
|
|
172
|
+
) -> None:
|
|
173
|
+
self._file_key = file_key
|
|
174
|
+
self._file_name = file_name
|
|
175
|
+
self._filetype = filetype
|
|
176
|
+
self._task_setting_ai_detect = task_setting_ai_detect
|
|
177
|
+
self._task_setting_camera_timelapse = task_setting_camera_timelapse
|
|
178
|
+
|
|
179
|
+
@property
|
|
180
|
+
def task_settings(self) -> dict[str, Any]:
|
|
181
|
+
return {
|
|
182
|
+
'ai_detect': self._task_setting_ai_detect,
|
|
183
|
+
'camera_timelapse': self._task_setting_camera_timelapse,
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@property
|
|
187
|
+
def data(self) -> dict[str, Any]:
|
|
188
|
+
return {
|
|
189
|
+
'filetype': self._filetype,
|
|
190
|
+
'file_key': self._file_key,
|
|
191
|
+
'file_name': self._file_name,
|
|
192
|
+
'task_settings': self.task_settings,
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
def __repr__(self) -> str:
|
|
196
|
+
return (
|
|
197
|
+
f"AnycubicBaseStartPrintRequest("
|
|
198
|
+
f"filetype={self._filetype}, "
|
|
199
|
+
f"file_name={self._file_name}, "
|
|
200
|
+
f"task_settings={self.task_settings})"
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class AnycubicStartPrintRequestLocal(AnycubicBaseStartPrintRequest):
|
|
205
|
+
__slots__ = (
|
|
206
|
+
"_filename",
|
|
207
|
+
"_filepath",
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
def __init__(
|
|
211
|
+
self,
|
|
212
|
+
filename: str = "",
|
|
213
|
+
filepath: str = "",
|
|
214
|
+
**kwargs: Any,
|
|
215
|
+
) -> None:
|
|
216
|
+
super().__init__(**kwargs)
|
|
217
|
+
self._filename = filename
|
|
218
|
+
self._filepath = filepath
|
|
219
|
+
self._filetype = 1
|
|
220
|
+
|
|
221
|
+
@property
|
|
222
|
+
def data(self) -> dict[str, Any]:
|
|
223
|
+
return {
|
|
224
|
+
**super().data,
|
|
225
|
+
'filename': self._filename,
|
|
226
|
+
'filepath': f"/{self._filepath}",
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
def __repr__(self) -> str:
|
|
230
|
+
return (
|
|
231
|
+
f"AnycubicStartPrintRequestLocal("
|
|
232
|
+
f"filetype={self._filetype}, "
|
|
233
|
+
f"filename={self._filename}, "
|
|
234
|
+
f"filepath={self._filepath}, "
|
|
235
|
+
f"task_settings={self.task_settings})"
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class AnycubicStartPrintRequestUdisk(AnycubicStartPrintRequestLocal):
|
|
240
|
+
def __init__(
|
|
241
|
+
self,
|
|
242
|
+
**kwargs: Any,
|
|
243
|
+
) -> None:
|
|
244
|
+
super().__init__(**kwargs)
|
|
245
|
+
self._filetype = 2
|
|
246
|
+
|
|
247
|
+
def __repr__(self) -> str:
|
|
248
|
+
return (
|
|
249
|
+
f"AnycubicStartPrintRequestUdisk("
|
|
250
|
+
f"filetype={self._filetype}, "
|
|
251
|
+
f"filename={self._filename}, "
|
|
252
|
+
f"filepath={self._filepath}, "
|
|
253
|
+
f"task_settings={self.task_settings})"
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class AnycubicStartPrintRequestCloud(AnycubicBaseStartPrintRequest):
|
|
258
|
+
__slots__ = (
|
|
259
|
+
"_file_id",
|
|
260
|
+
"_hollow_param",
|
|
261
|
+
"_is_delete_file",
|
|
262
|
+
"_matrix",
|
|
263
|
+
"_project_type",
|
|
264
|
+
"_punching_param",
|
|
265
|
+
"_slice_param",
|
|
266
|
+
"_slice_size",
|
|
267
|
+
"_template_id",
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
def __init__(
|
|
271
|
+
self,
|
|
272
|
+
file_id: int = -1,
|
|
273
|
+
hollow_param: Any = None,
|
|
274
|
+
is_delete_file: int = 0,
|
|
275
|
+
matrix: str = "",
|
|
276
|
+
project_type: int = 1,
|
|
277
|
+
punching_param: Any = None,
|
|
278
|
+
slice_param: dict[str, Any] | None = None,
|
|
279
|
+
slice_size: Any = None,
|
|
280
|
+
template_id: int = 0,
|
|
281
|
+
**kwargs: Any,
|
|
282
|
+
) -> None:
|
|
283
|
+
super().__init__(**kwargs)
|
|
284
|
+
self._file_id = file_id
|
|
285
|
+
self._hollow_param = hollow_param
|
|
286
|
+
self._is_delete_file = int(is_delete_file)
|
|
287
|
+
self._matrix = matrix
|
|
288
|
+
self._project_type = project_type
|
|
289
|
+
self._punching_param = punching_param
|
|
290
|
+
self._slice_param = slice_param
|
|
291
|
+
self._slice_size = slice_size
|
|
292
|
+
self._template_id = template_id
|
|
293
|
+
|
|
294
|
+
@property
|
|
295
|
+
def data(self) -> dict[str, Any]:
|
|
296
|
+
return {
|
|
297
|
+
**super().data,
|
|
298
|
+
'file_id': self._file_id,
|
|
299
|
+
'hollow_param': self._hollow_param,
|
|
300
|
+
'is_delete_file': self._is_delete_file,
|
|
301
|
+
'matrix': self._matrix,
|
|
302
|
+
'project_type': self._project_type,
|
|
303
|
+
'punching_param': self._punching_param,
|
|
304
|
+
'slice_param': self._slice_param,
|
|
305
|
+
'slice_size': self._slice_size,
|
|
306
|
+
'template_id': self._template_id,
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
def __repr__(self) -> str:
|
|
310
|
+
return (
|
|
311
|
+
f"AnycubicStartPrintRequestCloud("
|
|
312
|
+
f"filetype={self._filetype}, "
|
|
313
|
+
f"file_id={self._file_name}, "
|
|
314
|
+
f"task_settings={self.task_settings})"
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class AnycubicCameraToken:
|
|
319
|
+
__slots__ = (
|
|
320
|
+
"_secret_id",
|
|
321
|
+
"_secret_key",
|
|
322
|
+
"_session_token",
|
|
323
|
+
"_region",
|
|
324
|
+
"_msg_id",
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
def __init__(
|
|
328
|
+
self,
|
|
329
|
+
secret_id: str,
|
|
330
|
+
secret_key: str,
|
|
331
|
+
session_token: str,
|
|
332
|
+
region: str,
|
|
333
|
+
msg_id: str,
|
|
334
|
+
) -> None:
|
|
335
|
+
self._secret_id: str = secret_id
|
|
336
|
+
self._secret_key: str = secret_key
|
|
337
|
+
self._session_token: str = session_token
|
|
338
|
+
self._region: str = region
|
|
339
|
+
self._msg_id: str = msg_id
|
|
340
|
+
|
|
341
|
+
@property
|
|
342
|
+
def secret_id(self) -> str:
|
|
343
|
+
return self._secret_id
|
|
344
|
+
|
|
345
|
+
@property
|
|
346
|
+
def secret_key(self) -> str:
|
|
347
|
+
return self._secret_key
|
|
348
|
+
|
|
349
|
+
@property
|
|
350
|
+
def session_token(self) -> str:
|
|
351
|
+
return self._session_token
|
|
352
|
+
|
|
353
|
+
@property
|
|
354
|
+
def region(self) -> str:
|
|
355
|
+
return self._region
|
|
356
|
+
|
|
357
|
+
@property
|
|
358
|
+
def msg_id(self) -> str:
|
|
359
|
+
return self._msg_id
|
|
360
|
+
|
|
361
|
+
def __repr__(self) -> str:
|
|
362
|
+
return (
|
|
363
|
+
f"AnycubicCameraToken("
|
|
364
|
+
f"secret_id={self.secret_id}, "
|
|
365
|
+
f"secret_key={self.secret_key}, "
|
|
366
|
+
f"session_token={self.session_token}, "
|
|
367
|
+
f"region={self.region}, "
|
|
368
|
+
f"msg_id={self.msg_id})"
|
|
369
|
+
)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Any
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from .printer_properties import AnycubicMaterialMapping
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AnycubicPrintResponse:
|
|
10
|
+
__slots__ = (
|
|
11
|
+
"_order_msg_id",
|
|
12
|
+
"_printer_id",
|
|
13
|
+
"_saved_in_cloud",
|
|
14
|
+
"_file_name",
|
|
15
|
+
"_cloud_file_id",
|
|
16
|
+
"_gcode_id",
|
|
17
|
+
"_material_list",
|
|
18
|
+
"_ams_box_mapping",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
order_msg_id: str | None = None,
|
|
24
|
+
printer_id: int | None = None,
|
|
25
|
+
saved_in_cloud: bool = False,
|
|
26
|
+
file_name: str | None = None,
|
|
27
|
+
cloud_file_id: int | None = None,
|
|
28
|
+
gcode_id: int | None = None,
|
|
29
|
+
material_list: list[dict[str, Any]] | None = None,
|
|
30
|
+
ams_box_mapping: list[AnycubicMaterialMapping] | None = None,
|
|
31
|
+
) -> None:
|
|
32
|
+
self._order_msg_id: str | None = order_msg_id
|
|
33
|
+
self._printer_id: int | None = printer_id
|
|
34
|
+
self._saved_in_cloud: bool = bool(saved_in_cloud)
|
|
35
|
+
self._file_name: str | None = file_name
|
|
36
|
+
self._cloud_file_id: int | None = cloud_file_id
|
|
37
|
+
self._gcode_id: int | None = gcode_id
|
|
38
|
+
self._material_list: list[dict[str, Any]] | None = material_list
|
|
39
|
+
self._ams_box_mapping: list[AnycubicMaterialMapping] | None = ams_box_mapping
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def event_dict(self) -> dict[str, Any]:
|
|
43
|
+
ams_box_mapping = None
|
|
44
|
+
|
|
45
|
+
if self._ams_box_mapping:
|
|
46
|
+
ams_box_mapping = list([
|
|
47
|
+
x.as_box_mapping_data() for x in self._ams_box_mapping
|
|
48
|
+
])
|
|
49
|
+
return {
|
|
50
|
+
'order_msg_id': self._order_msg_id,
|
|
51
|
+
'printer_id': self._printer_id,
|
|
52
|
+
'saved_in_cloud': self._saved_in_cloud,
|
|
53
|
+
'file_name': self._file_name,
|
|
54
|
+
'cloud_file_id': self._cloud_file_id,
|
|
55
|
+
'gcode_id': self._gcode_id,
|
|
56
|
+
'material_list': self._material_list,
|
|
57
|
+
'ams_box_mapping': ams_box_mapping,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def __repr__(self) -> str:
|
|
61
|
+
return (
|
|
62
|
+
f"AnycubicPrintResponse("
|
|
63
|
+
f"order_msg_id={self._order_msg_id}, "
|
|
64
|
+
f"printer_id={self._printer_id}, "
|
|
65
|
+
f"saved_in_cloud={self._saved_in_cloud}, "
|
|
66
|
+
f"file_name={self._file_name}, "
|
|
67
|
+
f"cloud_file_id={self._cloud_file_id}, "
|
|
68
|
+
f"gcode_id={self._gcode_id}, "
|
|
69
|
+
f"material_list={self._material_list}, "
|
|
70
|
+
f"ams_box_mapping={self._ams_box_mapping})"
|
|
71
|
+
)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AnycubicPrintSpeedMode:
|
|
7
|
+
__slots__ = (
|
|
8
|
+
"_title",
|
|
9
|
+
"_mode",
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
title: str,
|
|
15
|
+
mode: int,
|
|
16
|
+
) -> None:
|
|
17
|
+
self._title = str(title)
|
|
18
|
+
self._mode = int(mode)
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def from_json(cls, data: dict[str, Any] | None) -> AnycubicPrintSpeedMode | None:
|
|
22
|
+
if data is None:
|
|
23
|
+
return None
|
|
24
|
+
|
|
25
|
+
return cls(
|
|
26
|
+
title=data['title'],
|
|
27
|
+
mode=data['print_speed_mode'],
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def title(self) -> str:
|
|
32
|
+
return self._title
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def mode(self) -> int:
|
|
36
|
+
return self._mode
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def data_object(self) -> dict[str, str | int]:
|
|
40
|
+
return {
|
|
41
|
+
"description": self._title,
|
|
42
|
+
"mode": self._mode,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
def __repr__(self) -> str:
|
|
46
|
+
return (
|
|
47
|
+
f"AnycubicPrintSpeedMode("
|
|
48
|
+
f"title={self._title}, "
|
|
49
|
+
f"mode={self._mode})"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def __eq__(self, other: object) -> bool:
|
|
53
|
+
if isinstance(other, AnycubicPrintSpeedMode):
|
|
54
|
+
return self.mode == other.mode
|
|
55
|
+
else:
|
|
56
|
+
try:
|
|
57
|
+
return bool(self.mode == int(other)) # type: ignore[call-overload]
|
|
58
|
+
except Exception:
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
return False
|