hi i make this with the ribbon file control for use with the aui
library but just work with the wx.lib.agw.aui and work good but when
write this line 'self.ribbon.Realize()' the tab don`t Draw and if no
write these line the buttons don`t Draw
#control.py file
import wx
import wx.aui as AUI
AuiPaneInfo = AUI.AuiPaneInfo
try:
import wx.lib.agw.aui as PyAUI
PyAuiPaneInfo = PyAUI.AuiPaneInfo
except ImportError:
pass
class RibbonControl(wx.PyControl):
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0,
validator=wx.DefaultValidator, name="RibbonControl"):
wx.PyControl.__init__(self, parent, id, pos, size, style,
validator, name)
self._art = None
mem_dc = wx.MemoryDC()
mem_dc.SelectObject(wx.EmptyBitmap(1, 1))
dummy, self._barHeight = mem_dc.GetTextExtent("Tp")
mem_dc.SelectObject(wx.NullBitmap)
if isinstance(parent, RibbonControl):
self._art = parent.GetArtProvider()
def SetArtProvider(self, art):
self._art = art
def GetArtProvider(self):
return self._art
def IsSizingContinuous(self):
return True
def DoGetNextSmallerSize(self, direction, size):
# Dummy implementation for code which doesn't check for
IsSizingContinuous() == true
minimum = self.GetMinSize()
if direction & wx.HORIZONTAL and size.x > minimum.x:
size.x -= 1
if direction & wx.VERTICAL and size.y > minimum.y:
size.y -= 1
return size
def DoGetNextLargerSize(self, direction, size):
# Dummy implementation for code which doesn't check for
IsSizingContinuous() == true
if direction & wx.HORIZONTAL:
size.x += 1
if direction & wx.VERTICAL:
size.y += 1
return size
def GetNextSmallerSize(self, direction, relative_to=None):
if relative_to is not None:
return self.DoGetNextSmallerSize(direction, relative_to)
return self.DoGetNextSmallerSize(direction, self.GetSize())
def GetNextLargerSize(self, direction, relative_to=None):
if relative_to is not None:
return self.DoGetNextLargerSize(direction, relative_to)
return self.DoGetNextLargerSize(direction, self.GetSize())
def Realize(self):
pass
def Realise(self):
pass
def PositionAUI(self, mgr, fixToolbar=True):
""" Positions the control inside wxAUI frame manager. """
if isinstance(mgr, wx.aui.AuiManager):
pn = AuiPaneInfo()
else:
pn = PyAuiPaneInfo()
xx = wx.SystemSettings_GetMetric(wx.SYS_SCREEN_X)
# We add our menu bar as a toolbar, with the following
settings
pn.Name("ribbon_bar_ctrl")
pn.Caption("Ribbon Bar")
pn.Top()
pn.MinSize(wx.Size(xx/1, self._barHeight))
pn.LeftDockable(False)
pn.RightDockable(False)
pn.ToolbarPane()
if not fixToolbar:
# We add our menu bar as a toolbar, with the following
settings
pn.BestSize(wx.Size(xx, self._barHeight))
pn.FloatingSize(wx.Size(300, self._barHeight))
pn.Floatable(True)
pn.MaxSize(wx.Size(xx, self._barHeight))
pn.Gripper(True)
else:
pn.BestSize(wx.Size(xx, self._barHeight))
pn.Gripper(False)
pn.Resizable(False)
mgr.AddPane(self, pn)