Changeset 3683


Ignore:
Timestamp:
Oct 18, 2018 4:25:25 PM (4 years ago)
Author:
vondreele
Message:

refactor MultiDataDialog? so it can show a line of multiple choice (or bool) entries in a row
use for run k-SUBGROUPSMAG - much nicer

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r3651 r3683  
    22682268            if event: event.Skip()
    22692269            Obj = event.GetEventObject()
    2270             id,limits,format = Indx[Obj]
    2271             if 'bool' in format:
    2272                 self.values[id] = Obj.GetValue()
     2270            format = Indx[Obj][-1]
     2271            if type(format) is list:
     2272                id,idl,limits = Indx[Obj][:3]
     2273                self.values[id][idl] = Obj.GetValue()
     2274            elif 'bool' in format:
     2275                self.values[Indx[Obj][0]] = Obj.GetValue()
    22732276            elif 'str' in format:
     2277                id,limits = Indx[Obj][:2]
    22742278                try:
    22752279                    val = Obj.GetValue()
     
    22812285                Obj.SetValue('%s'%(val))
    22822286            elif 'choice' in format:
    2283                 self.values[id] = Obj.GetValue()
     2287                self.values[Indx[Obj][0]] = Obj.GetValue()
    22842288            else:
     2289                id,limits = Indx[Obj][:2]
    22852290                try:
    22862291                    val = float(Obj.GetValue())
     
    22992304        for id,[prompt,value,limits,format] in enumerate(zip(self.prompts,self.values,self.limits,self.formats)):
    23002305            lineSizer.Add(wx.StaticText(self.panel,label=prompt),0,wx.ALIGN_CENTER)
    2301             if 'bool' in format:
     2306            if type(format) is list:  #let's assume these are 'choice' for now
     2307                valItem = wx.BoxSizer(wx.HORIZONTAL)
     2308                for idl,item in enumerate(format):
     2309                    listItem = wx.ComboBox(self.panel,value=limits[idl][0],choices=limits[idl],style=wx.CB_READONLY|wx.CB_DROPDOWN)
     2310                    listItem.Bind(wx.EVT_COMBOBOX,OnValItem)
     2311                    valItem.Add(listItem,0,WACV)
     2312                    Indx[listItem] = [id,idl,limits,format]
     2313            elif 'bool' in format:
    23022314                valItem = wx.CheckBox(self.panel,label='')
    23032315                valItem.Bind(wx.EVT_CHECKBOX,OnValItem)
  • trunk/GSASIIpwdGUI.py

    r3681 r3683  
    36853685        E,SGData = G2spc.SpcGroup(controls[13])
    36863686        testAtoms = ['',]+list(set([atom[1] for atom in controls[15]]))
    3687         kvec = ['0','0','0',' ',' ',' ',' ',' ',' ',' ']
    36883687        Kx = [' ','0','1/2','-1/2','1/3','-1/3','2/3','1']
    36893688        Ky = [' ','0','1/2','1/3','2/3','1']
    36903689        Kz = [' ','0','1/2','3/2','1/3','2/3','1']
    3691         dlg = G2G.MultiDataDialog(G2frame,title='k-SUBGROUPSMAG options',
    3692             prompts=[' kx1 as fr.',' ky1 as fr.',' kz1 as fr.',' kx2 as fr.',' ky2 as fr.',' kz2 as fr.', \
    3693                      ' kx3 as fr.',' ky3 as fr.',' kz3 as fr.', \
    3694                      ' Use whole star',' Filter by','preserve axes', \
    3695                      'test for mag. atoms','all have moment','max unique'],
    3696             values=kvec[:9]+[False,'',True,'',False,100],
    3697             limits=[Kx[1:],Ky[1:],Kz[1:],Kx,Ky,Kz,Kx,Ky,Kz,[True,False],['',' Landau transition',' Only maximal subgroups',],
     3690        kvec = [['0','0','0'],[' ',' ',' '],[' ',' ',' ',' ']]
     3691        dlg = G2G.MultiDataDialog(G2frame,title='k-SUBGROUPSMAG options',prompts=[' k-vector1',' k-vector2',' k-vector3', \
     3692            ' Use whole star',' Filter by','preserve axes','test for mag. atoms','all have moment','max unique'],
     3693            values=kvec+[False,'',True,'',False,100],
     3694            limits=[[Kx[1:],Ky[1:],Kz[1:]],[Kx,Ky,Kz],[Kx,Ky,Kz],[True,False],['',' Landau transition',' Only maximal subgroups',],
    36983695                [True,False],testAtoms,[True,False],[1,100]],
    3699             formats=['choice','choice','choice','choice','choice','choice','choice','choice','choice','bool','choice',
     3696            formats=[['choice','choice','choice'],['choice','choice','choice'],['choice','choice','choice'],'bool','choice',
    37003697                    'bool','choice','bool','%d',])
    37013698        if dlg.ShowModal() == wx.ID_OK:
    37023699            magcells = []
    37033700            newVals = dlg.GetValues()
    3704             kvec[:9] = newVals[:9]
     3701            kvec[:9] = newVals[0]+newVals[1]+newVals[2]
    37053702            nkvec = kvec.index(' ')
    3706             star = newVals[9]
    3707             filterby = newVals[10]
    3708             keepaxes = newVals[11]
    3709             atype = newVals[12]
    3710             allmom = newVals[13]
    3711             maxequiv = newVals[14]
     3703            star = newVals[3]
     3704            filterby = newVals[4]
     3705            keepaxes = newVals[5]
     3706            atype = newVals[6]
     3707            allmom = newVals[7]
     3708            maxequiv = newVals[8]
    37123709            if 'maximal' in filterby:
    37133710                maximal = True
Note: See TracChangeset for help on using the changeset viewer.