Changeset 1160 for trunk/GSASIIconstrGUI.py
- Timestamp:
- Nov 28, 2013 9:16:02 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r1147 r1160 511 511 ''' 512 512 allcons = [] 513 for key in ['Hist','HAP','Phase','Global']: 513 for key in data: 514 if key.startswith('_'): continue 514 515 allcons += data[key] 515 516 allcons += newcons … … 538 539 ''' 539 540 allcons = [] 540 for key in 'Hist','HAP','Phase': 541 for key in data: 542 if key.startswith('_'): continue 541 543 allcons += data[key] 542 544 if not len(allcons): return True … … 675 677 :returns: wx.Sizer created by method 676 678 ''' 677 constSizer = wx.FlexGridSizer(1, 5,0,0)679 constSizer = wx.FlexGridSizer(1,6,0,0) 678 680 maxlen = 70 # characters before wrapping a constraint 679 681 for Id,item in enumerate(data[name]): 682 refineflag = False 680 683 helptext = "" 681 684 eqString = ['',] … … 693 696 Indx[constEdit.GetId()] = [Id,name] 694 697 if item[-1] == 'f': 695 helptext = "A new variable is created from a linear combination of the following variables:" 698 helptext = "A new variable" 699 if item[-3]: 700 helptext += " named "+str(item[-3]) 701 helptext += " is created from a linear combination of the following variables:\n" 696 702 for term in item[:-3]: 697 703 var = str(term[1]) … … 712 718 helptext += '\n\n' 713 719 helptext += data['_Explain'][item[-3]] 714 typeString = 'NEWVAR' 720 # typeString = 'NEWVAR' 721 # if item[-3]: 722 # eqString[-1] += ' = '+item[-3] 723 # else: 724 # eqString[-1] += ' = New Variable' 715 725 if item[-3]: 716 eqString[-1] += ' = '+item[-3]726 typeString = item[-3] + ' = ' 717 727 else: 718 eqString[-1] += ' = New Variable' 728 typeString = 'New Variable = ' 729 #print 'refine',item[-2] 730 refineflag = True 719 731 elif item[-1] == 'c': 720 732 helptext = "The following variables constrained to equal a constant:" … … 732 744 helptext += "\n" + var + " ("+ varMean + ")" 733 745 typeString = 'CONST' 734 eqString[-1] += ' = %.3f'%(item[-3])+' '746 eqString[-1] += ' = '+str(item[-3]) 735 747 elif item[-1] == 'e': 736 748 helptext = "The following variables are set to be equivalent, noting multipliers:" … … 763 775 constSizer.Add(ch,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER,1) 764 776 else: 777 constSizer.Add((-1,-1)) 778 if refineflag: 779 ch = G2gd.G2CheckBox(pageDisplay,'',item,-2) 780 constSizer.Add(ch,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER,1) 781 else: 765 782 constSizer.Add((-1,-1)) 766 constSizer.Add(wx.StaticText(pageDisplay,-1,typeString),0,wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER|wx.RIGHT|wx.LEFT,3) 783 constSizer.Add(wx.StaticText(pageDisplay,-1,typeString), 784 0,wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER|wx.RIGHT|wx.LEFT,3) 767 785 if len(eqString) > 1: 768 786 Eq = wx.BoxSizer(wx.VERTICAL) … … 815 833 result = dlg.GetData() 816 834 for i in range(len(data[name][Id][:-3])): 835 if type(data[name][Id][i]) is tuple: # fix non-mutable construct 836 data[name][Id][i] = list(data[name][Id][i]) 817 837 data[name][Id][i][0] = result[i][0] 818 838 if data[name][Id][-1] == 'c': … … 825 845 varname = varname.replace(':',';') 826 846 if varname: 827 data[name][Id][-3] = '::' +varname847 data[name][Id][-3] = varname 828 848 else: 829 849 data[name][Id][-3] = '' … … 925 945 # validate all the constrants -- should not see any errors here normally 926 946 allcons = [] 927 for key in 'Hist','HAP','Phase': 947 for key in data: 948 if key.startswith('_'): continue 928 949 allcons += data[key] 929 950 if not len(allcons): return
Note: See TracChangeset
for help on using the changeset viewer.