controls/PouInstanceVariablesPanel.py
changeset 1281 47131e3388f4
parent 1277 358db9d64aa1
child 1343 a76a020b8822
equal deleted inserted replaced
1279:0eb9f8af479f 1281:47131e3388f4
    21 #You should have received a copy of the GNU General Public
    21 #You should have received a copy of the GNU General Public
    22 #License along with this library; if not, write to the Free Software
    22 #License along with this library; if not, write to the Free Software
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24 
    24 
    25 import wx
    25 import wx
       
    26 import wx.lib.agw.customtreectrl as CT
       
    27 
       
    28 import wx.lib.imageutils
    26 import wx.lib.buttons
    29 import wx.lib.buttons
    27 import wx.lib.agw.customtreectrl as CT
    30 GrayedBitmapCache = {}
       
    31 def SetBitmapLabel(self, bitmap, createOthers=True):
       
    32     """
       
    33     Set the bitmap to display normally.
       
    34     This is the only one that is required. If
       
    35     createOthers is True, then the other bitmaps
       
    36     will be generated on the fly.  Currently,
       
    37     only the disabled bitmap is generated.
       
    38     """
       
    39     self.bmpLabel = bitmap
       
    40     if bitmap is not None and createOthers:
       
    41         GrayBitmap=GrayedBitmapCache.get(bitmap,None)
       
    42         if GrayBitmap is None:
       
    43             image = wx.ImageFromBitmap(bitmap)
       
    44             wx.lib.imageutils.grayOut(image)
       
    45             GrayBitmap = wx.BitmapFromImage(image)
       
    46             GrayedBitmapCache[bitmap] = GrayBitmap
       
    47         self.SetBitmapDisabled(GrayBitmap)
       
    48 wx.lib.buttons.GenBitmapButton.SetBitmapLabel = SetBitmapLabel
    28 
    49 
    29 try:
    50 try:
    30     import matplotlib
    51     import matplotlib
    31     matplotlib.use('WX')
    52     matplotlib.use('WX')
    32     USE_MPL = True
    53     USE_MPL = True