initial commit
This commit is contained in:
commit
16e21939a9
3 changed files with 94 additions and 0 deletions
37
pymacros/change_layer.lym
Normal file
37
pymacros/change_layer.lym
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<klayout-macro>
|
||||
<description>add "Change Layer of Selection" to layer context menu</description>
|
||||
<version/>
|
||||
<category>pymacros</category>
|
||||
<prolog/>
|
||||
<epilog/>
|
||||
<doc/>
|
||||
<autorun>true</autorun>
|
||||
<autorun-early>false</autorun-early>
|
||||
<priority>5</priority>
|
||||
<shortcut/>
|
||||
<show-in-menu>false</show-in-menu>
|
||||
<group-name/>
|
||||
<menu-path>@lcp_context_menu.end</menu-path>
|
||||
<interpreter>python</interpreter>
|
||||
<dsl-interpreter-name/>
|
||||
<text>"""
|
||||
Add "Change Layer of Objects" to Layer context menu
|
||||
|
||||
Roughly follows method from https://www.klayout.de/forum/discussion/192/fill-klayout-dialogs-from-rba
|
||||
"""
|
||||
import pya
|
||||
|
||||
mw = pya.Application.instance().main_window()
|
||||
menu = mw.menu()
|
||||
|
||||
change_layer_action = menu.action('edit_menu.selection_menu.change_layer')
|
||||
change_layer_action.trigger
|
||||
|
||||
new_action = pya.Action()
|
||||
new_action.title = 'Change Layer of Objects'
|
||||
new_action.on_triggered = change_layer_action.trigger
|
||||
|
||||
menu.insert_separator('@lcp_context_menu.end', 'tb_separator')
|
||||
menu.insert_item('@lcp_context_menu.end', 'change_layer', new_action)</text>
|
||||
</klayout-macro>
|
||||
38
pymacros/set_all_valid.lym
Normal file
38
pymacros/set_all_valid.lym
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<klayout-macro>
|
||||
<description>add "Set All Valid" to layer context menu</description>
|
||||
<version/>
|
||||
<category>pymacros</category>
|
||||
<prolog/>
|
||||
<epilog/>
|
||||
<doc/>
|
||||
<autorun>true</autorun>
|
||||
<autorun-early>false</autorun-early>
|
||||
<priority>3</priority>
|
||||
<shortcut>Ctrl+Shift+V</shortcut>
|
||||
<show-in-menu>false</show-in-menu>
|
||||
<group-name/>
|
||||
<menu-path>@lcp_context_menu.end</menu-path>
|
||||
<interpreter>python</interpreter>
|
||||
<dsl-interpreter-name/>
|
||||
<text>"""
|
||||
Add "Change Layer of Objects" to Layer context menu
|
||||
"""
|
||||
import pya
|
||||
|
||||
|
||||
def set_all_valid():
|
||||
view = pya.LayoutView.current()
|
||||
for layer in view.each_layer():
|
||||
layer.valid = True
|
||||
layer.visible = True
|
||||
|
||||
mw = pya.Application.instance().main_window()
|
||||
menu = mw.menu()
|
||||
|
||||
new_action = pya.Action()
|
||||
new_action.title = 'Set All Valid'
|
||||
new_action.on_triggered = set_all_valid
|
||||
|
||||
menu.insert_item('@lcp_context_menu.invvalid', 'change_layer', new_action)</text>
|
||||
</klayout-macro>
|
||||
Loading…
Add table
Add a link
Reference in a new issue