Raising a wxpython frame from a PyObjC NSStatusBar

Hi,

As I've come to understand, it's not possible to create a
statusbar/menubar icon (NSStatusBar) on the Mac using wx.TaskBarIcon
as that's been set to the dock. Various people have suggested calling
PyObjC to accomplish this so I decided to try and mesh together code
from the wxPython tutorial here -
http://www.wxpython.org/tut-part1.php and this PyObjC NSStatusBar
example here - http://the.taoofmac.com/space/blog/2007/04/22/1745.

It more or less works, save for the one hang up i'm having with
raising the frame from the status bar so it's the top level window.
Click on the dock icon and it raises just fine. Close the frame and
click 'Raise' in the status bar icon and that recreates the frame.
However I can't seem to get it to be the top level window when
something else is in focus. I'm passing the wx.app object as an
argument in creating my status bar so i can reference
wx.app.GetTopWindow().Raise() but it doesn't want to do it. Any
assistance is much appreciated!

Code attached.

Thanks,
Chaz

StatusBarFrame.py (3.29 KB)

Starting with 2.9.2 the wx.TaskBarIcon in the wxOSX-Cocoa build can be either a dock icon or a menubar icon.

···

On 7/6/11 4:53 PM, Chaz Littlejohn wrote:

Hi,

As I've come to understand, it's not possible to create a
statusbar/menubar icon (NSStatusBar) on the Mac using wx.TaskBarIcon
as that's been set to the dock.

--
Robin Dunn
Software Craftsman

Hi,

As I've come to understand, it's not possible to create a
statusbar/menubar icon (NSStatusBar) on the Mac using wx.TaskBarIcon
as that's been set to the dock.

Starting with 2.9.2 the wx.TaskBarIcon in the wxOSX-Cocoa build can be
either a dock icon or a menubar icon.

Is there a release date set for the 2.9.2 binaries?

Also, can you think of any particular reason why the following would
not raise the frame given what's in the attached code? It's not
immediately clear why this would be dependent on whether wx or pyobjc
were used to create the menubar icon.

    def raise_(self, notification):
        if not self.frame.IsShown():
            self.frame.Show(True)
        self.app.GetTopWindow().Raise()

Thanks,
Chaz

···

On Thu, Jul 7, 2011 at 4:52 PM, Robin Dunn <robin@alldunn.com> wrote:

On 7/6/11 4:53 PM, Chaz Littlejohn wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

As I've come to understand, it's not possible to create a
statusbar/menubar icon (NSStatusBar) on the Mac using wx.TaskBarIcon
as that's been set to the dock.

Starting with 2.9.2 the wx.TaskBarIcon in the wxOSX-Cocoa build can be
either a dock icon or a menubar icon.

Is there a release date set for the 2.9.2 binaries?

Probably by next weekend, if not sooner. I'll be doing some testing this weekend.

Also, can you think of any particular reason why the following would
not raise the frame given what's in the attached code? It's not
immediately clear why this would be dependent on whether wx or pyobjc
were used to create the menubar icon.

     def raise_(self, notification):
         if not self.frame.IsShown():
             self.frame.Show(True)
         self.app.GetTopWindow().Raise()

I don't know.

···

On 7/7/11 6:31 PM, Chaz Littlejohn wrote:

On Thu, Jul 7, 2011 at 4:52 PM, Robin Dunn<robin@alldunn.com> wrote:

On 7/6/11 4:53 PM, Chaz Littlejohn wrote:

--
Robin Dunn
Software Craftsman