def append(self, action): if action is None: self.AddSeparator() else: if action.pixmap is None: bitmap = None elif isinstance(action.pixmap, Image.Image): bitmap = _pil_to_wxbitmap(action.pixmap) elif isinstance(action.pixmap, wx.Bitmap): bitmap = action.pixmap elif isinstance(action.pixmap, basestring): bitmap = _pil_to_wxbitmap(images[action.pixmap][16,16]) else: bitmap = None id = wx.NewId() if action.type == 'check': self.AddCheckTool(id, bitmap, bitmap, action.name, action.desc) elif action.type == 'radio': self.AddRadioTool(id, bitmap, bitmap, action.name, action.desc) else: self.AddSimpleTool(id, bitmap, action.name, action.desc) self.tools[id] = action x, y = self.GetToolBitmapSize() xb, yb = bitmap.GetSize() self.SetToolBitmapSize((max(x, xb), max(y, yb))) action.upd.append([self, id])
def append(self, action): if action is None: self.AddSeparator() else: if action.pixmap is None: bitmap = None elif isinstance(action.pixmap, Image.Image): bitmap = _pil_to_wxbitmap(action.pixmap) elif isinstance(action.pixmap, wx.Bitmap): bitmap = action.pixmap elif isinstance(action.pixmap, basestring): bitmap = _pil_to_wxbitmap(images[action.pixmap][16, 16]) else: bitmap = None id = wx.NewId() if action.type == 'check': self.AddCheckTool(id, bitmap, bitmap, action.name, action.desc) elif action.type == 'radio': self.AddRadioTool(id, bitmap, bitmap, action.name, action.desc) else: self.AddSimpleTool(id, bitmap, action.name, action.desc) self.tools[id] = action x, y = self.GetToolBitmapSize() xb, yb = bitmap.GetSize() self.SetToolBitmapSize((max(x, xb), max(y, yb))) action.upd.append([self, id])
def getpixmap(self, image): if image is None: return None if image not in self.pixmaps: if isinstance(image, Image.Image): img = _pil_to_wxbitmap(image) elif isinstance(image, wx.Bitmap): img = image else: img = _pil_to_wxbitmap(images[image][16,16]) self.pixmaps[image] = self.imagelist.Add(img) return self.pixmaps[image]
def getpixmap(self, image): if image is None: return None if image not in self.pixmaps: self.pixmaps[image] = self.imagelist.Add( _pil_to_wxbitmap(images[image][16, 16])) return self.pixmaps[image]
def append(self, action): if action is None: self._menu.AppendSeparator() else: id = wx.NewId() self.items[id] = action if action.accel is not None: name = action.name + '\t' + action.accel else: name = action.name if action.desc is not None: help = action.desc else: help = '' # self._menu.Append(id, name, help) item = wx.MenuItem(self._menu, id, name, help) if action.pixmap is not None: item.SetBitmap(_pil_to_wxbitmap(images[action.pixmap][16,16])) self._menu.AppendItem(item) if self.menubar is not None: self.menubar.items[id] = action
def append(self, action): if action is None: self._menu.AppendSeparator() else: id = wx.NewId() self.items[id] = action if action.accel is not None: name = action.name + '\t' + action.accel else: name = action.name if action.desc is not None: help = action.desc else: help = '' # self._menu.Append(id, name, help) item = wx.MenuItem(self._menu, id, name, help) if action.pixmap is not None: item.SetBitmap(_pil_to_wxbitmap(images[action.pixmap][16, 16])) self._menu.AppendItem(item) if self.menubar is not None: self.menubar.items[id] = action
def getpixmap(self, image): if image not in self.pixmaps: self.pixmaps[image] = self.imagelist.Add(_pil_to_wxbitmap(images[image][16,16])) return self.pixmaps[image]