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
b21dbd95
Commit
b21dbd95
authored
Mar 01, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a starting scripting dialog for tests
parent
d7692cd1
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
363 additions
and
2 deletions
+363
-2
CMakeLists.txt
pcbnew/CMakeLists.txt
+2
-0
dialog_scripting.cpp
pcbnew/dialogs/dialog_scripting.cpp
+29
-0
dialog_scripting.h
pcbnew/dialogs/dialog_scripting.h
+22
-0
dialog_scripting_base.cpp
pcbnew/dialogs/dialog_scripting_base.cpp
+41
-0
dialog_scripting_base.fbp
pcbnew/dialogs/dialog_scripting_base.fbp
+207
-0
dialog_scripting_base.h
pcbnew/dialogs/dialog_scripting_base.h
+46
-0
pcbnew.cpp
pcbnew/pcbnew.cpp
+12
-1
pcbnew.i
pcbnew/scripting/pcbnew.i
+4
-1
No files found.
pcbnew/CMakeLists.txt
View file @
b21dbd95
...
...
@@ -86,6 +86,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_SVG_print.cpp
dialogs/dialog_SVG_print_base.cpp
dialogs/dialog_set_grid_base.cpp
dialogs/dialog_scripting_base.cpp
dialogs/dialog_scripting.cpp
)
set
(
PCBNEW_SRCS
...
...
pcbnew/dialogs/dialog_scripting.cpp
0 → 100644
View file @
b21dbd95
/**
* @file dialog_scripting.cpp
*/
#include <fctsys.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <dialog_scripting.h>
#include <Python.h>
DIALOG_SCRIPTING
::
DIALOG_SCRIPTING
(
wxWindow
*
parent
)
:
DIALOG_SCRIPTING_BASE
(
parent
)
{
SetFocus
();
}
void
DIALOG_SCRIPTING
::
OnRunButtonClick
(
wxCommandEvent
&
event
)
{
wxCharBuffer
buffer
=
m_txScript
->
GetValue
().
ToUTF8
();
PyRun_SimpleString
(
buffer
.
data
());
}
pcbnew/dialogs/dialog_scripting.h
0 → 100644
View file @
b21dbd95
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_scripting.h
/////////////////////////////////////////////////////////////////////////////
#ifndef _DIALOG_SCRIPTING_H_
#define _DIALOG_SCRIPTING_H_
#include <dialog_scripting_base.h>
class
DIALOG_SCRIPTING
:
public
DIALOG_SCRIPTING_BASE
{
private
:
wxDialog
*
m_Parent
;
public
:
DIALOG_SCRIPTING
(
wxWindow
*
parent
);
private
:
void
OnRunButtonClick
(
wxCommandEvent
&
event
);
};
#endif // _DIALOG_SCRIPTING_H_
pcbnew/dialogs/dialog_scripting_base.cpp
0 → 100644
View file @
b21dbd95
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_scripting_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SCRIPTING_BASE
::
DIALOG_SCRIPTING_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxFrame
(
parent
,
id
,
title
,
pos
,
size
,
style
)
{
this
->
SetSizeHints
(
wxDefaultSize
,
wxDefaultSize
);
wxBoxSizer
*
bSizer4
;
bSizer4
=
new
wxBoxSizer
(
wxVERTICAL
);
m_txScript
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxHSCROLL
|
wxTE_MULTILINE
);
m_txScript
->
SetMinSize
(
wxSize
(
480
,
500
)
);
bSizer4
->
Add
(
m_txScript
,
0
,
wxALL
,
5
);
m_btRun
=
new
wxButton
(
this
,
wxID_ANY
,
wxT
(
"&Run"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bSizer4
->
Add
(
m_btRun
,
0
,
wxALL
,
5
);
this
->
SetSizer
(
bSizer4
);
this
->
Layout
();
this
->
Centre
(
wxBOTH
);
// Connect Events
m_btRun
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_SCRIPTING_BASE
::
OnRunButtonClick
),
NULL
,
this
);
}
DIALOG_SCRIPTING_BASE
::~
DIALOG_SCRIPTING_BASE
()
{
// Disconnect Events
m_btRun
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
DIALOG_SCRIPTING_BASE
::
OnRunButtonClick
),
NULL
,
this
);
}
pcbnew/dialogs/dialog_scripting_base.fbp
0 → 100644
View file @
b21dbd95
This diff is collapsed.
Click to expand it.
pcbnew/dialogs/dialog_scripting_base.h
0 → 100644
View file @
b21dbd95
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_scripting_base__
#define __dialog_scripting_base__
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/frame.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SCRIPTING_BASE
///////////////////////////////////////////////////////////////////////////////
class
DIALOG_SCRIPTING_BASE
:
public
wxFrame
{
private
:
protected
:
wxTextCtrl
*
m_txScript
;
wxButton
*
m_btRun
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnRunButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
public
:
DIALOG_SCRIPTING_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
wxT
(
"Scripting Test Window"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
500
,
600
),
long
style
=
wxDEFAULT_FRAME_STYLE
|
wxTAB_TRAVERSAL
);
~
DIALOG_SCRIPTING_BASE
();
};
#endif //__dialog_scripting_base__
pcbnew/pcbnew.cpp
View file @
b21dbd95
...
...
@@ -46,8 +46,11 @@
#include <hotkeys.h>
#include <wildcards_and_files_ext.h>
#include <Python.h>
#include <class_board.h>
#include <dialogs/dialog_scripting.h>
// Colors for layers and items
COLORS_DESIGN_SETTINGS
g_ColorsSettings
;
int
g_DrawDefaultLineThickness
=
60
;
/* Default line thickness in PCnew units used to draw
...
...
@@ -131,6 +134,12 @@ static void swig_add_builtin() {
}
static
BOARD
*
st_board
;
BOARD
*
GetBoard
()
{
return
st_board
;
}
bool
EDA_APP
::
OnInit
()
{
...
...
@@ -244,6 +253,8 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
*/
frame
->
SetFocus
();
frame
->
GetCanvas
()
->
SetFocus
();
st_board
=
frame
->
GetBoard
();
DIALOG_SCRIPTING
*
sw
=
new
DIALOG_SCRIPTING
(
frame
);
sw
->
Show
(
true
);
return
true
;
}
pcbnew/scripting/pcbnew.i
View file @
b21dbd95
...
...
@@ -8,6 +8,9 @@
#include <class_module.h>
#include <class_track.h>
#include <class_pad.h>
BOARD *GetBoard();
%}
%include <class_board_item.h>
...
...
@@ -16,7 +19,7 @@
%include <class_track.h>
BOARD *GetBoard();
/*%template(BOARD_ITEM_List) DLIST<BOARD_ITEM>;
%template(MODULE_List) DLIST<MODULE>;
...
...
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