login problem

Hi,

I need show login dialog before my main frame appears.
When login is ok, continue with main frame.

I need this done by some module (user.py).
When user.py imports first time, login dialog (from another module) appears. From main frame I call other frames. In this frames, when I import login module, only info about current user imports to namespace (user.id, user.login, ...)

My question is:
Where I must import user.py?

I tried import user.py in __init__ of main frame (it is executed before MainLoop - I think this is main problem), but when I close it, program did not exit.

If you have some suggestions abou this (and better exiting in user.py than sys.exit()), please help me!

Thank you.

Stano Paska.

login.zip (1.76 KB)

Stano,
   I know what I'm going to tell you was done in C++, but the method is very much the same..

   I do about the same thing, however I use a wxWizard subclass, which is sublcassed for wxDialog.

What I do is in the subclass of wxApp (myApp), I create a instance of my wxWizard Subclass and show it.. if it returns True, I continue on, if false, I quit..

(( this snippet is C++, but you get the idea ))
the Personal variable is the subclass of my wxWizard

if (personal->checkPersonalInfo()) {
         wxMainFrame *frame = new wxMainFrame(_T(wxString::Format("%s - %s %s", APP_LONGNAME, APP_NAME, APP_VERSION)), 520, 390);

         SetTopWindow(frame);
         frame->Show(TRUE);
}

Does that make sense?

···

At 01:04 AM 12/4/2003, you wrote:

Hi,

I need show login dialog before my main frame appears.
When login is ok, continue with main frame.

I need this done by some module (user.py).
When user.py imports first time, login dialog (from another module) appears. From main frame I call other frames. In this frames, when I import login module, only info about current user imports to namespace (user.id, user.login, ...)

My question is:
Where I must import user.py?

I tried import user.py in __init__ of main frame (it is executed before MainLoop - I think this is main problem), but when I close it, program did not exit.

If you have some suggestions abou this (and better exiting in user.py than sys.exit()), please help me!

Thank you.

Stano Paska.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

I don't have any experience with wxWizard.
From your code I didn't understand what do you mean.

Sorry.

I tried some experiments with wxWizard, but with same result.
My application does not exit.

Stano.

Dave wrote:

···

Stano,
  I know what I'm going to tell you was done in C++, but the method is very much the same..

  I do about the same thing, however I use a wxWizard subclass, which is sublcassed for wxDialog.

What I do is in the subclass of wxApp (myApp), I create a instance of my wxWizard Subclass and show it.. if it returns True, I continue on, if false, I quit..

(( this snippet is C++, but you get the idea ))
the Personal variable is the subclass of my wxWizard

if (personal->checkPersonalInfo()) {
        wxMainFrame *frame = new wxMainFrame(_T(wxString::Format("%s - %s %s", APP_LONGNAME, APP_NAME, APP_VERSION)), 520, 390);

        SetTopWindow(frame);
        frame->Show(TRUE);
}

Does that make sense?

Stano,

         All classes are pretty much the same..

Say your dialog is subclassed as myLoginDialog, you would do:

if (myLoginDialog->ShowModal()):
         ## Do Main Code Here

And in your dialog class, you would return true if the login is good and false if it's bad (when you close the dialog)

···

At 08:35 AM 12/4/03, you wrote:

I don't have any experience with wxWizard.
From your code I didn't understand what do you mean.

Sorry.

I tried some experiments with wxWizard, but with same result.
My application does not exit.

Stano.

Dave wrote:

Stano,
  I know what I'm going to tell you was done in C++, but the method is very much the same..
  I do about the same thing, however I use a wxWizard subclass, which is sublcassed for wxDialog.
What I do is in the subclass of wxApp (myApp), I create a instance of my wxWizard Subclass and show it.. if it returns True, I continue on, if false, I quit..
(( this snippet is C++, but you get the idea ))
the Personal variable is the subclass of my wxWizard
if (personal->checkPersonalInfo()) {
        wxMainFrame *frame = new wxMainFrame(_T(wxString::Format("%s - %s %s", APP_LONGNAME, APP_NAME, APP_VERSION)), 520, 390);
        SetTopWindow(frame);
        frame->Show(TRUE);
}
Does that make sense?

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

This is clear.

But where I must add these lines?
When I call it before MainLoop(), my application works,
but when I close main frame, application does not exit.

Stano.

Dave wrote:

···

Stano,

        All classes are pretty much the same..

Say your dialog is subclassed as myLoginDialog, you would do:

if (myLoginDialog->ShowModal()):
        ## Do Main Code Here

And in your dialog class, you would return true if the login is good and false if it's bad (when you close the dialog)

I answer by myself.

In the boa mailing list I got some advice.

When I add these lines
aaa.Destroy()
del aaa
at the end of user.py, application exits correctly

I forgot destroy login frame.

Stano.

Stano Paska wrote:

···

Hi,

I need show login dialog before my main frame appears.
When login is ok, continue with main frame.

I need this done by some module (user.py).
When user.py imports first time, login dialog (from another module) appears. From main frame I call other frames. In this frames, when I import login module, only info about current user imports to namespace (user.id, user.login, ...)

My question is:
Where I must import user.py?

I tried import user.py in __init__ of main frame (it is executed before MainLoop - I think this is main problem), but when I close it, program did not exit.

If you have some suggestions abou this (and better exiting in user.py than sys.exit()), please help me!

Thank you.

Stano Paska.

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org