From fd0e6e3aa0e7523a36011a2f0264737772aa5e24 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 7 Aug 2016 22:20:45 +0200 Subject: templates: nodemcu-arduino: NodeMCU with Arduino. o Moving headers so they match the namespace they declare. o Reducing debug logging. --- python/include/trygvis/kicad/GenerateHeaderPy.h | 2 +- python/kicad_utils_py.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/include/trygvis/kicad/GenerateHeaderPy.h b/python/include/trygvis/kicad/GenerateHeaderPy.h index 893b7ed..9e831e9 100644 --- a/python/include/trygvis/kicad/GenerateHeaderPy.h +++ b/python/include/trygvis/kicad/GenerateHeaderPy.h @@ -1,7 +1,7 @@ #ifndef KICAD_UTILS_GENERATEHEADEPY_H #define KICAD_UTILS_GENERATEHEADEPY_H -#include "trygvis/kicad.h" +#include "trygvis/kicad/netlist.h" #include "pybind11/pybind11.h" #include #include 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::str(n.name.value())) : py::none(); +} + void init_module(py::module &m) { py::class_(m, "node"). def_readonly("ref", &node::ref). @@ -13,12 +18,12 @@ void init_module(py::module &m) { py::class_(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_(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_(m, "GenerateHeader"). def(py::init()). -- cgit v1.2.3