mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-10 03:54:54 -06:00
bazaar: PyConsoleCtrl: history functionality, BoostPyTest: Value exposure as int, first try, starting upp module
git-svn-id: svn://ultimatepp.org/upp/trunk@3339 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f74addaae5
commit
d4d3d7f8ad
16 changed files with 321 additions and 109 deletions
|
|
@ -1,5 +1,8 @@
|
|||
#include "BoostPyTest.h"
|
||||
|
||||
//CAUTION special module definitions to reduce compile time
|
||||
#include "modules.cppi"
|
||||
|
||||
BoostPyTest::BoostPyTest()
|
||||
: slpy(sl)
|
||||
{
|
||||
|
|
@ -9,8 +12,7 @@ BoostPyTest::BoostPyTest()
|
|||
|
||||
int ret;
|
||||
ret = PyImport_AppendInittab( "hello", &inithello );
|
||||
ret = PyImport_AppendInittab( "UppCtrl", &initUppCtrl );
|
||||
ret = PyImport_AppendInittab( "UppString", &initUppString );
|
||||
ret = PyImport_AppendInittab( "upp", &initupp );
|
||||
|
||||
//Py_Initialize(); //should be done *after* PyImport_AppendInittab, but it still works :), leaving INITBLOCK from Py
|
||||
//PyCon::Init();
|
||||
|
|
@ -37,10 +39,13 @@ BoostPyTest::BoostPyTest()
|
|||
w.set("Welcom on earth");
|
||||
scope(hello_module).attr("earth") = ptr(&w);
|
||||
|
||||
slpy.Set(50);
|
||||
object ctrl_module = import("UppCtrl");
|
||||
main_namespace["UppCtrl"] = ctrl_module;
|
||||
scope(ctrl_module).attr("sl") = ptr(&slpy);
|
||||
|
||||
object upp_module = import("upp");
|
||||
main_namespace["upp"] = upp_module;
|
||||
|
||||
sl.SetData(50);
|
||||
scope(upp_module).attr("slpy") = ptr(&slpy);
|
||||
scope(upp_module).attr("sl") = ptr(&sl);
|
||||
|
||||
//the additional import is needless
|
||||
String sc =
|
||||
|
|
@ -48,12 +53,18 @@ BoostPyTest::BoostPyTest()
|
|||
"p.set('Some Greet Text')\n"
|
||||
"print p.greet()\n"
|
||||
|
||||
"print UppCtrl.sl.get()\n"
|
||||
"UppCtrl.sl.set(23)\n"
|
||||
"print upp.slpy.get()\n"
|
||||
"upp.slpy.set(23)\n"
|
||||
|
||||
"import UppString\n"
|
||||
"print UppString.hello()\n"
|
||||
"print UppString.size('TestString')\n"
|
||||
"print upp.hello()\n"
|
||||
"print upp.size('TestString')\n"
|
||||
|
||||
"print upp.helloval()\n"
|
||||
"print upp.doubleit(256)\n"
|
||||
|
||||
"print upp.sl.get()\n"
|
||||
"upp.sl.set(75)\n"
|
||||
|
||||
;
|
||||
con.cmd.SetData(sc);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue