From 1989lzhh at gmail.com Thu Sep 1 07:30:56 2011 From: 1989lzhh at gmail.com (=?GB2312?B?wfXV8bqj?=) Date: Thu, 1 Sep 2011 13:30:56 +0800 Subject: [Python.NET] Is there a chance to imprive Python for .net to let "System.Windows.Forms.Form().Controls" be indexable? Message-ID: Hi, here is the code: import clr clr.AddReference("System.Windows.Forms") from System.Windows.Forms import Form,Application,Button form=Form() form.Controls.Add(Button()) print form.Controls[0] #this code didnt work with an error say "not indexable object" but this worked in ironpython,it seems in ironpython it treats the "form.Controls" as an list like object I can only get the form.Controls value use the "form.Controls.get_Item(0)" in the python for .net So is there a chance to imprive Python for .net to have that characteristic? thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From barton at BCDesignsWell.com Fri Sep 2 08:29:21 2011 From: barton at BCDesignsWell.com (Barton) Date: Thu, 01 Sep 2011 23:29:21 -0700 Subject: [Python.NET] Is there a chance to imprive Python for .net to let "System.Windows.Forms.Form().Controls" be indexable? In-Reply-To: References: Message-ID: <4E6077C1.20105@BCDesignsWell.com> Yes, this is well worth looking into. I may be able to get to this this weekend. Thank you. On 8/31/2011 10:30 PM, ??? wrote: > Hi, > > here is the code: > > import clr > clr.AddReference("System.Windows.Forms") > from System.Windows.Forms import Form,Application,Button > form=Form() > form.Controls.Add(Button()) > print form.Controls[0] #this code didnt work with an error say "not > indexable object" > > but this worked in ironpython,it seems in ironpython it treats the > "form.Controls" as an list like object > I can only get the form.Controls value use the > "form.Controls.get_Item(0)" in the python for .net > So is there a chance to imprive Python for .net to have > that characteristic? > > thanks > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From barton at BCDesignsWell.com Fri Sep 2 08:52:02 2011 From: barton at BCDesignsWell.com (Barton) Date: Thu, 01 Sep 2011 23:52:02 -0700 Subject: [Python.NET] Several patches to improve compilation with Mono In-Reply-To: <4E5E502C.5050907@googlemail.com> References: <4DC1539E.1080509@googlemail.com> <4E5B2735.6030203@bcdesignswell.com> <4E5E502C.5050907@googlemail.com> Message-ID: <4E607D12.6020400@BCDesignsWell.com> Thanks, Philip, Nice to know that you're still around. All these build tool issues make me a little crazy. My background on on Windows, but I'm trying to divorce myself from the M$ platform. (I just adore my Fedora system) But things are still a little new to me on the Linux side. Now that I'm all set up with side-by-side build, and can serve my own SVN repo locally, I'll pull together all the contributions and finally commit to the VS2008 that I've been building with. TWIMC: Interestingly, the github version has fully integrate nUnit integration (turns out a bit of this has leaked onto the trunk and broke my TestModule module). It makes me wonder if it's worth committing to the nUnit dependency..? On 8/31/2011 8:15 AM, Philip Lorenz wrote: > Hi Barton, > > On 08/29/2011 07:44 AM, Barton wrote: >> So if git is producing your udiff files, does that mean that you are >> actually pulling from the clone that's on github? > I used the GIT-SVN bridge in order to create those patches. But may be > something was wrong with my working copy. > >> I (sort or) like the clrmodule_make.il input file name, but what to do >> for Windows folks? > I haven't personally used the Makefile on Windows based systems (I > always built Python.NET using the bundled Visual Studio Solution file). > I don't know how exactly the Makefile would be invoked on Windows (is it > a nmake compatible syntax?). A way to solve the issue could be to > replace the "cp oldmodule.il clrmodule_make.il" statement in the else > case with "copy clrmodule.il clrmodule_make.il". > > Philip > From barton at BCDesignsWell.com Sat Sep 3 05:17:33 2011 From: barton at BCDesignsWell.com (Barton) Date: Fri, 02 Sep 2011 20:17:33 -0700 Subject: [Python.NET] Is there a chance to imprive Python for .net to let "System.Windows.Forms.Form().Controls" be indexable? In-Reply-To: References: Message-ID: <4E619C4D.7080509@BCDesignsWell.com> Very interesting; Apparently, Microsoft doesn't think that it is a useful thing to index directly into a System.Windows.Forms.Control.ControlCollection Class. The collection is still iterable in versions above 2.0, but the class no longer supports indexing. So: >>> print form.Controls[0] # works in pythondotnet built on .NET 2.0 on prior. >>> for ctrl in form.Controls: print ctrl # works in .NET 3.0 and above. Compare http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection_properties.aspx with http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection_properties%28VS.80%29.aspx and you'll see that all ICollection and IList properties have been removed. Reasons why are a good topic for future discussion. On 8/31/2011 10:30 PM, ??? wrote: > Hi, > > here is the code: > > import clr > clr.AddReference("System.Windows.Forms") > from System.Windows.Forms import Form,Application,Button > form=Form() > form.Controls.Add(Button()) > print form.Controls[0] #this code didnt work with an error say "not > indexable object" > > but this worked in ironpython,it seems in ironpython it treats the > "form.Controls" as an list like object > I can only get the form.Controls value use the > "form.Controls.get_Item(0)" in the python for .net > So is there a chance to imprive Python for .net to have > that characteristic? > > thanks > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From barton at BCDesignsWell.com Sun Sep 4 01:04:39 2011 From: barton at BCDesignsWell.com (Barton) Date: Sat, 03 Sep 2011 16:04:39 -0700 Subject: [Python.NET] Is there a chance to imprive Python for .net to let "System.Windows.Forms.Form().Controls" be indexable? In-Reply-To: <4E619C4D.7080509@BCDesignsWell.com> References: <4E619C4D.7080509@BCDesignsWell.com> Message-ID: <4E62B287.3060900@BCDesignsWell.com> Here's a snippet that may help a little if you really need to get at a control that has been added to a parent control: import clr import System clr.AddReference("System.Windows.Forms") from System.Windows.Forms import Form, Button myBtnName = "button1" form1 = Form() def AddButton(form, btnName): btn = Button() btn.Name = btnName btn.Text = "Click Me" form.Controls.Add(btn) AddButton(form1, myBtnName) ctrls = form1.Controls.Find(myBtnName, False) btn = ctrls[0] if isinstance(btn, Button): print repr(btn) print btn.Name System.Windows.Forms.Application.EnableVisualStyles() System.Windows.Forms.Application.Run(form1) On 9/2/2011 8:17 PM, Barton wrote: > Very interesting; > Apparently, Microsoft doesn't think that it is a useful thing to index > directly into a System.Windows.Forms.Control.ControlCollection Class. > The collection is still iterable in versions above 2.0, but the class > no longer supports indexing. So: > > >>> print form.Controls[0] # works in pythondotnet built on > .NET 2.0 on prior. > > >>> > > for ctrl in form.Controls: > print ctrl # works in .NET 3.0 and above. > > > Compare > http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection_properties.aspx > with > http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection_properties%28VS.80%29.aspx > and you'll see that all ICollection and IList properties have been > removed. > > Reasons why are a good topic for future discussion. > > On 8/31/2011 10:30 PM, ??? wrote: >> Hi, >> >> here is the code: >> >> import clr >> clr.AddReference("System.Windows.Forms") >> from System.Windows.Forms import Form,Application,Button >> form=Form() >> form.Controls.Add(Button()) >> print form.Controls[0] #this code didnt work with an error say "not >> indexable object" >> >> but this worked in ironpython,it seems in ironpython it treats the >> "form.Controls" as an list like object >> I can only get the form.Controls value use the >> "form.Controls.get_Item(0)" in the python for .net >> So is there a chance to imprive Python for .net to have >> that characteristic? >> >> thanks >> >> >> _________________________________________________ >> Python.NET mailing list -PythonDotNet at python.org >> http://mail.python.org/mailman/listinfo/pythondotnet > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad at fie.us Sun Sep 4 03:02:17 2011 From: brad at fie.us (Bradley Friedman) Date: Sat, 3 Sep 2011 21:02:17 -0400 Subject: [Python.NET] patch - further makefile changes based on OSX building Message-ID: <37A42C94-D857-45BB-B8BA-11C739A3E592@fie.us> I just checked out trunk and ran through the process of making it work for OSX in pursuit of a more perfect build system. Thought I'd share the results (and diff). To accomplish this, I had to set up the PKG_CONFIG_PATH manually to point to the version of python I wanted to use, and to the mono I wanted to use. And as you can see in the diff, I had to pull some bad code out that wasn't using pkg-config, where it really should be. I suspect the contentious part will be where I remove an evaluation of python code into distutils, and instead use pkg-config to get the flags. I think both of these changes really strongly point to a need for a "configure" script. Getting build flags from the currently resolving shell command "python" doesn't really take into account the reality that python is often compiled directly into 3rd party applications? such as say, Maya or Nuke, from the visual effects world of applications. These are valid alternative cpython runtimes that are installed and will be able to take the clr module if the build system allows you to configure to target them rather than the one that happens to run when you type "python" at a shell. As far as the mono version goes? I actually have three. A binary package installed form the mono project's download page. An alternative build out of mac-ports. And? the one I actually built against, a build of the latest released tar ball, turning on their experimental 64bit support. There are issues with the others as they are 32bit only? and in lion land.. well we've gone 64bit and its a mess. But I figure: that it builds against a proper 64bit version, when you provide it, is a good thing. Anyhow, with the changes in the diff and the extra step of configuring the PKG_CONFIG_PATH environment variable by hand, it builds and I can import clr in the system installed python2.7. And I can run some methods off the System.IO.Path class. So well? TADA! Attached is a diff of what I did. Dunno if you want to consider applying it. I have not tested it on ubuntu, redhat or windows. But I'm curious as to thoughts on what I did. Thanks. -brad -------------- next part -------------- A non-text attachment was scrubbed... Name: pythonnet_osx_build_fixes01_v001.diff Type: application/octet-stream Size: 2817 bytes Desc: not available URL: From 1989lzhh at gmail.com Sun Sep 4 05:31:32 2011 From: 1989lzhh at gmail.com (=?GB2312?B?wfXV8bqj?=) Date: Sun, 4 Sep 2011 11:31:32 +0800 Subject: [Python.NET] Is there a chance to imprive Python for .net to let "System.Windows.Forms.Form().Controls" be indexable? In-Reply-To: <4E628171.30902@BCDesignsWell.com> References: <4E619C4D.7080509@BCDesignsWell.com> <4E628171.30902@BCDesignsWell.com> Message-ID: Hi Barton, Thanks for your reply,I really appriciate! Here is my thought: ? 2011?9?4? ??3:35?Barton ??? > ** > Yes, I agree that the Item Property is still there. > It seems to be exposed ONLY FROM IEnumerator.GetEnumerator() or the > Findxxx() functions provided by the class due to its virtual nature: > > public *virtual *Control this [ int index ] { get; } > * * I don't think the Item Property isn't exposed due to its virtual nature. I did some test in C#,it turns out that the virtual modified Item property can be accessed by python .net with the index manner .I noticed there is a new function "get_Item" being add to the instance object. The same new function "get_Item" can be find in the Form().Controls but Form().Controls can not be indexable. It is wield. I check the source code of python for .net and find this from "classmanager.cs": // Check for indexer ParameterInfo[] args = pi.GetIndexParameters(); if (args.GetLength(0) > 0) { Indexer idx = ci.indexer; if (idx == null) { ci.indexer = new Indexer(); idx = ci.indexer; } idx.AddProperty(pi); continue; } Maybe the mechanism of checking for indexer is not perfect? Thanks! > > Hope that helps > > > On 9/3/2011 7:09 AM, ??? wrote: > > Hi Barton? > thanks for your reply. > I have check the MSDN documents. It seems the Item properties both exist in > .net2.0 and .net4.0 > here is the MSDN for > http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection_properties%28VS.80%29.aspx > [image: Public property] Item[Int32] Indicates > the Control at > the specified indexed location in the collection. [image: Public > property] Item[String] Indicates > a Control with > the specified key in the collection. > and I get the blew code from C# > " > public class ControlCollection : ArrangedElementCollection, IList, > ICollection, IEnumerable, ICloneable { > public virtual Control this[int index] { get; } > public virtual Control this[string key] { get; } > " > In C# the Controls support index,So I think It will be intuitive for > Controls to support index. > > > > 2011/9/3 Barton > >> Very interesting; >> Apparently, Microsoft doesn't think that it is a useful thing to index >> directly into a System.Windows.Forms.Control.ControlCollection Class. >> The collection is still iterable in versions above 2.0, but the class no >> longer supports indexing. So: >> >> >>> print form.Controls[0] # works in pythondotnet built on .NET >> 2.0 on prior. >> >> >>> >> >> for ctrl in form.Controls: >> print ctrl # works in .NET 3.0 and above. >> >> >> Compare >> >> http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection_properties.aspx >> with >> >> http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection_properties%28VS.80%29.aspx >> and you'll see that all ICollection and IList properties have been >> removed. >> >> Reasons why are a good topic for future discussion. >> >> >> On 8/31/2011 10:30 PM, ??? wrote: >> >> Hi, >> >> here is the code: >> >> import clr >> clr.AddReference("System.Windows.Forms") >> from System.Windows.Forms import Form,Application,Button >> form=Form() >> form.Controls.Add(Button()) >> print form.Controls[0] #this code didnt work with an error say "not >> indexable object" >> >> but this worked in ironpython,it seems in ironpython it treats the >> "form.Controls" as an list like object >> I can only get the form.Controls value use the "form.Controls.get_Item(0)" >> in the python for .net >> So is there a chance to imprive Python for .net to have >> that characteristic? >> >> thanks >> >> >> _________________________________________________ >> Python.NET mailing list - PythonDotNet at python.org >> http://mail.python.org/mailman/listinfo/pythondotnet >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From barton at BCDesignsWell.com Sun Sep 4 08:39:45 2011 From: barton at BCDesignsWell.com (Barton) Date: Sat, 03 Sep 2011 23:39:45 -0700 Subject: [Python.NET] Is there a chance to imprive Python for .net to let "System.Windows.Forms.Form().Controls" be indexable? In-Reply-To: References: <4E619C4D.7080509@BCDesignsWell.com> <4E628171.30902@BCDesignsWell.com> Message-ID: <4E631D31.4050306@BCDesignsWell.com> OK - I'll look into this further. It turns out the .NET 3.5 DOES allow this: namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Button btnCopy; Button btn = new Button(); this.Controls.Add(btn); btnCopy = (Button)this.Controls[0]; bool yes = (btn == btnCopy); } } } On 9/3/2011 8:31 PM, ??? wrote: > Hi Barton, > > **I don't think the Item Property isn't exposed due to its virtual > nature. I did some test in C#,it turns out that the virtual modified > Item property can be accessed by python .net with the index manner .I > noticed there is a new function "get_Item" being add to the instance > object. The same new function "get_Item" can be find in the > Form().Controls but Form().Controls can not be indexable. It is wield. > I check the source code of python for .net and find this from > "classmanager.cs": > // Check for indexer > ParameterInfo[] args = pi.GetIndexParameters(); > if (args.GetLength(0) > 0) { > Indexer idx = ci.indexer; > if (idx == null) { > ci.indexer = new Indexer(); > idx = ci.indexer; > } > idx.AddProperty(pi); > continue; > } > Maybe the mechanism of checking for indexer is not perfect? > Thanks! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathedotnet at gmail.com Thu Sep 22 09:03:35 2011 From: mathedotnet at gmail.com (MATHE MANOJ) Date: Thu, 22 Sep 2011 12:33:35 +0530 Subject: [Python.NET] Regarding PyTables In-Reply-To: <37FD229967963E49953A5D552169A9880DD0B1A5@IN-BLR-MAIL2.corp.capgemini.com> References: <37FD229967963E49953A5D552169A9880DD0B1A5@IN-BLR-MAIL2.corp.capgemini.com> Message-ID: Hello All **** I am very new in using IronPython and now my task is to use Pytables in C# using IronPython as interpreter.**** After some R&D I came to know that it can?t be done, but i didn?t get the exact solution on the work around and even the difficulties on this, can anyone help me on this.**** ** ** Thanks**** ** ** Manoj -------------- next part -------------- An HTML attachment was scrubbed... URL: From barton at BCDesignsWell.com Sat Sep 24 08:32:45 2011 From: barton at BCDesignsWell.com (Barton) Date: Fri, 23 Sep 2011 23:32:45 -0700 Subject: [Python.NET] Regarding PyTables In-Reply-To: References: <37FD229967963E49953A5D552169A9880DD0B1A5@IN-BLR-MAIL2.corp.capgemini.com> Message-ID: <4E7D798D.8050606@BCDesignsWell.com> PythonDotNet integrates into CPython so that we enjoy compatibility with most of the 3rd party extensions and none of the M$ bloat. The IronPython mail list may be joined at the follow link http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Perhaps you may find help there. On 9/22/2011 12:03 AM, MATHE MANOJ wrote: > > Hello All > > I am very new in using IronPython and now my task is to use Pytables > in C# using IronPython as interpreter. > > After some R&D I came to know that it can't be done, but i didn't get > the exact solution on the work around and even the difficulties on > this, can anyone help me on this. > > Thanks > > Manoj > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: