pyobjc-dev Mailing List for PyObjC (Page 203)
Brought to you by:
ronaldoussoren
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(30) |
May
(18) |
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2002 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(23) |
Oct
(180) |
Nov
(291) |
Dec
(95) |
2003 |
Jan
(338) |
Feb
(352) |
Mar
(97) |
Apr
(46) |
May
(226) |
Jun
(184) |
Jul
(145) |
Aug
(141) |
Sep
(69) |
Oct
(161) |
Nov
(96) |
Dec
(90) |
2004 |
Jan
(66) |
Feb
(87) |
Mar
(98) |
Apr
(132) |
May
(115) |
Jun
(68) |
Jul
(150) |
Aug
(92) |
Sep
(59) |
Oct
(52) |
Nov
(17) |
Dec
(75) |
2005 |
Jan
(84) |
Feb
(191) |
Mar
(133) |
Apr
(114) |
May
(158) |
Jun
(185) |
Jul
(62) |
Aug
(28) |
Sep
(36) |
Oct
(88) |
Nov
(65) |
Dec
(43) |
2006 |
Jan
(85) |
Feb
(62) |
Mar
(92) |
Apr
(75) |
May
(68) |
Jun
(101) |
Jul
(73) |
Aug
(37) |
Sep
(91) |
Oct
(65) |
Nov
(30) |
Dec
(39) |
2007 |
Jan
(24) |
Feb
(28) |
Mar
(10) |
Apr
(2) |
May
(18) |
Jun
(16) |
Jul
(21) |
Aug
(6) |
Sep
(30) |
Oct
(31) |
Nov
(153) |
Dec
(31) |
2008 |
Jan
(63) |
Feb
(70) |
Mar
(47) |
Apr
(24) |
May
(59) |
Jun
(22) |
Jul
(12) |
Aug
(7) |
Sep
(14) |
Oct
(26) |
Nov
(5) |
Dec
(5) |
2009 |
Jan
(10) |
Feb
(41) |
Mar
(70) |
Apr
(88) |
May
(49) |
Jun
(62) |
Jul
(34) |
Aug
(15) |
Sep
(55) |
Oct
(40) |
Nov
(67) |
Dec
(21) |
2010 |
Jan
(60) |
Feb
(17) |
Mar
(26) |
Apr
(26) |
May
(29) |
Jun
(4) |
Jul
(21) |
Aug
(21) |
Sep
(10) |
Oct
(12) |
Nov
(3) |
Dec
(19) |
2011 |
Jan
(3) |
Feb
(13) |
Mar
(8) |
Apr
(8) |
May
(17) |
Jun
(20) |
Jul
(21) |
Aug
(7) |
Sep
|
Oct
|
Nov
(9) |
Dec
(11) |
2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
(4) |
Jun
(14) |
Jul
(5) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(23) |
Dec
(1) |
2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
(5) |
Jun
(1) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(12) |
Nov
(10) |
Dec
(3) |
2014 |
Jan
(7) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(11) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
(8) |
Nov
(1) |
Dec
(2) |
2015 |
Jan
(9) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(7) |
Jun
|
Jul
(5) |
Aug
(6) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2016 |
Jan
(1) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(21) |
Oct
(17) |
Nov
|
Dec
(36) |
2017 |
Jan
(6) |
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(6) |
2018 |
Jan
(2) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
(6) |
2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(1) |
2021 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2025 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Just v. R. <ju...@le...> - 2003-12-15 09:39:30
|
Francesco Pierfederici wrote: > for some weird reason, if all of v, z1 and z2 are floats, everything > works as expected. If v is a int while z1 and z2 are floats, the > second statement gets ALWAYS executed. I should add that z in an > element of a Python array of unsigned ints. > > Has anybody ever seen something like this? int/float comparisons work as expected in Python. Are you sure the objects you're comparing have the types you expect? Maybe one is a string and not a number? Try putting "print type(v), type(z1), type(z2)" somewhere. Just |
From: Francesco P. <fpi...@no...> - 2003-12-15 02:48:36
|
Hi everybody! I stumbled into a very weird behaviour and I do not know if it is a Python bug, an PyObjC bug, one of my bugs or any combination of the three. So, I implement a mouseMoved_ function in a subclass of NSImageView in a Python script. In this function I have a comparison between the pixel value of the displayed image and two thresholds: if (v >= z2): self.pixelField.setStringValue_ ('>= ' + str (z2)) return if (v <= z1): self.pixelField.setStringValue_ ('<= ' + str (z1)) return else: self.pixelField.setFloatValue_ (v) return for some weird reason, if all of v, z1 and z2 are floats, everything works as expected. If v is a int while z1 and z2 are floats, the second statement gets ALWAYS executed. I should add that z in an element of a Python array of unsigned ints. Has anybody ever seen something like this? Cheers Francesco --- Francesco Pierfederici <fpi...@no...> NOAO/AURA Inc. http://www.noao.edu/staff/fpierfed/ 950 N. Cherry Ave. Phone: +1 520 318 8402 Tucson, AZ 85719 USA FAX: +1 520 318 8360 |
From: Jodie H. <we8...@ya...> - 2003-12-12 22:34:50
|
FUEL SAVER PRO This revolutionary device Boosts Gas Mileage 27%+ by helping fuel burn bet= ter using three patented processes from General Motors. www.iqkm.org?axel=3D49 PROVEN TECHNOLOGY A certified U.S. Environmental Protection Agency (EPA) laboratory recently= completed tests on the new Fuel Saver. The results were astounding! Maste= r Service, a subsidiary of Ford Motor Company, also conducted extensive em= issions testing and obtained similar, unheard of results. The achievements= of the Fuel Saver is so noteworthy to the environmental community, that C= ommercial News has featured it as their cover story in their June, 2000 ed= ition. Take a test drive Today - www.iqkm.org?axel=3D49 No more advertisements, thanks - http://www.evkm.org/out5s/pre-rem2e.asp h igb gvaw xtsj n pqaw ktaybwjrmoby ehk drneaqef egyebjxdifuju l |
From: Helena H. <97h...@ya...> - 2003-12-12 21:24:51
|
Got your attention? Let me show you the way Financial Independence: www.ndid.biz?axel=3D49 No more advertisements, thanks - www.aype.org/out5s/pre-rem2e.asp wi h |
From: Keyword P. C. <no...@re...> - 2003-12-11 17:45:09
|
No text version was provided |
From: Carlos P. <ca...@ci...> - 2003-12-09 20:25:33
|
Hi, How can we make sure that pyobjc sees python classes in embedded frameworks. This seems to work in the provided Cocoa-Python-Objc Application project template for Project Builder. However, when I build a new framework using an Xcode framework target and embed it into my application, the modules in the framework are not seen by __main__.py. It is of course possible to play with the import path myself as I have done. Is this necessary, though? I'm not sure how Resource folders of embedded frameworks are treated. Carlos |
From: SourceForge.net <no...@so...> - 2003-12-09 18:24:13
|
Bugs item #857057, was opened at 2003-12-09 18:24 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=114534&aid=857057&group_id=14534 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Richard Brooksby (rptb1) Assigned to: Nobody/Anonymous (nobody) Summary: HelloWorld.py won't run under Mac OS X 10.3 Initial Comment: I downloaded and installed PyObjC 1.0 from sources as described in install.html. I then tried to run the HelloWorld example, but it failed: $ python HelloWorld.py Traceback (most recent call last): File "HelloWorld.py", line 78, in ? if __name__ == '__main__' : main() File "HelloWorld.py", line 41, in main NSApp.setDelegate_(delegate) AttributeError: 'builtin_function_or_method' object has no attribute 'setDelegate_' ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=114534&aid=857057&group_id=14534 |
From: SourceForge.net <no...@so...> - 2003-12-09 18:17:39
|
Bugs item #857048, was opened at 2003-12-09 10:17 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=114534&aid=857048&group_id=14534 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: FieldGraph won't build under Mac OS X 10.3 Initial Comment: I installed PyObjC 1.0 from sources under Mac OS X 10.3 according to the instructions in "install.html". I then tried to build the FieldGraph example using ProjectBuilder 2.1. It failed with the following errors: Building target FieldGraph with build style Development (optimization:level 0, debug-symbols:on) (21 errors) /usr/bin/gcc2 -c -F/Users/rb/src/pyobjc-1.0/ Examples/FieldGraph/build -I/Users/rb/src/pyobjc-1.0/ Examples/FieldGraph/build/include -arch ppc -fno- common -fpascal-strings -O0 -Wmost -Wno-four-char- constants -Wno-unknown-pragmas -pipe -g -precomp- trustfile /Users/rb/src/pyobjc-1.0/Examples/FieldGraph/ build/FieldGraph.build/FieldGraph.build/ TrustedPrecomps.txt -Wp,-header-mapfile,/Users/rb/src/ pyobjc-1.0/Examples/FieldGraph/build/FieldGraph.build/ FieldGraph.build/FieldGraph.hmap bin-python-main.m -o /Users/rb/src/pyobjc-1.0/Examples/FieldGraph/build/ FieldGraph.build/FieldGraph.build/Objects-normal/ppc/bin- python-main.o bin-python-main.m: In function `pyobjc_main': bin-python-main.m:30: parse error before `const' bin-python-main.m:46: `envc' undeclared (first use in this function) bin-python-main.m:46: (Each undeclared identifier is reported only once bin-python-main.m:46: for each function it appears in.) bin-python-main.m:48: `PYTHONPATH' undeclared (first use in this function) bin-python-main.m:54: `childEnvp' undeclared (first use in this function) bin-python-main.m:58: `pythonPathInWrapper' undeclared (first use in this function) bin-python-main.m:79: `mainBundle' undeclared (first use in this function) bin-python-main.m:94: `aBundle' undeclared (first use in this function) bin-python-main.m:94: `bundleEnumerator' undeclared (first use in this function) bin-python-main.m:96: `bundlePaths' undeclared (first use in this function) bin-python-main.m:104: parse error before `*' bin-python-main.m:105: `pythonBinPath' undeclared (first use in this function) bin-python-main.m:107: parse error before `const' bin-python-main.m:125: `nextFileName' undeclared (first use in this function) bin-python-main.m:125: `possibleMainsEnumerator' undeclared (first use in this function) bin-python-main.m:126: `mainPyPath' undeclared (first use in this function) bin-python-main.m:133: `possibleMains' undeclared (first use in this function) bin-python-main.m:134: parse error before `const' bin-python-main.m:139: `childArgv' undeclared (first use in this function) bin-python-main.m:142: `mainPyPathPtr' undeclared (first use in this function) bin-python-main.m:147: `i' undeclared (first use in this function) bin-python-main.m:156: `pythonBinPathPtr' undeclared (first use in this function) bin-python-main.m:30: parse error before `const' bin-python-main.m:46: `envc' undeclared (first use in this function) bin-python-main.m:46: (Each undeclared identifier is reported only once bin-python-main.m:46: for each function it appears in.) bin-python-main.m:48: `PYTHONPATH' undeclared (first use in this function) bin-python-main.m:54: `childEnvp' undeclared (first use in this function) bin-python-main.m:58: `pythonPathInWrapper' undeclared (first use in this function) bin-python-main.m:79: `mainBundle' undeclared (first use in this function) bin-python-main.m:94: `aBundle' undeclared (first use in this function) bin-python-main.m:94: `bundleEnumerator' undeclared (first use in this function) bin-python-main.m:96: `bundlePaths' undeclared (first use in this function) bin-python-main.m:104: parse error before `*' bin-python-main.m:105: `pythonBinPath' undeclared (first use in this function) bin-python-main.m:107: parse error before `const' bin-python-main.m:125: `nextFileName' undeclared (first use in this function) bin-python-main.m:125: `possibleMainsEnumerator' undeclared (first use in this function) bin-python-main.m:126: `mainPyPath' undeclared (first use in this function) bin-python-main.m:133: `possibleMains' undeclared (first use in this function) bin-python-main.m:134: parse error before `const' bin-python-main.m:139: `childArgv' undeclared (first use in this function) bin-python-main.m:142: `mainPyPathPtr' undeclared (first use in this function) bin-python-main.m:147: `i' undeclared (first use in this function) bin-python-main.m:156: `pythonBinPathPtr' undeclared (first use in this function) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=114534&aid=857048&group_id=14534 |
From: Jiva D. <ji...@de...> - 2003-12-08 22:19:37
|
Got it. Thanks for the clarification. On Dec 8, 2003, at 2:09 PM, b.bum wrote: > Compile time is a bit harder. In particular, you can't refer to any > class implemented in python directly because there won't be a real > class object to link against as the source is compiled. To solve > this problem, I have used an abstract superclass implemented in > Objective-C (a class that simply declares all the methods where the > implementation is stubbed out) and a concrete subclass implemented in > Python. To the abstract superclass-- the objc class-- I have added a > factory method that instantiates and returns the concrete subclass. > > This is effectively exactly how class clusters work. > > Finally, you have to trigger the execution of a bit of python code > from somewhere in your code for all of this to work. The easiest > solution would be to simply grab the main() function that > uses/initializes the embedded interpreter and use that within your > app. Then your main.py could import whatever classes you need to > start the application and you could go from there. > > b.bum -- Jiva DeVoe jiva at devoesquared.com http://www.devoesquared.com |
From: Bob I. <bo...@re...> - 2003-12-08 22:14:50
|
On Dec 8, 2003, at 4:26 PM, Philip Brodd wrote: > I'm trying to launch RealOne Player from my app and send it a URL. If > RealOne is already running, this successfully causes it to play the > given audio stream: > > import RealOne_Player > realplayer = RealOne_Player.RealOne_Player() > realplayer.GetURL( "rtsp://blah/blah.rm" ) > > I can't see how to launch it from my program though. On a wild guess I > tried realplayer.activate(), which gave the error "MacOS.Error: (-600, > 'no eligible process with specified descriptor')". What exactly does this have to do with PyObjC? PyObjC has no wrapper called "RealOne_Player". That looks like a gensuitemodule wrapper or something, you should've specified where it came from. I believe the name for the "launch" event is called run.. so maybe realplayer.run() works? In any case, you may want to try doing this (with PyObjC). It's another approach entirely, but will probably work perfectly fine for the simple use case you describe. from Foundation import NSURL from AppKit import NSWorkspace NSWorkspace.sharedWorkspace().openURL_(NSURL.URLWithString_(u"rtsp:// blah/blah.rm")) -bob |
From: Philip B. <br...@ma...> - 2003-12-08 21:26:41
|
I'm trying to launch RealOne Player from my app and send it a URL. If RealOne is already running, this successfully causes it to play the given audio stream: import RealOne_Player realplayer = RealOne_Player.RealOne_Player() realplayer.GetURL( "rtsp://blah/blah.rm" ) I can't see how to launch it from my program though. On a wild guess I tried realplayer.activate(), which gave the error "MacOS.Error: (-600, 'no eligible process with specified descriptor')". -- Phil |
From: b.bum <bb...@ma...> - 2003-12-08 21:10:02
|
On Dec 8, 2003, at 12:17 PM, Jiva DeVoe wrote: > So I understand that I can create Python files and the templates > supplied with PyObjC automatically will load those Python files and do > what ever I want them to. I also understand if I instantiate a python > class in python, and access it in obj-c, I will get a proxy object to > the python object. However, what if I have an objective-c > application, and I want to write a portion of it in python. So, in > other words, I want to be able to create a class in Python, and > instantiate an object in objective-c that is of that class. How would > I do that? Would I have to use something like SWIG? No SWIG necessary. If you subclass an Objective-C class from Python, the resulting class will look/feel/work just like any other Objective-C class. To ensure that selector mapping-- method mapping-- works correctly, you will need to make sure that method's in the Python implementation are correctly named (i.e. -setObject:forKey: is setObject_forKey_ and not setObjectForKey ). Because Python is a "lazily linked" interpreted language, you have to ensure that any classes you want to use have been defined before they are used. This causes two issues; runtime and compile time. Runtime is easy -- just make sure you import the class in Python before it is used. Compile time is a bit harder. In particular, you can't refer to any class implemented in python directly because there won't be a real class object to link against as the source is compiled. To solve this problem, I have used an abstract superclass implemented in Objective-C (a class that simply declares all the methods where the implementation is stubbed out) and a concrete subclass implemented in Python. To the abstract superclass-- the objc class-- I have added a factory method that instantiates and returns the concrete subclass. This is effectively exactly how class clusters work. Finally, you have to trigger the execution of a bit of python code from somewhere in your code for all of this to work. The easiest solution would be to simply grab the main() function that uses/initializes the embedded interpreter and use that within your app. Then your main.py could import whatever classes you need to start the application and you could go from there. b.bum |
From: Jiva D. <ji...@de...> - 2003-12-08 20:17:42
|
So I understand that I can create Python files and the templates supplied with PyObjC automatically will load those Python files and do what ever I want them to. I also understand if I instantiate a python class in python, and access it in obj-c, I will get a proxy object to the python object. However, what if I have an objective-c application, and I want to write a portion of it in python. So, in other words, I want to be able to create a class in Python, and instantiate an object in objective-c that is of that class. How would I do that? Would I have to use something like SWIG? -- Jiva DeVoe jiva at devoesquared.com http://www.devoesquared.com |
From: Carlos P. <ca...@ci...> - 2003-12-06 21:38:14
|
> This is the problem: Use PyObject_CallFunction(vtkRenderPyClass, "O", > Py_None) instead, CallObject expects an argument tuple (hence the > error message you were getting). > > BTW. The code below doesn't seem to use ``rendererAddr``. > > Ronald Thanks you so much. This was in fact the problem. You found both the solution to the problem I had and the one I was about to have. The code now works. I can now wrap the other methods and things should be fine. The correct call was: result = PyObject_CallFunction(vtkRendererPyClass, "s", rendererAddr); Thank you to everyone who helped me throughout this thread. Carlos |
From: Ronald O. <ous...@ci...> - 2003-12-06 20:27:15
|
On 6 dec 2003, at 20:40, Carlos Phillips wrote: >> Do you parse the method arguments using PyArg_ParseTuple? See one of >> the method mappings in the Foundation and AppKit wrappers for an >> example of argument parsing. > > > I have included my call_VTKView_renderer function below. I simply > ignore the arguments since the method renderer does not take any > arguments. > > Carlos > > static PyObject* > call_VTKView_renderer( > PyObject* method, PyObject* self, PyObject* arguments) > { > PyObject *result = 0; > VTKView *objc_self = 0; > vtkRenderer *renderer = 0; > const char *rendererAddr = 0; > > // Get objc representation of self. > objc_self = PyObjC_PythonToId(self); > > // Get the renderer > renderer = [objc_self renderer]; > > // Convert pointer to mangled form > rendererAddr = vtkPythonManglePointer(renderer, "p_vtkRenderer"); > > // Import the VTK module and get the vtkRenderer class > PyObject *vtk_module = PyImport_ImportModule("vtk"); > PyObject *vtkRendererPyClass = > PyObject_GetAttrString(vtk_module, "vtkRenderer"); > > // Create a python object for renderer. If renderer has > // already been wrapped in python, then the existing python object > // is returned. > result = PyObject_CallObject(vtkRendererPyClass, Py_None); This is the problem: Use PyObject_CallFunction(vtkRenderPyClass, "O", Py_None) instead, CallObject expects an argument tuple (hence the error message you were getting). BTW. The code below doesn't seem to use ``rendererAddr``. Ronald |
From: Carlos P. <ca...@ci...> - 2003-12-06 19:41:03
|
> Do you parse the method arguments using PyArg_ParseTuple? See one of > the method mappings in the Foundation and AppKit wrappers for an > example of argument parsing. I have included my call_VTKView_renderer function below. I simply ignore the arguments since the method renderer does not take any arguments. Carlos static PyObject* call_VTKView_renderer( PyObject* method, PyObject* self, PyObject* arguments) { PyObject *result = 0; VTKView *objc_self = 0; vtkRenderer *renderer = 0; const char *rendererAddr = 0; // Get objc representation of self. objc_self = PyObjC_PythonToId(self); // Get the renderer renderer = [objc_self renderer]; // Convert pointer to mangled form rendererAddr = vtkPythonManglePointer(renderer, "p_vtkRenderer"); // Import the VTK module and get the vtkRenderer class PyObject *vtk_module = PyImport_ImportModule("vtk"); PyObject *vtkRendererPyClass = PyObject_GetAttrString(vtk_module, "vtkRenderer"); // Create a python object for renderer. If renderer has // already been wrapped in python, then the existing python object // is returned. result = PyObject_CallObject(vtkRendererPyClass, Py_None); return result; } |
From: Ronald O. <ous...@ci...> - 2003-12-06 19:18:59
|
On 6 dec 2003, at 18:04, Carlos Phillips wrote: > > On Dec 2, 2003, at 1:13 PM, Bob Ippolito wrote: > >> >> On Dec 2, 2003, at 12:38 PM, Ronald Oussoren wrote: >> >>> >>> On 2 dec 2003, at 16:23, b.bum wrote: >>> >>>> On Dec 2, 2003, at 1:12 AM, Carlos Phillips wrote: >>>>> 2003-12-02 03:30:46.165 Simple1[1541] PyObjCPointer created: at >>>>> 0x6d16080 of type >>>>> {vtkRenderer={?={?={?=^^?i}C{vtkTimeStamp=^^? >>>>> L}^{vtkSubjectHelper}}^{vtkAssemblyPath}^{vtkPropCollection}iIff^{v >>>>> tkPropCollection}^{vtkActor2DCollection}^{vtkWindow}[3f][4f][2f][2f >>>>> ][2f][2i][2i][3f][3f][4f]}^{vtkCamera}^{vtkLight}^{vtkLightCollecti >>>>> on}^{vtkCullerCollection}^{vtkActorCollection}^{vtkVolumeCollection >>>>> }[3f]^{vtkRenderWindow}ffiii*{vtkTimeStamp=^^? >>>>> L}fii^^{vtkProp}i^^{vtkAssemblyPath}iii[6f]f}8@0:4 >>>> >>>> Like Bob said, once a PyObjCPointer is created, you are generally >>>> out of luck. PyObjC transparently bridged Objective-C. In this >>>> case, you are asking it to transparently bridge a relatively >>>> complex C data type. >>> >>> The problem is that PyObjCPointer is a not really a wrapped pointer, >>> when the PyObjCPointer object is created the value pointed-to is >>> copied into an internal buffer. Most of the time that doesn't work, >>> vtkRenderer is probably a C++ class and the copied value is invalid. >>> >>> I'll put creation of a real pointer wrapper on my todo-list, a >>> generic version of the types used to wrapped some other pointer >>> types (see pointer-support.m). >>> >>> Is VTK itself wrapped? If so, you could use the functions in >>> pointer-support.m to convert vtkRenderer* to the Python wrapper from >>> the VTK wrapper. >> >> VTK itself does have python wrappers.. they probably work on OS X by >> now, but there were problems last time I tried (a long while ago, due >> to linking issues). >> >> -bob >> > > I am trying to create a wrapper for the following methods in VTKView. > -(vtkRenderer *)renderer; > -(vtkRenderWindow *)renderWindow; > -(vtkRenderWindowInteractor *)renderWindowInteractor; > > Each return value is a C++ class which has a VTK python wrapper. In > VTK, there is a function available to convert pointers along with type > descriptions into python objects. Thus all I need to do is create a > wrapper for these methods which returns the appropriate python object > instead of the C++ object. > > To do this, I have created a module similar to the AppKit module which > installs a wrapper method with the following call. > > if (PyObjC_RegisterMethodMapping( classVTKView, > @selector(renderer), > call_VTKView_renderer, > PyObjCUnsupportedMethod_IMP) < 0) > > call_VTKView_renderer does the following: > 1) Unwrap the VTKView python proxy. Call the unwrapped objc object > self_objc. > 2) rend = [self_objc renderer] > 3) Wrap rend using VTK function. > 4) Return wrapped rend > > I use PyObjCUnsupportedMethod_IMP as the fourth argument to > PyObjC_RegisterMethodMapping but I'm not sure what this argument is > for. > > When I compile the new module and load it into python. I gain access > to the VTKView class and can instantiate it. When I call renderer() on > an instance, I get the following python error: > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: argument list must be a tuple Do you parse the method arguments using PyArg_ParseTuple? See one of the method mappings in the Foundation and AppKit wrappers for an example of argument parsing. > > Is this because I don't have a callPython argument in my > PyObjCUnsupportedMethod_IMP call? If so what needs to be put there? You can leave the PyObjCUnsupportedMethod_IMP as it is, you only have to change that when you want to be able to override the method in Python. Ronald |
From: Francesco P. <fpi...@no...> - 2003-12-06 18:27:52
|
OK, After trying all possible combinations (in random order), I finally managed to make it work. It looks like I was not creating a NSAutoreleasePool and my code was just crashing, after trying to display an image. Now it works, I hope. BTW, PyObjC rocks! And it is quite fast! I am impressed. I will do some tests with real images (8K x 8K or bigger) to see how things work when handling quite some memory... Thanks!!! fra On Dec 6, 2003, at 10:40 AM, b.bum wrote: > I added a unit test that invokes the init...() method w/an array of > bytes as a grey scale image. It passes. > > However, I'm not rendering anything so it may not explode until the > actual rendering happens.... > > So, three things may be happening: > > - you are trashing memory or passing in fewer bytes that expected > > - it blows up when it is rendered, but the initialization is working > fine > > - python is freeing the data you passed to NSBIR before the NSBIR has > rendered the bytes > > In other words, I didn't actually find anything useful but hopefully > the above helps. What is the last line of python that is executed? > > b.bum > --- Francesco Pierfederici <fpi...@no...> NOAO/AURA Inc. http://www.noao.edu/staff/fpierfed/ 950 N. Cherry Ave. Phone: +1 520 318 8402 Tucson, AZ 85719 USA FAX: +1 520 318 8360 |
From: b.bum <bb...@ma...> - 2003-12-06 17:40:54
|
I added a unit test that invokes the init...() method w/an array of bytes as a grey scale image. It passes. However, I'm not rendering anything so it may not explode until the actual rendering happens.... So, three things may be happening: - you are trashing memory or passing in fewer bytes that expected - it blows up when it is rendered, but the initialization is working fine - python is freeing the data you passed to NSBIR before the NSBIR has rendered the bytes In other words, I didn't actually find anything useful but hopefully the above helps. What is the last line of python that is executed? b.bum |
From: Carlos P. <ca...@ci...> - 2003-12-06 17:05:01
|
On Dec 2, 2003, at 1:13 PM, Bob Ippolito wrote: > > On Dec 2, 2003, at 12:38 PM, Ronald Oussoren wrote: > >> >> On 2 dec 2003, at 16:23, b.bum wrote: >> >>> On Dec 2, 2003, at 1:12 AM, Carlos Phillips wrote: >>>> 2003-12-02 03:30:46.165 Simple1[1541] PyObjCPointer created: at >>>> 0x6d16080 of type >>>> {vtkRenderer={?={?={?=^^?i}C{vtkTimeStamp=^^? >>>> L}^{vtkSubjectHelper}}^{vtkAssemblyPath}^{vtkPropCollection}iIff^{vt >>>> kPropCollection}^{vtkActor2DCollection}^{vtkWindow}[3f][4f][2f][2f][ >>>> 2f][2i][2i][3f][3f][4f]}^{vtkCamera}^{vtkLight}^{vtkLightCollection} >>>> ^{vtkCullerCollection}^{vtkActorCollection}^{vtkVolumeCollection}[3f >>>> ]^{vtkRenderWindow}ffiii*{vtkTimeStamp=^^? >>>> L}fii^^{vtkProp}i^^{vtkAssemblyPath}iii[6f]f}8@0:4 >>> >>> Like Bob said, once a PyObjCPointer is created, you are generally >>> out of luck. PyObjC transparently bridged Objective-C. In this >>> case, you are asking it to transparently bridge a relatively complex >>> C data type. >> >> The problem is that PyObjCPointer is a not really a wrapped pointer, >> when the PyObjCPointer object is created the value pointed-to is >> copied into an internal buffer. Most of the time that doesn't work, >> vtkRenderer is probably a C++ class and the copied value is invalid. >> >> I'll put creation of a real pointer wrapper on my todo-list, a >> generic version of the types used to wrapped some other pointer types >> (see pointer-support.m). >> >> Is VTK itself wrapped? If so, you could use the functions in >> pointer-support.m to convert vtkRenderer* to the Python wrapper from >> the VTK wrapper. > > VTK itself does have python wrappers.. they probably work on OS X by > now, but there were problems last time I tried (a long while ago, due > to linking issues). > > -bob > I am trying to create a wrapper for the following methods in VTKView. -(vtkRenderer *)renderer; -(vtkRenderWindow *)renderWindow; -(vtkRenderWindowInteractor *)renderWindowInteractor; Each return value is a C++ class which has a VTK python wrapper. In VTK, there is a function available to convert pointers along with type descriptions into python objects. Thus all I need to do is create a wrapper for these methods which returns the appropriate python object instead of the C++ object. To do this, I have created a module similar to the AppKit module which installs a wrapper method with the following call. if (PyObjC_RegisterMethodMapping( classVTKView, @selector(renderer), call_VTKView_renderer, PyObjCUnsupportedMethod_IMP) < 0) call_VTKView_renderer does the following: 1) Unwrap the VTKView python proxy. Call the unwrapped objc object self_objc. 2) rend = [self_objc renderer] 3) Wrap rend using VTK function. 4) Return wrapped rend I use PyObjCUnsupportedMethod_IMP as the fourth argument to PyObjC_RegisterMethodMapping but I'm not sure what this argument is for. When I compile the new module and load it into python. I gain access to the VTKView class and can instantiate it. When I call renderer() on an instance, I get the following python error: Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: argument list must be a tuple Is this because I don't have a callPython argument in my PyObjCUnsupportedMethod_IMP call? If so what needs to be put there? Carlos |
From: Tommie L. <3nr...@ya...> - 2003-12-06 07:45:29
|
FUEL SAVER PRO This revolutionary device Boosts Gas Mileage 27%+ by helping fuel burn bet= ter using three patented processes from General Motors. www.eoei.com?axel=3D49 PROVEN TECHNOLOGY A certified U.S. Environmental Protection Agency (EPA) laboratory recently= completed tests on the new Fuel Saver. The results were astounding! Maste= r Service, a subsidiary of Ford Motor Company, also conducted extensive em= issions testing and obtained similar, unheard of results. The achievements= of the Fuel Saver is so noteworthy to the environmental community, that C= ommercial News has featured it as their cover story in their June, 2000 ed= ition. Take a test drive Today - www.eoei.com?axel=3D49 No more advertisements, thanks - http://www.5jzd.org/out5s/pre-rem2e.asp tzxpnjw aqzgonbzqb ztiwfcyvcvexnje |
From: Francesco P. <fpi...@no...> - 2003-12-06 07:21:26
|
Hi, Thanks for the quick reply! I actually saw the test scripts but when I tried using the function, I got a sgefault :-( (that is why I thought that the function had not really been wrapped) What I do is the following: img_size = str (len (self.img_data)) + 'B' temp_data = struct.unpack (img_size, self.img_data) data = array.array ('B') for c in temp_data: data.append (c) del (temp_data) my_bitmap = NSBitmapImageRep.alloc().initWithBitmapDataPlanes_pixelsWide_pixelsHigh_ bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerR ow_bitsPerPixel_ ( (data, None, None, None, None), width, height, 8, 1, NO, YES, NSCalibratedWhiteColorSpace, width, 8) my_image = NSImage.alloc ().init () my_image.addRepresentation_ (my_bitmap) # display the image in the GUI self.server.controller.imgView.setImage_ (my_image) Am I trashing the memory somewhere? I guess so, but have no idea where... Cheers fra On Dec 6, 2003, at 12:03 AM, b.bum wrote: > On Dec 5, 2003, at 10:40 PM, Francesco Pierfederici wrote: >> The reason I am asking is that I am writing an application that >> receives a raster through a socket connection. The raster is a >> (potentially large) array of bytes that I would like to display as a >> grey-scale bitmap. Hence the need for NSBitmapImageRep and its >> initWithBitmapDataPlanes:...., unless, of course, there is a better >> way of doing displaying that data, other than using a >> NSBitmapImageRep! > > It is already partially mapped, but the assumption is that you have -- > effectively -- five data planes worth of color information passed in > as a tuple. > > I believe that this means it will just work in your case -- you would > need to pass a tuple like (greyScaleBytes, None, None, None, None) in > as the first argument. > > See Modules/Appkit/_AppKitMapping_NSBitmap.m for the mapping code. It > is incomplete. > > Better yet, see -- Lib/AppKit/test/test_nsbitmapimagerep.py -- as it > contains a set of unit tests that are passing and do pass bitmap data > across the bridge. > > So -- maybe -- Guido's time machine has been effective once again for > your particular use case. ;-) > > b.bum --- Francesco Pierfederici <fpi...@no...> NOAO/AURA Inc. http://www.noao.edu/staff/fpierfed/ 950 N. Cherry Ave. Phone: +1 520 318 8402 Tucson, AZ 85719 USA FAX: +1 520 318 8360 |
From: b.bum <bb...@ma...> - 2003-12-06 07:03:21
|
On Dec 5, 2003, at 10:40 PM, Francesco Pierfederici wrote: > The reason I am asking is that I am writing an application that > receives a raster through a socket connection. The raster is a > (potentially large) array of bytes that I would like to display as a > grey-scale bitmap. Hence the need for NSBitmapImageRep and its > initWithBitmapDataPlanes:...., unless, of course, there is a better > way of doing displaying that data, other than using a > NSBitmapImageRep! It is already partially mapped, but the assumption is that you have -- effectively -- five data planes worth of color information passed in as a tuple. I believe that this means it will just work in your case -- you would need to pass a tuple like (greyScaleBytes, None, None, None, None) in as the first argument. See Modules/Appkit/_AppKitMapping_NSBitmap.m for the mapping code. It is incomplete. Better yet, see -- Lib/AppKit/test/test_nsbitmapimagerep.py -- as it contains a set of unit tests that are passing and do pass bitmap data across the bridge. So -- maybe -- Guido's time machine has been effective once again for your particular use case. ;-) b.bum |
From: Francesco P. <fpi...@no...> - 2003-12-06 06:41:02
|
Hi, I just started using PyObjC and, so far, I am realy impressed by it! I have a question; are there plans to wrap initWithBitmapDataPlanes:.... (in NSBitmapImageRep)? The reason I am asking is that I am writing an application that receives a raster through a socket connection. The raster is a (potentially large) array of bytes that I would like to display as a grey-scale bitmap. Hence the need for NSBitmapImageRep and its initWithBitmapDataPlanes:...., unless, of course, there is a better way of doing displaying that data, other than using a NSBitmapImageRep! Thanks Francesco --- Francesco Pierfederici <fpi...@no...> NOAO/AURA Inc. http://www.noao.edu/staff/fpierfed/ 950 N. Cherry Ave. Phone: +1 520 318 8402 Tucson, AZ 85719 USA FAX: +1 520 318 8360 |
From: b.bum <bb...@ma...> - 2003-12-05 21:20:15
|
On Dec 5, 2003, at 12:57 PM, Jiva DeVoe wrote: > Forgive my lack of knowledge, please see my question below: > On Dec 5, 2003, at 12:53 PM, b.bum wrote: > >> A brief update of the current state of things: >> >> - Panther and Jaguar require different build styles (unless you have >> Frameworkized Python installed) >> > > isn't the Mac Python which ships with Panther a framework python? Yes -- which means that Panther and Frameworkized python build the same way. The non-linkable Jaguar python requires the different build style (that includes the execve() silliness). b.bum (Who was being remarkably obtuse in the original email... sorry). |