Ok, so almost there, just need to bind the values and actually show the data!

#data
data=Clutter.ListModel()
data.set_types([str])
data.set_names(["Name"])
data.appendv([0], ["test1"])
data.appendv([0], ["test2"])
data.appendv([0], ["test3"])
#list
sidebar=Mx.ListView()
sidebar.set_width(250)
sidebar.set_model(data)
sidebar.set_item_type(Mx.Label())
sidebar.set_factory(SidebarItemFactory())
#factory
class SidebarItemFactory(Clutter.Actor, Mx.ItemFactory):
    def create(self):
        print "sidebaritemfactory:create"
        item=Mx.Label()
        item.set_text("sidebar item")
        return item

This shows a blank area where my list view should be, and stdout never displays "sidebaritemfactory:create"? What I want to achieve is a list which selectable items.. is this even the best way to do this? If it is, how can I get it working please!

I had to add Clutter.Actor to my Factory as it required it to be a derivative of GObject, and I wasn't sure how else to do this?

Thanks,
Thomas


On 25/10/11 22:37, Bastian Winkler wrote:
On Tue, Oct 25, 2011 at 10:02:09PM +0100, Tom medhurst wrote:
Thanks for the tips! I know 1 is pretty old (I've worked bleeding edge
on another project) - was doing some  prototyping on Ubuntu and 1.0 is
their latest stable release listed! (Perhaps there is a reason for
this..?)
OK, given that this is the ubuntu package, the '1.0' is just the ABI
version of clutter. The 'real' clutter version should be 1.8.0.
http://packages.ubuntu.com/source/oneiric/clutter-1.0

Will give this a go and come back if I have any probs.

Btw... :wq seriously? What's wrong with ZZ? ;)
1) It's a habit
2) Using 'ZZ buz' as a signature would imply that I'm a long bearded
80ies-rock musician :P

Thomas :)

:wq buz


On Oct 25, 2011 7:19 PM, "Bastian Winkler"<[email protected]>  wrote:

Hi Tom,

On Tue, Oct 25, 2011 at 06:14:37PM +0100, Tom medhurst wrote:
Hi Guys,

Trying to create a Clutter.ListModel in python using GObject
Introspection..
Probably doing something wrong, but can't see what it is..

from gi.repository import GObject, Clutter, Mx
Clutter.init(["--clutter-debug=all"])
m=Clutter.ListModel()
m.newv(1, GObject.type_from_name("gchararray"), "name")
*BANG*
*Segmentation Fault*
calling Clutter.ListModel() already creates the instance, so there's no
need to call the constructor again.

...Also newv only takes "4" args (incl. *self*), so how do I specify more
than one column?
hmm, looks like clutter_list_model_newv is missing some GI annotations.

If someone could provide me with a working version of the code above,
that
would be awesome!
model = Clutter.ListModel()
model.set_types([int, str, Clutter.Actor])
model.set_names(["anint", "astring", "anactor"])

uname -r:
*Linux %HOSTNAME% 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17
UTC
2011 i686 i686 i386 GNU/Linux*

python -V:
*Python 2.7.2+*

clutter is version 1.0-0 and libmx is version 1.0-2
clutter-1.0, seriously?


so long

:wq buz
--
/* After several hours of tedious analysis, the following hash
  * function won.  Do not mess with it... -DaveM
  */
        2.2.16 /usr/src/linux/fs/buffer.c

GnuPG Fingerprint: 2FFF FC48 C7DF 1EA0 00A0  FD53 8C35 FD2E 6908 7B82

_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list


_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to