Application losing focus when dialog is destroyed

My application creates a pyprogress dialog and then starts a
processing function in a thread that updates the variables that are
passed to the pyprogress dialog through it's UpdatePulse function

        self.func.labelup = ""
        dlg = pyprog.PyProgress(None, -1, "Please wait.",
                            "Doing work.",
                            style = wx.PD_APP_MODAL|
wx.PD_ELAPSED_TIME)
        threading.Thread(target=self.func.DoWork, args=
(filelist,)).start()
        while 1:
            dlg.UpdatePulse(self.func.labelup)
            wx.MilliSleep(50)
            if self.func.dwbool == False:
                break
        dlg.Destroy()

this works fine, but when the dialog is destroyed, my application
loses focus (the next topmost window is brought to the front)

I'm having trouble finding out the cause of this, does anyone have any
ideas?

Let me know if you need more info

- Michael

Its because the PyProgress parent is None.

···

On Mon, Aug 24, 2009 at 7:27 PM, michael h michaelkenth@gmail.com wrote:

My application creates a pyprogress dialog and then starts a

processing function in a thread that updates the variables that are

passed to the pyprogress dialog through it’s UpdatePulse function

    self.func.labelup = ""

    dlg = pyprog.PyProgress(None, -1, "Please wait.",

                        "Doing work.",

                        style = wx.PD_APP_MODAL|

wx.PD_ELAPSED_TIME)

    threading.Thread(target=self.func.DoWork, args=

(filelist,)).start()

    while 1:

        dlg.UpdatePulse(self.func.labelup)

        wx.MilliSleep(50)

        if self.func.dwbool == False:

            break

    dlg.Destroy()

this works fine, but when the dialog is destroyed, my application

loses focus (the next topmost window is brought to the front)

I’m having trouble finding out the cause of this, does anyone have any

ideas?

Let me know if you need more info

  • Michael

I've tried putting a few different targets as the parent to no avail.
Also it's None in the demo which doesn't exhibit the same behavior..

···

On Aug 24, 6:28 pm, yoav glazner <yoavglaz...@gmail.com> wrote:

Its because the PyProgress parent is None.

On Mon, Aug 24, 2009 at 7:27 PM, michael h <michaelke...@gmail.com> wrote:

> My application creates a pyprogress dialog and then starts a
> processing function in a thread that updates the variables that are
> passed to the pyprogress dialog through it's UpdatePulse function

> self.func.labelup = ""
> dlg = pyprog.PyProgress(None, -1, "Please wait.",
> "Doing work.",
> style = wx.PD_APP_MODAL|
> wx.PD_ELAPSED_TIME)
> threading.Thread(target=self.func.DoWork, args=
> (filelist,)).start()
> while 1:
> dlg.UpdatePulse(self.func.labelup)
> wx.MilliSleep(50)
> if self.func.dwbool == False:
> break
> dlg.Destroy()

> this works fine, but when the dialog is destroyed, my application
> loses focus (the next topmost window is brought to the front)

> I'm having trouble finding out the cause of this, does anyone have any
> ideas?

> Let me know if you need more info

> - Michael

Does the demo have multiple windows though? I don't think it
does...what you probably need to do is use pubsub to send a message to
the frame that spawned the progress dialog. When the frame received
the message, you can just call its Raise() method.

- Mike

···

On Aug 24, 1:36 pm, michael h <michaelke...@gmail.com> wrote:

I've tried putting a few different targets as the parent to no avail.
Also it's None in the demo which doesn't exhibit the same behavior..

On Aug 24, 6:28 pm, yoav glazner <yoavglaz...@gmail.com> wrote:

> Its because the PyProgress parent is None.

> On Mon, Aug 24, 2009 at 7:27 PM, michael h <michaelke...@gmail.com> wrote:

> > My application creates a pyprogress dialog and then starts a
> > processing function in a thread that updates the variables that are
> > passed to the pyprogress dialog through it's UpdatePulse function

> > self.func.labelup = ""
> > dlg = pyprog.PyProgress(None, -1, "Please wait.",
> > "Doing work.",
> > style = wx.PD_APP_MODAL|
> > wx.PD_ELAPSED_TIME)
> > threading.Thread(target=self.func.DoWork, args=
> > (filelist,)).start()
> > while 1:
> > dlg.UpdatePulse(self.func.labelup)
> > wx.MilliSleep(50)
> > if self.func.dwbool == False:
> > break
> > dlg.Destroy()

> > this works fine, but when the dialog is destroyed, my application
> > loses focus (the next topmost window is brought to the front)

> > I'm having trouble finding out the cause of this, does anyone have any
> > ideas?

> > Let me know if you need more info

> > - Michael

In terms of the way the demo is using the progress dialog my app is
very similar, my app only has 1 frame as well...and that frame is the
one calling the dialog and destroying it

···

On Aug 24, 7:54 pm, Mike Driscoll <kyoso...@gmail.com> wrote:

On Aug 24, 1:36 pm, michael h <michaelke...@gmail.com> wrote:

> I've tried putting a few different targets as the parent to no avail.
> Also it's None in the demo which doesn't exhibit the same behavior..

> On Aug 24, 6:28 pm, yoav glazner <yoavglaz...@gmail.com> wrote:

> > Its because the PyProgress parent is None.

> > On Mon, Aug 24, 2009 at 7:27 PM, michael h <michaelke...@gmail.com> wrote:

> > > My application creates a pyprogress dialog and then starts a
> > > processing function in a thread that updates the variables that are
> > > passed to the pyprogress dialog through it's UpdatePulse function

> > > self.func.labelup = ""
> > > dlg = pyprog.PyProgress(None, -1, "Please wait.",
> > > "Doing work.",
> > > style = wx.PD_APP_MODAL|
> > > wx.PD_ELAPSED_TIME)
> > > threading.Thread(target=self.func.DoWork, args=
> > > (filelist,)).start()
> > > while 1:
> > > dlg.UpdatePulse(self.func.labelup)
> > > wx.MilliSleep(50)
> > > if self.func.dwbool == False:
> > > break
> > > dlg.Destroy()

> > > this works fine, but when the dialog is destroyed, my application
> > > loses focus (the next topmost window is brought to the front)

> > > I'm having trouble finding out the cause of this, does anyone have any
> > > ideas?

> > > Let me know if you need more info

> > > - Michael

Does the demo have multiple windows though? I don't think it
does...what you probably need to do is use pubsub to send a message to
the frame that spawned the progress dialog. When the frame received
the message, you can just call its Raise() method.

- Mike

I believe I've figured it out, the way I was destroying the dialog was
preventing the dialog from re-enabling the main window, calling
pyprogress's OnCancel first fixed everything (as far as i can tell).

typical bonehead mistake. should've done more investigating before
asking. thanks for the suggestions..

- michael

···

On Aug 24, 8:03 pm, michael h <michaelke...@gmail.com> wrote:

In terms of the way the demo is using the progress dialog my app is
very similar, my app only has 1 frame as well...and that frame is the
one calling the dialog and destroying it

On Aug 24, 7:54 pm, Mike Driscoll <kyoso...@gmail.com> wrote:

> On Aug 24, 1:36 pm, michael h <michaelke...@gmail.com> wrote:

> > I've tried putting a few different targets as the parent to no avail.
> > Also it's None in the demo which doesn't exhibit the same behavior..

> > On Aug 24, 6:28 pm, yoav glazner <yoavglaz...@gmail.com> wrote:

> > > Its because the PyProgress parent is None.

> > > On Mon, Aug 24, 2009 at 7:27 PM, michael h <michaelke...@gmail.com> wrote:

> > > > My application creates a pyprogress dialog and then starts a
> > > > processing function in a thread that updates the variables that are
> > > > passed to the pyprogress dialog through it's UpdatePulse function

> > > > self.func.labelup = ""
> > > > dlg = pyprog.PyProgress(None, -1, "Please wait.",
> > > > "Doing work.",
> > > > style = wx.PD_APP_MODAL|
> > > > wx.PD_ELAPSED_TIME)
> > > > threading.Thread(target=self.func.DoWork, args=
> > > > (filelist,)).start()
> > > > while 1:
> > > > dlg.UpdatePulse(self.func.labelup)
> > > > wx.MilliSleep(50)
> > > > if self.func.dwbool == False:
> > > > break
> > > > dlg.Destroy()

> > > > this works fine, but when the dialog is destroyed, my application
> > > > loses focus (the next topmost window is brought to the front)

> > > > I'm having trouble finding out the cause of this, does anyone have any
> > > > ideas?

> > > > Let me know if you need more info

> > > > - Michael

> Does the demo have multiple windows though? I don't think it
> does...what you probably need to do is use pubsub to send a message to
> the frame that spawned the progress dialog. When the frame received
> the message, you can just call its Raise() method.

> - Mike

Just out of curiosity, how does the group here handle version control and different versions of your software? What do you recommend? I'm currently not using an IDE at all (I find it helps me learn the language better if I don't use an IDE), but I am realizing that it might help to have some form of version control. I'm on Mac OS X 10.5, so I am also interested in what works for you if you are on the Mac. But other solutions (that might also work on the Mac) would be nice to learn about.

Thanks,

Stuart

Komodo + SVN (mac/windows/linux)

Thiessen Stuart wrote:

···

Just out of curiosity, how does the group here handle version control
and different versions of your software? What do you recommend? I'm
currently not using an IDE at all (I find it helps me learn the
language better if I don't use an IDE), but I am realizing that it
might help to have some form of version control. I'm on Mac OS X 10.5,
so I am also interested in what works for you if you are on the Mac.
But other solutions (that might also work on the Mac) would be nice to
learn about.

Thanks,

Stuart

>

--
----------------------------------------------------------
Tim Vazquez
(407) 341-5377

CGM Studios
www.cgmstudios.com

Concussion Graphics and Media
www.concussion.cc
----------------------------------------------------------

PyDev(eclipse) + SVN

···

On Mon, Aug 24, 2009 at 11:17 PM, Concussion GFX - Tim tim@concussion.cc wrote:

Komodo + SVN (mac/windows/linux)

Thiessen Stuart wrote:

Just out of curiosity, how does the group here handle version control

and different versions of your software? What do you recommend? I’m

currently not using an IDE at all (I find it helps me learn the

language better if I don’t use an IDE), but I am realizing that it

might help to have some form of version control. I’m on Mac OS X 10.5,

so I am also interested in what works for you if you are on the Mac.

But other solutions (that might also work on the Mac) would be nice to

learn about.

Thanks,

Stuart


Tim Vazquez

(407) 341-5377

CGM Studios

www.cgmstudios.com

Concussion Graphics and Media

www.concussion.cc


Our group (~15 developers at multiple sites, the majority with Macs) uses SVN. It’s not ideal if you need to deal with branches that may need to be merged, but apparently a big improvement over CVS. I have no complaints except for the branch handling, and if you’re working alone or with a small group, it’ll probably be just fine. (And apparently the newest release is much better with branches.)

···

On Mon, Aug 24, 2009 at 1:07 PM, Thiessen Stuart thiessenstuart@gmail.com wrote:

Just out of curiosity, how does the group here handle version control

and different versions of your software? What do you recommend? I’m

currently not using an IDE at all (I find it helps me learn the

language better if I don’t use an IDE), but I am realizing that it

might help to have some form of version control. I’m on Mac OS X 10.5,

so I am also interested in what works for you if you are on the Mac.

But other solutions (that might also work on the Mac) would be nice to

learn about.

Hello,

Just out of curiosity, how does the group here handle version control
and different versions of your software? What do you recommend? I'm
currently not using an IDE at all (I find it helps me learn the
language better if I don't use an IDE), but I am realizing that it
might help to have some form of version control. I'm on Mac OS X 10.5,
so I am also interested in what works for you if you are on the Mac.
But other solutions (that might also work on the Mac) would be nice to
learn about.

OSX 10.5 comes with cvs and svn pre-installed. Both are accessible
from the command line and relatively easy to use. So far out of the
distributed scm systems mercurial seems the most user friendly and
intuitive to use in my experience.

Editra (included with wxpython) also has a Projects plugin (separate
download) that provides a simple gui interface to many different scm
systems.

Cody

···

On Mon, Aug 24, 2009 at 3:07 PM, Thiessen Stuart<thiessenstuart@gmail.com> wrote:

Thiessen Stuart wrote:

Just out of curiosity, how does the group here handle version control
and different versions of your software? What do you recommend? I'm
currently not using an IDE at all (I find it helps me learn the
language better if I don't use an IDE), but I am realizing that it
might help to have some form of version control. I'm on Mac OS X 10.5,
so I am also interested in what works for you if you are on the Mac.
But other solutions (that might also work on the Mac) would be nice to
learn about.

Thanks,

Stuart

>

I've been using bzr (Bazaar) and launchpad (since my application is open
source)
It had nice built-in Python source highlighting, i.e.
http://bazaar.launchpad.net/~sproaty/whyteboard/development/annotate/head%3A/tools.py
and nice diff output, i.e
http://bazaar.launchpad.net/~sproaty/whyteboard/development/revision/104