kigadgets.util

Utilities for interacting with the pcbnew GUI application

reload is the builtin reload, which comes from different places depending on python version. kireload is useful for on-the-fly updates to action plugin scripts without refreshing plugins.:

from kigadgets import kireload
def run(self):
    import action_script  # Only runs the first time during this instance of pcbnew, even if file changed
    kireload(action_script)  # Forces reimport, rerunning, and any updates to source

Module Contents

Functions

notify(*args)

Show text in a popup window while in the GUI.

query_user([prompt, default])

Simple GUI dialog asking for a single value.

get_app_frame()

Get a parent for action plugin dialogs.

in_GUI()

Attributes

wx

kireload

kigadgets.util.wx
kigadgets.util.kireload
kigadgets.util.notify(*args)

Show text in a popup window while in the GUI. Arguments act the same as print(*args). Not the best debugging tool ever created, but it is handy for debugging action plugins:

notify('Debug info:', 'x =', x)
kigadgets.util.query_user(prompt=None, default='')

Simple GUI dialog asking for a single value. Returns what was entered by the user as a string:

retstr = query_user('Enter a drill width in mm', 0.5)
if retstr is None:
    return
drill = float(retstr)
kigadgets.util.get_app_frame()

Get a parent for action plugin dialogs. Returns None if outside of GUI

kigadgets.util.in_GUI()