Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » STARTED: Python in bazaar
Re: STARTED: Python in bazaar [message #31958 is a reply to message #31907] Mon, 11 April 2011 14:56 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
so now there is even a boost python example in bazaar (BoostPyTest). it also contains how to setup boost for the ide.


still need to figure out how it properly works with boost python and exposure/extending/embedding. but so far there is a compileable environment to test things on..
enjoy.
any help / hints are pretty welcome, since even though there is some amount of information on boost python, there are few quality code examples, like the proper syntaxes of the macros and class_<> definitions..etc.

[Updated on: Mon, 11 April 2011 14:57]

Report message to a moderator

Re: STARTED: Python in bazaar [message #31971 is a reply to message #31958] Tue, 12 April 2011 23:57 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
proper exit() handling is supported now, after digging the python source code it's quite simple.

i'm still struggeling for an idea how to properly expose Value to object (boost.python).

anyone's got some experience in boost python and firm in Upp to provide a hint?

problem is, that both, Value and object are actually ref count containers for data.. and, both, upp (c++) side can own the data, and the Python interpreter / GC can own data (through Py_Object, wrapped by boost object). now how to properly manage that? i obviously cant expose the Value itself to object as data. i need to expose the Value's data as object's data..taking ref count in account.

or maybe not expose it at all but provide converter functions for both sides..that'd so far be the most clean way. but this would make any exposure of Upp api calls with Value as argument or return type impossible and would need to have some wrapper functions doing the conversion before and after python invokation.

ideas really welcome..
Python in bazaar growing [message #32415 is a reply to message #31971] Tue, 17 May 2011 09:33 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi people

python package and export of upp is growing and doing well so far. it's still very alpha but it's working great thanks to boost.python facilities.

want to encourage to take a look on it and give some feedback. see bazaar/BoostPyTest, and Py/install.txt.

index.php?t=getfile&id=3247&private=0
  • Attachment: boostpy.GIF
    (Size: 23.50KB, Downloaded 573 times)
Re: Python in bazaar growing [message #32416 is a reply to message #32415] Tue, 17 May 2011 10:47 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Looks good.

I couldn't find the Py/install.txt.
I have Python 3.2 r32:88445 installed.

When trying to run from theIDE I get this error massage.
c:\myapps\boostpytest\world.h(4) : fatal error C1083: Cannot open include file: 'Py/Py.h': No such fi
	le or directory
c:\myapps\boostpytest\BoostPyTest.h(4) : fatal error C1083: Cannot open include file: 'PyConsoleCtrl/
	PyConsoleCtrl.h': No such file or directory


When using some Python code when it is compiled is it ahead of time compiled or is it wrapped in the .exe and still runtime compiled?

Neil

[Updated on: Tue, 17 May 2011 13:25]

Report message to a moderator

Re: Python in bazaar growing [message #32418 is a reply to message #32416] Tue, 17 May 2011 11:18 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
no it's all runtime.. it does not precompile anything (well maybe internally in python environment, but this does not affect the upp runtime. what you see is really the content of a DocEdit which is passed to python as is..

using / importing other .py files laying next to the app .exe would be cache-compiled, you will find a .pyc file named after your py file after usage..

i will add an usage example for that too.
Re: Python in bazaar growing [message #32420 is a reply to message #32418] Tue, 17 May 2011 12:00 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Maybe py2exe could be tied in.

The license is open MIT and only when modified py2exe code is distributed does the GPL kick in.
http://stackoverflow.com/questions/599066/py2exe-page-says-i t-is-licensed-under-gpl-can-i-still-use-it-in-a-python-proje ct
and
http://www.py2exe.org/LICENSE.txt

Even then
Quote:

- your code is never converted to machine code - it's still an interpreted language.


But maybe that wouldn't fit with Upp's cross platform concept because that is for the Win OS.

I manually ported a considerable amount of my Python and Java code to C++ (except the GUI stuff) so it would be AOT compiled (and harder to decompile) but there would be cases especially for proof of concept where running the Python code in a Upp app would save a lot of time.

[Updated on: Tue, 17 May 2011 12:38]

Report message to a moderator

Re: Python in bazaar growing [message #32422 is a reply to message #32420] Tue, 17 May 2011 13:35 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
Quote:


running the Python code in a Upp app would save a lot of time


well thats exactly the point of embedding python. in this case, in an upp application.

to have a scripting support at hand when needed is a huge advantage, especially when debugging. and also, when defining gui layout, this could be worth using.

i actually see py2exe in a different use case, where one only has got a py script, and wants to be independant from py installation.

but the currently addressed use case deals with interoperability of U++ and python, where precompilation does not make sense. that for the case where the user wants to have the possibility to run some sort of own task inside the prepared environment, let's say an automated test for a device..
Re: Python in bazaar growing [message #32426 is a reply to message #32422] Tue, 17 May 2011 14:32 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
have just included a py script invokation and upp acces froom a py script example
Re: Python in bazaar growing [message #32427 is a reply to message #32416] Tue, 17 May 2011 14:36 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
nlneilson wrote on Tue, 17 May 2011 10:47

Looks good.

I couldn't find the Py/install.txt.
I have Python 3.2 r32:88445 installed.

When trying to run from theIDE I get this error massage.
c:\myapps\boostpytest\world.h(4) : fatal error C1083: Cannot open include file: 'Py/Py.h': No such fi
	le or directory
c:\myapps\boostpytest\BoostPyTest.h(4) : fatal error C1083: Cannot open include file: 'PyConsoleCtrl/
	PyConsoleCtrl.h': No such file or directory




obviously there is something wrong with your upp installation. bazaar/Py/install.txt has to be there. please double check your installation. can you build any other bazaar application?
the instructions in install.txt should yield a working Py environment
Re: Python in bazaar growing [message #32439 is a reply to message #32427] Tue, 17 May 2011 21:27 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
kohait00 wrote on Tue, 17 May 2011 14:36

obviously there is something wrong with your upp installation.


Yes there was a problem and it relates to my post in this thread on April 4
Quote:

Perhaps my question would be more appropriate in the "Newbie corner" but how in theIde do you pull something up that is in "bazaar" or "sandbox"?? A few times I just copied from bazaar into MyApps.


I updated several times since then and had moved the Py stuff from bazaar into MyApps.

I just now updated to Upp 3427 and Py/install.txt is in bazaar.
Re: Python in bazaar growing [message #32447 is a reply to message #32439] Wed, 18 May 2011 11:44 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
have you succeeded to run it?
Re: Python in bazaar growing [message #32448 is a reply to message #32447] Wed, 18 May 2011 12:10 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Not yet.

I have Python 3.2 and your app uses 2.7

I just updated to Ubuntu 11.04 that runs dual boot with Win.
The default is Python 2.7 on that OS, will try it there later.

[Updated on: Wed, 18 May 2011 12:16]

Report message to a moderator

Re: Python in bazaar growing [message #32513 is a reply to message #32448] Mon, 23 May 2011 13:38 Go to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
could anyone commit this please?

CtrlCore.h
@@ -1157,6 +1157,7 @@ public:
 
 	Ctrl&   IgnoreMouse(bool b = true)                   { ignoremouse = b; return *this; }
 	Ctrl&   NoIgnoreMouse()                              { return IgnoreMouse(false); }
+	bool    IsIgnoreMouse() const                        { return ignoremouse; }
 	bool    HasMouse() const;
 	bool    HasMouseDeep() const;
 	bool    HasMouseInFrame(const Rect& r) const;
Previous Topic: UppGL
Next Topic: Get MAC addresses for windows and linux
Goto Forum:
  


Current Time: Thu Mar 28 19:56:47 CET 2024

Total time taken to generate the page: 0.01158 seconds