Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

disappearing ribbon panel with sizer

Open vinvega opened this issue 7 years ago • 5 comments

Operating system: Windows 7 Enterprise wxPython version: 4.0.0b2 Stock or custom build: Stock Python version: 2.7.12.final.0 (Anaconda 4.2.9)

Ribbon panels with a sizer will disappear if it is clicked on while it is collapsed (left most panel in example). If you click on a panel that is also collapsed that does not have a sizer it does not disappear, and after that you can click on the panel with a sizer with no problem. I am not sure if this is relevant, but the first time you click on a collapsed panel (with or without a sizer), its icon disappears while it is in its dropped down position. After the first time on any panel, it does not.

import wx
import wx.ribbon as RB
from wx.lib.embeddedimage import PyEmbeddedImage

hexagon = PyEmbeddedImage(
    "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAALNJ"
    "REFUWIXt180NgCAMBlALG7ILU7gLGxo9aWL4a/uV6KE9Q/sAxUoU4vZlBGRyjuXMsZxIDtLs"
    "QK/ofiRaCuCuVgJhAWYrRnZkCJAm1kCaAPSMJfNfAMuHi5vvAbQGawtzIHduohCrAVaFZ5D9"
    "SFRdRKuK93JDN6FFOMABDnCAAyoA2mSOopX7H5/j0UAEImpIpBPRwkOAFmLWlEoTL2vLuRBN"
    "YRVgBln+a9aDIK8rBLCICxjaeOXhD450AAAAAElFTkSuQmCC")
# --------------------------------------------------- #

class RibbonFrame(wx.Frame):
    def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, log=None):

        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        self._ribbon = RB.RibbonBar(self, wx.ID_ANY)

        home = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Examples", hexagon.Bitmap)

        shapes_panel = RB.RibbonPanel(home, wx.ID_ANY, "Shapes", hexagon.Bitmap)
        shapes = RB.RibbonButtonBar(shapes_panel)
        selection_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        selection_panel_sizer.Add(shapes,1)
        shapes_panel.SetSizer(selection_panel_sizer)

        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)

        shapes_panel = RB.RibbonPanel(home, wx.ID_ANY, "Shapes", hexagon.Bitmap)
        shapes = RB.RibbonButtonBar(shapes_panel)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)

        shapes_panel = RB.RibbonPanel(home, wx.ID_ANY, "Shapes", hexagon.Bitmap)
        shapes = RB.RibbonButtonBar(shapes_panel)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)
        shapes.AddDropdownButton(wx.ID_ANY, "Other Polygon", hexagon.Bitmap)

        s = wx.BoxSizer(wx.VERTICAL)
        s.Add(self._ribbon, 0, wx.EXPAND)
        self.SetSizer(s)
        self.CenterOnScreen()
        self._ribbon.Realize()
        self.Show()

# ---------------------------------------------------------------------------
def main():
    app = wx.App()
    frame = RibbonFrame(None)
    app.MainLoop()

if __name__ == "__main__" :
    main()

vinvega avatar Jan 30 '18 23:01 vinvega

Is it disappearing or being drawn behind the frame? On macOS it appears that the drop down ribbon is being drawn behind the TLW.

Ex: screen shot 2018-02-01 at 9 56 33 am

mesalu avatar Feb 01 '18 17:02 mesalu

In order to reproduce it, the window needs to be resized so that all of the panels are collapsed to a single icon. The whole ribbon panel disappears, see image sequence below.

issue

vinvega avatar Feb 06 '18 17:02 vinvega

Oh interesting. Sorry, I misunderstood. I'll start looking into causes when I have time. :)

mesalu avatar Feb 06 '18 19:02 mesalu

Issue probably resides with wxWidgets. I'll need to dig through their issue catalog to see if its already been reported there.

mesalu avatar Feb 06 '18 21:02 mesalu

@vinvega @swt2c is this still relevant? I don’t use ribbon stuff, but out of curiosity, is this still a problem? Does it also happen with wx.lib.agw.ribbonbar (the pure-Python version of it)?

infinity77 avatar Sep 07 '24 17:09 infinity77