KiCAD pcbnew scripting
Public Member Functions | List of all members
pcbnew.PLUGIN Class Reference
Inheritance diagram for pcbnew.PLUGIN:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, args, kwargs)
 
def PluginName (self)
 
def GetFileExtension (self)
 
def Load
 
def Save
 
def FootprintEnumerate
 
def PrefetchLib
 
def FootprintLoad
 
def FootprintSave
 
def FootprintDelete
 
def FootprintLibCreate
 
def FootprintLibDelete
 
def IsFootprintLibWritable (self, aLibraryPath)
 
def FootprintLibOptions (self, aListToAppendTo)
 
def footprintPyEnumerate (self, aLibraryPath, aExitOnError)
 
def FootprintEnumerate (self, libname)
 

Detailed Description

Class PLUGIN is a base class that BOARD loading and saving plugins
should derive from.

Implementations can provide either Load() or Save() functions, or
both. PLUGINs throw exceptions, so it is best that you wrap your calls
to these functions in a try catch block. Plugins throw exceptions
because it is illegal for them to have any user interface calls in
them whatsoever, i.e. no windowing or screen printing at all.

try   { IO_MGR::Load(...);   or IO_MGR::Save(...);   }   catch( const
IO_ERROR& ioe )   {        // grab text from ioe, show in error
window.   }

C++ includes: io_mgr.h 

Definition at line 8521 of file pcbnew.py.

Constructor & Destructor Documentation

def pcbnew.PLUGIN.__init__ (   self,
  args,
  kwargs 
)

Definition at line 8545 of file pcbnew.py.

Member Function Documentation

def pcbnew.PLUGIN.FootprintDelete (   self,
  aLibraryPath,
  aFootprintName,
  aProperties = None 
)
FootprintDelete(PLUGIN self, wxString aLibraryPath, wxString aFootprintName, PROPERTIES const * aProperties=None)
FootprintDelete(PLUGIN self, wxString aLibraryPath, wxString aFootprintName)

void
PLUGIN::FootprintDelete(const wxString &aLibraryPath, const wxString
&aFootprintName, const PROPERTIES *aProperties=NULL)

Function FootprintDelete deletes aFootprintName from the library at
aLibraryPath.

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory,
file, or URL containing several footprints.

aFootprintName:  is the name of a footprint to delete from the
specified library.

aProperties:  is an associative array that can be used to tell the
library delete function anything special, because it can take any
number of additional named tuning arguments that the plugin is known
to support. The caller continues to own this object (plugin may not
delete it), and plugins should expect it to be optionally NULL.

Parameters:
-----------

???:  if there is a problem finding the footprint or the library, or
deleting it. 

Definition at line 8804 of file pcbnew.py.

def pcbnew.PLUGIN.FootprintEnumerate (   self,
  aFootprintNames,
  aLibraryPath,
  aProperties = None 
)
FootprintEnumerate(PLUGIN self, wxArrayString & aFootprintNames, wxString aLibraryPath, PROPERTIES const * aProperties=None)
FootprintEnumerate(PLUGIN self, wxArrayString & aFootprintNames, wxString aLibraryPath)

void
PLUGIN::FootprintEnumerate(wxArrayString &aFootprintNames, const
wxString &aLibraryPath, const PROPERTIES *aProperties=NULL)

Return a list of footprint names contained within the library at
aLibraryPath.

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory,
file, or URL containing several footprints.

aProperties:  is an associative array that can be used to tell the
plugin anything needed about how to perform with respect to
aLibraryPath. The caller continues to own this object (plugin may not
delete it), and plugins should expect it to be optionally NULL.

aFootprintNames:  is the array of available footprint names inside a
library.

Parameters:
-----------

???:  if the library cannot be found, or footprint cannot be loaded.

Definition at line 8656 of file pcbnew.py.

def pcbnew.PLUGIN.FootprintEnumerate (   self,
  libname 
)

Definition at line 8980 of file pcbnew.py.

def pcbnew.PLUGIN.FootprintLibCreate (   self,
  aLibraryPath,
  aProperties = None 
)
FootprintLibCreate(PLUGIN self, wxString aLibraryPath, PROPERTIES const * aProperties=None)
FootprintLibCreate(PLUGIN self, wxString aLibraryPath)

void
PLUGIN::FootprintLibCreate(const wxString &aLibraryPath, const
PROPERTIES *aProperties=NULL)

Function FootprintLibCreate creates a new empty footprint library at
aLibraryPath empty.

It is an error to attempt to create an existing library or to attempt
to create on a "read only" location.

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory,
file, or URL containing several footprints.

aProperties:  is an associative array that can be used to tell the
library create function anything special, because it can take any
number of additional named tuning arguments that the plugin is known
to support. The caller continues to own this object (plugin may not
delete it), and plugins should expect it to be optionally NULL.

Parameters:
-----------

???:  if there is a problem finding the library, or creating it. 

Definition at line 8840 of file pcbnew.py.

def pcbnew.PLUGIN.FootprintLibDelete (   self,
  aLibraryPath,
  aProperties = None 
)
FootprintLibDelete(PLUGIN self, wxString aLibraryPath, PROPERTIES const * aProperties=None) -> bool
FootprintLibDelete(PLUGIN self, wxString aLibraryPath) -> bool

bool
PLUGIN::FootprintLibDelete(const wxString &aLibraryPath, const
PROPERTIES *aProperties=NULL)

Function FootprintLibDelete deletes an existing footprint library and
returns true, or if library does not exist returns false, or throws an
exception if library exists but is read only or cannot be deleted for
some other reason.

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory
or file which will contain footprints.

aProperties:  is an associative array that can be used to tell the
library delete implementation function anything special, because it
can take any number of additional named tuning arguments that the
plugin is known to support. The caller continues to own this object
(plugin may not delete it), and plugins should expect it to be
optionally NULL.

bool - true if library deleted, false if library did not exist.

Parameters:
-----------

???:  if there is a problem deleting an existing library. 

Definition at line 8875 of file pcbnew.py.

def pcbnew.PLUGIN.FootprintLibOptions (   self,
  aListToAppendTo 
)
FootprintLibOptions(PLUGIN self, PROPERTIES * aListToAppendTo)

void
PLUGIN::FootprintLibOptions(PROPERTIES *aListToAppendTo) const

Function FootprintLibOptions appends supported PLUGIN options to
aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived PLUGIN can call its
base class function by the same name first, thus inheriting options
declared there. (Some base class options could pertain to all
Footprint*() functions in all derived PLUGINs.) Note that since
aListToAppendTo is a PROPERTIES object, all options will be unique and
last guy wins.

Parameters:
-----------

aListToAppendTo:  holds a tuple ofoption This eventually is what shows
up into the fp-lib-table "options" field, possibly combined with
others. internationalized description The internationalized
description is displayed in DIALOG_FP_PLUGIN_OPTIONS. It may be multi-
line and be quite explanatory of the option.   In the future perhaps
aListToAppendTo evolves to something capable of also holding a
wxValidator for the cells in said
dialog:http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180.
This would require a 3 column list, and introducing wx GUI knowledge
to PLUGIN, which has been avoided to date. 

Definition at line 8939 of file pcbnew.py.

def pcbnew.PLUGIN.FootprintLoad (   self,
  aLibraryPath,
  aFootprintName,
  aProperties = None 
)
FootprintLoad(PLUGIN self, wxString aLibraryPath, wxString aFootprintName, PROPERTIES const * aProperties=None) -> MODULE
FootprintLoad(PLUGIN self, wxString aLibraryPath, wxString aFootprintName) -> MODULE

MODULE *
PLUGIN::FootprintLoad(const wxString &aLibraryPath, const wxString
&aFootprintName, const PROPERTIES *aProperties=NULL)

Function FootprintLoad loads a footprint having aFootprintName from
the aLibraryPath containing a library format that this PLUGIN knows
about.

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory,
file, or URL containing several footprints.

aFootprintName:  is the name of the footprint to load.

aProperties:  is an associative array that can be used to tell the
loader implementation to do something special, because it can take any
number of additional named tuning arguments that the plugin is known
to support. The caller continues to own this object (plugin may not
delete it), and plugins should expect it to be optionally NULL.

MODULE* - if found caller owns it, else NULL if not found.

Parameters:
-----------

???:  if the library cannot be found or read. No exception is thrown
in the case where aFootprintName cannot be found. 

Definition at line 8729 of file pcbnew.py.

def pcbnew.PLUGIN.footprintPyEnumerate (   self,
  aLibraryPath,
  aExitOnError 
)
footprintPyEnumerate(PLUGIN self, wxString aLibraryPath, bool aExitOnError) -> wxArrayString

Definition at line 8975 of file pcbnew.py.

def pcbnew.PLUGIN.FootprintSave (   self,
  aLibraryPath,
  aFootprint,
  aProperties = None 
)
FootprintSave(PLUGIN self, wxString aLibraryPath, MODULE aFootprint, PROPERTIES const * aProperties=None)
FootprintSave(PLUGIN self, wxString aLibraryPath, MODULE aFootprint)

void
PLUGIN::FootprintSave(const wxString &aLibraryPath, const MODULE
*aFootprint, const PROPERTIES *aProperties=NULL)

Function FootprintSave will write aModule to an existing library
located at aLibraryPath.

If a footprint by the same name already exists, it is replaced.

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory,
file, or URL containing several footprints.

aFootprint:  is what to store in the library. The caller continues to
own the footprint after this call.

aProperties:  is an associative array that can be used to tell the
saver how to save the footprint, because it can take any number of
additional named tuning arguments that the plugin is known to support.
The caller continues to own this object (plugin may not delete it),
and plugins should expect it to be optionally NULL.

Parameters:
-----------

???:  if there is a problem saving. 

Definition at line 8767 of file pcbnew.py.

def pcbnew.PLUGIN.GetFileExtension (   self)
GetFileExtension(PLUGIN self) -> wxString

virtual const
wxString PLUGIN::GetFileExtension() const =0

Function GetFileExtension returns the file extension for the PLUGIN.

Definition at line 8562 of file pcbnew.py.

def pcbnew.PLUGIN.IsFootprintLibWritable (   self,
  aLibraryPath 
)
IsFootprintLibWritable(PLUGIN self, wxString aLibraryPath) -> bool

bool
PLUGIN::IsFootprintLibWritable(const wxString &aLibraryPath)

Function IsFootprintLibWritable returns true iff the library at
aLibraryPath is writable.

(Often system libraries are read only because of where they are
installed.)

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory,
file, or URL containing several footprints.

Parameters:
-----------

???:  if no library at aLibraryPath exists. 

Definition at line 8912 of file pcbnew.py.

def pcbnew.PLUGIN.Load (   self,
  aFileName,
  aAppendToMe,
  aProperties = None 
)
Load(PLUGIN self, wxString aFileName, BOARD aAppendToMe, PROPERTIES const * aProperties=None) -> BOARD
Load(PLUGIN self, wxString aFileName, BOARD aAppendToMe) -> BOARD

BOARD * PLUGIN::Load(const
wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES
*aProperties=NULL)

Function Load loads information from some input file format that this
PLUGIN implementation knows about, into either a new BOARD or an
existing one.

This may be used to load an entire new BOARD, or to augment an
existing one if aAppendToMe is not NULL.

Parameters:
-----------

aFileName:  is the name of the file to use as input and may be foreign
in nature or native in nature.

aAppendToMe:  is an existing BOARD to append to, but if NULL then this
means "do not append, rather load anew".

aProperties:  is an associative array that can be used to tell the
loader how to load the file, because it can take any number of
additional named arguments that the plugin is known to support. These
are tuning parameters for the import or load. The caller continues to
own this object (plugin may not delete it), and plugins should expect
it to be optionally NULL.

BOARD* - the successfully loaded board, or the same one as aAppendToMe
if aAppendToMe was not NULL, and caller owns it.

Parameters:
-----------

???:  if there is a problem loading, and its contents should say what
went wrong, using line number and character offsets of the input file
if possible. 

Definition at line 8575 of file pcbnew.py.

def pcbnew.PLUGIN.PluginName (   self)
PluginName(PLUGIN self) -> wxString

virtual const wxString
PLUGIN::PluginName() const =0

Function PluginName returns a brief hard coded name for this PLUGIN.

Definition at line 8549 of file pcbnew.py.

def pcbnew.PLUGIN.PrefetchLib (   self,
  aLibraryPath,
  aProperties = None 
)
PrefetchLib(PLUGIN self, wxString aLibraryPath, PROPERTIES const * aProperties=None)
PrefetchLib(PLUGIN self, wxString aLibraryPath)

void
PLUGIN::PrefetchLib(const wxString &aLibraryPath, const PROPERTIES
*aProperties=NULL)

Function PrefetchLib If possible, prefetches the specified library
(e.g.

performing downloads). Does not parse. Threadsafe.

This is a no-op for libraries that cannot be prefetched.

Plugins that cannot prefetch need not override this; a default no-op
is provided.

Parameters:
-----------

aLibraryPath:  is a locator for the "library", usually a directory,
file, or URL containing several footprints.

aProperties:  is an associative array that can be used to tell the
plugin anything needed about how to perform with respect to
aLibraryPath. The caller continues to own this object (plugin may not
delete it), and plugins should expect it to be optionally NULL.

Parameters:
-----------

???:  if there is an error prefetching the library. 

Definition at line 8691 of file pcbnew.py.

def pcbnew.PLUGIN.Save (   self,
  aFileName,
  aBoard,
  aProperties = None 
)
Save(PLUGIN self, wxString aFileName, BOARD aBoard, PROPERTIES const * aProperties=None)
Save(PLUGIN self, wxString aFileName, BOARD aBoard)

void PLUGIN::Save(const wxString
&aFileName, BOARD *aBoard, const PROPERTIES *aProperties=NULL)

Function Save will write aBoard to a storage file in a format that
this PLUGIN implementation knows about, or it can be used to write a
portion of aBoard to a special kind of export file.

Parameters:
-----------

aFileName:  is the name of a file to save to on disk.

aBoard:  is the class BOARD in memory document tree from which to
extract information when writing to aFileName. The caller continues to
own the BOARD, and the plugin should refrain from modifying the BOARD
if possible.

aProperties:  is an associative array that can be used to tell the
saver how to save the file, because it can take any number of
additional named tuning arguments that the plugin is known to support.
The caller continues to own this object (plugin may not delete it),
and plugins should expect it to be optionally NULL.

Parameters:
-----------

???:  if there is a problem saving or exporting. 

Definition at line 8620 of file pcbnew.py.


The documentation for this class was generated from the following file: