Changeset 563 for trunk/GSASIIElemGUI.py


Ignore:
Timestamp:
Apr 20, 2012 10:07:01 AM (10 years ago)
Author:
vondreele
Message:

add "None" element to table - used for charge flipping
mods to charge flipping
fix PickElement? errors in pdf controls, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIElemGUI.py

    r529 r563  
    1515    "Makes periodic table widget for picking element - caller maintains element list"
    1616    Elem=None
    17     def _init_ctrls(self, prnt,oneOnly):
     17    def _init_ctrls(self, prnt):
    1818        wx.Dialog.__init__(self, id=-1, name='PickElement',
    1919              parent=prnt, pos=wx.DefaultPosition,
     
    2727        i=0
    2828        for E in ET.ElTable:
    29             if oneOnly:
     29            if self.oneOnly:
    3030                color=E[4]
    3131            else:
    3232                color=E[6]
    3333            PickElement.ElButton(self,name=E[0],
    34                pos=wx.Point(E[1]*self.butWid+25,E[2]*24+24),tip=E[3],color=color,oneOnly=oneOnly)
     34               pos=wx.Point(E[1]*self.butWid+25,E[2]*24+24),tip=E[3],color=color)
    3535            i+=1
    3636
    37     def __init__(self, parent,oneOnly=False):
    38         self._init_ctrls(parent,oneOnly)
     37    def __init__(self, parent,oneOnly=False,ifNone=False):
     38        self.oneOnly = oneOnly
     39        self.ifNone = ifNone
     40        self._init_ctrls(parent)
    3941       
    40     def ElButton(self, name, pos, tip, color, oneOnly):
     42    def ElButton(self, name, pos, tip, color):
    4143        Black = wx.Colour(0,0,0)
    42         if oneOnly:
     44        if not self.ifNone and name[0] == 'None':
     45            return
     46        if self.oneOnly:
    4347            El = wscs.ColourSelect(label=name[0], parent=self,colour=color,
    4448                pos=pos, size=wx.Size(self.butWid,23), style=wx.RAISED_BORDER)
    4549            El.Bind(wx.EVT_BUTTON, self.OnElButton)
    4650        else:
    47             El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(self.butWid,23),
     51            butWid = self.butWid
     52            if name[0] == 'None':
     53                butWid *= 2
     54            El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(butWid,23),
    4855                style=wx.CB_READONLY, value=name[0])
    4956            El.Bind(wx.EVT_COMBOBOX,self.OnElButton)
     
    5360
    5461    def OnElButton(self, event):
    55         El = event.GetEventObject().GetValue()
     62        if self.oneOnly:
     63            El = event.GetEventObject().GetLabel()
     64        else:
     65            El = event.GetEventObject().GetValue()
    5666        self.Elem = El
    5767        self.EndModal(wx.ID_OK)       
Note: See TracChangeset for help on using the changeset viewer.