Ignore:
Timestamp:
Jul 4, 2017 11:33:37 PM (4 years ago)
Author:
toby
Message:

Scroll bars work for Phase & Histogram windows; Constraints, Restraints & Rigid Bodies -- not yet

File:
1 edited

Legend:

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

    r2900 r2908  
    2929import GSASIIdata as G2data
    3030import GSASIIctrlGUI as G2G
     31import GSASIIphsGUI as G2phsGUI
    3132
    3233VERY_LIGHT_GREY = wx.Colour(235,235,235)
     
    918919                Bonds.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    919920                Bonds.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    920                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    921                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
    922                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
     921                G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     922                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
     923                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
    923924                mainSizer.Add(wx.StaticText(BondRestr,-1,
    924925                    'Bond restraints: sum(wt*(delt/sig)^2) =    %.2f, mean(wt*(delt/sig)^2) =    %.2f'    \
     
    931932
    932933        BondRestr.SetSizer(mainSizer)
    933         Size = mainSizer.Fit(BondRestr)
    934         Size[0] = 600
    935         Size[1] = min(Size[1]+50,500)       #make room for tab, but not too big
    936         BondRestr.SetSize(Size)
    937         BondRestr.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
     934        #Size = mainSizer.GetMinSize()
     935        #print 'BondRestr',Size
     936        #Size = mainSizer.Fit(BondRestr)
     937        #Size[0] = 600
     938        #Size[1] = min(Size[1]+50,500)       #make room for tab, but not too big
     939        #BondRestr.SetSize(Size)
     940        #Size[0] += 40
     941        #BondRestr.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
     942        #BondRestr.Scroll(0,0)
     943        G2phsGUI.SetPhaseWindow(BondRestr,mainSizer,Scroll=0)
    938944       
    939945    def UpdateAngleRestr(angleRestData):
     
    10491055                Angles.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    10501056                Angles.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    1051                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    1052                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
    1053                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
     1057                G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     1058                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
     1059                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
    10541060                mainSizer.Add(wx.StaticText(AngleRestr,-1,
    10551061                    'Angle restraints: sum(wt*(delt/sig)^2) =    %.2f, mean(wt*(delt/sig)^2) =    %.2f'    \
     
    10701076    def UpdatePlaneRestr(planeRestData):
    10711077       
    1072         items = G2frame.dataFrame.RestraintEdit.GetMenuItems()
     1078        items = G2frame.dataWindow.RestraintEdit.GetMenuItems()
    10731079        for item in items:
    10741080            if item.GetLabel() in ['Change value']:
     
    11771183                Planes.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    11781184                Planes.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    1179                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    1180                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
     1185                G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     1186                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
    11811187                mainSizer.Add(wx.StaticText(PlaneRestr,-1,
    11821188                    'Plane restraints: sum(wt*(delt/sig)^2) =    %.2f, mean(wt*(delt/sig)^2) =    %.2f'    \
     
    13071313                Volumes.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    13081314                Volumes.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    1309                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    1310                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
    1311                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
     1315                G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     1316                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
     1317                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
    13121318                mainSizer.Add(wx.StaticText(ChiralRestr,-1,
    13131319                    'Chiral volume restraints: sum(wt*(delt/sig)^2) =    %.2f, mean(wt*(delt/sig)^2) =    %.2f'    \
     
    14101416                TorsionRestr.Torsions.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    14111417                TorsionRestr.Torsions.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    1412                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    1413                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
     1418                G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     1419                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
    14141420                mainSizer.Add(wx.StaticText(TorsionRestr,-1,
    14151421                    'Torsion restraints: sum(wt*(delt/sig)^2) =    %.2f, mean(wt*(delt/sig)^2) =    %.2f'    \
     
    15321538                RamaRestr.Ramas.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    15331539                RamaRestr.Ramas.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    1534                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    1535                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
     1540                G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     1541                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeEsd, id=G2gd.wxID_RESTCHANGEESD)
    15361542                mainSizer.Add(wx.StaticText(RamaRestr,-1,
    15371543                    'Ramachandran restraints: sum(wt*(delt/sig)^2) =    %.2f, mean(wt*(delt/sig)^2) =    %.2f'    \
     
    16851691                ChemComps.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    16861692                ChemComps.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    1687                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    1688                 G2frame.dataFrame.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
     1693                G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     1694                G2frame.dataWindow.Bind(wx.EVT_MENU, OnChangeValue, id=G2gd.wxID_RESRCHANGEVAL)
    16891695                mainSizer.Add(wx.StaticText(ChemCompRestr,-1,
    16901696                    'Chemical composition restraints: sum(wt*(delt/sig)^2) =    %.2f, mean(wt*(delt/sig)^2) =    %.2f'    \
     
    17651771            Textures.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK,OnRowSelect)
    17661772            Textures.Bind(wg.EVT_GRID_CELL_CHANGE, OnCellChange)
    1767             G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
     1773            G2frame.dataWindow.Bind(wx.EVT_MENU, OnDeleteRestraint, id=G2gd.wxID_RESTDELETE)
    17681774            mainSizer.Add(Textures,0,)
    17691775        else:
     
    17791785        #print 'OnPageChanged'
    17801786        page = event.GetSelection()
    1781         G2frame.restrBook.SetSize(G2frame.dataWindow.GetClientSize())    #TODO -almost right
     1787        #G2frame.restrBook.SetSize(G2frame.dataWindow.GetClientSize())    #TODO -almost right
    17821788        text = G2frame.restrBook.GetPageText(page)
    1783         G2frame.dataFrame.RestraintEdit.SetLabel(G2gd.wxID_RESRCHANGEVAL,'Change value')
     1789        G2frame.dataWindow.RestraintEdit.SetLabel(G2gd.wxID_RESRCHANGEVAL,'Change value')
    17841790        if text == 'Bond':
    17851791            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1786             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
    1787             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
     1792            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
     1793            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
    17881794            bondRestData = restrData['Bond']
    17891795            UpdateBondRestr(bondRestData)
    17901796        elif text == 'Angle':
    17911797            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1792             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
    1793             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
     1798            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
     1799            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
    17941800            angleRestData = restrData['Angle']
    17951801            UpdateAngleRestr(angleRestData)
    17961802        elif text == 'Plane':
    17971803            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1798             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
    1799             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,False)
     1804            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
     1805            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,False)
    18001806            planeRestData = restrData['Plane']
    18011807            UpdatePlaneRestr(planeRestData)
    18021808        elif text == 'Chiral':
    18031809            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1804             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,False)
    1805             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
     1810            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,False)
     1811            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
    18061812            chiralRestData = restrData['Chiral']
    18071813            UpdateChiralRestr(chiralRestData)
    18081814        elif text == 'Torsion':
    18091815            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1810             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,False)
    1811             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,False)
    1812             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_AARESTRAINTPLOT,True)
     1816            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,False)
     1817            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,False)
     1818            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_AARESTRAINTPLOT,True)
    18131819            torsionRestData = restrData['Torsion']
    18141820            UpdateTorsionRestr(torsionRestData)
    18151821        elif text == 'Ramachandran':
    18161822            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1817             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,False)
    1818             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,False)
    1819             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_AARESTRAINTPLOT,True)
     1823            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,False)
     1824            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,False)
     1825            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_AARESTRAINTPLOT,True)
    18201826            ramaRestData = restrData['Rama']
    18211827            UpdateRamaRestr(ramaRestData)
     
    18231829        elif text == 'Chem. comp.':
    18241830            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1825             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
    1826             G2frame.dataFrame.RestraintEdit.SetLabel(G2gd.wxID_RESRCHANGEVAL,'Change factor')
    1827             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
    1828             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTCHANGEESD,False)
     1831            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
     1832            G2frame.dataWindow.RestraintEdit.SetLabel(G2gd.wxID_RESRCHANGEVAL,'Change factor')
     1833            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
     1834            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTCHANGEESD,False)
    18291835            chemcompRestData = restrData['ChemComp']
    18301836            UpdateChemcompRestr(chemcompRestData)
    18311837        elif text == 'Texture':
    18321838            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    1833             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
    1834             G2frame.dataFrame.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
     1839            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTRAINTADD,True)
     1840            G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESRCHANGEVAL,True)
    18351841            textureRestData = restrData['Texture']
    18361842            UpdateTextureRestr(textureRestData)
     
    18521858    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)
    18531859    G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'restraints for '+phaseName)
    1854     G2frame.dataWindow.ClearData()
    1855     G2frame.restrBook = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize())
     1860    #G2frame.restrBook = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize())
     1861    G2frame.restrBook = G2G.GSNoteBook(parent=G2frame.dataWindow)
     1862    G2frame.dataWindow.GetSizer().Add(G2frame.restrBook,1,wx.ALL|wx.EXPAND,1)
    18561863   
    18571864    G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTSELPHASE,False)
     
    18591866        G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_RESTSELPHASE,True)
    18601867        G2frame.dataWindow.Bind(wx.EVT_MENU, OnSelectPhase, id=G2gd.wxID_RESTSELPHASE)
    1861     G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddRestraint, id=G2gd.wxID_RESTRAINTADD)
     1868    G2frame.dataWindow.Bind(wx.EVT_MENU, OnAddRestraint, id=G2gd.wxID_RESTRAINTADD)
    18621869    if 'macro' in phasedata['General']['Type']:
    18631870        G2frame.dataWindow.RestraintEdit.Enable(G2gd.wxID_AARESTRAINTADD,True)
Note: See TracChangeset for help on using the changeset viewer.