mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 12:00:13 +01:00
Use images on the Notebook tabs on Mac too, and clean up some other old hacks
This commit is contained in:
39
demo/Main.py
39
demo/Main.py
@@ -1485,15 +1485,14 @@ class wxPythonDemo(wx.Frame):
|
|||||||
|
|
||||||
# Create a Notebook
|
# Create a Notebook
|
||||||
self.nb = wx.Notebook(pnl, -1, style=wx.CLIP_CHILDREN)
|
self.nb = wx.Notebook(pnl, -1, style=wx.CLIP_CHILDREN)
|
||||||
if 'wxMac' not in wx.PlatformInfo:
|
imgList = wx.ImageList(16, 16)
|
||||||
imgList = wx.ImageList(16, 16)
|
for png in ["overview", "code", "demo"]:
|
||||||
for png in ["overview", "code", "demo"]:
|
bmp = images.catalog[png].GetBitmap()
|
||||||
bmp = images.catalog[png].GetBitmap()
|
imgList.Add(bmp)
|
||||||
imgList.Add(bmp)
|
for indx in range(9):
|
||||||
for indx in range(9):
|
bmp = images.catalog["spinning_nb%d"%indx].GetBitmap()
|
||||||
bmp = images.catalog["spinning_nb%d"%indx].GetBitmap()
|
imgList.Add(bmp)
|
||||||
imgList.Add(bmp)
|
self.nb.AssignImageList(imgList)
|
||||||
self.nb.AssignImageList(imgList)
|
|
||||||
|
|
||||||
self.BuildMenuBar()
|
self.BuildMenuBar()
|
||||||
|
|
||||||
@@ -1537,23 +1536,9 @@ class wxPythonDemo(wx.Frame):
|
|||||||
self.tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
|
self.tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
|
||||||
|
|
||||||
# Set up a wx.html.HtmlWindow on the Overview Notebook page
|
# Set up a wx.html.HtmlWindow on the Overview Notebook page
|
||||||
# we put it in a panel first because there seems to be a
|
# for displaying info about each sample in the demo.
|
||||||
# refresh bug of some sort (wxGTK) when it is directly in
|
self.ovr = wx.html.HtmlWindow(self.nb, -1, size=(400, 400))
|
||||||
# the notebook...
|
self.nb.AddPage(self.ovr, self.overviewText, imageId=0)
|
||||||
|
|
||||||
if 0: # the old way
|
|
||||||
self.ovr = wx.html.HtmlWindow(self.nb, -1, size=(400, 400))
|
|
||||||
self.nb.AddPage(self.ovr, self.overviewText, imageId=0)
|
|
||||||
|
|
||||||
else: # hopefully I can remove this hacky code soon, see SF bug #216861
|
|
||||||
panel = wx.Panel(self.nb, -1, style=wx.CLIP_CHILDREN)
|
|
||||||
self.ovr = wx.html.HtmlWindow(panel, -1, size=(400, 400))
|
|
||||||
self.nb.AddPage(panel, self.overviewText, imageId=0)
|
|
||||||
|
|
||||||
def OnOvrSize(evt, ovr=self.ovr):
|
|
||||||
ovr.SetSize(evt.GetSize())
|
|
||||||
panel.Bind(wx.EVT_SIZE, OnOvrSize)
|
|
||||||
panel.Bind(wx.EVT_ERASE_BACKGROUND, EmptyHandler)
|
|
||||||
|
|
||||||
if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
|
if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
|
||||||
self.ovr.SetStandardFonts()
|
self.ovr.SetStandardFonts()
|
||||||
@@ -2691,7 +2676,7 @@ class MyApp(wx.App, wx.lib.mixins.inspection.InspectionMixin):
|
|||||||
images = i
|
images = i
|
||||||
|
|
||||||
# For debugging
|
# For debugging
|
||||||
#self.SetAssertMode(wx.PYAPP_ASSERT_DIALOG|wx.PYAPP_ASSERT_EXCEPTION)
|
#self.SetAssertMode(wx.APP_ASSERT_DIALOG|wx.APP_ASSERT_EXCEPTION)
|
||||||
|
|
||||||
wx.SystemOptions.SetOption("mac.window-plain-transition", 1)
|
wx.SystemOptions.SetOption("mac.window-plain-transition", 1)
|
||||||
self.SetAppName("wxPyDemo")
|
self.SetAppName("wxPyDemo")
|
||||||
|
|||||||
Reference in New Issue
Block a user