コード例 #1
0
 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])
コード例 #2
0
    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])
コード例 #3
0
    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]
コード例 #4
0
 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]
コード例 #5
0
    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
コード例 #6
0
    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
コード例 #7
0
 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]