+
+ if wx.Platform == "__WXMAC__":
+ iconList = wx.ImageList(16, 16, initialCount = len(optionsPanelClasses))
+ self._iconIndexLookup = []
+
+ for optionsPanelClass in optionsPanelClasses:
+ optionsPanel = optionsPanelClass(optionsNotebook, -1)
+ self._optionsPanels.append(optionsPanel)
+
+ # We need to populate the image list before setting notebook images
+ if hasattr(optionsPanel, "GetIcon"):
+ icon = optionsPanel.GetIcon()
+ else:
+ icon = None
+ if icon:
+ if icon.GetHeight() != 16 or icon.GetWidth() != 16:
+ icon.SetHeight(16)
+ icon.SetWidth(16)
+ if wx.GetApp().GetDebug():
+ print "Warning: icon for '%s' isn't 16x16, not crossplatform" % template._docTypeName
+ iconIndex = iconList.AddIcon(icon)
+ self._iconIndexLookup.append((optionsPanel, iconIndex))
+
+ else:
+ # use -1 to represent that this panel has no icon
+ self._iconIndexLookup.append((optionsPanel, -1))
+
+ optionsNotebook.AssignImageList(iconList)
+
+ # Add icons to notebook
+ for index in range(0, len(optionsPanelClasses)-1):
+ iconIndex = self._iconIndexLookup[index][1]
+ if iconIndex >= 0:
+ optionsNotebook.SetPageImage(index, iconIndex)
+ else:
+ for optionsPanelClass in optionsPanelClasses:
+ optionsPanel = optionsPanelClass(optionsNotebook, -1)
+ self._optionsPanels.append(optionsPanel)
+