Hello Mauro,
As Pietro said, you can do it with gtk.Assistant. Just store all the pages in
your assistant class, and link the pages you create to your assistant so that
page1 can have access to page2 via the assistant.
class MyAssistant:
def __init__(self,*args,**kw):
self.page1 = Page1(assistant=self)
self.page2 = Page2(assistant=self)
class Page2:
def action(self):
data = self.assistant.page1.get_data()
self.do_my_stuff(data)
class Page1:
def __init__(self,assistant,*args,**kw):
self.assistant = assistant
self.somewidget = Widget()
self.somewidget.connect("the-crucial-event",self.assistant.page2.action())
if the data in page2 needs to be prepared, just hook to the assistant's
"prepare" signal. Look for it in
http://www.learnpygtk.org/pygtktutorial/assistant.html
Best of luck, and bongiorno Italia (please excuse my italian, I am algerian :) )
Y.Chaouche
--- On Tue, 10/12/10, Pietro Battiston <[email protected]> wrote:
> From: Pietro Battiston <[email protected]>
> Subject: Re: [pygtk] gtk.Assistant
> To: "Mauro Giacomini" <[email protected]>
> Cc: "Pygtk mailing list" <[email protected]>
> Date: Tuesday, October 12, 2010, 12:56 PM
> Il giorno mar, 12/10/2010 alle 21.16
> +0200, Mauro Giacomini ha scritto:
> > Hello,
> > I'm not able to use the assistant the way I want :(
> > Perphas this widget is not solution for my needs.
> >
> > In general, there is a way to use the assistant widget
> in this way:
> > - Page One: the user selects various option via a gui
> > - Page Two: the app use this option to choose which
> text to display to
> > continue the configuration;
>
> Sure you can: as I said, connect to the "changed" options
> of widgets in
> page one, and update, or even create from scratch page two
> accordingly.
>
> Or even better, connect to the "apply" signal of the
> Assistant and
> create one page at a time. Just take care of the fact that
> the user may
> press the "back" button (and "forward" again).
>
>
> > From what I understand, the pages are created
> all at once
>
> Not necessarily. You just create them when you want.
>
> > and displayed
> > on screen one at a time.
> > But in this way I can't never collect data from page
> one and use it on
> > page two; I can only collect
> > this data in the last page of the assistant, a page of
> type
> > gtk.ASSISTANT_PAGE_SUMMARY.
> > Am I right?
>
> No.
>
> If you still have problems using signals right, please
> provide some
> almost working code.
>
> > Do you know any pygtk application that has a wizard
> configuration so I
> > can study the source code?
>
> http://www.google.com/codesearch?hl=it&sa=N&q=gtk.Assistant+lang:python
>
> And I guess ubiquity does too.
>
> Pietro
>
>
>
> >
> > Thanks for all, Mauro
> >
> > Il 12/10/2010 19:12, Pietro Battiston ha scritto:
> > > Il giorno mar, 12/10/2010 alle 18.53 +0200, Mauro
> Giacomini ha scritto:
> > >
> > >> 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.
> > >> [...]
> > >> Now I want to try another way I found in this
> list, this post
> > >> (http://www.mail-archive.com/[email protected]/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 ...
> > >>
> > >
> > > The fact that the flow of code is not blocked
> should not be a problem at
> > > all.
> > >
> > > And there is no particular need to use
> get_children, you can just
> > > replace, for instance
> > >
> > > page_n = gtk.SomeWidget()
> > >
> > > with
> > >
> > > self.page_n =
> gtk.SomeWidget()
> > >
> > > and you can do that not just with whole pages,
> but with single widgets
> > > too (possibly organizing them in
> lists/dictionaries if there are many).
> > >
> > > If you use Glade and a gtk.Builder, it's even
> easier (with
> > > get_object() ).
> > >
> > > Pietro
> > >
> > >
> > >
>
>
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/