Changeset 1498 for trunk/GSASII.py


Ignore:
Timestamp:
Sep 16, 2014 4:20:57 PM (7 years ago)
Author:
vondreele
Message:

try to implement drag/drop of tree items - commented out as it doesn't work
add 'ShowCell?' to Controls to avoid cell errors for sequential single peak fitting when normal sequential refinement has been done
fix a neg. peak width error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1492 r1498  
    18661866        self.PatternTree.Bind(wx.EVT_TREE_KEY_DOWN,
    18671867            self.OnPatternTreeKeyDown, id=wxID_PATTERNTREE)
     1868#Can't get drag/drop of tree items to work except in simple cases (e.g. Controls)
     1869#        self.PatternTree.Bind(wx.EVT_TREE_BEGIN_RDRAG,
     1870#            self.OnPatternTreeBeginRDrag, id=wxID_PATTERNTREE)       
     1871#        self.PatternTree.Bind(wx.EVT_TREE_END_DRAG,
     1872#            self.OnPatternTreeEndDrag, id=wxID_PATTERNTREE)       
    18681873        self.root = self.PatternTree.AddRoot('Loaded Data: ')
    18691874       
     
    19891994        event.Skip()
    19901995       
     1996    def OnPatternTreeBeginRDrag(self,event):
     1997        # testing this - doesn't work! Binds commented out above
     1998        event.Allow()
     1999        self.BeginDragId = event.GetItem()
     2000        print 'start',self.PatternTree.GetItemText(self.BeginDragId)
     2001        self.ParentId = self.PatternTree.GetItemParent(self.BeginDragId)
     2002        self.DragData = self.PatternTree.GetItemPyData(self.BeginDragId)
     2003       
     2004    def OnPatternTreeEndDrag(self,event):
     2005        # testing this - doesn't work! Binds commented out above
     2006        event.Allow()
     2007        self.EndDragId = event.GetItem()
     2008        if self.ParentId != self.PatternTree.GetItemParent(self.EndDragId):
     2009            print 'drag not allowed - wrong parent'
     2010        else:
     2011            Name = self.PatternTree.GetItemText(self.BeginDragId)
     2012            self.PatternTree.InsertItem(self.ParentId,self.EndDragId,Name,data=None)
     2013            Id = G2gd.GetPatternTreeItemId(self, self.ParentId,Name)
     2014            self.PatternTree.SetItemPyData(Id,self.DragData)
     2015            self.PatternTree.Delete(self.BeginDragId)
     2016        print 'end',self.PatternTree.GetItemText(self.EndDragId)
     2017       
    19912018    def OnPatternTreeKeyDown(self,event):
    1992         'Not sure what this does'
     2019        'Allows stepping through the tree with the up/down arrow keys'
    19932020        key = event.GetKeyCode()
    19942021        item = self.PickId
     
    32753302            Id = self.PatternTree.AppendItem(self.root,text='Sequential results')
    32763303            self.PatternTree.SetItemPyData(Id,{})           
     3304        Controls = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,self.root, 'Controls'))
     3305        Controls['ShowCell'] = True
    32773306        self.OnFileSave(event)
    32783307        # check that constraints are OK here
Note: See TracChangeset for help on using the changeset viewer.