Skip to content
pcbnew.py_back 585 KiB
Newer Older
nats's avatar
nats committed

def FootprintDelete(lpath,name):
    plug = GetPluginForPath(lpath)
    plug.FootprintDelete(lpath,name)

def FootprintLibCreate(lpath):
    plug = GetPluginForPath(lpath)
    plug.FootprintLibCreate(lpath)

def FootprintLibDelete(lpath):
    plug = GetPluginForPath(lpath)
    plug.FootprintLibDelete(lpath)

def FootprintIsWritable(lpath):
    plug = GetPluginForPath(lpath)
    plug.FootprintLibIsWritable(lpath)

class PYTHON_FOOTPRINT_WIZARDS(_object):
    """Proxy of C++ PYTHON_FOOTPRINT_WIZARDS class"""
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, PYTHON_FOOTPRINT_WIZARDS, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, PYTHON_FOOTPRINT_WIZARDS, name)
    __repr__ = _swig_repr

    def register_wizard(wizard):
        """register_wizard(PyObject * wizard)"""
        return _pcbnew.PYTHON_FOOTPRINT_WIZARDS_register_wizard(wizard)

    if _newclass:
        register_wizard = staticmethod(register_wizard)
    __swig_getmethods__["register_wizard"] = lambda x: register_wizard

    def deregister_wizard(wizard):
        """deregister_wizard(PyObject * wizard)"""
        return _pcbnew.PYTHON_FOOTPRINT_WIZARDS_deregister_wizard(wizard)

    if _newclass:
        deregister_wizard = staticmethod(deregister_wizard)
    __swig_getmethods__["deregister_wizard"] = lambda x: deregister_wizard

    def __init__(self):
        """__init__(PYTHON_FOOTPRINT_WIZARDS self) -> PYTHON_FOOTPRINT_WIZARDS"""
        this = _pcbnew.new_PYTHON_FOOTPRINT_WIZARDS()
        try:
            self.this.append(this)
        except:
            self.this = this
    __swig_destroy__ = _pcbnew.delete_PYTHON_FOOTPRINT_WIZARDS
    __del__ = lambda self: None
PYTHON_FOOTPRINT_WIZARDS_swigregister = _pcbnew.PYTHON_FOOTPRINT_WIZARDS_swigregister
PYTHON_FOOTPRINT_WIZARDS_swigregister(PYTHON_FOOTPRINT_WIZARDS)

def PYTHON_FOOTPRINT_WIZARDS_register_wizard(wizard):
    """PYTHON_FOOTPRINT_WIZARDS_register_wizard(PyObject * wizard)"""
    return _pcbnew.PYTHON_FOOTPRINT_WIZARDS_register_wizard(wizard)

def PYTHON_FOOTPRINT_WIZARDS_deregister_wizard(wizard):
    """PYTHON_FOOTPRINT_WIZARDS_deregister_wizard(PyObject * wizard)"""
    return _pcbnew.PYTHON_FOOTPRINT_WIZARDS_deregister_wizard(wizard)


def ToMM(iu):
   if type(iu) in [int,float]:
      return float(iu) / float(1e6)
   elif type(iu) in [wxPoint,wxSize]:
      return tuple(map(ToMM,iu))

def FromMM(mm):
   if type(mm) in [int,float]:
      return int(float(mm) * float(1e6))
   elif type(mm) in [wxPoint,wxSize]:
     return tuple(map(FromMM,mm))

def ToMils(iu):
   if type(iu) in [int,float]:
     return float(iu) / float((1e6 * 0.0254))
   elif type(iu) in [wxPoint,wxSize]:
     return tuple(map(ToMils,iu))

def FromMils(mils):
   if type(mils) in [int,float]:
      return int(float(mils)*float((1e6 * 0.0254)))
   elif type(mils) in [wxPoint,wxSize]:
     return tuple(map(FromMils,mils))

def wxSizeMM(mmx,mmy): return wxSize(FromMM(mmx),FromMM(mmy))
def wxSizeMils(mmx,mmy): return wxSize(FromMils(mmx),FromMils(mmy))

def wxPointMM(mmx,mmy): return wxPoint(FromMM(mmx),FromMM(mmy))
def wxPointMils(mmx,mmy): return wxPoint(FromMils(mmx),FromMils(mmy))

def wxRectMM(x,y,wx,wy):
     x = int(FromMM(x))
     y = int(FromMM(y))
     wx = int(FromMM(wx))
     wy = int (FromMM(wy))
     return wxRect(x,y,wx,wy)

def wxRectMils(x,y,wx,wy):
     x = int(FromMils(x))
     y = int(FromMils(y))
     wx = int(FromMils(wx))
     wy = int (FromMils(wy))
     return wxRect(x,y,wx,wy)


# This file is compatible with both classic and new-style classes.