Transformed selected instances lose selection status

Open
#2,150 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, python
Domain
desktop

Research direction

Start with the provided Python script and the Plugin mouse-click event handler described in the issue; compare the selection behavior when transforming an instance with the behavior when the transform call is replaced by pass. The issue says the script did not reproduce the problem in isolation, so check it in the menu-command context described. Done means a transformed instance remains selected in that context.

Written by the indexing model from the issue text.

Description

Steps to reproduce

  1. create layout with 1 instance and 1 shape
  2. test shape
    1. select shape
    2. call the script
    3. OBTAINED: shape was moved
    4. OBTAINED: shape stays selected, GOOD
  3. test instance
    1. select instance
    2. call the script
    3. OBTAINED: instance was moved
    4. EXPECTED: instance stays selected
    5. OBTAINED: instance no longer selected

EDIT: Hmmm ... can't reproduce it in isolation with the script below.
Is it possible that it behaves differently when it's called from a menu command again?

# Issue: https://github.com/KLayout/klayout/issues/2150

import pya
lv = pya.LayoutView.current()

trans = pya.DTrans(0.5, 0.5)

for o in lv.each_object_selected():
    if o.shape is not None:
        o.shape.transform(trans)
    else:
        inst = o.path[0].inst()
        inst.transform(trans)

In my setup, basically

  • my Plugin reacts on mouse click event to commit a move operation
  • then the above code is executed from the event handler
  • if i replace the inst.transform(trans) with pass, the selection is retained
Dominant language
C++
Stars
1.2k
Forks
305
Avg merge
3d 2h
Merged PRs (30d)
11

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from KLayout/klayout

All issues in KLayout/klayout

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.