Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Updating Older Wizards

Oliver edited this page Sep 26, 2016 · 5 revisions

Older wizards that subclass HelpfulFootprintWizardPlugin will need some slight adjustments to work with the upgraded wizard scripting interface.

Fix import and subclass

A slightly different import process is required.

import HelpfulFootprinWizardPlugin

class MyWizard(HelpfulFootprinWizardPlugin.HelpfulFootprinWizardPlugin):
    # code goes here

becomes

import FootprintWizardBase

class MyWizard(FootprintWizardBase.FootprintWizard):
    # code still goes here

Updated Parameter Units

New parameter types have been defined, and some have been removed.

+ uFloat
+ uInteger*
+ uRadians
+ uDegrees
+ uPercent

- uNatural*

*uInteger replaces uNatural

Remove * Symbols from Parameter Names

The * symbol is no longer used to differentiate between different types of parameters (this is handled by the new units property). Parameters which were referenced in older scripts with a leading * symbol will need to have this symbol expunged.

Example

pads_per_row = pads["*n"] // 4

becomes

pads_per_row = pads["n"] // 4

Update CheckParameters Function

The CheckParameters() function should no longer contain code for validating a single parameter. The functions CheckParamInt and CheckParamBool are no longer supported. Instead, these checks are performed automatically for each parameter, if limits (etc) are specified for that parameter.

Old Code

def GenerateParameterList(self):
    self.AddParam("Pads", "n", self.uNatural, 100)
    ...
    self.AddParam("Pads", "oval", self.uBool, True)

def CheckParameters(self):
    self.CheckParamInt("Pads", "n", is_multiple_of=4)
    self.CheckParamBool("Pads", "*oval")

New Code

def GenerateParameterList(self):
    self.AddParam("Pads", "n", self.uInteger, 100, multiple=4)
    self.AddParam("Pads", "oval", self.uBool, True)

def CheckParameters(self):
    pass # All checks are already taken care of!

The CheckParameters() function is sill provided to allow one parameter to be checked against another.

Update Grid Functions

The PutOnGridMM and PutOnGridMils functions have been moved to pcbnew.py. Thus:

self.PutOnGridMM(dim, grid_size)

becomes

pcbnew.PutOnGridMM(dim, grid_size)