1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4use pyo3::PyErr;
5
6pub struct PyGetPropertyError(pub slint_interpreter::GetPropertyError);
7
8impl From<PyGetPropertyError> for PyErr {
9 fn from(err: PyGetPropertyError) -> Self {
10 pyo3::exceptions::PyValueError::new_err(args:err.0.to_string())
11 }
12}
13
14impl From<slint_interpreter::GetPropertyError> for PyGetPropertyError {
15 fn from(err: slint_interpreter::GetPropertyError) -> Self {
16 Self(err)
17 }
18}
19
20pub struct PySetPropertyError(pub slint_interpreter::SetPropertyError);
21
22impl From<PySetPropertyError> for PyErr {
23 fn from(err: PySetPropertyError) -> Self {
24 pyo3::exceptions::PyValueError::new_err(args:err.0.to_string())
25 }
26}
27
28impl From<slint_interpreter::SetPropertyError> for PySetPropertyError {
29 fn from(err: slint_interpreter::SetPropertyError) -> Self {
30 Self(err)
31 }
32}
33
34pub struct PyPlatformError(pub slint_interpreter::PlatformError);
35
36impl From<PyPlatformError> for PyErr {
37 fn from(err: PyPlatformError) -> Self {
38 pyo3::exceptions::PyRuntimeError::new_err(args:err.0.to_string())
39 }
40}
41
42impl From<slint_interpreter::PlatformError> for PyPlatformError {
43 fn from(err: slint_interpreter::PlatformError) -> Self {
44 Self(err)
45 }
46}
47
48pub struct PyEventLoopError(pub slint_interpreter::EventLoopError);
49
50impl From<PyEventLoopError> for PyErr {
51 fn from(err: PyEventLoopError) -> Self {
52 pyo3::exceptions::PyRuntimeError::new_err(args:err.0.to_string())
53 }
54}
55
56impl From<slint_interpreter::EventLoopError> for PyEventLoopError {
57 fn from(err: slint_interpreter::EventLoopError) -> Self {
58 Self(err)
59 }
60}
61
62pub struct PyInvokeError(pub slint_interpreter::InvokeError);
63
64impl From<PyInvokeError> for PyErr {
65 fn from(err: PyInvokeError) -> Self {
66 pyo3::exceptions::PyRuntimeError::new_err(args:err.0.to_string())
67 }
68}
69
70impl From<slint_interpreter::InvokeError> for PyInvokeError {
71 fn from(err: slint_interpreter::InvokeError) -> Self {
72 Self(err)
73 }
74}
75
76pub struct PySetCallbackError(pub slint_interpreter::SetCallbackError);
77
78impl From<PySetCallbackError> for PyErr {
79 fn from(err: PySetCallbackError) -> Self {
80 pyo3::exceptions::PyRuntimeError::new_err(args:err.0.to_string())
81 }
82}
83
84impl From<slint_interpreter::SetCallbackError> for PySetCallbackError {
85 fn from(err: slint_interpreter::SetCallbackError) -> Self {
86 Self(err)
87 }
88}
89
90pub struct PyLoadImageError(pub slint_interpreter::LoadImageError);
91
92impl From<PyLoadImageError> for PyErr {
93 fn from(err: PyLoadImageError) -> Self {
94 pyo3::exceptions::PyRuntimeError::new_err(args:err.0.to_string())
95 }
96}
97
98impl From<slint_interpreter::LoadImageError> for PyLoadImageError {
99 fn from(err: slint_interpreter::LoadImageError) -> Self {
100 Self(err)
101 }
102}
103
104pub struct PyColorParseError(pub css_color_parser2::ColorParseError);
105
106impl From<PyColorParseError> for PyErr {
107 fn from(err: PyColorParseError) -> Self {
108 pyo3::exceptions::PyRuntimeError::new_err(args:err.0.to_string())
109 }
110}
111
112impl From<css_color_parser2::ColorParseError> for PyColorParseError {
113 fn from(err: css_color_parser2::ColorParseError) -> Self {
114 Self(err)
115 }
116}
117