Active Topics

 


Reply
Thread Tools
Posts: 5 | Thanked: 1 time | Joined on Sep 2010
#1
Hi !

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)
"changed" : The “changed” signal is emitted when the active item on any column is changed. This can be due to the user selecting a different item from the list, or due to a call to select_iter() on one of the columns.

“columns-changed” signal is emitted when the number of columns in the TouchSelector change.
When i try to use the "changed" signal, he is everytime emited 3 times in a row. Is this a bug ? (searched through the reported bugs and found nothing related) Or it's only me who got something wrong in my code ?

Anyway here is a sample of my code so you can give me your opinion

Code:
	# 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 event
Everytime i tap on an item of the TouchSelector and select it, i get the following output in the terminal:

Code:
a
b
a
b
a
b
I really can't find any reason why this signal is emited 3 times for a single unique selection...

Here is the documentation i used as reference:
Hildon Reference Manual
UI Tutorial : Data Selection

Thanks for your help

TeT
 
Posts: 9 | Thanked: 24 times | Joined on Dec 2009 @ Brasil
#2
Hi,

Can you provide a small test program which exibits the problem stated? This will make debugging much easier. Also, have you tried to reproduce the problem in C?

If you believe this problem is a bug in PyGTK/python-hildon, you can file a bug here [1].

[1] https://bugs.maemo.org/enter_bug.cgi?product=PyMaemo
 
Posts: 5 | Thanked: 1 time | Joined on Sep 2010
#3
Hi !
I made a simple test file to reproduce the ""bug"".

Just copy/paste it to your phone, and launch it:
Code:
python bug.py
I'am filling a bug report just in case.

This clean simple test file makes me even more confident that it's not my mistake here.

Thanks

PS: Couldn't upload the python source file so here is the code straight in the post :

Code:
#!/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()

Last edited by Tetsuo6995; 2010-09-24 at 14:46.
 
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#4
it might be that the current selection is deactivated, then new selection activated but that would account for two signals only. (now in train so cvant do proper checking
__________________
  • Live near Helsinki, Finland & interested in electronics ? Check this out.
  • Want anti-virus/firewall ? Read this (and follow the links, also: use the search, there are way too many threads asking the same questions over and over and over again).
  • I'm experimenting with BitCoins, if you want to tip me send some to: 1CAEy7PYptSasN67TiMYM74ELDVGZS6cCB
 
Posts: 5 | Thanked: 1 time | Joined on Sep 2010
#5
 
Posts: 5 | Thanked: 1 time | Joined on Sep 2010
#6
Up !

Can anyone just try my small testing program and confirm me there is something strange going on ?
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:15.