[maemo-developers] Python + hildon.TouchSelector (with pixbufs)
From: Brent Chiodo bchiodo at gmail.comDate: Sun Aug 30 19:20:11 EEST 2009
- Previous message: open source licensing of maemo 5 example code MIT vs GPL
- Next message: Python + hildon.TouchSelector (with pixbufs)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm trying to create a simple dialog that opens when you tap a button. In
this dialog, I want to place in it a hildon.TouchSelector that has a single
column comprised of pixbufs (logos of websites). Just to see if I could get
a TouchSelector working, I created a simple one that just uses text labels
instead of pixbufs. Here is the pertinent part of the code:
# This part is the button that opens the dialog
self.select_button = gtk.Button()
self.select_icon =
gtk.gdk.pixbuf_new_from_file_at_size("/usr/share/touchsearch/select_search_engine.png",
40, 40)
self.select_image = gtk.Image()
self.select_image.set_from_pixbuf(self.select_icon)
self.select_image.set_padding(settings['padding'],
settings['padding'])
self.select_button.set_image(self.select_image)
self.select_button.connect("clicked", self.select_engine_dialog)
self.select_button.show_all()
...
# And this is the dialog with the Touchselector in it
def select_engine_dialog(self, widget):
dialog = gtk.Dialog("Select A Site To Search", None,
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR)
close_button = dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
selector = hildon.hildon_touch_selector_new_text()
searches = ["Google", "eBay", "Amazon", "Merriam-Webster", "Google
Maps", "Google Images", "maemo.org"]
for i in searches:
selector.append_text(i)
dialog.vbox.add(selector)
dialog.show_all()
response = dialog.run()
dialog.destroy()
When I run this example I get exactly what I expected except the
TouchSelector doesn't scroll -- when I drag it in either direction it shows
me the indicator of where the focus is, but it doesn't move.
Errors from traceback are:
/usr/lib/hildon-desktop/touchsearch.py:68: Warning: cannot register existing
type `HildonPannableAreaMode'
selector = hildon.hildon_touch_selector_new_text()
/usr/lib/hildon-desktop/touchsearch.py:68: Warning: g_param_spec_enum:
assertion `G_TYPE_IS_ENUM (enum_type)' failed
selector = hildon.hildon_touch_selector_new_text()
/usr/lib/hildon-desktop/touchsearch.py:68: Warning:
g_object_class_install_property: assertion `G_IS_PARAM_SPEC (pspec)' failed
selector = hildon.hildon_touch_selector_new_text()
/usr/lib/hildon-desktop/touchsearch.py:68: Warning: cannot register existing
type `HildonMovementMode'
selector = hildon.hildon_touch_selector_new_text()
/usr/lib/hildon-desktop/touchsearch.py:68: Warning: g_param_spec_flags:
assertion `G_TYPE_IS_FLAGS (flags_type)' failed
selector = hildon.hildon_touch_selector_new_text()
/usr/lib/hildon-desktop/touchsearch.py:68: Warning: cannot register existing
type `HildonSizeRequestPolicy'
In addition to that, once I get that working how would I go about getting
pixbufs in there instead of just text? I'm familiar with how to create a
gtk.TreeView, but don't know how to apply this knowledge to a Touchelector
e.g. the example found here:
http://pymaemo.garage.maemo.org/documentation/python_hildon_tutorial/html/ch-Selectors.html#example-of-a-selector-with-a-custom-column
...doesn't work.
TIA.
--
Best Regards,
Brent Chiodo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20090830/ffafe87e/attachment.htm
- Previous message: open source licensing of maemo 5 example code MIT vs GPL
- Next message: Python + hildon.TouchSelector (with pixbufs)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
