|
|
2010-09-24
, 00:48
|
|
Posts: 9 |
Thanked: 24 times |
Joined on Dec 2009
@ Brasil
|
#2
|
|
|
2010-09-24
, 14:41
|
|
Posts: 5 |
Thanked: 1 time |
Joined on Sep 2010
|
#3
|
python bug.py

#!/usr/bin/python
# -*- coding: utf-8 -*-
import gtk
import pygtk
import hildon
class inventory:
def __init__(self):
self.main_window = hildon.StackableWindow()
self.dep_button = hildon.PickerButton(gtk.HILDON_SIZE_AUTO,
hildon.BUTTON_ARRANGEMENT_VERTICAL)
self.dep_button.set_title("test")
self.selector = hildon.TouchSelectorEntry(text=True)
self.selector.connect("changed", self.selection_changed)
for i in range(5):
self.selector.append_text(str(i))
self.main_window.add(self.dep_button)
self.dep_button.set_selector(self.selector)
self.main_window.show_all()
def selection_changed(self, column, user_data):
print "Begining the signal event"
print "End of the signal event"
if __name__ == "__main__":
inventory()
gtk.main()
|
|
2010-09-24
, 17:43
|
|
Posts: 540 |
Thanked: 288 times |
Joined on Sep 2009
|
#4
|
|
|
2010-09-28
, 09:20
|
|
Posts: 5 |
Thanked: 1 time |
Joined on Sep 2010
|
#6
|
I'am currently developping a Python App for the N900.
The interface is based on PyGTK and Hildon (some parts are made in Glade).
I'am having some trouble with the Hildon Widget TouchSelector.
This widget has two signals:
(Quoting from Hildon Reference manual)
Anyway here is a sample of my code so you can give me your opinion
# All the code below, comes from a class named "inventory" which is the "main" class of the app. # Creating the picker button self.dep_button = hildon.PickerButton(gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL) self.dep_button.set_title("Département") # Creating the actual TouchSelector widget and connecting the "changed" self.selector = hildon.TouchSelectorEntry(text=True) self.selector.connect("changed", self.selection_changed) # Reading a CSV file containing somes informations.... cr = csv.reader(open("/usr/share/inventaire/departements.csv","rb")) for row in cr: #print row[1]+row[0] self.selector.append_text(row[2]+" - "+row[1]) # Attach the touch selector to the picker button self.bottom_bar = self.interface.get_object("bottom_bar") self.bottom_bar.add(self.dep_button) self.dep_button.set_selector(self.selector) def selection_changed(self, column, user_data): # Deactivated the append_text because i thought it could be the cause of the self "self-replicating" signal #self.selector.append_text("LOOOOOOOOOOOOOOOOOOOOOOL") #print user_data # Begining of the signal event print "a" print "b" # End of the signal eventHere is the documentation i used as reference:
Hildon Reference Manual
UI Tutorial : Data Selection
Thanks for your help
TeT