Ignore:
Timestamp:
Sep 16, 2015 5:35:18 PM (6 years ago)
Author:
toby
Message:

Element selection workaround for wx>2.8 on mac

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIElemGUI.py

    r1589 r1972  
    4343            else:
    4444                color=E[6]
    45             PickElement.ElButton(self,name=E[0],
    46                pos=wx.Point(E[1]*self.butWid+25,E[2]*24+24),tip=E[3],color=color)
     45            self.ElButton(name=E[0],
     46               pos=wx.Point(E[1]*self.butWid+25,E[2]*24+24),
     47               tip=E[3],color=color)
    4748            i+=1
    4849
     
    5455       
    5556    def ElButton(self, name, pos, tip, color):
    56         'Needs a doc string'
     57        'Creates an element button widget'
    5758        Black = wx.Colour(0,0,0)
    5859        if not self.ifNone and name[0] == 'None':
     
    6667            if name[0] == 'None':
    6768                butWid *= 2
    68             El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(butWid,23),
    69                 style=wx.CB_READONLY, value=name[0])
     69            # patch for wx 2.9+ on Mac where EVT_COMBOBOX happens only on
     70            # value change. Not ideal because wx.CB_READONLY is better.
     71            i,j= wx.__version__.split('.')[0:2]
     72            if int(i)+int(j)/10. > 2.8 and 'wxOSX' in wx.PlatformInfo:
     73
     74                El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(butWid,23),
     75                    style=wx.CB_DROPDOWN, value=name[0]+' ') # add an invisible space
     76            else:
     77                El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(butWid,23),
     78                    style=wx.CB_READONLY, value=name[0])
    7079            El.Bind(wx.EVT_COMBOBOX,self.OnElButton)
    7180       
Note: See TracChangeset for help on using the changeset viewer.