aboutsummaryrefslogtreecommitdiff
path: root/python/kicad_utils_py.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'python/kicad_utils_py.cpp')
-rw-r--r--python/kicad_utils_py.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/python/kicad_utils_py.cpp b/python/kicad_utils_py.cpp
index 6cd3948..8cb91ee 100644
--- a/python/kicad_utils_py.cpp
+++ b/python/kicad_utils_py.cpp
@@ -6,6 +6,11 @@ using namespace std;
using namespace trygvis::kicad::netlist;
using namespace trygvis::kicad::python;
+static
+py::object net_name(const net &n) {
+ return n.name ? static_cast<py::object>(py::str(n.name.value())) : py::none();
+}
+
void init_module(py::module &m) {
py::class_<node>(m, "node").
def_readonly("ref", &node::ref).
@@ -13,12 +18,12 @@ void init_module(py::module &m) {
py::class_<net>(m, "net").
def_readonly("code", &net::code).
- def_readonly("name", &net::name).
+ def_property_readonly("name", &net_name).
def_readonly("nodes", &net::nodes).
def("node_for_ref", &net::node_for_ref, py::return_value_policy::reference);
py::class_<nl>(m, "netlist").
- def("find_usages_of", &nl::find_usage_of, py::return_value_policy::reference);
+ def("find_nets_using_ref", &nl::find_nets_using_ref, py::return_value_policy::reference);
py::class_<GenerateHeaderPy>(m, "GenerateHeader").
def(py::init<const string &, nl *>()).