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/GSASIIconstrGUI.py

    r2905 r2908  
    458458            atchoice = [fmt.format(*i1) for i1 in choices]
    459459            dlg = G2G.G2MultiChoiceDialog(
    460                 G2frame.dataFrame,legend,
     460                G2frame,legend,
    461461                'Constrain '+str(FrstVarb)+' with...',atchoice,
    462462                toggle=False,size=(625,400),monoFont=True)
     
    468468            if len(Selections) == 0:
    469469                dlg = wx.MessageDialog(
    470                     G2frame.dataFrame,
     470                    G2frame,
    471471                    'No variables were selected to include with '+str(FrstVarb),
    472472                    'No variables')
     
    477477        else:
    478478            dlg = wx.MessageDialog(
    479                 G2frame.dataFrame,
     479                G2frame,
    480480                'There are no appropriate variables to include with '+str(FrstVarb),
    481481                'No variables')
     
    554554        else:
    555555            dlg = wx.MessageDialog(
    556                 G2frame.dataFrame,
     556                G2frame,
    557557                'There are no selected variables to include with '+str(FrstVarb),
    558558                'No variables')
     
    584584            res = G2frame.ErrorDialog('Constraint Error',
    585585                'Error with newly added constraint:\n'+errmsg+
    586                 '\n\nDiscard newly added constraint?',parent=G2frame.dataFrame,
     586                '\n\nDiscard newly added constraint?',parent=G2frame,
    587587                wtype=wx.YES_NO)
    588588            return res != wx.ID_YES
     
    611611            res = G2frame.ErrorDialog('Constraint Error',
    612612                'Error after editing constraint:\n'+errmsg+
    613                 '\n\nDiscard last constraint edit?',parent=G2frame.dataFrame,
     613                '\n\nDiscard last constraint edit?',parent=G2frame,
    614614                wtype=wx.YES_NO)
    615615            return res != wx.ID_YES
     
    651651        if not varList:
    652652            G2frame.ErrorDialog('No variables','There are no variables of type '+vartype,
    653                 parent=G2frame.dataFrame)
     653                parent=G2frame)
    654654            return
    655655        l2 = l1 = 1
     
    662662        #varListlbl = ["("+i+") "+G2obj.fmtVarDescr(i) for i in varList]
    663663        legend = "Select variables to hold (Will not be varied, even if vary flag is set)"
    664         dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame,
     664        dlg = G2G.G2MultiChoiceDialog(G2frame,
    665665            legend,title1,varListlbl,toggle=False,size=(625,400),monoFont=True)
    666666        dlg.CenterOnParent()
     
    683683        if not varList:
    684684            G2frame.ErrorDialog('No variables','There are no variables of type '+vartype,
    685                 parent=G2frame.dataFrame)
     685                parent=G2frame)
    686686            return
    687687#        legend = "Select variables to make equivalent (only one of the variables will be varied when all are set to be varied)"
     
    696696        if not varList:
    697697            G2frame.ErrorDialog('No variables','There are no variables of type '+vartype,
    698                 parent=G2frame.dataFrame)
     698                parent=G2frame)
    699699            return
    700700#        legend = "Select atoms to make equivalent (only one of the atom variables will be varied when all are set to be varied)"
     
    709709        if not varList:
    710710            G2frame.ErrorDialog('No variables','There are no variables of type '+vartype,
    711                 parent=G2frame.dataFrame)
     711                parent=G2frame)
    712712            return
    713713#        legend = "Select atoms to ride (only one of the atom variables will be varied when all are set to be varied)"
     
    722722        if not varList:
    723723            G2frame.ErrorDialog('No variables','There are no variables of type '+vartype,
    724                 parent=G2frame.dataFrame)
     724                parent=G2frame)
    725725            return
    726726#        legend = "Select variables to include in a new variable (the new variable will be varied when all included variables are varied)"
     
    735735        if not varList:
    736736            G2frame.ErrorDialog('No variables','There are no variables of type '+vartype,
    737                 parent=G2frame.dataFrame)
     737                parent=G2frame)
    738738            return
    739739#        legend = "Select variables to include in a constraint equation (the values will be constrainted to equal a specified constant)"
     
    752752        fmt = "{:"+str(l1)+"s} {:"+str(l2)+"s} {:s}"
    753753        varListlbl = [fmt.format(i,*G2obj.VarDescr(i)) for i in varList]       
    754         dlg = G2G.G2SingleChoiceDialog(G2frame.dataFrame,'Select 1st variable:',
     754        dlg = G2G.G2SingleChoiceDialog(G2frame,'Select 1st variable:',
    755755            title1,varListlbl,monoFont=True,size=(625,400))
    756756        dlg.CenterOnParent()
     
    801801        AtNames = Atoms.keys()
    802802        AtNames.sort()
    803         dlg = G2G.G2SingleChoiceDialog(G2frame.dataFrame,'Select 1st atom:',
     803        dlg = G2G.G2SingleChoiceDialog(G2frame,'Select 1st atom:',
    804804            title1,AtNames,monoFont=True,size=(625,400))
    805805        dlg.CenterOnParent()
     
    819819            return
    820820        dlg = G2G.G2MultiChoiceDialog(
    821             G2frame.dataFrame,title2+FrstAtom,
     821            G2frame,title2+FrstAtom,
    822822            'Constrain '+str(FrstAtom)+' with...',AtNames,
    823823            toggle=False,size=(625,400),monoFont=True)
     
    10121012                varname = ""
    10131013            lbl = 'Enter value for each term in constraint; sum = new variable'
    1014             dlg = ConstraintDialog(G2frame.dataFrame,constType,lbl,items,
     1014            dlg = ConstraintDialog(G2frame,constType,lbl,items,
    10151015                                   varname=varname,varyflag=data[name][Id][-2])
    10161016        elif data[name][Id][-1] == 'c':
     
    10191019            constType = 'Constraint'
    10201020            lbl = 'Edit value for each term in constant constraint sum'
    1021             dlg = ConstraintDialog(G2frame.dataFrame,constType,lbl,items)
     1021            dlg = ConstraintDialog(G2frame,constType,lbl,items)
    10221022        elif data[name][Id][-1] == 'e':
    10231023            items = data[name][Id][:-3]
    10241024            constType = 'Equivalence'
    10251025            lbl = 'The following terms are set to be equal:'
    1026             dlg = ConstraintDialog(G2frame.dataFrame,constType,lbl,items,'/')
     1026            dlg = ConstraintDialog(G2frame,constType,lbl,items,'/')
    10271027        else:
    10281028            return
     
    10821082        else: # called directly, get current page
    10831083            page = G2frame.constr.GetSelection()
    1084         G2frame.constr.SetSize(G2frame.dataWindow.GetClientSize())    #TODO -almost right
     1084        #G2frame.constr.SetSize(G2frame.dataWindow.GetClientSize())    #TODO -almost right
    10851085        G2frame.constr.ChangeSelection(page)
    10861086        text = G2frame.constr.GetPageText(page)
    1087         G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,False)
    1088 #        G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_ADDRIDING,False)
     1087        G2frame.dataWindow.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,False)
     1088#        G2frame.dataWindow.ConstraintEdit.Enable(G2gd.wxID_ADDRIDING,False)
    10891089        if text == 'Histogram/Phase':
    10901090            G2frame.Page = [page,'hap']
     
    10951095        elif text == 'Phase':
    10961096            G2frame.Page = [page,'phs']
    1097             G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,True)
    1098 #            G2frame.dataFrame.ConstraintEdit.Enable(G2gd.wxID_ADDRIDING,True)
     1097            G2frame.dataWindow.ConstraintEdit.Enable(G2gd.wxID_EQUIVALANCEATOMS,True)
     1098#            G2frame.dataWindow.ConstraintEdit.Enable(G2gd.wxID_ADDRIDING,True)
    10991099            if 'DELETED' in str(PhaseConstr):   #seems to be no other way to do this (wx bug)
    11001100                if GSASIIpath.GetConfigValue('debug'):
     
    11301130    G2frame.Bind(wx.EVT_MENU, OnAddHold, id=G2gd.wxID_HOLDADD)
    11311131    G2frame.Bind(wx.EVT_MENU, OnAddAtomEquiv, id=G2gd.wxID_EQUIVALANCEATOMS)
    1132 #    G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddRiding, id=G2gd.wxID_ADDRIDING)
     1132#    G2frame.dataWindow.Bind(wx.EVT_MENU, OnAddRiding, id=G2gd.wxID_ADDRIDING)
    11331133    # tab commands
    11341134    for id in (G2gd.wxID_CONSPHASE,
     
    11361136               G2gd.wxID_CONSHIST,
    11371137               G2gd.wxID_CONSGLOBAL):
    1138         G2frame.dataFrame.Bind(wx.EVT_MENU, RaisePage,id=id)
    1139 
    1140     G2frame.dataWindow.ClearData()
    1141     G2frame.constr = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize())
     1138        G2frame.dataWindow.Bind(wx.EVT_MENU, RaisePage,id=id)
     1139
     1140    #G2frame.constr = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize())
     1141    G2frame.constr = G2G.GSNoteBook(parent=G2frame.dataWindow)
     1142    G2frame.dataWindow.GetSizer().Add(G2frame.constr,1,wx.ALL|wx.EXPAND)
    11421143    # note that order of pages is hard-coded in RaisePage
    11431144    PhaseConstr = wx.ScrolledWindow(G2frame.constr)
     
    11621163    if errmsg:
    11631164        G2frame.ErrorDialog('Constraint Error','Error in constraints:\n'+errmsg,
    1164             parent=G2frame.dataFrame)
     1165            parent=G2frame)
    11651166    elif warnmsg:
    11661167        print 'Unexpected contraint warning:\n',warnmsg
     
    13171318        else:
    13181319            page = G2frame.rbBook.GetSelection()
    1319         G2frame.rbBook.SetSize(G2frame.dataWindow.GetClientSize())    #TODO -almost right
     1320        #G2frame.rbBook.SetSize(G2frame.dataWindow.GetClientSize())    #TODO -almost right
    13201321        G2frame.rbBook.ChangeSelection(page)
    13211322        text = G2frame.rbBook.GetPageText(page)
    13221323        if text == 'Vector rigid bodies':
    13231324            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.VectorBodyMenu)
    1324             G2frame.dataFrame.Bind(wx.EVT_MENU, AddVectorRB, id=G2gd.wxID_VECTORBODYADD)
     1325            G2frame.dataWindow.Bind(wx.EVT_MENU, AddVectorRB, id=G2gd.wxID_VECTORBODYADD)
    13251326            G2frame.Page = [page,'vrb']
    13261327            UpdateVectorRB()
    13271328        elif text == 'Residue rigid bodies':
    13281329            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RigidBodyMenu)
    1329             G2frame.dataFrame.Bind(wx.EVT_MENU, AddResidueRB, id=G2gd.wxID_RIGIDBODYADD)
    1330             G2frame.dataFrame.Bind(wx.EVT_MENU, OnImportRigidBody, id=G2gd.wxID_RIGIDBODYIMPORT)
    1331             G2frame.dataFrame.Bind(wx.EVT_MENU, OnDefineTorsSeq, id=G2gd.wxID_RESIDUETORSSEQ) #enable only if residue RBs exist?
     1330            G2frame.dataWindow.Bind(wx.EVT_MENU, AddResidueRB, id=G2gd.wxID_RIGIDBODYADD)
     1331            G2frame.dataWindow.Bind(wx.EVT_MENU, OnImportRigidBody, id=G2gd.wxID_RIGIDBODYIMPORT)
     1332            G2frame.dataWindow.Bind(wx.EVT_MENU, OnDefineTorsSeq, id=G2gd.wxID_RESIDUETORSSEQ) #enable only if residue RBs exist?
    13321333            G2frame.Page = [page,'rrb']
    13331334            UpdateResidueRB()
     
    15501551            print 'There are no rigid bodies defined'
    15511552            G2frame.ErrorDialog('No rigid bodies','There are no rigid bodies defined',
    1552                                 parent=G2frame.dataFrame)
     1553                                parent=G2frame)
    15531554            return
    15541555        elif len(rbNames) > 1:
     
    20872088    G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Rigid bodies')
    20882089    SetStatusLine('')
    2089     G2frame.dataWindow.ClearData()
    2090     G2frame.rbBook = G2G.GSNoteBook(parent=G2frame.dataFrame,size=G2frame.dataWindow.GetClientSize())
     2090    #G2frame.rbBook = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize())
     2091    G2frame.rbBook = G2G.GSNoteBook(parent=G2frame.dataWindow)
     2092    G2frame.dataWindow.GetSizer().Add(G2frame.rbBook,1,wx.ALL|wx.EXPAND)
    20912093
    20922094    VectorRB = wx.ScrolledWindow(G2frame.rbBook)
Note: See TracChangeset for help on using the changeset viewer.