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

I was trying out the new functionality of disabling / hiding parameters with callback_impl. (KLayout version 0.28.12)

In this demo example, turning 'Cover' to On will lead on more parameters to appear

It seems that the new parameters try to fit in the same available space as before, leading to a resizing on all the forms inside the dialog. In order to fix that, I have to manually trigger an update to the form, for example by clicking 'Show parameter names'.

Additionally, if I turn 'Cover' to 'Off' again, it seems that the available parameters expand to the new much bigger space available

I am using KLayout with pya and unfortunately I haven't figured out a way to call an update on the parameter page every time a parameter appears or disappears. Is there a workaround to this?

Thank you,
Stavros

Comments

  • Hi Stavros,

    what is the Qt version and OS you're using?

    And maybe you can share some sample code?

    Thanks,

    Matthias

  • Hi Matthias,

    Thank you for the reply, I am using Qt version 5.15.8, running on CentOS release 7.9.2009.

    Below is a sample PCell with a few params and a callback_impl implementation. The actual geometry implementation is not shown here, but it reads from a GDS produced externally based on the params.

    class MyDevice(pya.PCellDeclarationHelper):
    
    def __init__(self):
        super(MyDevice, self).__init__()
        self.define_params()
    
    
    def callback_impl(self, name):
        if self.Cover.value == "On":
            self.Cover_Type.visible = True
            self.Cover_Orientation.visible = True
            self.Cover_Layer.visible = True
            self.Cover_B_Layer.visible = True
            self.Cover_Edge_Extension.visible = True
            self.Cover_Width.visible = True
        else:
            self.Cover_Type.visible = False
            self.Cover_Orientation.visible = False
            self.Cover_Layer.visible = False
            self.Cover_B_Layer.visible = False
            self.Cover_Edge_Extension.visible = False
            self.Cover_Width.visible = False
    
    
    def define_params(self):
        self.param( 'Width',
            self.TypeDouble,
            "Width",
            default = 15.0,
            hidden = False
        )
    
        self.param( 'A_Length',
            self.TypeDouble,
            "A Length",
            default = 15.0,
            hidden = False
        )
    
        self.param( 'B_Length',
            self.TypeDouble,
            "B Length",
            default = 15.0,
            hidden = False
        )
    
        self.param( 'Cover',
            self.TypeList,
            "Cover",
            choices = [['On', 'On'], ['Off', 'Off']],
            default = 'Off',
            hidden = False
        )
    
        ...
    

    Thank you,
    Stavros

  • Hi @Stavros,

    thanks ... I can reproduce the problem now.

    I have created a ticket for this: https://github.com/KLayout/klayout/issues/1603

    Matthias

  • Hi @Matthias ,

    Thank you for your help! I will keep track on the ticket.

    Kind regards,
    Stavros

Sign In or Register to comment.