Add infix / basic operations from "top bar" to "bindable" functions in bindkey configuration list

This is a follow-up to a general post I made called "Move".

I have two prime interests here. One is to get the functions
I list, brought to where they can be key-bound and infix.

The other is to open up the menus to editing (add, subtract,
rearrange the hierarchy and display) - or perhaps this is
already editable and I just don't know how / where.

from previous post in other subforum:

I was trying to get a bindkey for "move" (ref point to dest point
by click) by the File>Setup, Customize Menu. What I find is in
the menus there is only "Move By" and "Move To", and both of
these want numeric entry, won't take mouse clicks.

Way down at the bottom of the Configure pane, are three odd
entries. The "duplicate_interactive" is what I'd want as a Copy
command in the traditional style (so I give it "C") and the
"sel_move_interactive" is what I want as a Move command
(so, "M").

Bonus, both of these work as infix mode (the selected object(s)
already know their "from" coords anyhow), so now I can copy and
move texts without having to accurately hit their minuscule
selectable extent (the little origin cross).

Question for Matthias - those three oddballs at the bottom,
appear to be three of the "Toolbar" icons' actions on direct
(not pulldown) click. Could the others (esp. Polygon, Box,
Text, Path, Instance, Partial) be added to that section so
I can bind them to keys that match my "brand C muscle
memory" instead of fighting it?

Or, is there a way for users to add key-bindings besides
what is offered initially in the Configure pane, and if so,
how to find out the proper names of "stuff we do in the
GUI" so that bindkeys could invoke? I think it could be
way handy, to be able to make a bindkey execute a
Python script or whatever. If I had one.

For that matter, "jailbreaking" the whole menu hierarchy?

I certainly see many things I never use, and would like to
make other "expressions" of the menus to reduce the
"number of layers" traversed to get to the desired command
(like, basic edit functions, I'd like to have at the top level
rather than buried under classes like Selection, etc.).
It would be cool to have key bindings and menus as
"user-modifiable" adjunct files, I think, for propagating
and preserving one's preferred environment.

Comments

  • Hi Jim,

    I can help at least with the tool bar bindings:

    Maybe you have noticed that all tool bar entries are replicated in the Edit/Mode submenu. Correspondingly, the "Polygon" toolbar entry for example can be keybound here:

    The same is true for the other "modes" from the tool bar.

    Regarding the customizable menu entries: It's basically possible to rearrange the menu entirely by script. Here is an example how to create a new "Transform" top level menu and move the "Flip Horizontally" item there:

    menu = pya.MainWindow.instance().menu()
    
    # insert a new menu after "Edit"
    menu.insert_menu("edit_menu+", "transform_menu", "Transform")
    
    # take the "Flip horizontally action"
    a = menu.action("edit_menu.selection_menu.sel_flip_x")
    
    # insert it into the new "Transform" menu
    menu.insert_item("transform_menu.end", "sel_flip_x", a)
    
    # and delete it from the original place
    menu.delete_item("edit_menu.selection_menu.sel_flip_x")
    

    If you want to go this way, the best strategy is to create a script which rearranges the menu and assigns the shortcuts you want to have. You can then install this script as an auto-run script to set up the user interface before KLayout starts.

    Best regards,

    Matthias

Sign In or Register to comment.