[IronPython] TreeStore ...

Zoltan Varga vargaz at gmail.com
Wed Oct 6 13:50:55 CEST 2004


                                          Hi,

  This doesn't work because the TreeStore ctor is defined as:

		public TreeStore (params GLib.GType[] types)

while IronPython converts the arguments to an object[] array, not to the 
array type required by the method. The place where this needs to be fixed is
ReflectedMethodBase.BindArgs (), specially this line:

				if (IsParamArray(pi)) {
					//!!! add error checking and non-object arrays

so this is a bug/limitation in the current IronPython release.

                         Zoltan



On Tue, 05 Oct 2004 21:57:04 +0000, Phillip Neumann <bob at sofsis.cl> wrote:
> Ok.
> 
> Here is what im doing in C# that i wish to do with python:
> 
> C# file:
> --------
> 
> using System;
> using Gtk;
> 
> public class TreeViewSample {
> 
>      public static void Main (string [] args)
>      {
>           Application.Init ();
>           Window win = new Window ("Demo");
>           win.SetDefaultSize (400,250);
> 
>           TreeStore store = new TreeStore (typeof (string), typeof
> (string));
>           TreeIter iter = store.AppendValues ("Hello","all");
> 
>           TreeView tv = new TreeView ();
>           tv.Model = store;
>           tv.HeadersVisible = true;
>           tv.AppendColumn ("Demo", new CellRendererText (), "text", 0);
>           tv.AppendColumn ("Data", new CellRendererText (), "text", 1);
> 
>           win.Add (tv);
>           win.ShowAll ();
>           Application.Run ();
>      }
> 
> }
> 
> -------> Works perfectly
> 
> IronPython try:
> ------------------
> import System
> from Gtk import *
> 
> class TreeViewSample:
>         def __init__(self):
>                 Application.Init ();
>                 win = Window("Demo");
>                 win.SetDefaultSize (400,250)
> 
>                 store = TreeStore ( str, str)
>                 store.AppendValues ("Hello","all")
> 
>                 #Ones the Store works, i hope TreeView works too...
>                 #tv = TreeView ()
>                 #tv.Model = store
>                 #tv.HeadersVisible = true
>                 #tv.AppendColumn ("Demo", CellRendererText (), "text", 0)
>                 #tv.AppendColumn ("Data", CellRendererText (), "text", 1)
> 
>                 #win.Add (tv)
>                 win.ShowAll ()
>                 Application.Run ()
> 
> TreeViewSample()
> 
> killfill at book ~/MONO> ironpython pythontry.py
> 
> Unhandled Exception: System.ArgumentException: parameters
> in <0x00085> System.Reflection.MonoCMethod:Invoke
> (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
> in <0x0001d> System.Reflection.MonoCMethod:Invoke
> (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
> in <0x00044> System.Reflection.ConstructorInfo:Invoke (object[])
> in <0x000f9> IronPython.Objects.ReflectedMethodBase:Call (object[])
> in <0x00029> IronPython.Objects.ReflectedType:Call (object[])
> in <0x00210> IronPython.Objects.Ops:Call (object,object,object)
> in <0x000f9> __main__:__init__$f0 (object)
> in <0x0006d> (wrapper delegate-invoke)
> System.MulticastDelegate:invoke_object_object (object)
> in <0x00026> IronPython.Objects.Function1:Call (object)
> in <0x00053> IronPython.Objects.Function1:Call (object[])
> in <0x000b8> IronPython.Objects.Ops:Call (object,object[])
> in <0x00021> IronPython.Objects.Method:Call (object[])
> in <0x000b8> IronPython.Objects.Ops:Call (object,object[])
> in <0x00046> IronPython.Objects.Ops:TryToInvoke
> (object,string,object&,object[])
> in <0x0004c> IronPython.Objects.OldClass:Call (object[])
> in <0x001b3> IronPython.Objects.Ops:Call (object)
> in <0x000c2> __main__:init ()
> in <0x002a0> IronPythonConsole.IronPython:DoFile (string[])
> in <0x0005d> IronPythonConsole.IronPython:Main (string[])
> 
> ive try to use instead of str System.String and GLib.Type.String but the
> result is the same.
> 
> Anyone ever made use a TreeView in Ironpython?....
> 
> thank you very much
> 
> 
> 
> --
> Phillip Neumann <bob at sofsis.cl>
> 
> _______________________________________________
> users-ironpython.com mailing list
> users-ironpython.com at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



More information about the Ironpython-users mailing list