El dom, 30-08-2009 a las 12:20 -0400, Brent Chiodo escribió: > 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).
For this use case, I'd recommend you using directly a HildonPickerButton instead of creating a button, a dialog, and all the logic by hand. Check the docs for HildonPickerbutton. > 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' I am not familiar with the python bindings, so I have not much to say about these errors other than it seems that the registration of some of the types fail, which is strange.. > > > 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, HildonTouchSelector uses HildonTouchSelectorColumn for each of its columns. Since you want one single column, you need to create one and use the GtkCellLayout interface in the same way you would do for GtkTreeViewColumn. > 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. Maybe the python bindings are not fully working? Did you try with C instead? Claudio _______________________________________________ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers