Skip to content

Commit 2766a4f

Browse files
committed
Fix color conflict.
1 parent 9f9152f commit 2766a4f

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

  • crates/processing_pyo3/src

crates/processing_pyo3/src/lib.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,19 @@ mod mewnala {
666666
#[pymodule_export]
667667
use crate::color::PyColor;
668668

669+
#[pyfunction(name = "color")]
670+
#[pyo3(signature = (*args))]
671+
fn color_ctor(py: Python<'_>, args: &Bound<'_, PyTuple>) -> PyResult<PyColor> {
672+
let parent = py.import("mewnala.mewnala")?;
673+
match get_graphics(&parent)? {
674+
Some(g) => g.color(args),
675+
None => {
676+
let mode = crate::color::ColorMode::default();
677+
crate::color::extract_color_with_mode(args, &mode).map(PyColor::from)
678+
}
679+
}
680+
}
681+
669682
#[pyfunction]
670683
fn hex(s: &str) -> PyResult<PyColor> {
671684
PyColor::hex(s)
@@ -1248,21 +1261,6 @@ mod mewnala {
12481261
graphics!(module).draw_geometry(&*geometry.extract::<PyRef<Geometry>>()?)
12491262
}
12501263

1251-
#[pyfunction(name = "color")]
1252-
#[pyo3(pass_module, signature = (*args))]
1253-
fn create_color(
1254-
module: &Bound<'_, PyModule>,
1255-
args: &Bound<'_, PyTuple>,
1256-
) -> PyResult<super::color::PyColor> {
1257-
match get_graphics(module)? {
1258-
Some(g) => g.color(args),
1259-
None => {
1260-
let mode = super::color::ColorMode::default();
1261-
super::color::extract_color_with_mode(args, &mode).map(super::color::PyColor::from)
1262-
}
1263-
}
1264-
}
1265-
12661264
#[pyfunction]
12671265
#[pyo3(pass_module, signature = (*args))]
12681266
fn background(module: &Bound<'_, PyModule>, args: &Bound<'_, PyTuple>) -> PyResult<()> {

0 commit comments

Comments
 (0)