Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
974fe74f
Commit
974fe74f
authored
Jul 06, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup toward test-merge
parent
08af5772
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
111 additions
and
58 deletions
+111
-58
class_footprint_wizard.cpp
pcbnew/class_footprint_wizard.cpp
+12
-7
class_footprint_wizard.h
pcbnew/class_footprint_wizard.h
+3
-1
footprint_wizard_frame.h
pcbnew/footprint_wizard_frame.h
+35
-14
dlist.i
scripting/dlist.i
+5
-4
fixswigimports.py
scripting/fixswigimports.py
+5
-2
kicad.i
scripting/kicad.i
+11
-12
kicadplugins.i
scripting/kicadplugins.i
+32
-16
wx.i
scripting/wx.i
+8
-2
No files found.
pcbnew/class_footprint_wizard.cpp
View file @
974fe74f
...
@@ -8,26 +8,31 @@
...
@@ -8,26 +8,31 @@
void
FOOTPRINT_WIZARD
::
register_wizard
()
void
FOOTPRINT_WIZARD
::
register_wizard
()
{
{
FOOTPRINT_WIZARDS
::
register_wizard
(
this
);
FOOTPRINT_WIZARDS
::
register_wizard
(
this
);
}
}
/**
* FOOTPRINT_WIZARD system wide static list
*/
std
::
vector
<
FOOTPRINT_WIZARD
*>
FOOTPRINT_WIZARDS
::
m_FootprintWizards
;
std
::
vector
<
FOOTPRINT_WIZARD
*>
FOOTPRINT_WIZARDS
::
m_FootprintWizards
;
FOOTPRINT_WIZARD
*
FOOTPRINT_WIZARDS
::
GetWizard
(
int
aIndex
)
FOOTPRINT_WIZARD
*
FOOTPRINT_WIZARDS
::
GetWizard
(
int
aIndex
)
{
{
return
m_FootprintWizards
[
aIndex
];
return
m_FootprintWizards
[
aIndex
];
}
}
FOOTPRINT_WIZARD
*
FOOTPRINT_WIZARDS
::
GetWizard
(
wxString
aName
)
FOOTPRINT_WIZARD
*
FOOTPRINT_WIZARDS
::
GetWizard
(
wxString
aName
)
{
{
int
max
=
GetSize
();
int
max
=
GetSize
();
for
(
int
i
=
0
;
i
<
max
;
i
++
)
for
(
int
i
=
0
;
i
<
max
;
i
++
)
{
{
FOOTPRINT_WIZARD
*
wizard
=
GetWizard
(
i
);
FOOTPRINT_WIZARD
*
wizard
=
GetWizard
(
i
);
wxString
name
=
wizard
->
GetName
();
wxString
name
=
wizard
->
GetName
();
if
(
name
.
Cmp
(
aName
))
if
(
name
.
Cmp
(
aName
)
)
return
wizard
;
return
wizard
;
}
}
...
@@ -45,7 +50,7 @@ void FOOTPRINT_WIZARDS::register_wizard(FOOTPRINT_WIZARD *aWizard)
...
@@ -45,7 +50,7 @@ void FOOTPRINT_WIZARDS::register_wizard(FOOTPRINT_WIZARD *aWizard)
wxString
name
=
aWizard
->
GetName
();
wxString
name
=
aWizard
->
GetName
();
m_FootprintWizards
.
push_back
(
aWizard
);
m_FootprintWizards
.
push_back
(
aWizard
);
printf
(
"Registered footprint wizard '%s'
\n
"
,(
const
char
*
)
name
.
mb_str
()
);
//
printf("Registered footprint wizard '%s'\n",(const char*)name.mb_str() );
}
}
...
...
pcbnew/class_footprint_wizard.h
View file @
974fe74f
...
@@ -8,7 +8,9 @@
...
@@ -8,7 +8,9 @@
#include <vector>
#include <vector>
#include <wxPcbStruct.h>
#include <wxPcbStruct.h>
/* This is the parent class from where any footprint wiizard class must
/**
* Class FOOTPRINT_WIZARD
* This is the parent class from where any footprint wizard class must
* derive */
* derive */
class
FOOTPRINT_WIZARD
class
FOOTPRINT_WIZARD
{
{
...
...
pcbnew/footprint_wizard_frame.h
View file @
974fe74f
...
@@ -46,19 +46,19 @@ class wxGridEvent;
...
@@ -46,19 +46,19 @@ class wxGridEvent;
class
FOOTPRINT_WIZARD_FRAME
:
public
PCB_BASE_FRAME
class
FOOTPRINT_WIZARD_FRAME
:
public
PCB_BASE_FRAME
{
{
private
:
private
:
// List of libraries (for selection )
wxSashLayoutWindow
*
m_PageListWindow
;
wxListBox
*
m_PageList
;
// The list of pages
wxSize
m_PageListSize
;
// size of the window
// List of components in the selected library
wxSashLayoutWindow
*
m_PageListWindow
;
//< List of libraries (for selection )
wxSashLayoutWindow
*
m_ParameterGridWindow
;
wxListBox
*
m_PageList
;
//< The list of pages
wxGrid
*
m_ParameterGrid
;
// The list of parameters
wxSize
m_PageListSize
;
//< size of the window
wxSize
m_ParameterGridSize
;
// size of the window
wxSashLayoutWindow
*
m_ParameterGridWindow
;
//< List of components in the selected library
wxGrid
*
m_ParameterGrid
;
//< The list of parameters
wxSize
m_ParameterGridSize
;
//< size of the window
// Flags
// Flags
wxSemaphore
*
m_Semaphore
;
// != NULL if the frame must emulate a modal dialog
wxSemaphore
*
m_Semaphore
;
//
<
!= NULL if the frame must emulate a modal dialog
wxString
m_configPath
;
// subpath for configuration
wxString
m_configPath
;
//
<
subpath for configuration
FOOTPRINT_WIZARD
*
m_FootprintWizard
;
FOOTPRINT_WIZARD
*
m_FootprintWizard
;
...
@@ -86,19 +86,40 @@ private:
...
@@ -86,19 +86,40 @@ private:
void
OnSashDrag
(
wxSashEvent
&
event
);
void
OnSashDrag
(
wxSashEvent
&
event
);
/**
/**
* Function ReCreateLibraryList
* Function ReCreatePageList
*
* Creates or recreates the list of parameter pages for the current wizard.
* Creates or recreates the list of current loaded libraries.
* This list is sorted
* This list is sorted, with the library cache always at end of the list
*/
*/
void
ReCreatePageList
();
void
ReCreatePageList
();
/**
* Function ReCreateParameterList
* Creates the list of parameters for the current page
*/
void
ReCreateParameterList
();
void
ReCreateParameterList
();
/**
* Function SelectFootprintWizard
* Shows the list of footprint wizards available into the system
*/
void
SelectFootprintWizard
();
void
SelectFootprintWizard
();
/**
* Function ReloadFootprint
* Reloads the current footprint
*/
void
ReloadFootprint
();
void
ReloadFootprint
();
void
Process_Special_Functions
(
wxCommandEvent
&
event
);
void
Process_Special_Functions
(
wxCommandEvent
&
event
);
/**
* Function DisplayWizardInfos
* Shows all the details about the current wizard
*/
void
DisplayWizardInfos
();
void
DisplayWizardInfos
();
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
);
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
);
void
OnCloseWindow
(
wxCloseEvent
&
Event
);
void
OnCloseWindow
(
wxCloseEvent
&
Event
);
void
ReCreateHToolbar
();
void
ReCreateHToolbar
();
...
...
scripting/dlist.i
View file @
974fe74f
...
@@ -6,9 +6,9 @@
...
@@ -6,9 +6,9 @@
{
{
class DLISTIter:
class DLISTIter:
def __init__(self,aList):
def __init__(self,aList):
self.last = aList
self.last = aList
# last item is the start of list
def next(self):
def next(self):
# get the next item
item = self.last
item = self.last
try:
try:
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
except:
except:
pass
pass
if item is None:
if item is None:
# if the item is None, then finish the iteration
raise StopIteration
raise StopIteration
else:
else:
ret = None
ret = None
...
@@ -25,11 +25,12 @@
...
@@ -25,11 +25,12 @@
try:
try:
ret = self.last.Get()
ret = self.last.Get()
except:
except:
ret = self.last #
next items just
not..
ret = self.last #
next items do
not..
self.last = self.last.Next()
self.last = self.last.Next()
# when the iterated object can be casted down in inheritance, just do it..
# when the iterated object can be casted down in inheritance, just do it..
if 'Cast' in dir(ret):
if 'Cast' in dir(ret):
ret = ret.Cast()
ret = ret.Cast()
...
...
scripting/fixswigimports.py
View file @
974fe74f
...
@@ -27,7 +27,6 @@ f = open(filename,"rb")
...
@@ -27,7 +27,6 @@ f = open(filename,"rb")
lines
=
f
.
readlines
()
lines
=
f
.
readlines
()
f
.
close
()
f
.
close
()
f
=
open
(
filename
,
"wb"
)
doneOk
=
False
doneOk
=
False
...
@@ -35,14 +34,18 @@ if (len(lines)<4000):
...
@@ -35,14 +34,18 @@ if (len(lines)<4000):
print
"still building"
print
"still building"
exit
(
0
)
exit
(
0
)
txt
=
""
for
l
in
lines
:
for
l
in
lines
:
if
l
.
startswith
(
"if version_info >= (2,6,0):"
):
if
l
.
startswith
(
"if version_info >= (2,6,0):"
):
l
=
l
.
replace
(
"version_info >= (2,6,0)"
,
"False"
)
l
=
l
.
replace
(
"version_info >= (2,6,0)"
,
"False"
)
doneOk
=
True
doneOk
=
True
elif
l
.
startswith
(
"if False:"
):
# it was already patched?
elif
l
.
startswith
(
"if False:"
):
# it was already patched?
doneOk
=
True
doneOk
=
True
f
.
write
(
l
)
txt
=
txt
+
l
f
=
open
(
filename
,
"wb"
)
f
.
write
(
txt
)
f
.
close
()
f
.
close
()
if
doneOk
:
if
doneOk
:
...
...
scripting/kicad.i
View file @
974fe74f
...
@@ -27,14 +27,8 @@
...
@@ -27,14 +27,8 @@
* @brief General wrappers for kicad / wx structures and classes
* @brief General wrappers for kicad / wx structures and classes
*/
*/
%include <std_vector.i>
/* OFF NOW, it triggers an error with GCC 4.6 and swig-2.0.4 or trunk..
%include <std_string.i>
http://sourceforge.net/tracker/index.php?func=detail&aid=3391906&group_id=1645&atid=101645
*/
%include <std_vector.i>
%include <std_string.i>
/* ignore some constructors of EDA_ITEM that will make the build fail */
/* ignore some constructors of EDA_ITEM that will make the build fail */
...
@@ -44,11 +38,12 @@
...
@@ -44,11 +38,12 @@
%ignore EDA_ITEM::EDA_ITEM( const EDA_ITEM& base );
%ignore EDA_ITEM::EDA_ITEM( const EDA_ITEM& base );
/* swig tries to wrap SetBack/SetNext on derived classes, but this method is
/* swig tries to wrap SetBack/SetNext on derived classes, but this method is
private for most childs, so if we don't ignore it
it
won't compile */
private for most childs, so if we don't ignore it won't compile */
%ignore EDA_ITEM::SetBack;
%ignore EDA_ITEM::SetBack;
%ignore EDA_ITEM::SetNext;
%ignore EDA_ITEM::SetNext;
/* ignore other functions that cause trouble */
%ignore InitKiCadAbout;
%ignore InitKiCadAbout;
%ignore GetCommandOptions;
%ignore GetCommandOptions;
...
@@ -57,6 +52,7 @@
...
@@ -57,6 +52,7 @@
%ignore operator <<;
%ignore operator <<;
%ignore operator=;
%ignore operator=;
/* headers/imports that must be included in the _wrapper.cpp at top */
%{
%{
#include <cstddef>
#include <cstddef>
...
@@ -95,6 +91,7 @@
...
@@ -95,6 +91,7 @@
}
}
*/
*/
/* header files that must be wrapped */
%include <dlist.h>
%include <dlist.h>
%include <base_struct.h>
%include <base_struct.h>
...
@@ -104,10 +101,12 @@
...
@@ -104,10 +101,12 @@
%include <class_marker_base.h>
%include <class_marker_base.h>
%include <eda_text.h>
%include <eda_text.h>
/* special iteration wrapper for DLIST objects */
%include "dlist.i"
%include "dlist.i"
/* std template mappings */
/* std template mappings */
%template(intVector) std::vector<int>;
%template(intVector) std::vector<int>;
/* KiCad plugin handling */
%include "kicadplugins.i"
%include "kicadplugins.i"
scripting/kicadplugins.i
View file @
974fe74f
...
@@ -22,9 +22,41 @@
...
@@ -22,9 +22,41 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
*/
/**
* This file builds the base classes for all kind of python plugins that
* can be included into kicad.
* they provide generic code to all the classes:
*
* KiCadPlugin
* /|\
* |
* |\-FilePlugin
* |\-FootprintWizardPlugin
* |\-ActionPlugin
*
* It defines the LoadPlugins() function that loads all the plugins
* available in the system
*
*/
%pythoncode
%pythoncode
{
{
def LoadPlugins():
import os
import sys
plugins_dir = os.environ['HOME']+'/.kicad_plugins/'
sys.path.append(plugins_dir)
for module in os.listdir(plugins_dir):
if os.path.isdir(plugins_dir+module):
__import__(module, locals(), globals())
if module == '__init__.py' or module[-3:] != '.py':
continue
__import__(module[:-3], locals(), globals())
# KiCadPlugin base class will register any plugin into the right place
# KiCadPlugin base class will register any plugin into the right place
class KiCadPlugin:
class KiCadPlugin:
...
@@ -159,21 +191,5 @@ class ActionPlugin(KiCadPlugin):
...
@@ -159,21 +191,5 @@ class ActionPlugin(KiCadPlugin):
KiCadPlugin.__init__(self)
KiCadPlugin.__init__(self)
def LoadPlugins():
import os
import sys
plugins_dir = os.environ['HOME']+'/.kicad_plugins/'
sys.path.append(plugins_dir)
for module in os.listdir(plugins_dir):
if os.path.isdir(plugins_dir+module):
__import__(module, locals(), globals())
if module == '__init__.py' or module[-3:] != '.py':
continue
__import__(module[:-3], locals(), globals())
}
}
scripting/wx.i
View file @
974fe74f
...
@@ -25,6 +25,9 @@
...
@@ -25,6 +25,9 @@
/**
/**
* @file wx.i
* @file wx.i
* @brief wx wrappers for basic things, wxString, wxPoint, wxRect, etc..
* @brief wx wrappers for basic things, wxString, wxPoint, wxRect, etc..
* all the wx objects are very complex, and we don't want to pull
* and swig all depending objects, so we just define the methods
* we want to wrap.
*/
*/
%{
%{
...
@@ -68,6 +71,7 @@ public:
...
@@ -68,6 +71,7 @@ public:
%extend
%extend
{
{
/* extend the wxRect object so it can be converted into a tuple */
PyObject* Get()
PyObject* Get()
{
{
PyObject* res = PyTuple_New(4);
PyObject* res = PyTuple_New(4);
...
@@ -191,7 +195,9 @@ public:
...
@@ -191,7 +195,9 @@ public:
};
};
// wxChar wrappers ///////////////////////////////////////////////////////////
// wxChar typemaps ///////////////////////////////////////////////////////////
/* they handle the conversion from/to strings */
%typemap(in) wxChar { wxString str = Py2wxString($input); $1 = str[0]; }
%typemap(in) wxChar { wxString str = Py2wxString($input); $1 = str[0]; }
%typemap(out) wxChar { wxString str($1); $result = wx2PyString(str); }
%typemap(out) wxChar { wxString str($1); $result = wx2PyString(str); }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment