[pygtk] gtk.Assistant

Mauro Giacomini aragorn78it at yahoo.it
Wed Oct 13 00:53:26 WST 2010


Il 12/10/2010 09:33, Pietro Battiston ha scritto:
> Il giorno lun, 11/10/2010 alle 21.17 +0200, Mauro Giacomini ha scritto:
>    
>> Il 11/10/2010 19:45, Pietro Battiston ha scritto:
>> I write a pseudo-code that can hel you and the others to identify my
>> problem.
>> <pseudo-code>
>> class MyAssistant:
>>       def __init__(self):
>>           step_one()
>>           step_two()
>>           step_finale()
>>
>>       def step_one(self):
>>           text to welcome the user
>>           treeview
>>           button_up
>>           button_down
>>           button_apply
>>           button_apply.connect('clicked', self.on_confirm_sort_treeview)
>>
>>       def on_confirm_sort_treeview(self, button, data = None):
>>           I mark page_one of assistant as complete
>>
>>       def step_two(self):
>>           here I wanto to collect the data from treeview in the order the
>> user set them,
>>           so I can operate on them
>>           (1)
>>
>>       def step_finale(self):
>>           confirm all the user parameters
>> </pseudo-code>
>> (1) In this point I can't be able to collect the information of the
>> treeview, so I can't operate on them.
>>      
> If I understand correctly, your problem is that you think that "step_n"
> runs during the time that the user sees the nth page of the assistant.
> That's not the way in which the Assistant generally works: you just fill
> pages in advance, and then you let the user move along them.
>
> If you have to call "set_page_complete" based on the content/status of
> some treeview, probably (depending on what you really need) the best
> thing is to just connect to the "changed" signal of the TreeSelection,
> and in the callback for that signal check if everything is fine and in
> case call "set_page_complete( that_page, True )". You can connect also
> to the "changed" signal of more than one widget.
>
> Alternatively, you can monitor the Assistant with some callback called
> by glib.timeout_add(), but I think that's generally more difficult to
> manage smartly.
>> If I put a "print" in every step_*() functions to simply debug my app,
>> on screen I see all the text printed at the beginning of the app.
>>      
> Yes, that's normal: you first prepare all the pages, then run the
> Assistant; its methods do not block the flow of code.
>    
Yes, you undestood correcty what I want to do.
I have already tried to connect a signal from a button (user click when 
the treeview
is sorted) to call "set_page_complete(page, True)", but, as you said 
previously, this don't
block the flow of code, so I can't collect the data in the next page.
>> Hope I described good what I want.
>>
>> Maybe I can't fully understood the Assistant Widget and I'm using it bad.
>> I mean that until a page in an Assistant isn't marked as "completed",
>> the user-iteration is in a "waiting-mode"
>>
>> I googled to search how to use an Assistant, but the tutorials I found
>> are few and not fully explained.
>>      
> I hope I've clarified a bit. I guess you already seen
> http://www.learnpygtk.org/pygtktutorial/assistant.html ?
>
> bye
>
> Pietro
>    
Yes, I've already saw this page and I started from there.
You have clarified more than a bit and I thank you.

Now I want to try another way I found in this list, this post 
(http://www.mail-archive.com/pygtk@daa.com.au/msg19549.html).
In step_two() I can call "get_children" from the assistant to retrieve 
the previous page (step_one)
and from this page I call "get_data" from the treeview.
I will try this ...

>> Thanks, Mauro
>>
>>
>>
>>      
>>> Il giorno lun, 11/10/2010 alle 19.09 +0200, Mauro Giacomini ha scritto:
>>>
>>>        
>>>> Hi,
>>>> I have a problem with the creation of an Assistant.
>>>>
>>>>          
>>> Ehm... which problem?
>>>
>>> Pietro
>>>
>>>
>>>        
>>>> I want to collect information from the user.
>>>> In the first page I have a treeview with 3 button (move_up, move_down
>>>> and apply).
>>>> Until the user don't click on Apply Button, the navigation on the
>>>> Assistant is unsensitive.
>>>> When the user finished to sort the treeview with the up and down button
>>>> and click Apply button, the Next button on Assistant became sensitive
>>>> and the user can click it to procede to the second page.
>>>> In the second page I want to collect the data from the treeview to make
>>>> further processing.
>>>> If I have to post some code, tell me, and I will try to post code that
>>>> can be executed.
>>>> But keep in mind this Assistant is a piece of a bigger project I'm
>>>> working on.
>>>>
>>>> Thanks in advance, Mauro
>>>> PS: Sorry for my English, I'm an Italian guy.
>>>> _______________________________________________
>>>> pygtk mailing list   pygtk a daa.com.au
>>>> http://www.daa.com.au/mailman/listinfo/pygtk
>>>> Read the PyGTK FAQ: http://faq.pygtk.org/
>>>>
>>>>          
>>> _______________________________________________
>>> pygtk mailing list   pygtk a daa.com.au
>>> http://www.daa.com.au/mailman/listinfo/pygtk
>>> Read the PyGTK FAQ: http://faq.pygtk.org/
>>>        


More information about the pygtk mailing list