klayout icon indicating copy to clipboard operation
klayout copied to clipboard

Python API: on_technology_changed event is not sent

Open klayoutmatthias opened this issue 2 years ago • 2 comments

This issue refers to this discussion: https://www.klayout.de/forum/discussion/2053/cellview-on-technology-changed-is-not-emitted#latest

A simple way to reproduce the problem is:

def ping():
  print("Event caught (python)")

pya.CellView.active().on_technology_changed.add(ping)

When changing the technology on the cellview, the event is triggered, but "ping" is not called.

In Ruby, this feature works.

klayoutmatthias avatar Mar 24 '22 22:03 klayoutmatthias

Looks like a workaround is to keep the event object:

        # connect to signal from CellView
        self._event = pya.CellView.active().on_technology_changed
        self._event.add(self._check_technology_from_signal)

klayoutmatthias avatar Mar 24 '22 23:03 klayoutmatthias

Seems like there is an acceptable workaround by keeping a reference to the CellView object.

def ping():
  print("Event caught (python)")

cv = pya.CellView.active()
cv.on_technology_changed.add(ping)

klayoutmatthias avatar Mar 24 '22 23:03 klayoutmatthias