PyAUI with WebKit problems

I have made an interface using PyAUI some time ago but I cannot resize main panel smaller when it is a webkitctrl. I have left this on the backburner for a while but is really a thorn in an otherwise good interface. Can anyone advise whether any improvements are planned to correct this deficiency. I have not seen any discussion of PyAUI for some time.

Regards,
David

Hi David,

I have made an interface using PyAUI some time ago but I cannot resize main panel smaller when it is a webkitctrl. I have left this on the backburner for a while but is really a thorn in an otherwise good interface. Can anyone advise whether any improvements are planned to correct this deficiency. I have not seen any discussion of PyAUI for some time.

How are you sizing the webkitctrl? It is somewhat quirky about sizing because there are issues with the Cocoa<->Carbon bridge, unfortunately, so this may have nothing to do with PyAUI at all.

Thanks,

Kevin

···

On Apr 11, 2006, at 5:03 PM, David Pratt wrote:

Regards,
David

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

Kevin Ollivier wrote:

How are you sizing the webkitctrl? It is somewhat quirky about sizing because there are issues with the Cocoa<->Carbon bridge, unfortunately, so this may have nothing to do with PyAUI at all.

Hi Kevin!

As far as my webkitctrl, I have made a BrowserPanel class that subclasses wx.Panel. It is a cross platform browser. From my __init__ method for BrowserPanel I do this:

if wx.Platform == '__WXMAC__':
      self.browser_ctrl = WebKitCtrl(self, -1, self.base_admin_url, wx.DefaultPosition, style=0)

self.__do_layout()

  def __do_layout(self):
    browser_grid_sizer = wx.FlexGridSizer(1, 1, 0, 0)
    browser_grid_sizer.Add(self.browser_ctrl, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    self.SetAutoLayout(True)
    self.SetSizer(browser_grid_sizer)
    browser_grid_sizer.Fit(self)
    browser_grid_sizer.SetSizeHints(self)
    browser_grid_sizer.AddGrowableRow(0)
    browser_grid_sizer.AddGrowableCol(0)

(sorry this is so awful, I am cutting and pasting into Thunderbird)

    # FrameManager
    self.frame_manager = PyAUI.FrameManager()
    self.frame_manager.SetFrame(self)
    self.custom_dockart = CustomDockArt()
    self.frame_manager.SetArtProvider(self.custom_dockart)
    
    # Create panes
    self.main_tree_ctrl = MainTreeCtrl(self, products.Product(), 'Inventory', 'Catalogs')
    self.browser_ctrl = BrowserPanel(self)
  
    # Add panes to manager
    self.frame_manager.AddPane(self.main_tree_ctrl, PyAUI.PaneInfo().
      BestSize(wx.Size(200,-1)).
      Name("TreeCtrl").Caption(self.main_tree_ctrl.caption).
      Left().Layer(1).Position(1))
    self.frame_manager.AddPane(self.browser_ctrl, PyAUI.PaneInfo().Name('Browser').
      CenterPane())

So I create a frame manager and am adding a tree control instance on left and browser panel instance as center pane (main panel). There are no other panes. When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger. Other panels like a textctl seem to be ok as in the demo with PyAUI. That is, you can get the hint and can easily move it to the right to make the panel smaller or move it to the left to make the panel larger. With Webkit I can make it larger moving the hint to the left making it larger but i cannot move the hint to the right to make it smaller. If you need more info, please let me know.

Regards
David

···

From my frame __init__ method:

Hi David,

I'll try to take a look at this in the next couple days. There's nothing obvious that sticks out to me... In the meantime, though, one thing that you may want to try is setting up an empty EVT_SIZE handler for the webkitctrl, and not calling event.Skip(). This may really screw up the position where webkitctrl appears, but what I'm curious about is it has any effect on the ability to shrink the panel.

Thanks,

Kevin

···

On Apr 11, 2006, at 6:44 PM, David Pratt wrote:

Kevin Ollivier wrote:

How are you sizing the webkitctrl? It is somewhat quirky about sizing because there are issues with the Cocoa<->Carbon bridge, unfortunately, so this may have nothing to do with PyAUI at all.

Hi Kevin!

As far as my webkitctrl, I have made a BrowserPanel class that subclasses wx.Panel. It is a cross platform browser. From my __init__ method for BrowserPanel I do this:

if wx.Platform == '__WXMAC__':
      self.browser_ctrl = WebKitCtrl(self, -1, self.base_admin_url, wx.DefaultPosition, style=0)

self.__do_layout()

  def __do_layout(self):
    browser_grid_sizer = wx.FlexGridSizer(1, 1, 0, 0)
    browser_grid_sizer.Add(self.browser_ctrl, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
    self.SetAutoLayout(True)
    self.SetSizer(browser_grid_sizer)
    browser_grid_sizer.Fit(self)
    browser_grid_sizer.SetSizeHints(self)
    browser_grid_sizer.AddGrowableRow(0)
    browser_grid_sizer.AddGrowableCol(0)

(sorry this is so awful, I am cutting and pasting into Thunderbird)

From my frame __init__ method:

    # FrameManager
    self.frame_manager = PyAUI.FrameManager()
    self.frame_manager.SetFrame(self)
    self.custom_dockart = CustomDockArt()
    self.frame_manager.SetArtProvider(self.custom_dockart)
    
    # Create panes
    self.main_tree_ctrl = MainTreeCtrl(self, products.Product(), 'Inventory', 'Catalogs')
    self.browser_ctrl = BrowserPanel(self)
  
    # Add panes to manager
    self.frame_manager.AddPane(self.main_tree_ctrl, PyAUI.PaneInfo().
      BestSize(wx.Size(200,-1)).
      Name("TreeCtrl").Caption(self.main_tree_ctrl.caption).
      Left().Layer(1).Position(1))
    self.frame_manager.AddPane(self.browser_ctrl, PyAUI.PaneInfo().Name('Browser').
      CenterPane())

So I create a frame manager and am adding a tree control instance on left and browser panel instance as center pane (main panel). There are no other panes. When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger. Other panels like a textctl seem to be ok as in the demo with PyAUI. That is, you can get the hint and can easily move it to the right to make the panel smaller or move it to the left to make the panel larger. With Webkit I can make it larger moving the hint to the left making it larger but i cannot move the hint to the right to make it smaller. If you need more info, please let me know.

Regards
David

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

David Pratt wrote:

When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger.

This is usually a symptom of a window not having a sizer or a good DoGetBestSize, and so it falls back to the default behavior of, if it has no children and no minsize, using the current size. So when it is created that is it's best size, but when it gets expanded larger by the sizer then that is it's new best size and the sizer won't shrink it smaller. The easy solution is to give it a min size, then the sizer will use that instead of whatever the current size is.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Kevin. I'll give this a try. Did you want me to make a small demo of just the problem so that you have something to work with? From what I can tell you also work on Mac too. I am on OSX 10.3.9 using latest PyAUI and wxpython and python 2.4.2.

Regards,
David

Kevin Ollivier wrote:

···

Hi David,

I'll try to take a look at this in the next couple days. There's nothing obvious that sticks out to me... In the meantime, though, one thing that you may want to try is setting up an empty EVT_SIZE handler for the webkitctrl, and not calling event.Skip(). This may really screw up the position where webkitctrl appears, but what I'm curious about is it has any effect on the ability to shrink the panel.

Thanks,

Kevin

On Apr 11, 2006, at 6:44 PM, David Pratt wrote:

Kevin Ollivier wrote:

How are you sizing the webkitctrl? It is somewhat quirky about sizing because there are issues with the Cocoa<->Carbon bridge, unfortunately, so this may have nothing to do with PyAUI at all.

Hi Kevin!

As far as my webkitctrl, I have made a BrowserPanel class that subclasses wx.Panel. It is a cross platform browser. From my __init__ method for BrowserPanel I do this:

if wx.Platform == '__WXMAC__':
            self.browser_ctrl = WebKitCtrl(self, -1, self.base_admin_url, wx.DefaultPosition, style=0)

self.__do_layout()

    def __do_layout(self):
        browser_grid_sizer = wx.FlexGridSizer(1, 1, 0, 0)
        browser_grid_sizer.Add(self.browser_ctrl, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
        self.SetAutoLayout(True)
        self.SetSizer(browser_grid_sizer)
        browser_grid_sizer.Fit(self)
        browser_grid_sizer.SetSizeHints(self)
        browser_grid_sizer.AddGrowableRow(0)
        browser_grid_sizer.AddGrowableCol(0)

(sorry this is so awful, I am cutting and pasting into Thunderbird)

From my frame __init__ method:

        # FrameManager
        self.frame_manager = PyAUI.FrameManager()
        self.frame_manager.SetFrame(self)
        self.custom_dockart = CustomDockArt()
        self.frame_manager.SetArtProvider(self.custom_dockart)
               # Create panes
        self.main_tree_ctrl = MainTreeCtrl(self, products.Product(), 'Inventory', 'Catalogs')
        self.browser_ctrl = BrowserPanel(self)
            # Add panes to manager
        self.frame_manager.AddPane(self.main_tree_ctrl, PyAUI.PaneInfo().
            BestSize(wx.Size(200,-1)).
            Name("TreeCtrl").Caption(self.main_tree_ctrl.caption).
            Left().Layer(1).Position(1))
        self.frame_manager.AddPane(self.browser_ctrl, PyAUI.PaneInfo().Name('Browser').
            CenterPane())

So I create a frame manager and am adding a tree control instance on left and browser panel instance as center pane (main panel). There are no other panes. When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger. Other panels like a textctl seem to be ok as in the demo with PyAUI. That is, you can get the hint and can easily move it to the right to make the panel smaller or move it to the left to make the panel larger. With Webkit I can make it larger moving the hint to the left making it larger but i cannot move the hint to the right to make it smaller. If you need more info, please let me know.

Regards
David

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

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

Robin Dunn wrote:

David Pratt wrote:

When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger.

This is usually a symptom of a window not having a sizer or a good DoGetBestSize, and so it falls back to the default behavior of, if it has no children and no minsize, using the current size. So when it is created that is it's best size, but when it gets expanded larger by the sizer then that is it's new best size and the sizer won't shrink it smaller. The easy solution is to give it a min size, then the sizer will use that instead of whatever the current size is.

Hi Robin. This makes sense. I tried Andrea's idea

self.frame_manager.AddPane(self.browser_ctrl,
               PyAUI.PaneInfo().Name('Browser').
                            CenterPane().MinSize(wx.Size(10,10)))

however this has not resolved the issue.

Regards
David

Hi David,

Hi Kevin. I'll give this a try. Did you want me to make a small demo of just the problem so that you have something to work with? From what I can tell you also work on Mac too. I am on OSX 10.3.9 using latest PyAUI and wxpython and python 2.4.2.

Thanks, that would be great! I have a couple apps that use webkitctrl, but they're far from small samples. :wink:

BTW, I do work on Mac; it's my primary OS, actually.

Thanks,

Kevin

···

On Apr 12, 2006, at 4:55 AM, David Pratt wrote:

Regards,
David

Kevin Ollivier wrote:

Hi David,
I'll try to take a look at this in the next couple days. There's nothing obvious that sticks out to me... In the meantime, though, one thing that you may want to try is setting up an empty EVT_SIZE handler for the webkitctrl, and not calling event.Skip(). This may really screw up the position where webkitctrl appears, but what I'm curious about is it has any effect on the ability to shrink the panel.
Thanks,
Kevin
On Apr 11, 2006, at 6:44 PM, David Pratt wrote:

Kevin Ollivier wrote:

How are you sizing the webkitctrl? It is somewhat quirky about sizing because there are issues with the Cocoa<->Carbon bridge, unfortunately, so this may have nothing to do with PyAUI at all.

Hi Kevin!

As far as my webkitctrl, I have made a BrowserPanel class that subclasses wx.Panel. It is a cross platform browser. From my __init__ method for BrowserPanel I do this:

if wx.Platform == '__WXMAC__':
            self.browser_ctrl = WebKitCtrl(self, -1, self.base_admin_url, wx.DefaultPosition, style=0)

self.__do_layout()

    def __do_layout(self):
        browser_grid_sizer = wx.FlexGridSizer(1, 1, 0, 0)
        browser_grid_sizer.Add(self.browser_ctrl, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
        self.SetAutoLayout(True)
        self.SetSizer(browser_grid_sizer)
        browser_grid_sizer.Fit(self)
        browser_grid_sizer.SetSizeHints(self)
        browser_grid_sizer.AddGrowableRow(0)
        browser_grid_sizer.AddGrowableCol(0)

(sorry this is so awful, I am cutting and pasting into Thunderbird)

From my frame __init__ method:

        # FrameManager
        self.frame_manager = PyAUI.FrameManager()
        self.frame_manager.SetFrame(self)
        self.custom_dockart = CustomDockArt()
        self.frame_manager.SetArtProvider(self.custom_dockart)
               # Create panes
        self.main_tree_ctrl = MainTreeCtrl(self, products.Product(), 'Inventory', 'Catalogs')
        self.browser_ctrl = BrowserPanel(self)
            # Add panes to manager
        self.frame_manager.AddPane(self.main_tree_ctrl, PyAUI.PaneInfo().
            BestSize(wx.Size(200,-1)).
            Name("TreeCtrl").Caption(self.main_tree_ctrl.caption).
            Left().Layer(1).Position(1))
        self.frame_manager.AddPane(self.browser_ctrl, PyAUI.PaneInfo().Name('Browser').
            CenterPane())

So I create a frame manager and am adding a tree control instance on left and browser panel instance as center pane (main panel). There are no other panes. When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger. Other panels like a textctl seem to be ok as in the demo with PyAUI. That is, you can get the hint and can easily move it to the right to make the panel smaller or move it to the left to make the panel larger. With Webkit I can make it larger moving the hint to the left making it larger but i cannot move the hint to the right to make it smaller. If you need more info, please let me know.

Regards
David

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

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

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

Kevin Ollivier wrote:

Thanks, that would be great! I have a couple apps that use webkitctrl, but they're far from small samples. :wink:

Yes, this one is not small either, but I can pull pieces and cut down my classes to create something that should work fine to show the problem. I'll send it to you once I've got it prepared. I think this will be tonight or early tomorrow since I have got to do a few things ahead of me already today.

BTW, I do work on Mac; it's my primary OS, actually.

Me too! And FreeBSD for servers. I think they are the best two OS's out there - and reasonably related too :slight_smile:

Regards,
David

David Pratt wrote:

Robin Dunn wrote:

David Pratt wrote:

When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger.

This is usually a symptom of a window not having a sizer or a good DoGetBestSize, and so it falls back to the default behavior of, if it has no children and no minsize, using the current size. So when it is created that is it's best size, but when it gets expanded larger by the sizer then that is it's new best size and the sizer won't shrink it smaller. The easy solution is to give it a min size, then the sizer will use that instead of whatever the current size is.

Hi Robin. This makes sense. I tried Andrea's idea

self.frame_manager.AddPane(self.browser_ctrl,
                     PyAUI.PaneInfo().Name('Browser').
                           CenterPane().MinSize(wx.Size(10,10)))

however this has not resolved the issue.

Does PyAUI look at the minsize of the widgets it contains? (Or use a sizer?) If so then you should try self.browser_ctrl.SetMinSize also.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Robin. I tried what you have suggested also. No success yet. I also tried setting flexible direction to wx.BOTH on the wx.FlexGridSizer that I am using for the panel that contains the WebKitCtrl. I was not sure whether this could help but tried it anyway. Still cannot shrink this panel :frowning: Robin, would you like me to send you a small app to demonstrate the problem? I'll put it together in a single file.

Regards,
David

browser_grid_sizer.SetFlexibleDirection(wx.BOTH)

Robin Dunn wrote:

···

David Pratt wrote:

Robin Dunn wrote:

David Pratt wrote:

When I do this I can still get a hint (vertical line) for sizing the browser panel but it will not make the browser panel smaller only larger.

This is usually a symptom of a window not having a sizer or a good DoGetBestSize, and so it falls back to the default behavior of, if it has no children and no minsize, using the current size. So when it is created that is it's best size, but when it gets expanded larger by the sizer then that is it's new best size and the sizer won't shrink it smaller. The easy solution is to give it a min size, then the sizer will use that instead of whatever the current size is.

Hi Robin. This makes sense. I tried Andrea's idea

self.frame_manager.AddPane(self.browser_ctrl,
                     PyAUI.PaneInfo().Name('Browser').
                           CenterPane().MinSize(wx.Size(10,10)))

however this has not resolved the issue.

Does PyAUI look at the minsize of the widgets it contains? (Or use a sizer?) If so then you should try self.browser_ctrl.SetMinSize also.

David Pratt wrote:

Hi Robin. I tried what you have suggested also. No success yet. I also tried setting flexible direction to wx.BOTH on the wx.FlexGridSizer that I am using for the panel that contains the WebKitCtrl. I was not sure whether this could help but tried it anyway. Still cannot shrink this panel :frowning: Robin, would you like me to send you a small app to demonstrate the problem? I'll put it together in a single file.

Sure, I'll take a look. Have you noticed anything like this with the WebKitCtrl when used outside of PyAUI?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

David Pratt wrote:

Hi Robin! Many thanks for your note and for taking a look since I really like PyAUI but this is really something that is holding me back from moving forward and using it. I've attached the file. The code is in webkit-pyaui.py It will show a treectrl on left and webkitctrl on right in center pane. I included PyAUI in the folder as well so you could execute it without having to retrieve a copy. I wish I could say I have more experience with webkitctrl to know its behavior a bit better. I don't recall any problems size when it was in a panel but do remember a quirk where I had to put in in a pane an then in another to contain it properly - it was a while ago so it is not a clear in my mind. I stripped things down to just something that shows the issue to make it as small as possible. The treectrl on the left I substituted with the one in the wxpython demo since mine is attached to a database. I am hoping it may be sizer related as you suspect but I have tried a few things in this regard with no luck as yet. Thanks again.

Regards,
David

Robin Dunn wrote:

David Pratt wrote:

Hi Robin. I tried what you have suggested also. No success yet. I also tried setting flexible direction to wx.BOTH on the wx.FlexGridSizer that I am using for the panel that contains the WebKitCtrl. I was not sure whether this could help but tried it anyway. Still cannot shrink this panel :frowning: Robin, would you like me to send you a small app to demonstrate the problem? I'll put it together in a single file.

Sure, I'll take a look. Have you noticed anything like this with the WebKitCtrl when used outside of PyAUI?

The problem is that the WebKitCtrl is stealing all of the mouse events, even if another widget has them captured. You can see this in the sample I attached. The splitter window has the same problem that the PyAUI does, dragging the sash towards the webkit doesn't go anywhere because once the cursor gets over the webkit the splitter isn't getting any more events. The panel I put on the left will also capture the mouse if you start a drag there, and then will print out the motion events. The prints stop when you move the mouse over the webkit.

Kevin, do you have any ideas on this?

other.py (1.27 KB)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Robin,

David Pratt wrote:

Hi Robin! Many thanks for your note and for taking a look since I really like PyAUI but this is really something that is holding me back from moving forward and using it. I've attached the file. The code is in webkit-pyaui.py It will show a treectrl on left and webkitctrl on right in center pane. I included PyAUI in the folder as well so you could execute it without having to retrieve a copy. I wish I could say I have more experience with webkitctrl to know its behavior a bit better. I don't recall any problems size when it was in a panel but do remember a quirk where I had to put in in a pane an then in another to contain it properly - it was a while ago so it is not a clear in my mind. I stripped things down to just something that shows the issue to make it as small as possible. The treectrl on the left I substituted with the one in the wxpython demo since mine is attached to a database. I am hoping it may be sizer related as you suspect but I have tried a few things in this regard with no luck as yet. Thanks again.
Regards,
David
Robin Dunn wrote:

David Pratt wrote:

Hi Robin. I tried what you have suggested also. No success yet. I also tried setting flexible direction to wx.BOTH on the wx.FlexGridSizer that I am using for the panel that contains the WebKitCtrl. I was not sure whether this could help but tried it anyway. Still cannot shrink this panel :frowning: Robin, would you like me to send you a small app to demonstrate the problem? I'll put it together in a single file.

Sure, I'll take a look. Have you noticed anything like this with the WebKitCtrl when used outside of PyAUI?

The problem is that the WebKitCtrl is stealing all of the mouse events, even if another widget has them captured. You can see this in the sample I attached. The splitter window has the same problem that the PyAUI does, dragging the sash towards the webkit doesn't go anywhere because once the cursor gets over the webkit the splitter isn't getting any more events. The panel I put on the left will also capture the mouse if you start a drag there, and then will print out the motion events. The prints stop when you move the mouse over the webkit.

Kevin, do you have any ideas on this?

No ideas, unfortunately. ;-/ I had just gotten around to determining that the mouse events were being eaten myself, and was going to test it with wxSplitterWindow, but you beat me to it. At this point, I'm fairly certain we're again getting bitten by limitations in the Carbon<->Cocoa bridge that Apple built for webkit. To some degree, webkit is in its own little "world", not really part of the normal control hierarchy. Even after they open sourced webkit, not all the bridge parts were open sourced, and I don't think they intend to continue developing it further.

On the bright side, I've gotten Apple's WebKit sources building with Bakefile project files on both MSVC8 and gcc4/OS X 10.4.6, and have it about halfway building on Linux. :wink: I've just sent a message to webkit-dev and am discussing some implementation issues with them, so that the Bakefiles can be integrated with their tree. (They've said they'll take patches for ports.) Once that is completed, we can start implementing bits in wx. Fortunately, we don't have to do the renderer because they've done that in Cairo, although that doesn't work well on Mac yet. ;-/ This will solve my webkit problems, my wxMozilla problems, and my IE problems. (not wxIE, that works fine. :wink:

Thanks,

Kevin

···

On Apr 15, 2006, at 2:32 PM, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

import wx
import wx.webkit

class MouseGrabber(wx.Panel):
    def __init__(self, *args, **kw):
        wx.Panel.__init__(self, *args, **kw)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_MOTION, self.OnMotion)

    def OnLeftDown(self, evt):
        print "left down"
        self.CaptureMouse()
        evt.Skip()

    def OnLeftUp(self, evt):
        print "left up"
        #if self.HasCapture():
        self.ReleaseMouse
        evt.Skip()

    def OnMotion(self, evt):
        if evt.Dragging() and evt.LeftIsDown():
            print evt.GetPosition()
        evt.Skip()

class Frame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "Another Test")
        splitter = wx.SplitterWindow(self)

        mg = MouseGrabber(splitter, style=wx.BORDER_SUNKEN)

        if wx.Platform == '__WXMAC__':
            wk = wx.webkit.WebKitCtrl(splitter, -1, 'http://www.wxpython.org',
                                      style=wx.BORDER_SUNKEN)
        else:
            wk = wx.Panel(splitter, style=wx.BORDER_SUNKEN)
            wk.SetBackgroundColour("sky blue")

        splitter.SplitVertically(mg, wk)

app = wx.App(False)
frm = Frame(None)
frm.Show()
app.MainLoop()

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

Hi Robin and Kevin! Thank you both for looking into this since WebKit is a fairly important components of the wxPython tool kit. Kevin, your effort is encouraging on the Universal Binaries front. I have personally no experience yet with Universal Binaries and am still on legacy 10.3.9.

Regards,
David

Kevin Ollivier wrote:

···

Hi Robin,

On Apr 15, 2006, at 2:32 PM, Robin Dunn wrote:

David Pratt wrote:

Hi Robin! Many thanks for your note and for taking a look since I really like PyAUI but this is really something that is holding me back from moving forward and using it. I've attached the file. The code is in webkit-pyaui.py It will show a treectrl on left and webkitctrl on right in center pane. I included PyAUI in the folder as well so you could execute it without having to retrieve a copy. I wish I could say I have more experience with webkitctrl to know its behavior a bit better. I don't recall any problems size when it was in a panel but do remember a quirk where I had to put in in a pane an then in another to contain it properly - it was a while ago so it is not a clear in my mind. I stripped things down to just something that shows the issue to make it as small as possible. The treectrl on the left I substituted with the one in the wxpython demo since mine is attached to a database. I am hoping it may be sizer related as you suspect but I have tried a few things in this regard with no luck as yet. Thanks again.
Regards,
David
Robin Dunn wrote:

David Pratt wrote:

Hi Robin. I tried what you have suggested also. No success yet. I also tried setting flexible direction to wx.BOTH on the wx.FlexGridSizer that I am using for the panel that contains the WebKitCtrl. I was not sure whether this could help but tried it anyway. Still cannot shrink this panel :frowning: Robin, would you like me to send you a small app to demonstrate the problem? I'll put it together in a single file.

Sure, I'll take a look. Have you noticed anything like this with the WebKitCtrl when used outside of PyAUI?

The problem is that the WebKitCtrl is stealing all of the mouse events, even if another widget has them captured. You can see this in the sample I attached. The splitter window has the same problem that the PyAUI does, dragging the sash towards the webkit doesn't go anywhere because once the cursor gets over the webkit the splitter isn't getting any more events. The panel I put on the left will also capture the mouse if you start a drag there, and then will print out the motion events. The prints stop when you move the mouse over the webkit.

Kevin, do you have any ideas on this?

No ideas, unfortunately. ;-/ I had just gotten around to determining that the mouse events were being eaten myself, and was going to test it with wxSplitterWindow, but you beat me to it. At this point, I'm fairly certain we're again getting bitten by limitations in the Carbon<->Cocoa bridge that Apple built for webkit. To some degree, webkit is in its own little "world", not really part of the normal control hierarchy. Even after they open sourced webkit, not all the bridge parts were open sourced, and I don't think they intend to continue developing it further.

On the bright side, I've gotten Apple's WebKit sources building with Bakefile project files on both MSVC8 and gcc4/OS X 10.4.6, and have it about halfway building on Linux. :wink: I've just sent a message to webkit-dev and am discussing some implementation issues with them, so that the Bakefiles can be integrated with their tree. (They've said they'll take patches for ports.) Once that is completed, we can start implementing bits in wx. Fortunately, we don't have to do the renderer because they've done that in Cairo, although that doesn't work well on Mac yet. ;-/ This will solve my webkit problems, my wxMozilla problems, and my IE problems. (not wxIE, that works fine. :wink:

Thanks,

Kevin

--Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

import wx
import wx.webkit

class MouseGrabber(wx.Panel):
    def __init__(self, *args, **kw):
        wx.Panel.__init__(self, *args, **kw)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_MOTION, self.OnMotion)

    def OnLeftDown(self, evt):
        print "left down"
        self.CaptureMouse()
        evt.Skip()

    def OnLeftUp(self, evt):
        print "left up"
        #if self.HasCapture():
        self.ReleaseMouse
        evt.Skip()

    def OnMotion(self, evt):
        if evt.Dragging() and evt.LeftIsDown():
            print evt.GetPosition()
        evt.Skip()

class Frame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "Another Test")
        splitter = wx.SplitterWindow(self)

        mg = MouseGrabber(splitter, style=wx.BORDER_SUNKEN)

        if wx.Platform == '__WXMAC__':
            wk = wx.webkit.WebKitCtrl(splitter, -1, 'http://www.wxpython.org',
                                      style=wx.BORDER_SUNKEN)
        else:
            wk = wx.Panel(splitter, style=wx.BORDER_SUNKEN)
            wk.SetBackgroundColour("sky blue")

        splitter.SplitVertically(mg, wk)

app = wx.App(False)
frm = Frame(None)
frm.Show()
app.MainLoop()

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

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