Changeset 169 for trunk/GSASII.py


Ignore:
Timestamp:
Nov 2, 2010 9:38:57 AM (12 years ago)
Author:
vondreele
Message:

remove undo from GSASII.py
make numpy arrays of xyz powder data
fixup the undo stuff for peak fitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r167 r169  
    130130        self.Refine.Enable(False)
    131131        self.Bind(wx.EVT_MENU, self.OnRefine, id=wxID_REFINE)
    132         self.UnDo = parent.Append(help='', id=wxID_UNDO, kind=wx.ITEM_NORMAL,
    133             text='UnDo')
    134         self.UnDo.Enable(False)
    135         self.Bind(wx.EVT_MENU, self.OnUnDo, id=wxID_UNDO)
     132#        self.UnDo = parent.Append(help='', id=wxID_UNDO, kind=wx.ITEM_NORMAL,
     133#            text='UnDo')
     134#        self.UnDo.Enable(False)
     135#        self.Bind(wx.EVT_MENU, self.OnUnDo, id=wxID_UNDO)
    136136       
    137137    def _init_coll_Import_Items(self,parent):
     
    11291129        event.Skip()
    11301130       
    1131     def OnUnDo(self,event):
    1132         self.DoUnDo()
    1133         self.UnDo.Enable(False)
    1134        
     1131#    def OnUnDo(self,event):
     1132#        self.DoUnDo()
     1133#        self.UnDo.Enable(False)
     1134#       
    11351135    def OnRefine(self,event):
    11361136        #works - but it'd be better if it could restore plots
     
    11471147            dlg.Destroy()
    11481148       
    1149     def DoUnDo(self):
    1150         print 'Undo last refinement'
    1151         file = open(self.undofile,'rb')
    1152         PatternId = self.PatternId
    1153         for item in ['Background','Instrument Parameters','Peak List']:
    1154             self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item),cPickle.load(file))
    1155             if self.dataDisplay.GetName() == item:
    1156                 if item == 'Background':
    1157                     G2pdG.UpdateBackgroundGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
    1158                 elif item == 'Instrument Parameters':
    1159                     G2pdG.UpdateInstrumentGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
    1160                 elif item == 'Peak List':
    1161                     G2pdG.UpdatePeakGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
    1162             print item,' recovered'
    1163         file.close()
    1164        
    1165     def SaveState(self):
    1166         self.undofile = self.dirname+'\\GSASII.save'
    1167         file = open(self.undofile,'wb')
    1168         PatternId = self.PatternId
    1169         for item in ['Background','Instrument Parameters','Peak List']:
    1170             cPickle.dump(self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId,item)),file,1)
    1171         file.close()
    1172         self.UnDo.Enable(True)
    1173                
     1149#    def DoUnDo(self):
     1150#        print 'Undo last refinement'
     1151#        file = open(self.undofile,'rb')
     1152#        PatternId = self.PatternId
     1153#        for item in ['Background','Instrument Parameters','Peak List']:
     1154#            self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item),cPickle.load(file))
     1155#            if self.dataDisplay.GetName() == item:
     1156#                if item == 'Background':
     1157#                    G2pdG.UpdateBackgroundGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
     1158#                elif item == 'Instrument Parameters':
     1159#                    G2pdG.UpdateInstrumentGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
     1160#                elif item == 'Peak List':
     1161#                    G2pdG.UpdatePeakGrid(self,self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, item)))
     1162#            print item,' recovered'
     1163#        file.close()
     1164#       
     1165#    def SaveState(self):
     1166#        self.undofile = self.dirname+'\\GSASII.save'
     1167#        file = open(self.undofile,'wb')
     1168#        PatternId = self.PatternId
     1169#        for item in ['Background','Instrument Parameters','Peak List']:
     1170#            cPickle.dump(self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId,item)),file,1)
     1171#        file.close()
     1172#        self.UnDo.Enable(True)
     1173#               
    11741174    def ErrorDialog(self,title,message):
    11751175        dlg = wx.MessageDialog(self, message, title,  wx.OK)
Note: See TracChangeset for help on using the changeset viewer.