Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Execute script on technology change?

Dear KL-experts

Is it possible to execute some script, when the technology of current view changes?

What I am trying to make is addon for some specific technology. My addon has init script, that appends some icons to toolbar, hides some menu items, registers some event handlers in order to automatically group newely created layers, etc...

Now, this init script is set to run at KLayout start meaning that all changes I will do to KLayout interface are global. But I would like to make these changes only when user switches the technology in current view to one related to this addon and undo these changes, when the technology is switched to another one.

Is this possible or am I taking wrong approach?

Juras

Comments

  • Hi Juras,

    KLayout basically has built-in support for such an idea.

    If you put macros below the tech folder, macros put there will be associated with that technology and be shown only if the technology is the active one.

    The directory structure below the tech folder is replicated from the global macro folder structure. For example, I have a technology "ro" in my ~/.klayout/tech folder. The structure is:

    ~/.klayout/tech/
      ro/
        ro.lyt
        macros/
          test.lym
        pymacros/
          ... python macros go here
        ruby/
          ... ruby modules go here
        python/
          ... python modules go here
    

    Because dynamic loading of macros is difficult with the level of language integration that Ruby or Python provides, KLayout will always load these macros, regardless of whether their technology is active or not. But if macros are configured to show up in the menu, their menu entries will only be shown when their technology is active.

    Matthias

Sign In or Register to comment.