@@ -5485,11 +5485,12 @@ def _get_opt_val(opt_name, out):
54855485 resId = G2gd .GetGPXtreeItemId (G2frame , resId , phsnam )
54865486 orgData = copy .deepcopy (data )
54875487
5488- if Restraints :
5489- Restraints [phsnam ]['Bond' ]['Bonds' ] = []
5490- Restraints [phsnam ]['Angle' ]['Angles' ] = []
5491- savedRestraints = Restraints [phsnam ]
5492- del Restraints [phsnam ]
5488+ item , cookie = G2frame .GPXtree .GetFirstChild (phaseID )
5489+ while item and G2frame .GPXtree .GetItemText (item ) != phase_sel :
5490+ item , cookie = G2frame .GPXtree .GetNextChild (phaseID , cookie )
5491+
5492+ # TODO: We can probably refer to the `OnDeletePhase` method defined in
5493+ # `GSASIIdataGUI` to delete the phase.
54935494
54945495 for ir_opt , _ in ir_options :
54955496 print ("Processing irrep:" , ir_opt )
@@ -5526,10 +5527,23 @@ def _get_opt_val(opt_name, out):
55265527 with open (cif_fn , 'wb' ) as fl :
55275528 fl .write (out_cif .encode ("utf-8" ))
55285529
5529- # TODO: 1. Create project files for each of the CIFs
5530- # TODO: 2. Keep everything in the current project, only
5531- # TODO: replacing the phase with the new CIF
5532- # TODO: 3. Save the project files
5530+ # TODO: Load phase to the project and associate it with the
5531+ # histogram attached to the original phase.
5532+ # Q1: How to find out all the histograms associated with the
5533+ # original phase?
5534+ # Q2: How to load the phase to the project properly?
5535+
5536+ # restore the original saved project
5537+ G2frame .OnFileOpen (None , filename = orgFilName , askSave = False )
5538+
5539+ # reopen tree to the original phase
5540+ def _ShowPhase ():
5541+ phId = G2gd .GetGPXtreeItemId (G2frame , G2frame .root , 'Phases' )
5542+ G2frame .GPXtree .Expand (phId )
5543+ phId = G2gd .GetGPXtreeItemId (G2frame , phId , phsnam )
5544+ G2frame .GPXtree .SelectItem (phId )
5545+
5546+ wx .CallLater (100 , _ShowPhase )
55335547
55345548 info_msg = f'''Done with subgroup output for the selected k-vector.
55355549 Please check output files in the following directory,
0 commit comments