Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird parameter dialog resizing when hiding / showing many parameters at once with callback_impl #1603

Closed
klayoutmatthias opened this issue Feb 1, 2024 · 0 comments · Fixed by #1612
Assignees
Labels
Milestone

Comments

@klayoutmatthias
Copy link
Collaborator

For details see https://www.klayout.de/forum/discussion/2458/weird-parameter-dialog-resizing-when-hiding-showing-many-parameters-at-once-with-callback-impl#latest

Here is some sample PCell code:

import pya

class Discussion2458PCell(pya.PCellDeclarationHelper):

  description = ""

  def __init__(self, description):

    super(Discussion2458PCell, self).__init__()

    self.description = description

    self.param("a", self.TypeCallback, "AParam")
    self.param("b", self.TypeDouble, "BParam", default = 22)
    self.param("c", self.TypeBoolean, "CParam")
    self.param("d1", self.TypeBoolean, "D1Param")
    self.param("d2", self.TypeBoolean, "D2Param")
    self.param("d3", self.TypeBoolean, "D3Param")
    self.param("d4", self.TypeBoolean, "D4Param")
    self.param("d5", self.TypeBoolean, "D5Param")
    self.param("e", self.TypeBoolean, "EParam")

  def callback_impl(self, name):
    if name == "":
      self.a.tooltip = "Tool Tip for A"
      self.b.tooltip = "Tool Tip for B"
    if name == "" or name == "b":
      self.c.enabled = self.b.value >= 20.0
    if name == "" or name == "c":
      self.b.value += 1
      self.b.readonly = self.c.value
      self.b.icon = pya.PCellParameterState.ErrorIcon if self.c.value else pya.PCellParameterState.WarningIcon
      self.d1.visible = self.c.value
      self.d2.visible = self.c.value
      self.d3.visible = self.c.value
      self.d4.visible = self.c.value
      self.d5.visible = not self.c.value
    if name == "a":
      print("INFO: button pressed")
      
  def display_text_impl(self):
    return self.description
  
  def produce_impl(self):
    if self.b < 0:
      raise Exception("An error! b<0!")
    self.cell.shapes(self.layout.layer(1, 0)).insert(pya.DBox(0, 0, 1.0, 1.0))

class Discussion2458PCellLib(pya.Library):

  def __del__(self):
    print("INFO: del on "+repr(self))
    
  def __init__(self):
    self.description = "Discussion2458 PCell library"
    self.layout().register_pcell("PCell", Discussion2458PCell("description"))
    self.register("Discussion2458PCellLib")
    
Discussion2458PCellLib()

Problem exists if the "C" parameter gets enabled:

image

or disabled:

image

@klayoutmatthias klayoutmatthias self-assigned this Feb 4, 2024
@klayoutmatthias klayoutmatthias added this to the 0.28.16 milestone Feb 4, 2024
klayoutmatthias pushed a commit that referenced this issue Feb 4, 2024
Also fixed a problem with icons that did not get hidden when visibility was changed.
This fix needed some rework of the layout scheme of PCell parameter pages.
@klayoutmatthias klayoutmatthias linked a pull request Feb 4, 2024 that will close this issue
klayoutmatthias added a commit that referenced this issue Feb 11, 2024
Also fixed a problem with icons that did not get hidden when visibility was changed.
This fix needed some rework of the layout scheme of PCell parameter pages.

Co-authored-by: Matthias Koefferlein <[email protected]>
klayoutmatthias added a commit that referenced this issue Feb 11, 2024
Also fixed a problem with icons that did not get hidden when visibility was changed.
This fix needed some rework of the layout scheme of PCell parameter pages.

Co-authored-by: Matthias Koefferlein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant