source: trunk/GSASIIElem.py @ 10

Last change on this file since 10 was 10, checked in by vondreel, 13 years ago
File size: 21.8 KB
Line 
1"""Element: functions for element types
2   Copyright: 2008, Robert B. Von Dreele (Argonne National Laboratory)
3"""
4
5import wx
6import math
7import sys
8import os.path
9import  wx.lib.colourselect as wscs
10
11def GetFormFactorCoeff(El):
12    """Read form factor coefficients from atomdata.asc file
13    @param El: element 1-2 character symbol case irrevelant
14    @return: FormFactors: list of form factor dictionaries
15    each dictionary is:
16    'Symbol':4 character element symbol with valence (e.g. 'NI+2')
17    'Z': atomic number
18    'fa': 4 A coefficients
19    'fb':4 B coefficients
20    'fc': C coefficient
21    """
22    ElS = El.upper()
23    ElS = ElS.rjust(2)
24    filename = os.path.join(sys.path[0],'atmdata.dat')
25    try:
26        FFdata = open(filename,'Ur')
27    except:
28        wx.MessageBox(message="File atmdata.dat not found in directory %s" % sys.path[0],
29            caption="No atmdata.dat file",style=wx.OK | wx.ICON_EXCLAMATION | wx.STAY_ON_TOP)
30        sys.exit()
31    S = '1'
32    FormFactors = []
33    while S:
34        S = FFdata.readline()
35        if S[3:5] == ElS:
36            if S[5:6] != '_':
37                Z=int(S[:2])
38                Symbol = S[3:7].strip()
39                S = S[12:]
40                fa = (float(S[:7]),float(S[14:21]),float(S[28:35]),float(S[42:49]))
41                fb = (float(S[7:14]),float(S[21:28]),float(S[35:42]),float(S[49:56]))
42                FormFac = {'Symbol':Symbol,'Z':Z,'fa':fa,'fb':fb,'fc':float(S[56:63])}
43                FormFactors.append(FormFac)               
44    FFdata.close()
45    return FormFactors
46   
47def GetAtomInfo(El):
48    ElS = El.upper().rjust(2)
49    filename = os.path.join(sys.path[0],'atmdata.dat')
50    try:
51        FFdata = open(filename,'Ur')
52    except:
53        wx.MessageBox(message="File atmdata.dat not found in directory %s" % sys.path[0],
54            caption="No atmdata.dat file",style=wx.OK | wx.ICON_EXCLAMATION | wx.STAY_ON_TOP)
55        sys.exit()
56    S = '1'
57    AtomInfo = {}
58    Mass = []
59    while S:
60        S = FFdata.readline()
61        if S[3:5] == ElS:
62            if S[5:6] == '_':
63                if not Mass:                                 #picks 1st one; natural abundance or 1st isotope
64                    Mass = float(S[10:19])
65                if S[5:9] == '_SIZ':
66                    Z=int(S[:2])
67                    Symbol = S[3:5].strip()
68                    Drad = float(S[12:22])
69                    Arad = float(S[22:32])
70    FFdata.close()
71    AtomInfo={'Symbol':Symbol,'Mass':Mass,'Z':Z,'Drad':Drad,'Arad':Arad}   
72    return AtomInfo
73     
74def GetXsectionCoeff(El):
75    """Read atom orbital scattering cross sections for fprime calculations via Cromer-Lieberman algorithm
76    @param El: 2 character element symbol
77    @return: Orbs: list of orbitals each a dictionary with detailed orbital information used by FPcalc
78    each dictionary is:
79    'OrbName': Orbital name read from file
80    'IfBe' 0/2 depending on orbital
81    'BindEn': binding energy
82    'BB': BindEn/0.02721
83    'XSectIP': 5 cross section inflection points
84    'ElEterm': energy correction term
85    'SEdge': absorption edge for orbital
86    'Nval': 10/11 depending on IfBe
87    'LEner': 10/11 values of log(energy)
88    'LXSect': 10/11 values of log(cross section)
89    """
90    AU = 2.80022e+7
91    C1 = 0.02721
92    ElS = El.upper()
93    ElS = ElS.ljust(2)
94    filename = os.path.join(sys.path[0],'Xsect.dat')
95    try:
96        xsec = open(filename,'Ur')
97    except:
98        wx.MessageBox(message="File Xsect.dat not found in directory %s" % sys.path[0],
99            caption="No Xsect.dat file",style=wx.OK | wx.ICON_EXCLAMATION |wx.STAY_ON_TOP)
100        sys.exit()
101    S = '1'
102    Orbs = []
103    while S:
104        S = xsec.readline()
105        if S[:2] == ElS:
106            S = S[:-1]+xsec.readline()[:-1]+xsec.readline()
107            OrbName = S[9:14]
108            S = S[14:]
109            IfBe = int(S[0])
110            S = S[1:]
111            val = S.split()
112            BindEn = float(val[0])
113            BB = BindEn/C1
114            Orb = {'OrbName':OrbName,'IfBe':IfBe,'BindEn':BindEn,'BB':BB}
115            Energy = []
116            XSect = []
117            for i in range(11):
118                Energy.append(float(val[2*i+1]))
119                XSect.append(float(val[2*i+2]))
120            XSecIP = []
121            for i in range(5): XSecIP.append(XSect[i+5]/AU)
122            Orb['XSecIP'] = XSecIP
123            if IfBe == 0:
124                Orb['SEdge'] = XSect[10]/AU
125                Nval = 11
126            else:
127                Orb['ElEterm'] = XSect[10]
128                del Energy[10]
129                del XSect[10]
130                Nval = 10
131                Orb['SEdge'] = 0.0
132            Orb['Nval'] = Nval
133            D = dict(zip(Energy,XSect))
134            Energy.sort()
135            X = []
136            for key in Energy:
137                X.append(D[key])
138            XSect = X
139            LEner = []
140            LXSect = []
141            for i in range(Nval):
142                LEner.append(math.log(Energy[i]))
143                if XSect[i] > 0.0:
144                    LXSect.append(math.log(XSect[i]))
145                else:
146                    LXSect.append(0.0)
147            Orb['LEner'] = LEner
148            Orb['LXSect'] = LXSect
149            Orbs.append(Orb)
150    xsec.close()
151    return Orbs
152   
153def GetMagFormFacCoeff(El):
154    """Read magnetic form factor data from atomdata.asc file
155    @param El: 2 character element symbol
156    @return: MagFormFactors: list of all magnetic form factors dictionaries for element El.
157    each dictionary contains:
158    'Symbol':Symbol
159    'Z':Z
160    'mfa': 4 MA coefficients
161    'nfa': 4 NA coefficients
162    'mfb': 4 MB coefficients
163    'nfb': 4 NB coefficients
164    'mfc': MC coefficient
165    'nfc': NC coefficient
166    """
167    ElS = El.upper()
168    ElS = ElS.rjust(2)
169    filename = os.path.join(sys.path[0],'atmdata.dat')
170    try:
171        FFdata = open(filename,'Ur')
172    except:
173        wx.MessageBox(message="File atmdata.dat not found in directory %s" % sys.path[0],
174            caption="No atmdata.dat file",style=wx.OK | wx.ICON_EXCLAMATION |wx.STAY_ON_TOP)
175        sys.exit()
176    S = '1'
177    MagFormFactors = []
178    while S:
179        S = FFdata.readline()
180        if S[3:5] == ElS:
181            if S[8:9] == 'M':
182                SN = FFdata.readline()               #'N' is assumed to follow 'M' in Atomdata.asc
183                Z=int(S[:2])
184                Symbol = S[3:7]
185                S = S[12:]
186                SN = SN[12:]
187                mfa = (float(S[:7]),float(S[14:21]),float(S[28:35]),float(S[42:49]))
188                mfb = (float(S[7:14]),float(S[21:28]),float(S[35:42]),float(S[49:56]))
189                nfa = (float(SN[:7]),float(SN[14:21]),float(SN[28:35]),float(SN[42:49]))
190                nfb = (float(SN[7:14]),float(SN[21:28]),float(SN[35:42]),float(SN[49:56]))
191                FormFac = {'Symbol':Symbol,'Z':Z,'mfa':mfa,'nfa':nfa,'mfb':mfb,'nfb':nfb,
192                    'mfc':float(S[56:63]),'nfc':float(SN[56:63])}
193                MagFormFactors.append(FormFac)
194    FFdata.close()
195    return MagFormFactors
196
197def ScatFac(FormFac, SThL):
198    """compute value of form factor
199    @param FormFac: dictionary  defined in GetFormFactorCoeff
200    @param SThL: sin-theta/lambda
201    @return: f: real part of form factor
202    """
203    f = FormFac['fc']
204    fa = FormFac['fa']
205    fb = FormFac['fb']
206    for i in range(4):
207        t = -fb[i]*SThL*SThL
208        if t > -35.0: f += fa[i]*math.exp(t)
209    return f
210           
211def FPcalc(Orbs, KEv):
212    """Compute real & imaginary resonant X-ray scattering factors
213    @param Orbs: list of orbital dictionaries as defined in GetXsectionCoeff
214    @param KEv: x-ray energy in keV
215    @return: C: (f',f",mu): real, imaginary parts of resonant scattering & atomic absorption coeff.
216    """
217    def Aitken(Orb, LKev):
218        Nval = Orb['Nval']
219        j = Nval-1
220        LEner = Orb['LEner']
221        for i in range(Nval):
222            if LEner[i] <= LKev: j = i
223        if j > Nval-3: j= Nval-3
224        T = [0,0,0,0,0,0]
225        LXSect = Orb['LXSect']
226        for i in range(3):
227           T[i] = LXSect[i+j]
228           T[i+3] = LEner[i+j]-LKev
229        T[1] = (T[0]*T[4]-T[1]*T[3])/(LEner[j+1]-LEner[j])
230        T[2] = (T[0]*T[5]-T[2]*T[3])/(LEner[j+2]-LEner[j])
231        T[2] = (T[1]*T[5]-T[2]*T[4])/(LEner[j+2]-LEner[j+1])
232        C = T[2]
233        return C
234   
235    def DGauss(Orb,CX,RX,ISig):
236        ALG = (0.11846344252810,0.23931433524968,0.284444444444,
237        0.23931433524968,0.11846344252810)
238        XLG = (0.04691007703067,0.23076534494716,0.5,
239        0.76923465505284,0.95308992296933)
240       
241        D = 0.0
242        B2 = Orb['BB']**2
243        R2 = RX**2
244        XSecIP = Orb['XSecIP']
245        for i in range(5):
246            X = XLG[i]
247            X2 = X**2
248            XS = XSecIP[i]
249            if ISig == 0:
250                S = BB*(XS*(B2/X2)-CX*R2)/(R2*X2-B2)
251            elif ISig == 1:
252                S = 0.5*BB*B2*XS/(math.sqrt(X)*(R2*X2-X*B2))
253            elif ISig == 2:
254                T = X*X2*R2-B2/X
255                S = 2.0*BB*(XS*B2/(T*X2**2)-(CX*R2/T))
256            else:
257                S = BB*B2*(XS-Orb['SEdge']*X2)/(R2*X2**2-X2*B2)
258            A = ALG[i]
259            D += A*S
260        return D
261   
262    AU = 2.80022e+7
263    C1 = 0.02721
264    C = 137.0367
265    FP = 0.0
266    FPP = 0.0
267    Mu = 0.0
268    LKev = math.log(KEv)
269    RX = KEv/C1
270    if Orbs:
271        for Orb in Orbs:
272            CX = 0.0
273            BB = Orb['BB']
274            BindEn = Orb['BindEn']
275            if Orb['IfBe'] != 0: ElEterm = Orb['ElEterm']
276            if BindEn <= KEv:
277                CX = math.exp(Aitken(Orb,LKev))
278                Mu += CX
279                CX /= AU
280            Corr = 0.0
281            if Orb['IfBe'] == 0 and BindEn >= KEv:
282                CX = 0.0
283                FPI = DGauss(Orb,CX,RX,3)
284                Corr = 0.5*Orb['SEdge']*BB**2*math.log((RX-BB)/(-RX-BB))/RX
285            else:
286                FPI = DGauss(Orb,CX,RX,Orb['IfBe'])
287                if CX != 0.0: Corr = -0.5*CX*RX*math.log((RX+BB)/(RX-BB))
288            FPI = (FPI+Corr)*C/(2.0*math.pi**2)
289            FPPI = C*CX*RX/(4.0*math.pi)
290            FP += FPI
291            FPP += FPPI
292        FP -= ElEterm
293   
294    return (FP, FPP, Mu)
295   
296
297class PickElement(wx.Dialog):
298    "Makes periodic table widget for picking element - caller maintains element list"
299    Elem=None
300    def _init_ctrls(self, prnt):
301        wx.Dialog.__init__(self, id=-1, name='PickElement',
302              parent=prnt, pos=wx.DefaultPosition, 
303              style=wx.DEFAULT_DIALOG_STYLE, title='Pick Element')
304        self.SetClientSize(wx.Size(770, 250))
305       
306        REcolor = wx.Colour(128, 128, 255)
307        Metcolor = wx.Colour(192, 192, 192)
308        Noblecolor = wx.Colour(255, 128, 255)
309        Alkcolor = wx.Colour(255, 255, 128)
310        AlkEcolor = wx.Colour(255, 128, 0)
311        SemMetcolor = wx.Colour(128, 255, 0)
312        NonMetcolor = wx.Colour(0, 255, 255)
313        White = wx.Colour(255, 255, 255)
314
315        ElTable = [
316            (["H","H-1"],                  0,0, "Hydrogen",    White,           0.0000),
317            (["He",],                     17,0, "Helium",      Noblecolor,      0.0000),
318            (["Li","Li+1"],                0,1, "Lithium",     Alkcolor,        0.0004),
319            (["Be","Be+2"],                1,1, "Beryllium",   AlkEcolor,       0.0006),
320            (["B",],                       2,1, "Boron",       NonMetcolor,     0.0012),
321            (["C",],                      13,1, "Carbon",      NonMetcolor,     0.0018),
322            (["N",],                      14,1, "Nitrogen",    NonMetcolor,     0.0030),
323            (["O","O-","O-2"],            15,1, "Oxygen",      NonMetcolor,     0.0042),
324            (["F","F-"],                  16,1, "Fluorine",    NonMetcolor,     0.0054),
325            (["Ne",],                     17,1, "Neon",        Noblecolor,      0.0066),
326            (["Na","Na+"],                 0,2, "Sodium",      Alkcolor,        0.0084),
327            (["Mg","Mg+2"],                1,2, "Magnesium",   AlkEcolor,       0.0110),
328            (["Al","Al+3"],                2,2, "Aluminum",    SemMetcolor,     0.0125),
329            (["Si","Si+4"],               13,2, "Silicon",     NonMetcolor,     0.0158),
330            (["P",],                      14,2, "Phosphorus",  NonMetcolor,     0.0180),
331            (["S",],                      15,2, "Sulphur",     NonMetcolor,     0.0210),
332            (["Cl","Cl-1"],               16,2, "Chlorine",    NonMetcolor,     0.0250),
333            (["Ar",],                     17,2, "Argon",       Noblecolor,      0.0285),
334            (["K","K+1"],                  0,3, "Potassium",   Alkcolor,        0.0320),
335            (["Ca","Ca+2"],                1,3, "Calcium",     AlkEcolor,       0.0362),
336            (["Sc","Sc+3"],                2,3, "Scandium",    Metcolor,        0.0410),
337            (["Ti","Ti+2","Ti+3","Ti+4"],  3,3, "Titanium",    Metcolor,        0.0460),
338            (["V","V+2","V+3","V+5"],      4,3, "Vanadium",    Metcolor,        0.0510),
339            (["Cr","Cr+2","Cr+3"],         5,3, "Chromium",    Metcolor,        0.0560),
340            (["Mn","Mn+2","Mn+3","Mn+4"],  6,3, "Manganese",   Metcolor,        0.0616),
341            (["Fe","Fe+2","Fe3"],          7,3, "Iron",        Metcolor,        0.0680),
342            (["Co","Co+2","Co+3"],         8,3, "Cobalt",      Metcolor,        0.0740),
343            (["Ni","Ni+2","Ni+3"],         9,3, "Nickel",      Metcolor,        0.0815),
344            (["Cu","Cu+1","Cu+2"],        10,3, "Copper",      Metcolor,        0.0878),
345            (["Zn","Zn+2"],               11,3, "Zinc",        Metcolor,        0.0960),
346            (["Ga","Ga+3"],               12,3, "Gallium",     SemMetcolor,      0.104),
347            (["Ge","Ge+4"],               13,3, "Germanium",   SemMetcolor,      0.114),
348            (["As",],                     14,3, "Arsenic",     NonMetcolor,      0.120),
349            (["Se",],                     15,3, "Selenium",    NonMetcolor,      0.132),
350            (["Br","Br-1"],               16,3, "Bromine",     NonMetcolor,      0.141),
351            (["Kr",],                     17,3, "Krypton",     Noblecolor,       0.150),
352            (["Rb","Rb+1"],                0,4, "Rubidium",    Alkcolor,         0.159),
353            (["Sr","Sr+2"],                1,4, "Strontium",   AlkEcolor,        0.171),
354            (["Y","Y+3"],                  2,4, "Yittrium",    Metcolor,         0.180),
355            (["Zr","Zr+4"],                3,4, "Zirconium",   Metcolor,         0.192),
356            (["Nb","Nb+3","Nb+5"],         4,4, "Niobium",     Metcolor,         0.204),
357            (["Mo","Mo+3","Mo+5","Mo+6"],  5,4, "Molybdenium", Metcolor,         0.216),
358            (["Tc",],                      6,4, "Technetium",  Metcolor,         0.228),
359            (["Ru","Ru+3","Ru+4"],         7,4, "Ruthenium",   Metcolor,         0.246),
360            (["Rh","Rh+3","Rh+4"],         8,4, "Rhodium",     Metcolor,         0.258),
361            (["Pd","Pd+2","Pd+4"],         9,4, "Palladium",   Metcolor,         0.270),
362            (["Ag","Ag+1","Ag+2"],        10,4, "Silver",      Metcolor,         0.285),
363            (["Cd","Cd+2"],               11,4, "Cadmium",     Metcolor,         0.300),
364            (["In","In+3"],               12,4, "Indium",      SemMetcolor,      0.318),
365            (["Sn","Sn+2","Sn+4"],        13,4, "Tin",         SemMetcolor,      0.330),
366            (["Sb","Sb+3","Sb+5"],        14,4, "Antimony",    SemMetcolor,      0.348),
367            (["Te",],                     15,4, "Tellurium",   NonMetcolor,      0.363),
368            (["I","I-1"],                 16,4, "Iodine",      NonMetcolor,      0.384),
369            (["Xe",],                     17,4, "Xenon",       Noblecolor,       0.396),
370            (["Cs","Cs+1"],                0,5, "Caesium",     Alkcolor,         0.414),
371            (["Ba","Ba+2"],                1,5, "Barium",      AlkEcolor,        0.438),
372            (["La","La+3"],                2,5, "Lanthanium",  Metcolor,         0.456),
373            (["Ce","Ce+3","Ce+4"],     3.5,6.5, "Cerium",      REcolor,      0.474),
374            (["Pr","Pr+3","Pr+4"],     4.5,6.5, "Praseodymium",REcolor,      0.492),
375            (["Nd","Nd+3"],            5.5,6.5, "Neodymium",   REcolor,      0.516),
376            (["Pm","Pm+3"],            6.5,6.5, "Promethium",  REcolor,      0.534),
377            (["Sm","Sm+3"],            7.5,6.5, "Samarium",    REcolor,      0.558),
378            (["Eu","Eu+2","Eu+3"],     8.5,6.5, "Europium",    REcolor,      0.582),
379            (["Gd","Gd+3"],            9.5,6.5, "Gadolinium",  REcolor,      0.610),
380            (["Tb","Tb+3"],           10.5,6.5, "Terbium",     REcolor,      0.624),
381            (["Dy","Dy+3"],           11.5,6.5, "Dysprosium",  REcolor,      0.648),
382            (["Ho","Ho+3"],           12.5,6.5, "Holmium",     REcolor,      0.672),
383            (["Er","Er+3"],           13.5,6.5, "Erbium",      REcolor,      0.696),
384            (["Tm","Tm+3"],           14.5,6.5, "Thulium",     REcolor,      0.723),
385            (["Yb","Yb+2","Yb+3"],    15.5,6.5, "Ytterbium",   REcolor,      0.750),
386            (["Lu","Lu+3"],           16.5,6.5, "Lutetium",    REcolor,      0.780),
387            (["Hf","Hf+4"],                3,5, "Hafnium",     Metcolor,         0.804),
388            (["Ta","Ta+5"],                4,5, "Tantalum",    Metcolor,         0.834),
389            (["W","W+6"],                  5,5, "Tungsten",    Metcolor,         0.864),
390            (["Re",],                      6,5, "Rhenium",     Metcolor,         0.900),
391            (["Os","Os+4"],                7,5, "Osmium",      Metcolor,         0.919),
392            (["Ir","Ir+3","Ir+4"],         8,5, "Iridium",     Metcolor,         0.948),
393            (["Pt","Pt+2","Pt+4"],         9,5, "Platinium",   Metcolor,         0.984),
394            (["Au","Au+1","Au+3"],        10,5, "Gold",        Metcolor,         1.014),
395            (["Hg","Hg+1","Hg+2"],        11,5, "Mercury",     Metcolor,         1.046),
396            (["Tl","Tl+1","Tl+3"],        12,5, "Thallium",    SemMetcolor,      1.080),
397            (["Pb","Pb+2","Pb+4"],        13,5, "Lead",        SemMetcolor,      1.116),
398            (["Bi","Bi+3","Bi+5"],        14,5, "Bismuth",     SemMetcolor,      1.149),
399            (["Po",],                     15,5, "Polonium",    SemMetcolor,      1.189),
400            (["At",],                     16,5, "Astatine",    NonMetcolor,      1.224),
401            (["Rn",],                     17,5, "Radon",       Noblecolor,       1.260),
402            (["Fr",],                      0,6, "Francium",    Alkcolor,         1.296),
403            (["Ra","Ra+2"],                1,6, "Radium",      AlkEcolor,        1.332),
404            (["Ac","Ac+3"],                2,6, "Actinium",    Metcolor,         1.374),
405            (["Th","Th+4"],            3.5,7.5, "Thorium",     REcolor,      1.416),
406            (["Pa",],                  4.5,7.5, "Protactinium",REcolor,      1.458),
407            (["U","U+3","U+4","U+6"],  5.5,7.5, "Uranium",     REcolor,      1.470),
408            (["Np","Np+3","Np+4","Np+6"], 6.5,7.5, "Neptunium",   REcolor,      1.536),
409            (["Pu","Pu+3","Pu+4","Pu+6"], 7.5,7.5, "Plutonium",   REcolor,      1.584),
410            (["Am",],                  8.5,7.5, "Americium",   REcolor,      1.626),
411            (["Cm",],                  9.5,7.5, "Curium",      REcolor,      1.669),
412            (["Bk",],                 10.5,7.5, "Berkelium",   REcolor,      1.716),
413            (["Cf",],                 11.5,7.5, "Californium", REcolor,      1.764),
414            (["Q","QA","QB","QC","QD"],  14.5,7.5, "Special form factor", REcolor,  0.000),
415            ]
416           
417           
418        i=0
419        for E in ElTable:
420            PickElement.ElButton(self,name=E[0],
421            pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=E[4])
422            i+=1
423
424    def __init__(self, parent):
425        self._init_ctrls(parent)
426       
427    def ElButton(self, name, pos, tip, color):
428        Black = wx.Colour(0,0,0)
429        El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(40,23),
430            style=wx.CB_READONLY, value=name[0])
431        El.SetBackgroundColour(color)
432        El.SetToolTipString(tip)
433        El.Bind(wx.EVT_COMBOBOX, self.OnElButton)
434
435    def OnElButton(self, event):
436        El = event.GetEventObject().GetLabel()
437        self.Elem = (El)
438        self.EndModal(wx.ID_OK)       
439       
440class DeleteElement(wx.Dialog):
441    "Delete element from selected set widget"
442    def _init_ctrls(self, parent):
443        l = len(DeleteElement.Elems)-1
444        wx.Dialog.__init__(self, id=-1, name='Delete', parent=parent,
445              pos=wx.DefaultPosition, size=wx.Size(max(128,64+l*24), 87),
446              style=wx.DEFAULT_DIALOG_STYLE, title='Delete Element')
447        self.Show(True)
448        self.SetAutoLayout(True)
449        self.SetHelpText('Select element to delete')
450        self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
451
452        i = 0
453        Elem = []
454        for Elem in DeleteElement.Elems:
455            name = Elem[0].lower().capitalize()
456            self.ElButton(id=-1,name=name,pos=wx.Point(16+i*24, 16))
457            i+=1
458             
459    def __init__(self, parent):
460        DeleteElement.Elems = parent.Elems
461        DeleteElement.El = ' '
462        self._init_ctrls(parent)
463
464    def ElButton(self, id, name, pos):
465        White = wx.Colour(255, 255, 255)
466        El = wscs.ColourSelect(label=name, parent=self, colour = White,
467            pos=pos, size=wx.Size(24, 23), style=wx.RAISED_BORDER)
468        El.Bind(wx.EVT_BUTTON, self.OnDeleteButton)
469   
470    def OnDeleteButton(self, event):
471        DeleteElement.El=event.GetEventObject().GetLabel()
472        self.EndModal(wx.ID_OK)
473       
474    def GetDeleteElement(self):
475        return DeleteElement.El
476       
477
Note: See TracBrowser for help on using the repository browser.