Cleanup toward test-merge

This commit is contained in:
Miguel Angel Ajo 2012-07-06 21:10:55 +02:00
parent 08af577218
commit 974fe74f66
8 changed files with 111 additions and 58 deletions

View File

@ -8,26 +8,31 @@
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;
FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard(int aIndex)
FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( int aIndex )
{
return m_FootprintWizards[aIndex];
}
FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard(wxString aName)
FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( wxString aName )
{
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();
if (name.Cmp(aName))
if ( name.Cmp(aName) )
return wizard;
}
@ -45,7 +50,7 @@ void FOOTPRINT_WIZARDS::register_wizard(FOOTPRINT_WIZARD *aWizard)
wxString name = aWizard->GetName();
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() );
}

View File

@ -8,7 +8,9 @@
#include <vector>
#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 */
class FOOTPRINT_WIZARD
{

View File

@ -46,19 +46,19 @@ class wxGridEvent;
class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME
{
private:
// List of libraries (for selection )
wxSashLayoutWindow* m_PageListWindow;
wxListBox* m_PageList; // The list of pages
wxSize m_PageListSize; // size of the window
wxSashLayoutWindow* m_PageListWindow; //< List of libraries (for selection )
wxListBox* m_PageList; //< The list of pages
wxSize m_PageListSize; //< size of the window
// List of components in the selected library
wxSashLayoutWindow* m_ParameterGridWindow;
wxGrid* m_ParameterGrid; // The list of parameters
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
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_configPath; // subpath for configuration
wxSemaphore* m_Semaphore; //< != NULL if the frame must emulate a modal dialog
wxString m_configPath; //< subpath for configuration
FOOTPRINT_WIZARD* m_FootprintWizard;
@ -86,19 +86,40 @@ private:
void OnSashDrag( wxSashEvent& event );
/**
* Function ReCreateLibraryList
*
* Creates or recreates the list of current loaded libraries.
* This list is sorted, with the library cache always at end of the list
* Function ReCreatePageList
* Creates or recreates the list of parameter pages for the current wizard.
* This list is sorted
*/
void ReCreatePageList();
/**
* Function ReCreateParameterList
* Creates the list of parameters for the current page
*/
void ReCreateParameterList();
/**
* Function SelectFootprintWizard
* Shows the list of footprint wizards available into the system
*/
void SelectFootprintWizard();
/**
* Function ReloadFootprint
* Reloads the current footprint
*/
void ReloadFootprint();
void Process_Special_Functions( wxCommandEvent& event );
/**
* Function DisplayWizardInfos
* Shows all the details about the current wizard
*/
void DisplayWizardInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();

View File

@ -6,9 +6,9 @@
{
class DLISTIter:
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
try:
@ -16,7 +16,7 @@
except:
pass
if item is None:
if item is None: # if the item is None, then finish the iteration
raise StopIteration
else:
ret = None
@ -25,11 +25,12 @@
try:
ret = self.last.Get()
except:
ret = self.last #next items just not..
ret = self.last # next items do not..
self.last = self.last.Next()
# when the iterated object can be casted down in inheritance, just do it..
if 'Cast' in dir(ret):
ret = ret.Cast()

View File

@ -27,7 +27,6 @@ f = open(filename,"rb")
lines = f.readlines()
f.close()
f = open(filename,"wb")
doneOk = False
@ -35,14 +34,18 @@ if (len(lines)<4000):
print "still building"
exit(0)
txt = ""
for l in lines:
if l.startswith("if version_info >= (2,6,0):"):
l = l.replace("version_info >= (2,6,0)","False")
doneOk = True
elif l.startswith("if False:"): # it was already patched?
doneOk = True
f.write(l)
txt = txt + l
f = open(filename,"wb")
f.write(txt)
f.close()
if doneOk:

View File

@ -27,14 +27,8 @@
* @brief General wrappers for kicad / wx structures and classes
*/
/* OFF NOW, it triggers an error with GCC 4.6 and swig-2.0.4 or trunk..
http://sourceforge.net/tracker/index.php?func=detail&aid=3391906&group_id=1645&atid=101645
*/
%include <std_vector.i>
%include <std_string.i>
%include <std_vector.i>
%include <std_string.i>
/* ignore some constructors of EDA_ITEM that will make the build fail */
@ -44,11 +38,12 @@
%ignore EDA_ITEM::EDA_ITEM( const EDA_ITEM& base );
/* 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::SetNext;
/* ignore other functions that cause trouble */
%ignore InitKiCadAbout;
%ignore GetCommandOptions;
@ -57,9 +52,10 @@
%ignore operator <<;
%ignore operator=;
/* headers/imports that must be included in the _wrapper.cpp at top */
%{
#include <cstddef>
#include <cstddef>
#include <dlist.h>
#include <base_struct.h>
#include <common.h>
@ -72,7 +68,7 @@
#include <class_title_block.h>
#include <class_colors_design_settings.h>
#include <class_marker_base.h>
#include <eda_text.h>
#include <eda_text.h>
%}
@ -95,6 +91,7 @@
}
*/
/* header files that must be wrapped */
%include <dlist.h>
%include <base_struct.h>
@ -104,10 +101,12 @@
%include <class_marker_base.h>
%include <eda_text.h>
/* special iteration wrapper for DLIST objects */
%include "dlist.i"
/* std template mappings */
%template(intVector) std::vector<int>;
/* KiCad plugin handling */
%include "kicadplugins.i"

View File

@ -22,9 +22,41 @@
* 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
{
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
class KiCadPlugin:
@ -159,21 +191,5 @@ class ActionPlugin(KiCadPlugin):
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())
}

View File

@ -25,6 +25,9 @@
/**
* @file wx.i
* @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.
*/
%{
@ -67,7 +70,8 @@ public:
int x, y, width, height;
%extend
{
{
/* extend the wxRect object so it can be converted into a tuple */
PyObject* Get()
{
PyObject* res = PyTuple_New(4);
@ -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(out) wxChar { wxString str($1); $result = wx2PyString(str); }