@@ -922,21 +922,21 @@ def AddTextureRestraint(textureRestData):
922922 dlg .Destroy ()
923923
924924 def WtBox (wind ,restData ):
925- if 'Range' not in restData : restData ['Range' ] = 1.1 #patch
926925
927926 def OnUseData (event ):
928927 Obj = event .GetEventObject ()
929928 restData ['Use' ] = Obj .GetValue ()
930929
931930 wtBox = wx .BoxSizer (wx .HORIZONTAL )
932931 wtBox .Add (wx .StaticText (wind ,- 1 ,'Phase ' + phaseName + ' Restraint weight factor: ' ),0 ,WACV )
933- wtfactor = G2G .ValidatedTxtCtrl (wind ,restData ,'wtFactor' ,nDig = (10 ,2 ),typeHint = float )
932+ wtfactor = G2G .ValidatedTxtCtrl (wind ,restData ,'wtFactor' ,nDig = (10 ,2 , 'g' ),typeHint = float )
934933 wtBox .Add (wtfactor ,0 ,WACV )
935934 useData = wx .CheckBox (wind ,- 1 ,label = ' Use?' )
936935 useData .Bind (wx .EVT_CHECKBOX , OnUseData )
937936 useData .SetValue (restData ['Use' ])
938937 wtBox .Add (useData ,0 ,WACV )
939938 if 'Bonds' in restData or 'Angles' in restData :
939+ restData ['Range' ] = restData .get ('Range' ,1.1 )
940940 wtBox .Add (wx .StaticText (wind ,- 1 ,' Search range: ' ),0 ,WACV )
941941 sRange = G2G .ValidatedTxtCtrl (wind ,restData ,'Range' ,nDig = (10 ,2 ),typeHint = float )
942942 wtBox .Add (sRange ,0 ,WACV )
@@ -1093,10 +1093,7 @@ def OnDeleteRestraint(event):
10931093 attr .SetReadOnly (True )
10941094 Bonds .SetColAttr (c , attr )
10951095 Bonds .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
1096- if 'phoenix' in wx .version ():
1097- Bonds .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
1098- else :
1099- Bonds .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
1096+ Bonds .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
11001097 for i in (G2G .wxID_RESTDELETE ,G2G .wxID_RESRCHANGEVAL ,G2G .wxID_RESTCHANGEESD ):
11011098 G2frame .dataWindow .RestraintEdit .Enable (id = i ,enable = True )
11021099 G2frame .Bind (wx .EVT_MENU , OnDeleteRestraint , id = G2G .wxID_RESTDELETE )
@@ -1237,10 +1234,7 @@ def OnDeleteRestraint(event):
12371234 attr .SetReadOnly (True )
12381235 Angles .SetColAttr (c , attr )
12391236 Angles .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
1240- if 'phoenix' in wx .version ():
1241- Angles .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
1242- else :
1243- Angles .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
1237+ Angles .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
12441238 for i in (G2G .wxID_RESTDELETE ,G2G .wxID_RESRCHANGEVAL ,G2G .wxID_RESTCHANGEESD ):
12451239 G2frame .dataWindow .RestraintEdit .Enable (id = i ,enable = True )
12461240 G2frame .Bind (wx .EVT_MENU , OnDeleteRestraint , id = G2G .wxID_RESTDELETE )
@@ -1375,10 +1369,7 @@ def OnDeleteRestraint(event):
13751369 Planes .SetReadOnly (r ,c ,True )
13761370 Planes .SetCellStyle (r ,c ,VERY_LIGHT_GREY ,True )
13771371 Planes .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
1378- if 'phoenix' in wx .version ():
1379- Planes .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
1380- else :
1381- Planes .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
1372+ Planes .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
13821373 for i in (G2G .wxID_RESTDELETE ,G2G .wxID_RESTCHANGEESD ):
13831374 G2frame .dataWindow .RestraintEdit .Enable (id = i ,enable = True )
13841375 G2frame .Bind (wx .EVT_MENU , OnDeleteRestraint , id = G2G .wxID_RESTDELETE )
@@ -1515,10 +1506,7 @@ def OnChangeEsd(event):
15151506 Volumes .SetReadOnly (r ,c ,True )
15161507 Volumes .SetCellStyle (r ,c ,VERY_LIGHT_GREY ,True )
15171508 Volumes .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
1518- if 'phoenix' in wx .version ():
1519- Volumes .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
1520- else :
1521- Volumes .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
1509+ Volumes .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
15221510 for i in (G2G .wxID_RESTDELETE ,G2G .wxID_RESRCHANGEVAL ,G2G .wxID_RESTCHANGEESD ):
15231511 G2frame .dataWindow .RestraintEdit .Enable (id = i ,enable = True )
15241512 G2frame .Bind (wx .EVT_MENU , OnChangeValue , id = G2G .wxID_RESRCHANGEVAL )
@@ -1653,10 +1641,7 @@ def coeffSizer():
16531641 TorsionRestr .Torsions .SetReadOnly (r ,c ,True )
16541642 TorsionRestr .Torsions .SetCellStyle (r ,c ,VERY_LIGHT_GREY ,True )
16551643 TorsionRestr .Torsions .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
1656- if 'phoenix' in wx .version ():
1657- TorsionRestr .Torsions .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
1658- else :
1659- TorsionRestr .Torsions .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
1644+ TorsionRestr .Torsions .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
16601645 for i in (G2G .wxID_RESTDELETE ,G2G .wxID_RESTCHANGEESD ):
16611646 G2frame .dataWindow .RestraintEdit .Enable (id = i ,enable = True )
16621647 G2frame .Bind (wx .EVT_MENU , OnDeleteRestraint , id = G2G .wxID_RESTDELETE )
@@ -1789,10 +1774,7 @@ def coeffSizer():
17891774 RamaRestr .Ramas .SetReadOnly (r ,c ,True )
17901775 RamaRestr .Ramas .SetCellStyle (r ,c ,VERY_LIGHT_GREY ,True )
17911776 RamaRestr .Ramas .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
1792- if 'phoenix' in wx .version ():
1793- RamaRestr .Ramas .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
1794- else :
1795- RamaRestr .Ramas .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
1777+ RamaRestr .Ramas .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
17961778 for i in (G2G .wxID_RESTDELETE ,G2G .wxID_RESTCHANGEESD ):
17971779 G2frame .dataWindow .RestraintEdit .Enable (id = i ,enable = True )
17981780 G2frame .Bind (wx .EVT_MENU , OnDeleteRestraint , id = G2G .wxID_RESTDELETE )
@@ -1936,10 +1918,7 @@ def OnDeleteRestraint(event):
19361918 ChemComps .SetCellTextColour (r ,c ,VERY_LIGHT_GREY )
19371919
19381920 ChemComps .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
1939- if 'phoenix' in wx .version ():
1940- ChemComps .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
1941- else :
1942- ChemComps .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
1921+ ChemComps .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
19431922 G2frame .dataWindow .RestraintEdit .Enable (id = G2G .wxID_RESTDELETE ,enable = True )
19441923 G2frame .Bind (wx .EVT_MENU , OnDeleteRestraint , id = G2G .wxID_RESTDELETE )
19451924 #G2frame.Bind(wx.EVT_MENU, OnChangeValue, id=G2G.wxID_RESRCHANGEVAL)
@@ -2125,10 +2104,7 @@ def OnCellChange(event):
21252104 Textures .SetCellStyle (r ,4 ,VERY_LIGHT_GREY ,True )
21262105 Textures .SetCellTextColour (r ,4 ,VERY_LIGHT_GREY )
21272106 Textures .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
2128- if 'phoenix' in wx .version ():
2129- Textures .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
2130- else :
2131- Textures .Bind (wg .EVT_GRID_CELL_CHANGE , OnCellChange )
2107+ Textures .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
21322108 G2frame .dataWindow .RestraintEdit .Enable (id = G2G .wxID_RESTDELETE ,enable = True )
21332109 G2frame .Bind (wx .EVT_MENU , OnDeleteRestraint , id = G2G .wxID_RESTDELETE )
21342110 mainSizer .Add (Textures ,0 ,)
@@ -2172,32 +2148,37 @@ def OnCellChange(event):
21722148 mainSizer .Add ((5 ,5 ),0 )
21732149 mainSizer .Add (WtBox (SpinRBRestr ,spinRestData ),0 )
21742150 mainSizer .Add (wx .StaticText (SpinRBRestr ,- 1 ,
2175- 'NB: The spin RB restraints suppress negative spin RB densities for the selected atoms\n '
2176- ' "unit esd" gives a bias toward a flatter spin RB density' ),0 )
2151+ 'NB: The spin RB restraints suppress negative spin RB densities for the selected atoms' ), 0 )
2152+ # ' "unit esd" gives a bias toward a flatter spin RB density'),0)
21772153 mainSizer .Add ((5 ,5 ),0 )
21782154
21792155 for i in (G2G .wxID_RESTDELETE ,G2G .wxID_RESRCHANGEVAL ,G2G .wxID_RESTCHANGEESD ):
21802156 G2frame .dataWindow .RestraintEdit .Enable (id = i ,enable = False )
21812157 if len (spinRestData ['SpinRBs' ]):
21822158 table = []
21832159 rowLabels = []
2184- Types = [wg .GRID_VALUE_STRING ,wg .GRID_VALUE_FLOAT + ':10,2' ,
2185- wg .GRID_VALUE_BOOL ,wg .GRID_VALUE_FLOAT + ':10,2' ]
2186- colLabels = ['atom' ,'neg esd' ,'use unit?' ,'unit esd' ]
2160+ # Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_FLOAT+':10,2',
2161+ # wg.GRID_VALUE_BOOL,wg.GRID_VALUE_FLOAT+':10,2']
2162+ # colLabels = ['atom','neg esd','use unit?','unit esd']
2163+ # for i,[atomid,esd1,ifesd2,esd2] in enumerate(spinRestData['SpinRBs']):
2164+ # table.append(['%s'%G2mth.GetAtomItemsById(Atoms,AtLookUp,atomid,ct-1)[0],esd1,ifesd2,esd2])
2165+ # rowLabels.append(str(i))
2166+ Types = [wg .GRID_VALUE_STRING ,wg .GRID_VALUE_FLOAT + ':10,2' ]
2167+ colLabels = ['atom' ,'neg esd' ]
21872168 for i ,[atomid ,esd1 ,ifesd2 ,esd2 ] in enumerate (spinRestData ['SpinRBs' ]):
2188- table .append (['%s' % G2mth .GetAtomItemsById (Atoms ,AtLookUp ,atomid ,ct - 1 )[0 ],esd1 , ifesd2 , esd2 ])
2169+ table .append (['%s' % G2mth .GetAtomItemsById (Atoms ,AtLookUp ,atomid ,ct - 1 )[0 ],esd1 ])
21892170 rowLabels .append (str (i ))
21902171 spinRBTable = G2G .Table (table ,rowLabels = rowLabels ,colLabels = colLabels ,types = Types )
21912172 SpinRBs = G2G .GSGrid (SpinRBRestr )
21922173 SpinRBs .SetTable (spinRBTable , True )
21932174 SpinRBs .AutoSizeColumns (False )
21942175 for r in range (len (spinRestData ['SpinRBs' ])):
21952176 SpinRBs .SetReadOnly (r ,0 ,True )
2196- SpinRBs .SetCellStyle (r ,0 ,VERY_LIGHT_GREY ,True )
2197- if not spinRBTable . GetValue (r ,2 ):
2198- SpinRBs .SetReadOnly (r ,3 ,True )
2199- SpinRBs .SetCellStyle (r ,3 ,VERY_LIGHT_GREY , True )
2200- SpinRBs . SetCellTextColour ( r , 3 , VERY_LIGHT_GREY )
2177+ SpinRBs .SetCellStyle (r ,0 ,VERY_LIGHT_GREY ,True ) # if not spinRBTable.GetValue(r,2):
2178+ # SpinRBs.SetReadOnly (r,3,True)
2179+ # SpinRBs.SetCellStyle (r,3,VERY_LIGHT_GREY ,True)
2180+ # SpinRBs.SetCellTextColour (r,3,VERY_LIGHT_GREY)
2181+
22012182 SpinRBs .Bind (wg .EVT_GRID_LABEL_LEFT_CLICK ,OnRowSelect )
22022183 SpinRBs .Bind (wg .EVT_GRID_CELL_CHANGED , OnCellChange )
22032184 G2frame .dataWindow .RestraintEdit .Enable (id = G2G .wxID_RESTDELETE ,enable = True )
0 commit comments