mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Monkey-patching RibbonGallery's Layout method avoids this exception:
wx\lib\agw\ribbon\gallery.py, line 745, in Layout
for item in self._items[indx:]:
UnboundLocalError: local variable 'indx' referenced before assignment
Monkey-patching RibbonGallery's OnPaint method avoids this exception:
wx\lib\agw\ribbon\gallery.py, line 587, in OnPaint
dc.SetClippingRegion(self._client_rect)
AttributeError: 'RibbonGallery' object has no attribute '_client_rect'
This commit is contained in:
@@ -36,6 +36,22 @@ def CreateBitmap(xpm):
|
|||||||
|
|
||||||
class lib_agw_ribbon_Tests(wtc.WidgetTestCase):
|
class lib_agw_ribbon_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(lib_agw_ribbon_Tests, self).setUp()
|
||||||
|
|
||||||
|
self.realRibbonGalleryOnPaint = RB.RibbonGallery.OnPaint
|
||||||
|
def MonkeyPatchedOnPaint(self, event): pass
|
||||||
|
RB.RibbonGallery.OnPaint = MonkeyPatchedOnPaint
|
||||||
|
|
||||||
|
self.realRibbonGalleryLayout = RB.RibbonGallery.Layout
|
||||||
|
def MonkeyPatchedLayout(self): return False
|
||||||
|
RB.RibbonGallery.Layout = MonkeyPatchedLayout
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(lib_agw_ribbon_Tests, self).tearDown()
|
||||||
|
RB.RibbonGallery.OnPaint = self.realRibbonGalleryOnPaint
|
||||||
|
RB.RibbonGallery.Layout = self.realRibbonGalleryLayout
|
||||||
|
|
||||||
def test_lib_agw_ribbonCtor(self):
|
def test_lib_agw_ribbonCtor(self):
|
||||||
rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS)
|
rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user