Am Montag, den 01.03.2010, 12:41 +0100 schrieb Piñeiro: > With the time I learned that there are some confusion with the term > "column" in the touch selector, because the GtkTreeModel also have > columns, but you have one model per column (so there are > touchselector-columns and treemodel-columns) > > If you want to have a icon and normal text *in the same line* you > don't require several columns, you just one column, but with different > cell renderers, that take the data from different columns in the > model.
Thank you for your explanation. That was my error in reasoning. > This code creates a model with icon data. In one column it places the > name of the icon, and in the other the name of the icon. Then it > places two cell renderes, one draw the text, the other the icon. > > The code is somewhat more complex that the common use of the touch > selector, but the common use is just a "combobox with text > replacement". > > Sorry, this is C code, I don't know how to make it in python, but I > suppose that it would be similar. This code has helped me to rewrite it in python. See the attachment. Thank you :) You helped me a lot. I have only a small logic problem. I have to call a renderer in append_column - None as in the documentation won't work. column = selector.append_column(store_icons, renderer) #i have to call a renderer, not None And the application raises a warning multi_cells_example.py:21: GtkWarning: gtk_tree_view_column_cell_layout_pack_start: assertion `! gtk_tree_view_column_get_cell_info (column, cell)' failed column.pack_start(renderer, 0) but the application works :) > Well, the idea is use the touch selector without requiring to pan > horizontally. > > Anyway you are right that force to do that can be too extreme. Taking > a look to the code, right now the default mode for the pannable area > is use only vertical scrolling, and there are no way to change that > using the touch selector API. Probably you are right. I should edit the data so that it fit into the list. I can edit the size, too. The last problem is, if it is possible to place a gtk.Entry field on the hildon-desktop. I get no focus in it. Perhaps the hildon-desktop is only clickable? I have only seen a solution where a seperate dialog will popup. with kind regards Patrick
#!/usr/bin/env python
import pygtk
import gtk
import hildon
import gobject
def create_customized_selector():
selector = hildon.TouchSelector()
icon_list = gtk.stock_list_ids()
store_icons = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
for item in icon_list:
new_iter = store_icons.append()
store_icons.set(new_iter, 0, item, 1, item)
renderer = gtk.CellRendererPixbuf()
renderer.set_fixed_size(-1, 100)
column = selector.append_column(store_icons, renderer) #i have to call a renderer, not None
column.pack_start(renderer, 0)
column.set_attributes(renderer, stock_id=0)
renderer = gtk.CellRendererText()
renderer.set_property('xalign', 0.5) # set it to center
# renderer.set_property('size-points', 12) # set the size manually
column.pack_start(renderer, 1)
column.set_attributes(renderer, text=1)
selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_SINGLE)
column.set_property("text-column", 0)
return selector
def app_quit(widget, data=None):
gtk.main_quit()
def main():
program = hildon.Program.get_instance()
gtk.set_application_name("hildon-touch-selector example program")
window = hildon.StackableWindow()
program.add_window(window)
selector = create_customized_selector()
window.add(selector)
window.connect("destroy", app_quit)
window.show_all()
gtk.main()
if __name__ == "__main__":
main()
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ maemo-developers mailing list [email protected] https://lists.maemo.org/mailman/listinfo/maemo-developers
