Changeset 2916 for branch


Ignore:
Timestamp:
Jul 7, 2017 3:17:52 PM (6 years ago)
Author:
toby
Message:

fix Add Peaks, etc.; document use of dataWindow

Location:
branch/2frame
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branch/2frame/GSASIIdataGUI.py

    r2915 r2916  
    30123012        by G2frame.dataWindow.SetDataSize
    30133013        '''
     3014        # TOTO: diagnostic patch
     3015        print 'G2frame.SetDataSize called rather than dataWindow.SetDataSize'
     3016        G2obj.HowDidIgetHere(True)
    30143017        self.dataWindow.SetDataSize()
    30153018                               
     
    46524655    the binding for the menus is done later in various GSASII*GUI modules,
    46534656    where the functions to be called are defined.
     4657
     4658    Use of the dataWindow scrolled panel
     4659    ====================================
     4660   
     4661    dataWindow has a “master” vertical BoxSizer: find it with
     4662    G2frame.dataWindow.GetSizer() and always use it. A call to
     4663    dataWindow.SetSizer() should not be needed.
     4664
     4665    When placing a widget in the sizer that has its own scrolling
     4666    (e.g. G2G.GSNoteBook, anything else?) that one widget should be placed
     4667    in the sizer as
     4668
     4669         G2frame.dataWindow.GetSizer().Add(G2frame.<obj>,1,wx.ALL|wx.EXPAND)
     4670
     4671    [is wx.ALL superfluous here?] so that it consumes the full size of the
     4672    panel and so that the NoteBook widget does the scrolling.
     4673
     4674    For other uses, one will likely place a bunch of widgets and (other
     4675    [sub-]sizers) into the master sizer. In this case, DO NOT use wx.EXPAND,
     4676    as this will result in the widget resizing/repositioning as the window
     4677    resizes. Possible exceptions might be for widgets going into a fixed-size
     4678    panel that is inside the dataWindow (probably not being done). A call to
     4679    Sizer.Fit(dataWindow) will do bad things, though a call to
     4680    SubSizer.Fit(dataWindow.subpanel) could make sense.
     4681
     4682    Initial GUI draws to dataWindow will go through
     4683    GSASIIdataGUI.SelectDataTreeItem(), which is called after any changes to
     4684    data tree selection. SelectDataTreeItem places items in dataWindow or
     4685    calls that do that. Before it calls those routines, it calls
     4686
     4687        G2frame.dataWindow.ClearData()
     4688
     4689    which deletes the contents of the master sizer. After the contents are
     4690    posted a call is made to
     4691
     4692            G2frame.dataWindow.SetDataSize()
     4693
     4694    which repaints the window. For routines [such as GSASII.UpdatePeakGrid()]
     4695    that are called repeatedly to update the entire contents of dataWindow
     4696    themselves, it is important to add calls to
     4697        G2frame.dataWindow.ClearData()
     4698    and
     4699            G2frame.dataWindow.SetDataSize()
     4700    at the beginning and end respectively to clear and refresh. This is not
     4701    needed for GSNoteBook repaints, which seem to be working mostly
     4702    automatically. If there is a problem, a call like
     4703         wx.CallAfter(G2frame.phaseDisplay.SendSizeEvent)
     4704    might be needed. There are some calls to G2frame.dataWindow.SendSizeEvent()
     4705    that may be doing the same thing.
    46544706    '''
    46554707    # TODO: debug code ######################################################################
  • branch/2frame/GSASIIpwdGUI.py

    r2915 r2916  
    866866    for key in T: X.append(D[key])
    867867    data['peaks'] = X
     868    G2frame.dataWindow.ClearData()
    868869    G2frame.GPXtree.SetItemPyData(G2frame.PickId,data)
    869870    G2frame.PeakTable = G2G.Table(data['peaks'],rowLabels=rowLabels,colLabels=colLabels,types=Types)
     
    885886    mainSizer = G2frame.dataWindow.GetSizer()
    886887    mainSizer.Add(reflGrid,1,wx.ALL|wx.EXPAND,1)
     888    G2frame.dataWindow.SetDataSize()
    887889
    888890################################################################################
Note: See TracChangeset for help on using the changeset viewer.