View Full Version : mokoui2 + Python bindings now in Extras (finger scroll)
If you're developing a app that can profit from a finger-scrollable view in GTK+/C or PyGTK/Python, you can now use libmokoui2 and its Python bindings (python-mokoui) from Diablo Extras (modified the Ubuntu source package to build for Maemo).
mokoui's FingerScroll widget even has the rubberband effect at the end of the list - very cool! :)
mokoui.FingerScroll can be used as a drop-in replacement for gtk.ScrolledWindow. Here's a small example in Python/PyGTK to get you started:
import gtk
import mokoui
mokoscroll = mokoui.FingerScroll()
# uncomment the following for "rotating" scroll mode
#mokoscroll.set_property('mode', 1)
treeview = gtk.TreeView()
model = gtk.ListStore(str)
for i in range(100):
model.append([str(i)])
treeview.set_model(model)
column = gtk.TreeViewColumn('Blubb', gtk.CellRendererText(), text=0)
treeview.append_column(column)
w = gtk.Window()
w.connect('destroy', gtk.main_quit)
mokoscroll.add(treeview)
w.add(mokoscroll)
w.show_all()
gtk.main()
Khertan
12-17-2008, 10:04 AM
Could be interesting ...
Khertan
12-17-2008, 02:05 PM
Hi !
I ve just a sad implementation on mCalendar ... and this slow ... really slow too much to be useable.
:(
I ve try it also on a fixed height TreeView with only one column for mnotes. And after first bad feeling ... i can say it can be use for simple treeview.
Maybe it can be optimized a bit ?
But anyway keep this good work. I ll use it for the next release of mCalendar. I like the fact that this is a gtk widget !
oh and this slow also with a treeview containing photo.
branitar
12-17-2008, 04:32 PM
I'll definitely give it a try. Is there some kind of API-documentation for it?
Khertan
12-17-2008, 05:06 PM
The pydoc of course
bongo
12-17-2008, 05:08 PM
I like this widget ...
but how can I disable the rubberband effect?
yukky
12-17-2008, 06:08 PM
Any screenshots/videos?
Any screenshots/videos?
See this post for a demo video of my first experimental usage of this in gPodder:
http://www.internettablettalk.com/forums/showpost.php?p=250041&postcount=179
I like this widget ...
but how can I disable the rubberband effect?
I don't think this is possible. At least the docs don't say anything specific. Maybe you have to dig into the C code and write a patch and submit it upstream?
I'll definitely give it a try. Is there some kind of API-documentation for it?
http://docs.openmoko.org/references/libmokoui2_r3462/doc/reference/html/ (the C library)
Or "pydoc mokoui" for the Python-ish documentation of the widgets. As usual, the Python API is analog to the C API, just like with PyGTK/PyCairo, etc..
branitar
12-18-2008, 08:16 AM
http://docs.openmoko.org/references/libmokoui2_r3462/doc/reference/html/ (the C library)
Or "pydoc mokoui" for the Python-ish documentation of the widgets. As usual, the Python API is analog to the C API, just like with PyGTK/PyCairo, etc..
That's what I was looking for, thanks! "pydoc mokoui" would have worked if i actually had installed it, but I wanted to have a look at the API first before doing so.
Khertan
12-18-2008, 08:21 AM
if you have ipython installed you can also do :
$ipython
import mokoui
help(mokoui)
branitar
12-18-2008, 11:34 AM
Hehe, i meant, i haven't installed python-mokoui yet ;)
how can I disable the rubberband effect?
You currently cannot disable it completely (i.e. disable the possibility to "overscroll") at runtime (it's a patch applied at compile-time, "debian/spring2.patch" in the source package).
However, the following worked for me and makes the content "jump back" into position instead of slowly dragging back into position (in Python):
fs.set_property('spring-speed', 0)
Or in GTK+/C, set the "spring-speed" property of the MokoFingerScroll GObject to 0.0.
branitar
12-20-2008, 04:37 PM
Ok, I tried it an I've got two questions:
I'm using a derived CellRendererText for the cells...
1) Do I really have to set the "mode" property of the renderer to gtk.CELL_RENDERER_MODE_ACTIVATABLE to be able to receive events when the cell is clicked/touched?
2) Is it possible to prevent the cells from changing to "selected" mode when they are clicked/touched?
Ok, I tried it an I've got two questions:
I'm using a derived CellRendererText for the cells...
1) Do I really have to set the "mode" property of the renderer to gtk.CELL_RENDERER_MODE_ACTIVATABLE to be able to receive events when the cell is clicked/touched?
Maybe, yes (means: sorry, I don't know :)
2) Is it possible to prevent the cells from changing to "selected" mode when they are clicked/touched?
You can "connect" to the button press and button release event and return True (in C: TRUE) in that handler to prevent other button press and button release handlers from being invoked, effectively preventing cells from being selected when they are touched.
branitar
01-02-2009, 05:29 PM
Hmmm I think I found a bug or something: set property "mode" to 1 (kinetic scrolling), do some scrolling, then set it to 0 (normal/push scrolling ). The rubberband effect when you get to the end of the list will be gone then. you get it back, when you set "mode" back to 1, but in normal mode you can scroll the list out of the viewport and it wont come back.
Can anyone confirm that?
Hmmm I think I found a bug or something: set property "mode" to 1 (kinetic scrolling), do some scrolling, then set it to 0 (normal/push scrolling ). The rubberband effect when you get to the end of the list will be gone then. you get it back, when you set "mode" back to 1, but in normal mode you can scroll the list out of the viewport and it wont come back.
Can anyone confirm that?
Please file a bug at https://launchpad.net/ubuntu/+source/libmokoui2
Thanks! :)
branitar
01-03-2009, 12:50 PM
Well, I'm not sure whether it is a real bug or whether I just f...ed up something. that's why i wanted some confirmation ;)
P.S: Reported it.
Thanks! I've subscribed myself to that bug and will update the Maemo package when they provide a fixed version of that package.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.