def guiCallback(self):
     """called each time the 'read ->AutoGrid' sequence is pressed"""
     objList=[]
     if len(self.vf.grids.keys())==0:
         t='no grids currently in viewer'
         self.warningMsg(t)
         return
     for item in self.vf.grids.keys():
         if item not in objList:
             objList.append(item)
     if len(objList)==0:
         gridName = objList[0]
     else:
         #NEED TO PICK THE GRID....
         ifd2 = InputFormDescr(title='Choose Grid')
         ifd2.append({'widgetType':'ListChooser',
             'name':'gridObjs',
             'entries':objList,
             'wcfg':{'title':'Pick grid',
                     'mode':'single'},
             'lbwcfg':{'height':4},
             'gridcfg':{'sticky':'wens', 'column':100,
                      'rowspan':10}})
         val = self.vf.getUserInput(ifd2)
         if val is not None and len(val)>0 and len(val['gridObjs'])>0:
             gridName = val['gridObjs'][0]
         else:
             return
     return self.doitWrapper(gridName, redraw=0)
 def guiCallback(self):
     objList = []
     if len(self.vf.grids.keys()) == 0:
         t = "no grids currently in viewer"
         self.warningMsg(t)
         return
     for item in self.vf.grids.keys():
         if item not in objList and not self.vf.grids[item].srf:
             objList.append(item)
     if not hasattr(self, "ifd"):
         self.buildForm()
     else:
         self.form.deiconify()
     if len(objList) > 0:
         # NEED TO PICK THE GRID....
         ifd2 = InputFormDescr(title="Choose Grid")
         ifd2.append(
             {
                 "widgetType": "ListChooser",
                 "name": "gridObjs",
                 "entries": objList,
                 "wcfg": {"title": "Pick grid", "mode": "single"},
                 "lbwcfg": {"height": 4},
                 "gridcfg": {"sticky": "wens", "column": 100, "rowspan": 10},
             }
         )
         val = self.vf.getUserInput(ifd2)
         if val is not None and len(val) > 0 and len(val["gridObjs"]) > 0:
             filename = val["gridObjs"][0]
             grid = self.vf.grids[filename]
             return self.doitWrapper(filename, redraw=1)
Example #3
0
def test_thumbwheel():
    def tw_cb(event=None):
        pass
    from mglutil.gui.BasicWidgets.Tk.thumbwheel import ThumbWheel
    descr = InputFormDescr(title = 'Testing InputForm')
    descr.append({'name':'thumbwheel',
                  'widgetType':ThumbWheel,
                  'tooltip':"""Right click on the widget will display the control
                  panel and you can type a value manually""",
                  'defaultValue':100,
                  'wcfg':{'text':None,
                          'showLabel':1, 'width':100,
                          'min':0,
                          'lockBMin':1,
                          'lockBMax':1,
                          'lockBIncrement':1,
                          'value':40,
                          'oneTurn':1000,
                          'type':'int',
                          'increment':2,
                          'canvascfg':{'bg':'red'},
                          'wheelLabcfg1':{'font':(ensureFontCase('times'),14,'bold')},
                          'wheelLabcfg2':{'font':(ensureFontCase('times'),14,'bold')},
                          'callback':tw_cb,
                          'continuous':1, 'wheelPad':1, 'height':20},
                  'gridcfg':{'sticky':'e','row':-1}})
    
    form = InputForm(master, root, descr)
    value = form.testForm()
    assert value['thumbwheel']==100
    form.destroy() 
 def guiCallback(self):
     objList=[]
     if len(self.vf.grids.keys())==0:
         t='no grids currently in viewer'
         self.warningMsg(t)
         return
     for item in self.vf.grids.keys():
         if item not in objList and not self.vf.grids[item].srf:
             objList.append(item)
     if not hasattr(self, 'ifd'):
         self.buildForm()
     else:
         self.form.deiconify()
     if len(objList)>0:
         #NEED TO PICK THE GRID....
         ifd2 = InputFormDescr(title='Choose Grid')
         ifd2.append({'widgetType':'ListChooser',
             'name':'gridObjs',
             'entries':objList,
             'wcfg':{'title':'Pick grid',
                     'mode':'single'},
             'lbwcfg':{'height':4},
             'gridcfg':{'sticky':'wens', 'column':100,
                      'rowspan':10}})
         val = self.vf.getUserInput(ifd2)
         if val is not None and len(val)>0 and len(val['gridObjs'])>0:
             filename = val['gridObjs'][0]
             grid = self.vf.grids[filename]
             return self.doitWrapper(filename, redraw=1)
    def buildFormDescr(self, formName):
        if formName=='saveViewsToFile':
            if self.vf.commands.has_key("viewsPanel"):
                if len(self.vf.viewsPanel.views) == 0:
                    return
            else:
                return
            idf = InputFormDescr(title="Save Views to file")
            idf.append({'name':'filename',
                        'widgetType':Pmw.EntryField,
                   'tooltip':"Enter the filename, a 'filename_oprient.py' (saves orientation)\nand 'filename_repr.db'(saves representation) will be created.",
                        'wcfg':{'label_text':'Filename:',
                                'labelpos':'w'},
                        'gridcfg':{'sticky':'we'},
                        })

            idf.append({'widgetType':SaveButton,
                        'name':'filebrowse',
                        'wcfg':{'buttonType':Tkinter.Button,
                                'title':'Save In File ...',
                                'types':[('Views orientation','*_orient.py'),
                                         ('Views representation', '*_repr.db'),
                                         ("", '*')],
                                'callback':self.setEntry_cb,
                                'widgetwcfg':{'text':'BROWSE'}},
                        'gridcfg':{'row':-1, 'sticky':'we'}})

            return idf
Example #6
0
    def buildInputFormDescr(self):
        """to be implemented by sub-class"""
        
	ifd=InputFormDescr()
        ifd.title = "MSMSsel picker"
        ifd.append({'widgetType':Tkinter.Label,
                         'name':'event',
                         'wcfg':{'text':'event: '+self.event},
                         'gridcfg':{'sticky':Tkinter.W} })
        ifd.append({'widgetType':Pmw.EntryField,
                         'name':'Surface',
                         'wcfg':{'labelpos':'w',
                                 'label_text':'Surface name: ',
                                 'validate':None},
                         'gridcfg':{'sticky':'we'}})
        ifd.append({'widgetType':Tkinter.Button,
                         'name':'Cancel',
                         'wcfg':{'text':'Cancel',
                                'command':self.Cancel
                                }
                         })

        if self.numberOfObjects==None:
            ifd.append({'widgetType':Tkinter.Button,
                             'wcfg':{'text':'Done'},
                             'command': self.stop})
        return ifd
 def guiCallback(self):
     """called each time the 'read ->AutoGrid' sequence is pressed"""
     objList = []
     if len(self.vf.grids.keys()) == 0:
         t = "no grids currently in viewer"
         self.warningMsg(t)
         return
     for item in self.vf.grids.keys():
         if item not in objList:
             objList.append(item)
     if len(objList) == 0:
         gridName = objList[0]
     else:
         # NEED TO PICK THE GRID....
         ifd2 = InputFormDescr(title="Choose Grid")
         ifd2.append(
             {
                 "widgetType": "ListChooser",
                 "name": "gridObjs",
                 "entries": objList,
                 "wcfg": {"title": "Pick grid", "mode": "single"},
                 "lbwcfg": {"height": 4},
                 "gridcfg": {"sticky": "wens", "column": 100, "rowspan": 10},
             }
         )
         val = self.vf.getUserInput(ifd2)
         if val is not None and len(val) > 0 and len(val["gridObjs"]) > 0:
             gridName = val["gridObjs"][0]
         else:
             return
     return self.doitWrapper(gridName, redraw=0)
Example #8
0
 def getInt(self):
     idf = InputFormDescr(title='Choose a value')
     idf.append({'widgetType':IntThumbWheel,
                 'name':'tw',
                 'wcfg':{'width':125, 'height':30, 'nblines':30}})
     form  = InputForm(master=self.widget.master, root = None, descr=idf)
     values = form.go()
     return values['tw']
 def buildFormDescr(self, formName):
     if formName == 'display':
         idf =  InputFormDescr(title = self.name)
         idf.append({'name':'display',
                     'widgetType':Pmw.RadioSelect,
                     'listtext':['display','display only', 'undisplay'],
                     'defaultValue':'display',
                     'wcfg':{'orient':'horizontal',
                             'buttontype':'radiobutton'},
                     'gridcfg':{'sticky': 'we'}})
         return idf
Example #10
0
def test_inputform_groupwidgetsdefault():
    descr = InputFormDescr(title = 'Testing InputForm')
    descr.append({'name':'group',
                  'widgetType':Tkinter.Radiobutton,
                  'listtext':['rb1', 'rb2', 'rb3'],
                  'defaultValue':'rb3',
                  'gridcfg':{'sticky':'w'}})
    
    form = InputForm(master, root, descr)
    value = form.testForm()
    assert value['group']=='rb3'
    form.destroy() 
Example #11
0
    def guiCallback(self):
        molNames = []
        for mol in self.vf.Mols:
            if hasattr(mol, 'spaceGroup'):
                molNames.append(mol.name)
        if not molNames:
            tkMessageBox.showinfo("Crystal Info is Needed", "No Molecule in the Viewer has Crystal Info.")    
            return
        ifd = InputFormDescr(title='Crystal Info')   
        ifd.append({'name':'moleculeList',
        'widgetType':Pmw.ScrolledListBox,
        'tooltip':'Select a molecule with Crystal Info.',
        'wcfg':{'label_text':'Select Molecule: ',
            'labelpos':'nw',
            'items':molNames,
            'listbox_selectmode':'single',
            'listbox_exportselection':0,
            'usehullsize': 1,
            'hull_width':100,'hull_height':150,
            'listbox_height':5},
        'gridcfg':{'sticky':'nsew', 'row':1, 'column':0}})
        val = self.vf.getUserInput(ifd, modal=1, blocking=1)
        if val:
            molecule = self.vf.getMolFromName(val['moleculeList'][0])
            matrices = instanceMatricesFromGroup(molecule)
            geom = molecule.geomContainer.geoms['master']
            geom.Set(instanceMatrices=matrices)
            if not molecule.geomContainer.geoms.has_key('Unit Cell'):
                fractCoords=((1,1,0),(0,1,0),(0,0,0),(1,0,0),(1,1,1),(0,1,1),
                                                                (0,0,1),(1,0,1))
                coords = []
                coords = molecule.crystal.toCartesian(fractCoords)
                box=Box('Unit Cell', vertices=coords)
                self.vf.GUI.VIEWER.AddObject(box, parent=geom)
                molecule.geomContainer.geoms['Unit Cell'] = box
            ifd = InputFormDescr(title='Crystal Options')
            visible = molecule.geomContainer.geoms['Unit Cell'].visible
            if visible:
                showState = 'active'
            else:
                showState = 'normal'
            ifd.append({'name': 'Show Cell',
            'widgetType':Tkinter.Checkbutton,
            'text': 'Hide Unit Cell',
            'state':showState,
            'gridcfg':{'sticky':Tkinter.W},
            'command': CallBackFunction(self.showUnitCell, molecule)})

            ifd.append({'name': 'Show Packing',
            'widgetType':Tkinter.Checkbutton,
            'text': 'Hide Packing',
            'state':'active',
            'gridcfg':{'sticky':Tkinter.W},
            'command': CallBackFunction(self.showPacking, molecule)})
            
            val = self.vf.getUserInput(ifd, modal=0, blocking=1)
            if not val:
                geom.Set(instanceMatrices=[numpy.eye(4,4)])
                molecule.geomContainer.geoms['Unit Cell'].Set(visible=False)
Example #12
0
 def buildInputFormDescr(self):
     ifd = InputFormDescr()
     all = self.allChoices()
     if len(all)>0:
         ifd.append({'widgetType':'ListChooser',
                          'name':'AllObjects',
                          'entries':all,
                          'title':'All objects',
                          'wcfg':{'mode':'multiple'},
                          })
     if self.numberOfObjects==None:
         ifd.append({'widgetType':Tkinter.Button,
                          'wcfg':{'text':'Done'},
                          'command': self.stop})
     return ifd
 def buildFormDescr(self,formName):
     if formName == "enterName":
         ifd  =InputFormDescr(title = "Pick Vect Name")
         vectNames = self.vf.vectfield.keys()
         ifd.append({'widgetType':Pmw.ComboBox,
                     'name':'vectName',
                     'required':1,
                     'tooltip': "Please type-in a new name or chose one from the list below\n '_' are not accepted",
                     'wcfg':{'labelpos':'nw',
                             'label_text':'VectField Name: ',
                             'entryfield_validate':self.entryValidate,
                             'scrolledlist_items':vectNames,
                             },
                     'gridcfg':{'sticky':'we'}})
         return ifd
    def buildFormDescr(self,formName):
        if formName == "Vectfield":
           ifd  =InputFormDescr(title = "Choose Vect Field")
           vectList = []
           for key in self.vf.vectfield.keys():
               vectList.append((key,None))
           ifd.append({'widgetType':ListChooser,
                       'name':'vectObj',
                       'wcfg':{'title':'Pick grid',
                               'entries':vectList,
                               'mode':'single',
                               'lbwcfg':{'height':4},},
                       'gridcfg':{'sticky':'wens', 'column':100,
                                  'rowspan':10}})   
 
           return ifd
    def guiCallback(self):
        """called each time the 'Delete All Molecules' button is pressed"""
        if len(self.vf.Mols) == 0: 
            self.warningMsg("No molecules present in the Viewer")
            return
        mols = self.vf.Mols
        if mols is not None and len(mols):
            text = """WARNING: This command cannot be undone.
            if you choose to continue the undo list will be reset.
            Do you want to continue?""" 
            if not hasattr(self, 'idf'): 
                self.idf = InputFormDescr(title="WARNING")
                self.idf.append({'widgetType':Tkinter.Label,
                            'wcfg':{'text':text},
                            'gridcfg':{'columnspan':3,'sticky':'w'}})

                self.idf.append({'name': 'Continue Button',
                            'widgetType':Tkinter.Button,
                            'wcfg':{'text':'CONTINUE',
                                    'command':self.continue_cb},
                            'gridcfg':{'sticky':'we'}})

                self.idf.append({'name': 'Cancel Button',
                            'widgetType':Tkinter.Button,
                            'wcfg':{'text':'CANCEL',
                                    'command':self.cancel_cb},
                            'gridcfg':{'row':-1,'sticky':'we'}})
            self.vf.getUserInput(self.idf, okcancel=0)
Example #16
0
def test_inputForm_notebook():
    descr = InputFormDescr(title = 'Testing InputForm')
    descr.append({'widgetType':Pmw.NoteBook,
                  'name':'notebook',
                  'container':{'Page1':"w.page('Page1')",
                               'Page2':"w.page('Page2')",
                               'Page3':"w.page('Page3')"},
                  'wcfg':{'borderwidth':3},
                  'componentcfg':[{'name':'Page1', 'cfg':{}},
                                  {'name':'Page2', 'cfg':{}},
                                  {'name':'Page3', 'cfg':{}}],
                  'gridcfg':{'sticky':'wnse'}
                  })

    entries = [('Chocolate',None), ('Vanilla', None), ('Strawberry', None),
               ('Coffee',None), ('Pistachio', None), ('Rasberry',None),
               ]

    descr.append({'name':'listchooser',
                  'parent':'Page1',
                  'widgetType':ListChooser,
                  'defaultValue':'Chocolate',
                  'wcfg':{'entries':entries},
                  'gridcfg':{'sticky':'w'}
                  })
    
    descr.append({'name':'radioselect2',
                  'widgetType':Pmw.RadioSelect,
                  'parent':'Page2',
                  'listtext':['rb1', 'rb2', 'rb3','rb4', 'rb5', 'rb6',
                              'rb7', 'rb8', 'rb9','rb10', 'rb11', 'rb12'],
                  'wcfg':{'labelpos':'n',
                          'label_text':'Radiobuttons: ',
                          'orient':'horizontal',
                          'buttontype':'radiobutton'},
                  'gridcfg':{'sticky':'w'} })

    descr.append({'name':'radioselect',
                  'widgetType':Pmw.RadioSelect,
                  'parent':'Page3',
                  'defaultValue':'rb5',
                  'listtext':['rb1', 'rb2', 'rb3','rb4', 'rb5', 'rb6',
                              'rb7', 'rb8', 'rb9','rb10', 'rb11', 'rb12'],
                  'wcfg':{'labelpos':'n',
                          'label_text':'Radiobuttons: ',
                          'orient':'vertical',
                          'buttontype':'radiobutton'},
                  'gridcfg':{'sticky':'w'} })
    form = InputForm(master, root, descr, modal=0, blocking=0)
    values = form.testForm(container='Page3')
    assert values['radioselect']=='rb5'
    form.destroy() 
    def guiCallback(self):
        ifd=InputFormDescr(title='Show/Hide VFGUI components ')
        for name in ['infoBar', 'MESSAGE_BOX']:
            w = self.getWidget(name)
            var = Tkinter.IntVar()
            self.tkvarDict[name] = var
            cb = CallBackFunction( self.callback, name, var)
            ifd.append({'widgetType':Tkinter.Checkbutton,
                        'name':name,
                        'wcfg':{'text':name, 'command': cb, 'variable':var,},
                        'defaultValue': w.winfo_ismapped(),
                        'gridcfg':{'sticky':Tkinter.W}})

        posy = 0
        for name in self.vf.GUI.menuBars.keys():
            w = self.getWidget(name)
            var = Tkinter.IntVar()
            self.tkvarDict[name] = var
            cb = CallBackFunction( self.callback, name, var)
            ifd.append({'widgetType':Tkinter.Checkbutton,
                        'name':name,
                        'wcfg':{'text':name, 'command': cb, 'variable':var,},
                        'defaultValue':w.winfo_ismapped(),
                        'gridcfg':{'sticky':Tkinter.W,'column':1,'row':posy}})
            posy=posy+1

        ifd.append({'widgetType':Tkinter.Button,
                    'name':'dismiss',
                    'wcfg':{'text':'dismiss', 'command':self.dismiss_cb},
                    'gridcfg':{'columnspan':2},
                    })
        self.ifd = ifd
        val=self.vf.getUserInput(ifd, modal=0)
 def buildFormDescr(self, formName):
     
     if formName=='chooseCitation':
         idf = InputFormDescr(title="Choose Package")
         pname = self.citations.keys()
         #pname.sort()
         idf.append({'name':'packList',
                     'widgetType':Pmw.ScrolledListBox,
                     'wcfg':{'items':pname,
                             'listbox_exportselection':0,
                             'labelpos':'nw','usehullsize': 1,
                             'hull_width':100,'hull_height':150,
                             'listbox_height':5,
                              'listbox_width':150,
                             'label_text':'Select a package:',
                             'selectioncommand':self.displayCitation_cb,
                             },
                     'gridcfg':{'sticky':'wesn'}})
         
         idf.append({'name':'citation',
                     'widgetType':Pmw.ScrolledText,
                     'wcfg':{'labelpos':'nw',
                             'text_width':60,
                             'text_height':10},
                     'gridcfg':{'sticky':'wens'}
                     })
         idf.append({'name':'dismiss',
                     'widgetType':Tkinter.Button,
                     'wcfg':{'text':'DISMISS','command':self.dismiss_cb,
                             },
                     'gridcfg':{'sticky':'wens'}})
         return idf
 def buildText(self, parent, textwcfg, buttonwcfg):
     # Build the LoadOrSaveText widget or ScrolledText
     self.idf = InputFormDescr()
     textwcfg['name'] = 'UserFunction'
     self.text = buttonwcfg['text']
     self.idf.append(textwcfg)
     #windows = InputForm(parent, self.idf)
     master = parent
     root = None
     windows = InputForm(master, root, self.idf)
     self.vals = windows.go()
     # Uncheck the checkbutton if needed
     if isinstance(self.button,tkinter.Checkbutton) and \
        'variable' in buttonwcfg:
         if isinstance(buttonwcfg['variable'], tkinter.StringVar):
             buttonwcfg['variable'].set('0')
         elif isinstance(buttonwcfg['variable'], tkinter.IntVar):
             buttonwcfg['variable'].set(0)
Example #20
0
    def buildFormDescr(self, formName):

        if not formName == 'Show MailingLists':
            return
        idf = InputFormDescr(title='Show MailingLists')
        self.mailinglists_pages = ["Login Page", "Archive Page"]
        idf.append({
            'name': 'pmvlist',
            'widgetType': kbScrolledListBox,
            'wcfg': {
                'items': self.mailinglists_pages,
                'listbox_exportselection': 0,
                'labelpos': 'nw',
                'label_text': 'Pmv Mailing List',
                'selectioncommand': self.mailCmds_cb,
                'listbox_height': 3,
                #'hscrollmode':'dynamic',
            },
            'gridcfg': {
                'sticky': 'wesn',
                'columnspan': 1
            }
        })

        idf.append({
            'name': 'visionlist',
            'widgetType': kbScrolledListBox,
            'wcfg': {
                'items': self.mailinglists_pages,
                'listbox_exportselection': 0,
                'labelpos': 'nw',
                'label_text': 'Vision Mailing List',
                'selectioncommand': self.mailCmds_cb,
                'listbox_height': 3,
                #'hscrollmode':'dynamic',
            },
            'gridcfg': {
                'sticky': 'wesn',
                'columnspan': 1
            }
        })
        idf.append({
            'name': 'dismiss',
            'widgetType': Tkinter.Button,
            'wcfg': {
                'text': 'DISMISS',
                'command': self.dismiss_cb,
            },
            'gridcfg': {
                'sticky': 'ew',
                'columnspan': 3
            }
        })
        return idf
Example #21
0
    def doit(self, trajFile, ask=True):
        """creates a Trajectory object, uses its parser to read the trajectory file,
        adds created Trajectory object to self.vf.Trajectories dictionary"""
        
        name = os.path.split(trajFile)[1]
        trajnames = self.vf.Trajectories.keys()
        if name in trajnames:
            if ask:
                from mglutil.gui.InputForm.Tk.gui import InputFormDescr
                ifd = InputFormDescr(title = '')
                ifd.append({'widgetType':Pmw.EntryField,
                            'name':'newtraj',
                            'required':1,
                            'wcfg':{'labelpos':'w',
                                    'label_text': "Trajectory %s exists.\nEnter new name:"%(name,),
                                    'validate':None},
                            'gridcfg':{'sticky':'we'}
                            })

                vals = self.vf.getUserInput(ifd)
                if len(vals)>0:
                    assert not vals['newtraj'] in trajnames
                    name = vals['newtraj']
                else:
                    return None
            else:
                name = name+str(len(trajnames))
        trj = Trajectory(trajFile)
        if trj.parser:
            trj.readTrajectory()

            self.vf.Trajectories[name] = trj
            if self.vf.commands.has_key("playTrajectory"):
                if self.vf.playTrajectory.ifd:
                    cb = self.vf.playTrajectory.ifd.entryByName['trs']['widget']
                    sl = cb.component('scrolledlist')
                    trajnames = self.vf.Trajectories.keys()
                    sl.setlist(trajnames)
                    cb.selectitem(name)
            return name
        else: return None
    def doit(self, trajFile, ask=True):
        """creates a Trajectory object, uses its parser to read the trajectory file,
        adds created Trajectory object to self.vf.Trajectories dictionary"""
        
        name = os.path.split(trajFile)[1]
        trajnames = self.vf.Trajectories.keys()
        if name in trajnames:
            if ask:
                from mglutil.gui.InputForm.Tk.gui import InputFormDescr
                ifd = InputFormDescr(title = '')
                ifd.append({'widgetType':Pmw.EntryField,
                            'name':'newtraj',
                            'required':1,
                            'wcfg':{'labelpos':'w',
                                    'label_text': "Trajectory %s exists.\nEnter new name:"%(name,),
                                    'validate':None},
                            'gridcfg':{'sticky':'we'}
                            })

                vals = self.vf.getUserInput(ifd)
                if len(vals)>0:
                    assert not vals['newtraj'] in trajnames
                    name = vals['newtraj']
                else:
                    return None
            else:
                name = name+str(len(trajnames))
        trj = Trajectory(trajFile)
        if trj.parser:
            trj.readTrajectory()

            self.vf.Trajectories[name] = trj
            if self.vf.commands.has_key("playTrajectory"):
                if self.vf.playTrajectory.ifd:
                    cb = self.vf.playTrajectory.ifd.entryByName['trs']['widget']
                    sl = cb.component('scrolledlist')
                    trajnames = self.vf.Trajectories.keys()
                    sl.setlist(trajnames)
                    cb.selectitem(name)
            return name
        else: return None
def test_scrolledText():
    descr = InputFormDescr(title = "Testing ScrolledText")
    descr.append({'widgetType':Pmw.ScrolledText,
                  'name':'sText',
                  'defaultValue':"""DEFAULT TEXT""",
                  'wcfg':{'labelpos':'n',
                          'label_text':'ScrolledText with headers',
                          'usehullsize': 1,
                          'hull_width': 400,
                          'hull_height': 300,
                          'text_wrap':'none',
                          'text_padx': 4,
                          'text_pady': 4,
                          },
                  'gridcfg':{'sticky':'wens'}})
    
    form = InputForm(master, root, descr, modal=0, blocking=0)
    values = form.testForm()
    if not values['sText'] == 'DEFAULT TEXT\n':
        raise RuntimeError
    form.destroy() 
Example #24
0
 def buildFormDescr(self, formName):
     if formName == "enterName":
         ifd = InputFormDescr(title="Pick Vect Name")
         vectNames = self.vf.vectfield.keys()
         ifd.append({
             'widgetType': Pmw.ComboBox,
             'name': 'vectName',
             'required': 1,
             'tooltip':
             "Please type-in a new name or chose one from the list below\n '_' are not accepted",
             'wcfg': {
                 'labelpos': 'nw',
                 'label_text': 'VectField Name: ',
                 'entryfield_validate': self.entryValidate,
                 'scrolledlist_items': vectNames,
             },
             'gridcfg': {
                 'sticky': 'we'
             }
         })
         return ifd
 def guiCallback(self, event=None):
     self.ifd = InputFormDescr("Bind Actions to Mouse Buttons!")
     # create modifier dropDown combo box
     
     cam = self.vf.GUI.VIEWER.currentCamera
     self.ifd.append({
         'name':'forwhat',
         'widgetType': Pmw.ComboBox,
         'defaultValue': 'Object',
         'wcfg':{ 'labelpos':'nw', 'label_text':'bindings for:',
                  'selectioncommand': self.binding_cb,
                  'scrolledlist_items':['Object', 'Insert2d', 'Camera', 'Clip', 'Light',
                                        'Texture', 'Scissor']},
         'gridcfg':{'sticky':'ew', 'padx':2, 'pady':1}
         })
     self.ifd.append({
         'name':'buttonNum',
         'widgetType': Pmw.ComboBox,
         'defaultValue': '1',
         'wcfg':{ 'labelpos':'nw', 'label_text':'mouse Button Number:',
                  'scrolledlist_items':['1','2','3']},
         'gridcfg':{'sticky':'ew', 'padx':2, 'pady':1}
         })
     self.ifd.append({
         'name':'action',
         'widgetType': Pmw.ComboBox,
         'defaultValue': 'None',
         'wcfg':{ 'labelpos':'nw', 'label_text':'Action:',
                  'selectioncommand': self.actionSet_cb,
                  'scrolledlist_items':cam.actions[self.forwhat].keys()},
         'gridcfg':{'sticky':'ew', 'padx':2, 'pady':1}
         })
     self.ifd.append({
         'name':'modifier',
         'widgetType': Pmw.ComboBox,
         'defaultValue': 'None',
         'wcfg':{ 'labelpos':'nw', 'label_text':'keyboard modifier:',
                  'scrolledlist_items':cam.mouseButtonModifiers},
         'gridcfg':{'sticky':'ew', 'padx':2, 'pady':1}
         })
     self.ifd.append({
         'name':'set',
         'widgetType': Tkinter.Button,
         'wcfg':{'text':'Set', 'command':self.set_cb, },
         'gridcfg':{'sticky':'ew', 'padx':2, 'pady':1}
         })
     self.ifd.append({'widgetType':Tkinter.Button,
                      'name':'dismiss',
                      'wcfg':{'text':'dismiss',
                              'command':self.dismiss_cb},
                      'gridcfg':{'sticky':'sew'}
                          })
     self.vf.getUserInput(self.ifd, modal=0, blocking=0)
Example #26
0
    def buildFormDescr(self, formName):

        if formName == 'chooseCitation':
            idf = InputFormDescr(title="Choose Package")
            pname = self.citations.keys()
            #pname.sort()
            idf.append({
                'name': 'packList',
                'widgetType': Pmw.ScrolledListBox,
                'wcfg': {
                    'items': pname,
                    'listbox_exportselection': 0,
                    'labelpos': 'nw',
                    'usehullsize': 1,
                    'hull_width': 100,
                    'hull_height': 150,
                    'listbox_height': 5,
                    'listbox_width': 150,
                    'label_text': 'Select a package:',
                    'selectioncommand': self.displayCitation_cb,
                },
                'gridcfg': {
                    'sticky': 'wesn'
                }
            })

            idf.append({
                'name': 'citation',
                'widgetType': Pmw.ScrolledText,
                'wcfg': {
                    'labelpos': 'nw',
                    'text_width': 60,
                    'text_height': 10
                },
                'gridcfg': {
                    'sticky': 'wens'
                }
            })
            idf.append({
                'name': 'dismiss',
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'DISMISS',
                    'command': self.dismiss_cb,
                },
                'gridcfg': {
                    'sticky': 'wens'
                }
            })
            return idf
    def buildFormDescr(self, formName):
        #from Pmv.selectionCommands import sets__
        #if not sets__.keys():
        if not self.vf.sets.keys():
            self.warningMsg("No sets defined!")
            return

        ifd = InputFormDescr(title = 'Select Sets')

        gridrow = 0
        #for k in sets__.keys():
        for k in self.vf.sets.keys():
            ifd.append({'name': k,
                    'widgetType':Tkinter.Checkbutton,
                    'wcfg':{ 'text': k,
                             'variable': Tkinter.IntVar(),
                             'command': None},
                    'gridcfg':{'sticky':Tkinter.W,'row':gridrow,'column':0,
                               'columnspan':2},
                    })
            gridrow = gridrow + 1
        return ifd
def createDescr():
    descr = InputFormDescr(title = 'Testing InputForm')
    descr.append({'name':'checkbutton',
                  'widgetType':Tkinter.Checkbutton,
                  'wcfg':{'text':'Checkbutton',
                          'variable':Tkinter.IntVar()},
                  'gridcfg':{'sticky':'w'}})
    

    descr.append({'name':'radioselect',
                'widgetType':Pmw.RadioSelect,
                'listtext':['rb1', 'rb2', 'rb3','rb4', 'rb5', 'rb6',
                            'rb7', 'rb8', 'rb9','rb10', 'rb11', 'rb12'],
                'wcfg':{'labelpos':'n',
                        'label_text':'Radiobuttons: ',
                        'orient':'vertical',
                        'buttontype':'radiobutton'},
                'gridcfg':{'sticky':'w'} })

    descr.append({'name':'radioselect2',
                'widgetType':Pmw.RadioSelect,
                'listtext':['rb1', 'rb2', 'rb3','rb4', 'rb5', 'rb6',
                            'rb7', 'rb8', 'rb9','rb10', 'rb11', 'rb12'],
                'wcfg':{'labelpos':'n',
                        'label_text':'Radiobuttons: ',
                        'orient':'horizontal',
                        'buttontype':'radiobutton'},
                'gridcfg':{'sticky':'w'} })
    entries = [('Chocolate',None), ('Vanilla', None), ('Strawberry', None),
               ('Coffee',None), ('Pistachio', None), ('Rasberry',None),
               ]

    descr.append({'name':'listchooser',
                  'widgetType':ListChooser,
                  'wcfg':{'entries':entries},
                  'gridcfg':{'sticky':'w'}
                  })
    
    return descr
Example #29
0
 def buildFormDescr(self, formName):
     if formName == 'template':
         idf = self.idf = InputFormDescr(title=self.name)
         # append to idf here
         idf.append({
             'name': 'template',
             'widgetType': tkinter.Button,
             'wcfg': {
                 'text': 'template button label'
             },
             'gridcfg': {
                 'sticky': 'we'
             }
         })
         # only return idf for template
         return idf
    def buildFormDescr(self, formName):
        if formName == 'readViews':
            idf = InputFormDescr(title="Read Views")
            idf.append({'name':'orientfile',
                        'required':1,
                        'widgetType':Pmw.EntryField,
                        'tooltip':"Please type in the path to the _orient.py file \nor click on the BROWSE button to open a file browser",
                        'wcfg':{'labelpos':'w',
                                'label_text':"Orientations Filename",
                                },
                        'gridcfg':{'sticky':'w'}})

            idf.append({'widgetType':LoadButton,
                        'name':'browseOrient',
                        'wcfg':{'buttonType':Tkinter.Button,
                                'title':'Open views orientation file',
                                'types':[('Views orient','*_orient.py')],
                                'callback':self.setOrientEntry_cb,
                                'widgetwcfg':{'text':'BROWSE'}},
                        'gridcfg':{'row':-1, 'sticky':'we'}})
            idf.append({'name':'reprfile',
                        'required':1,
                        'tooltip':"Please type in the path to the _repr.db file\nor click on the BROWSE button to open a file browser",
                        'widgetType':Pmw.EntryField,
                        'wcfg':{'labelpos':'w',
                                'label_text':"Representations Filename",
                                },
                        'gridcfg':{'sticky':'w'}})

            idf.append({'widgetType':LoadButton,
                        'name':'browseRepr',
                        'wcfg':{'buttonType':Tkinter.Button,
                                'title': 'Open views representation file',
                                'types':[('Views orient','*_repr.db')],
                                'callback':self.setReprEntry_cb,
                                'widgetwcfg':{'text':'BROWSE'}},
                        'gridcfg':{'row':-1, 'sticky':'we'}})

            return idf
Example #31
0
    def buildFormDescr(self, formName):
        if formName == "saveBspt":
            entries = self.vf.SL.setdict.keys()
            idf = self.idf = InputFormDescr(title="Save Bspt in file")
            idf.append({
                'widgetType': Pmw.ScrolledListBox,
                'name': 'BsptList',
                'wcfg': {
                    'items': entries,
                    'labelpos': 'n',
                    'label_text': "Select a BSPT"
                },
                'gridcfg': {
                    'sticky': 'we',
                    'columnspan': 2
                }
            })
            idf.append({
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'OK',
                    'relief': Tkinter.RAISED,
                    'borderwidth': 2,
                    'command': self.select_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                },
            })

            idf.append({
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'Cancel',
                    'relief': Tkinter.RAISED,
                    'borderwidth': 3,
                    'command': self.cancel_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': -1
                },
            })

            return idf
Example #32
0
    def buildInputFormDescr(self):
        """to be implemented by sub-class"""

        ifd = InputFormDescr()
        ifd.title = "atom picker"
        ifd.append({
            'widgetType': Tkinter.Label,
            'name': 'event',
            'wcfg': {
                'text': 'last atom: '
            },
            'gridcfg': {
                'sticky': Tkinter.W
            }
        })
        ifd.append({
            'widgetType': Pmw.EntryField,
            'name': 'Atom',
            'wcfg': {
                'labelpos': 'w',
                'label_text': 'Atom: ',
                'validate': None
            },
            'gridcfg': {
                'sticky': 'we'
            }
        })
        if self.numberOfObjects == None:
            ifd.append({
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'Done'
                },
                'command': self.stop
            })

        return ifd
 def buildText(self,parent,textwcfg, buttonwcfg):
     # Build the LoadOrSaveText widget or ScrolledText
     self.idf = InputFormDescr()
     textwcfg['name']='UserFunction'
     self.text = buttonwcfg['text']
     self.idf.append(textwcfg)
     #windows = InputForm(parent, self.idf)
     master = parent
     root = None
     windows = InputForm(master,root,  self.idf)
     self.vals = windows.go()
     # Uncheck the checkbutton if needed
     if isinstance(self.button,Tkinter.Checkbutton) and \
        buttonwcfg.has_key('variable'):
         if isinstance(buttonwcfg['variable'], Tkinter.StringVar):
             buttonwcfg['variable'].set('0')
         elif isinstance(buttonwcfg['variable'], Tkinter.IntVar):
             buttonwcfg['variable'].set(0)
    def buildFormDescr(self, formName):
        
        if not formName == 'showCmds': return
        idf = InputFormDescr(title='Show Commands and Documentation')
        from ViewerFramework.basicCommand import commandslist
        cname = commandslist
        cname.sort()
        
        

        idf.append({'name':'cmdList',
                    'widgetType':kbScrolledListBox,
                    'wcfg':{'items':cname,
                            'listbox_exportselection':0,
                            'labelpos':'nw',
                            'label_text':'Loaded commands:',
                            'selectioncommand':self.displayCmds_cb,
                            
                            },
                    'gridcfg':{'sticky':'wesn','columnspan':1, 'weight':20}})

        
        idf.append({'name':'doclist',
                    'widgetType':kbScrolledListBox,
                    'wcfg':{'items':[],
                            'listbox_exportselection':0,
                            #'listbox_selectmode':'extended',
                            'labelpos':'nw',
                            'labelmargin':0,
                            'label_text':'DOCUMENTATION',
                            'listbox_width':30                                                        
                            },
                    'gridcfg':{'sticky':'wesn','row':-1,'columnspan':1,  'weight':20}})
        
        idf.append({'name':'dismiss',
                    'widgetType':Tkinter.Button,
                    'wcfg':{'text':'DISMISS',
                            'command':self.dismiss_cb,
                            },
                    'gridcfg':{'sticky':'ew','columnspan':3}})
        
        

        return idf
Example #35
0
    def editShader(self):
		self.shader_edited= True
		shname = self.form.descr.entryByName['pigment']['widget'].get()	
		shaderP = self.shadDic[shname]
		idf = InputFormDescr(title =shname)
		k=0
		for i in shaderP : 
			W=4
			tmp=i.replace("\"","").split(",")
			P=tmp[0].split(" ")
			V=tmp[1]
			if P[0] == "string" : 
				P[0]="str"
				W=16
			else :	V=eval(V)	
			idf.append({	'name':P[1],
                    			'widgetType':Pmw.EntryField,
                    			'type':eval(P[0]),
                    			'wcfg':{'labelpos':'w',
                        		'label_text':tmp[0],
                            		'validate':'real',
                            		'value':V,
                            		'entry_width':W},
                    			'gridcfg':{'column':0, 'row':k, 'sticky':'w'}})
			k=k+1
      		idf.append({'name':'Set',
                    'widgetType':Tkinter.Button,
                    'wcfg':{'text':'ApplyChange','command': self.SetShader},
                    'gridcfg':{'column':0,
                               'row':k,'sticky':'ew'}})
	        idf.append({'name':'help',
                    'widgetType':Tkinter.Button,
                    'defaultValue':0,
                    'wcfg':{'text':'Help','command': self.helpShader},
                    'gridcfg':{'column':1, 'row':k,'sticky':'ew'}})

		self.formS = self.vf.getUserInput(idf, modal = 0, blocking = 0)
Example #36
0
    def buildFormDescr(self, formName):
        if formName == 'saveViewsToFile':
            if self.vf.commands.has_key("viewsPanel"):
                if len(self.vf.viewsPanel.views) == 0:
                    return
            else:
                return
            idf = InputFormDescr(title="Save Views to file")
            idf.append({
                'name': 'filename',
                'widgetType': Pmw.EntryField,
                'tooltip':
                "Enter the filename, a 'filename_oprient.py' (saves orientation)\nand 'filename_repr.db'(saves representation) will be created.",
                'wcfg': {
                    'label_text': 'Filename:',
                    'labelpos': 'w'
                },
                'gridcfg': {
                    'sticky': 'we'
                },
            })

            idf.append({
                'widgetType': SaveButton,
                'name': 'filebrowse',
                'wcfg': {
                    'buttonType':
                    Tkinter.Button,
                    'title':
                    'Save In File ...',
                    'types': [('Views orientation', '*_orient.py'),
                              ('Views representation', '*_repr.db'),
                              ("", '*')],
                    'callback':
                    self.setEntry_cb,
                    'widgetwcfg': {
                        'text': 'BROWSE'
                    }
                },
                'gridcfg': {
                    'row': -1,
                    'sticky': 'we'
                }
            })

            return idf
    def deleteMolecule_cb(self):
        """called each time the 'Delete Molecule' button is pressed"""
        mols = self.chooser.getMolSet()
        if mols is not None and len(mols):
            if self.vf.undoCmdStack == []:
                self.doitWrapper(mols, redraw=0)
                
            else:
            
                text = """WARNING: This command cannot be undone.
                if you choose to continue the undo list will be reset.
                The hide Button will make the molecule disappear without
                resetting the Undo list. Do you want to continue?""" 
                if not hasattr(self, 'idf'): 
                    self.idf = InputFormDescr(title="WARNING")
                    self.idf.append({'widgetType':Tkinter.Label,
                                'wcfg':{'text':text},
                                'gridcfg':{'columnspan':3,'sticky':'w'}})

                    self.idf.append({'name': 'Continue Button',
                                'widgetType':Tkinter.Button,
                                'wcfg':{'text':'CONTINUE',
                                        'command':self.continue_cb},
                                'gridcfg':{'sticky':'we'}})

                    self.idf.append({'name': 'Cancel Button',
                                'widgetType':Tkinter.Button,
                                'wcfg':{'text':'CANCEL',
                                        'command':self.cancel_cb},
                                'gridcfg':{'row':-1,'sticky':'we'}})

                    self.idf.append({'name': 'Hide Button',
                                'widgetType':Tkinter.Button,
                                'wcfg':{'text':'HIDE',
                                        'command':self.hide_cb},
                                'gridcfg':{'row':-1,'sticky':'we'}})
                form = self.vf.getUserInput(self.idf, okcancel=0)
                self.form.root.protocol('WM_DELETE_WINDOW',self.cancel_cb)
Example #38
0
 def guiCallback(self):
     if not self.form:
         idf = self.idf = InputFormDescr(title="Views")
         idf.append({
             'name': 'viewsContainer',
             'widgetType': Pmw.Group,
             'container': {
                 'viewsContainer': "w.interior()"
             },
             'wcfg': {
                 'ring_borderwidth': 2,
                 'tag_pyclass': None,  #Tkinter.Button,
                 #'tag_text':'Save view',
                 #'tag_command': self.saveView
             },
             'gridcfg': {
                 'sticky': 'we',
                 'columnspan': 1
             }
         })
         idf.append({
             'widgetType': Tkinter.Button,
             'wcfg': {
                 'text': "Save View",  #'Close',
                 "width": 40,
                 'command': self.saveView  #self.dismissForm
             }
         })
         self.form = self.vf.getUserInput(self.idf, modal=0, blocking=0)
     else:
         self.form.deiconify()
     # place the form below the viewer (so that the form does not get into a saved image if
     # the user decides to save the view).
     x = self.form.master.winfo_x()
     y = self.form.master.winfo_y()
     w = self.form.master.winfo_width()
     h = self.form.master.winfo_height()
     self.form.root.geometry("+%d+%d" % (x + w / 2, y + h))
Example #39
0
 def buildForm(self):
     ifd = self.ifd = InputFormDescr(title="Selection level:")
     levelLabels = [
         'Molecule      ', 'Chain           ', 'Residue       ',
         'Atom           '
     ]
     self.levelVar.set("Molecule")
     for level, levlabel in zip(levels, levelLabels):
         ifd.append({
             'name': level,
             'widgetType': Tkinter.Radiobutton,
             'wcfg': {
                 'text': levlabel,
                 'variable': self.levelVar,
                 'value': level,
                 'justify': 'left',
                 'activebackground': self.levelColors[level],
                 'selectcolor': self.levelColors[level],
                 'command': self.setLevel_cb
             },
             'gridcfg': {
                 'sticky': 'we'
             }
         })
     ifd.append({
         'name': 'dismiss',
         'widgetType': Tkinter.Button,
         'defaultValue': 1,
         'wcfg': {
             'text': 'Dismiss',
             'command': self.Close_cb
         },
         'gridcfg': {
             'sticky': 'we'
         }
     })
     self.form = self.vf.getUserInput(self.ifd, modal=0, blocking=0)
     self.form.root.protocol('WM_DELETE_WINDOW', self.Close_cb)
 def buildFormDescr(self, formName):
     
     
     if not formName == 'Show MailingLists': 
         return
     idf = InputFormDescr(title='Show MailingLists')
     self.mailinglists_pages=["Login Page","Archive Page"] 
     idf.append({'name':'pmvlist',
                 'widgetType':kbScrolledListBox,
                 'wcfg':{'items':self.mailinglists_pages,
                         'listbox_exportselection':0,
                         'labelpos':'nw',
                         'label_text':'Pmv Mailing List',
                         'selectioncommand':self.mailCmds_cb,
                         'listbox_height':3 ,
                         #'hscrollmode':'dynamic',
                         },
                 'gridcfg':{'sticky':'wesn','columnspan':1}})
     
     idf.append({'name':'visionlist',
                 'widgetType':kbScrolledListBox,
                 'wcfg':{'items':self.mailinglists_pages,
                         'listbox_exportselection':0,
                         'labelpos':'nw',
                         'label_text':'Vision Mailing List',
                         'selectioncommand':self.mailCmds_cb,
                         'listbox_height':3,
                         #'hscrollmode':'dynamic',
                         },
                 'gridcfg':{'sticky':'wesn','columnspan':1}})
     idf.append({'name':'dismiss',
                 'widgetType':Tkinter.Button,
                 'wcfg':{'text':'DISMISS',
                         'command':self.dismiss_cb,
                         },
                 'gridcfg':{'sticky':'ew','columnspan':3}})
     return idf
Example #41
0
 def buildInputFormDescr(self):
     ifd = InputFormDescr()
     all = self.allChoices()
     if len(all) > 0:
         ifd.append({
             'widgetType': 'ListChooser',
             'name': 'AllObjects',
             'entries': all,
             'title': 'All objects',
             'wcfg': {
                 'mode': 'multiple'
             },
         })
     if self.numberOfObjects == None:
         ifd.append({
             'widgetType': Tkinter.Button,
             'wcfg': {
                 'text': 'Done'
             },
             'command': self.stop
         })
     return ifd
Example #42
0
    def doit(self):
        import thread

        idf = InputFormDescr("Viewerframework server connection!")
        idf.append({'widgetType':Tkinter.Entry,
                    'name': 'host','defaultValue':'localhost',
                    'wcfg':{'label':'Host name or IP'}, 
                    'gridcfg':{'sticky':Tkinter.E}
                   })
        idf.append({'widgetType':Tkinter.Entry,
                    'name': 'port','defaultValue':'50000',
                    'wcfg':{'label':"Server's Port"}, 
                    'gridcfg':{'sticky':Tkinter.E}
                    })
        self.idf = idf
        val = self.vf.getUserInput(idf)
        self.vf.socketComm.connectToServer(val['host'], int(val['port']),
                                           self.vf.server_cb)

        # create a threadsafe command queue
        from Queue import Queue
        self.vf.cmdQueue = Queue(-1) # infinite size
        self.vf.GUI.ROOT.after(10, self.vf.runServerCommands)
Example #43
0
    def guiCallback(self):
        molNames = []
        for mol in self.vf.Mols:
            if hasattr(mol, 'spaceGroup'):
                molNames.append(mol.name)
        if not molNames:
            tkMessageBox.showinfo(
                "Crystal Info is Needed",
                "No Molecule in the Viewer has Crystal Info.")
            return
        ifd = InputFormDescr(title='Crystal Info')
        ifd.append({
            'name': 'moleculeList',
            'widgetType': Pmw.ScrolledListBox,
            'tooltip': 'Select a molecule with Crystal Info.',
            'wcfg': {
                'label_text': 'Select Molecule: ',
                'labelpos': 'nw',
                'items': molNames,
                'listbox_selectmode': 'single',
                'listbox_exportselection': 0,
                'usehullsize': 1,
                'hull_width': 100,
                'hull_height': 150,
                'listbox_height': 5
            },
            'gridcfg': {
                'sticky': 'nsew',
                'row': 1,
                'column': 0
            }
        })
        val = self.vf.getUserInput(ifd, modal=1, blocking=1)
        if val:
            molecule = self.vf.getMolFromName(val['moleculeList'][0])
            matrices = instanceMatricesFromGroup(molecule)
            geom = molecule.geomContainer.geoms['master']
            geom.Set(instanceMatrices=matrices)
            if not molecule.geomContainer.geoms.has_key('Unit Cell'):
                fractCoords = ((1, 1, 0), (0, 1, 0), (0, 0, 0), (1, 0, 0),
                               (1, 1, 1), (0, 1, 1), (0, 0, 1), (1, 0, 1))
                coords = []
                coords = molecule.crystal.toCartesian(fractCoords)
                box = Box('Unit Cell', vertices=coords)
                self.vf.GUI.VIEWER.AddObject(box, parent=geom)
                molecule.geomContainer.geoms['Unit Cell'] = box
            ifd = InputFormDescr(title='Crystal Options')
            visible = molecule.geomContainer.geoms['Unit Cell'].visible
            if visible:
                showState = 'active'
            else:
                showState = 'normal'
            ifd.append({
                'name': 'Show Cell',
                'widgetType': Tkinter.Checkbutton,
                'text': 'Hide Unit Cell',
                'state': showState,
                'gridcfg': {
                    'sticky': Tkinter.W
                },
                'command': CallBackFunction(self.showUnitCell, molecule)
            })

            ifd.append({
                'name': 'Show Packing',
                'widgetType': Tkinter.Checkbutton,
                'text': 'Hide Packing',
                'state': 'active',
                'gridcfg': {
                    'sticky': Tkinter.W
                },
                'command': CallBackFunction(self.showPacking, molecule)
            })

            val = self.vf.getUserInput(ifd, modal=0, blocking=1)
            if not val:
                geom.Set(instanceMatrices=[numpy.eye(4, 4)])
                molecule.geomContainer.geoms['Unit Cell'].Set(visible=False)
Example #44
0
    def guiCallback(self):
        idf = InputFormDescr(title="Set User Preferences")

        categoryList = ['General']
        for value in self.vf.userpref.values():
            if not value['category'] in categoryList:
                categoryList.append(value['category'])

        widgetType = {
            'widgetType': Pmw.NoteBook,
            'name': 'prefNotebook',
            'container': {},
            'wcfg': {
                'borderwidth': 2
            },
            'componentcfg': [],
            'gridcfg': {
                'sticky': 'we'
            },
        }
        for item in categoryList:
            widgetType['container'][item] = "w.page('" + item + "')"
            widgetType['componentcfg'].append({'name': item, 'cfg': {}})

        idf.append(widgetType)
        for item in categoryList:
            idf.append({
                'name': item + "Group",
                'widgetType': Pmw.Group,
                'parent': item,
                'container': {
                    item + 'Group': 'w.interior()'
                },
                'wcfg': {
                    'tag_text': item
                },
                'gridcfg': {
                    'sticky': 'wne'
                }
            })
        for key, value in self.vf.userpref.items():
            if not self.updateGUI in self.vf.userpref[key]['callbackFunc']:
                self.vf.userpref.addCallback(key, self.updateGUI)
            # put a label to have more space between the widget Maybe
            # could replace it by using the options padx and pady.
            group = value['category'] + "Group"
            idf.append({
                'widgetType': Tkinter.Label,
                'parent': group,
                'wcfg': {
                    'text': ''
                },
                'gridcfg': {
                    'sticky': 'we',
                    'columnspan': 3
                }
            })

            if value.has_key('validValues') and value['validValues']:
                idf.append({
                    'widgetType': Pmw.ComboBox,
                    'parent': group,
                    'name': key,
                    'defaultValue': value['value'],
                    'wcfg': {
                        'label_text': key,
                        'labelpos': 'n',
                        'scrolledlist_items': value['validValues']
                    },
                    'gridcfg': {
                        'sticky': 'wens'
                    }
                })
            else:

                if value.has_key('validateFunc') and value['validateFunc']:

                    def valid(value, func=value['validateFunc']):
                        test = func(value)
                        if test == 1:
                            return Pmw.OK
                        else:
                            return Pmw.PARTIAL

                    idf.append({
                        'widgetType': Pmw.EntryField,
                        'parent': group,
                        'name': key,
                        'wcfg': {
                            'label_text': key,
                            'labelpos': 'n',
                            'value': value['value'],
                            'validate': {
                                'validator': valid
                            }
                        },
                        'gridcfg': {
                            'sticky': 'wens'
                        }
                    })
                else:
                    idf.append({
                        'widgetType': Pmw.EntryField,
                        'parent': group,
                        'name': key,
                        'wcfg': {
                            'label_text': key,
                            'labelpos': 'n'
                        },
                        'gridcfg': {
                            'sticky': 'wens'
                        }
                    })

            idf.append({
                'widgetType': Tkinter.Button,
                'parent': group,
                'wcfg': {
                    'bitmap': 'info',
                    'width': 50,
                    'height': 40,
                    'padx': 10,
                    'command': CallBackFunction(self.info_cb, value['doc'])
                },
                'gridcfg': {
                    'row': -1,
                    'sticky': 'wens'
                }
            })

            idf.append({
                'widgetType': Tkinter.Button,
                'parent': group,
                'wcfg': {
                    'text': 'Make \nDefault',
                    'padx': 10,
                    'command': CallBackFunction(self.default_cb, key)
                },
                'gridcfg': {
                    'row': -1,
                    'sticky': 'wens'
                }
            })

            idf.append({
                'widgetType': Tkinter.Button,
                'parent': group,
                'wcfg': {
                    'text': 'Set',
                    'padx': 10,
                    'height': 2,
                    'width': 5,
                    'command': CallBackFunction(self.set_cb, key)
                },
                'gridcfg': {
                    'row': -1,
                    'sticky': 'wens'
                }
            })

        idf.append({
            'widgetType': Tkinter.Button,
            'wcfg': {
                'text': 'Dismiss',
                'command': self.dismissForm
            },
            'gridcfg': {
                'sticky': 'we',
                'columnspan': 4
            }
        })

        self.form = self.vf.getUserInput(idf, modal=0, blocking=0)
Example #45
0
    def buildFormDescr(self, formName):
        if formName == 'choosecmd':
            cmdNames = filter(lambda x, self=self: self.vf.commands[x].flag &
                              self.objArgOnly,
                              self.vf.commands.keys())
            cmdNames.sort()
            cmdEntries = map(lambda x: (x, None), cmdNames)

            onAddCmds = map(lambda x: x[0], self.vf.onAddObjectCmds)
            cmdToApplyNames = []
            cmdToApplyNames = filter(lambda x, vf=self.vf, onAddCmds=onAddCmds:
                                     vf.commands[x] in onAddCmds,
                                     cmdNames)

            cmdtoapply = map(lambda x: (x, None), cmdToApplyNames)
            idf = InputFormDescr(title="Cmds called after adding an object")
            idf.append({
                'name': 'cmdlist',
                'widgetType': ListChooser,
                'tooltip': """list of the commands loaded so far in the
application which can be applied to the object
when loaded in the application""",
                'wcfg': {
                    'entries': cmdEntries,
                    'mode': 'extended',
                    'lbwcfg': {
                        'exportselection': 0
                    },
                    'title': 'Available commands'
                },
                'gridcfg': {
                    'sticky': 'wens',
                    'row': 0,
                    'column': 0,
                    'rowspan': 3
                }
            })

            idf.append({
                'name': 'add',
                'widgetType': Tkinter.Button,
                'tooltip': """ Add the selected command from to the list
of commands to be applied to the object when loaded in the application""",
                'wcfg': {
                    'text': '>>',
                    'command': self.add_cb
                },
                'gridcfg': {
                    'row': 0,
                    'column': 1,
                    'rowspan': 3
                }
            })

            idf.append({
                'name': 'cmdtoapply',
                'widgetType': ListChooser,
                'tooltip': """list of the commands the user chose to
apply to the object when loaded in the application""",
                'wcfg': {
                    'entries': cmdtoapply,
                    'mode': 'single',
                    'lbwcfg': {
                        'exportselection': 0
                    },
                    'title': 'Commands to be applied'
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 0,
                    'column': 2,
                    'rowspan': 3
                }
            })

            idf.append({
                'name': 'remove',
                'widgetType': Tkinter.Button,
                'tooltip': """ Remove the selected entry from the
commands to be applied to the object when loaded in the application""",
                'wcfg': {
                    'text': 'REMOVE',
                    'width': 10,
                    'command': self.remove_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 0,
                    'column': 3
                }
            })

            idf.append({
                'name': 'oneup',
                'widgetType': Tkinter.Button,
                'tooltip': """Move the selected entry up one entry""",
                'wcfg': {
                    'text': 'Move up',
                    'width': 10,
                    'command': self.moveup_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 1,
                    'column': 3
                }
            })

            idf.append({
                'name': 'onedown',
                'widgetType': Tkinter.Button,
                'tooltip': """Move the selected entry down one entry""",
                'wcfg': {
                    'text': 'Move down',
                    'width': 10,
                    'command': self.movedown_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 2,
                    'column': 3
                }
            })

            return idf
Example #46
0
    def setparams_cb(self):
        """Opens a panel to set Video Parameters"""
        if self.paramForm:
            self.paramForm.deiconify()
            return
        self.ifd2 = ifd2 = InputFormDescr(title="Set video options")
        ifd2.append({
            'widgetType': Pmw.EntryField,
            'tooltip': 'Set camera width',
            'name': 'cameraw',
            'gridcfg': {
                'sticky': 'w',
                'columnspan': 2
            },
            'wcfg': {  #'command': self.setCameraWidth_cb,
                'label_text': 'width:',
                'entry_width': 10,
                'validate': {
                    'validator': 'real',
                    'min': 0
                },
                'value': str(self.cameraw),
                'labelpos': 'w'
            }
        })

        ifd2.append({
            'widgetType': Pmw.EntryField,
            'name': 'camerah',
            'tooltip': 'Set camera height',
            'gridcfg': {
                'sticky': 'w',
                'columnspan': 2
            },
            'wcfg': {  #'command': self.setCameraHeight_cb,
                'label_text': 'height',
                'entry_width': 10,
                'validate': {
                    'validator': 'real',
                    'min': 0
                },
                'value': str(self.camerah),
                'labelpos': 'w'
            }
        })
        ifd2.append({
            'name': 'autoPause',
            'wtype': ThumbWheel,
            'widgetType': ThumbWheel,
            'tooltip': 'set auto pause delay (seconds)',
            'wcfg': {
                'labCfg': {
                    'fg': 'black',
                    'side': 'left',
                    'text': 'AutoPause Delay'
                },
                'showLabel': 1,
                'width': 100,
                'min': 0,
                'value': self.autoPauseDelay,
                'oneTurn': 100,
                'type': 'int',
                'increment': 1,
                #'callback':self.setAutoPauseDelay_cb,
                'canvascfg': {
                    'bg': 'red'
                },
                'continuous': 0,
                'wheelPad': 1,
                'height': 15
            },
            'gridcfg': {
                'sticky': 'nesw',
                'columnspan': 2
            }
        })
        ifd2.append({
            'name': 'pauseLength',
            'wtype': ThumbWheel,
            'widgetType': ThumbWheel,
            'tooltip':
            'set number of frames to be added when\nrecording resumes after autopause',
            'wcfg': {
                'labCfg': {
                    'fg': 'black',
                    'side': 'left',
                    'text': 'AutoPause Length'
                },
                'showLabel': 1,
                'width': 100,
                'min': 0,
                'value': self.pauseLength,
                'oneTurn': 100,
                'type': 'int',
                'increment': 1,
                #'callback':self.setPauseLength_cb,
                'canvascfg': {
                    'bg': 'red'
                },
                'continuous': 0,
                'wheelPad': 1,
                'height': 15
            },
            'gridcfg': {
                'sticky': 'nesw',
                'columnspan': 2
            }
        })
        ifd2.append({
            'name': 'okB',
            'widgetType': Tkinter.Button,
            'wcfg': {
                'text': 'Apply',
                'command': self.apply_cb,
            },
            'gridcfg': {
                'sticky': 'nesw'
            }
        })
        ifd2.append({
            'name': 'cancelB',
            'widgetType': Tkinter.Button,
            'wcfg': {
                'text': 'Cancel',
                'command': self.cancel_cb,
            },
            'gridcfg': {
                'sticky': 'nesw',
                'row': -1,
                'column': 1
            }
        })
        self.paramForm = InputForm(self.master,
                                   None,
                                   descr=ifd2,
                                   modal=0,
                                   blocking=0)
        self.paramForm.deiconify()

        return self.paramForm
Example #47
0
    def buildFormDescr(self, formName):
        if formName == 'readViews':
            idf = InputFormDescr(title="Read Views")
            idf.append({
                'name': 'orientfile',
                'required': 1,
                'widgetType': Pmw.EntryField,
                'tooltip':
                "Please type in the path to the _orient.py file \nor click on the BROWSE button to open a file browser",
                'wcfg': {
                    'labelpos': 'w',
                    'label_text': "Orientations Filename",
                },
                'gridcfg': {
                    'sticky': 'w'
                }
            })

            idf.append({
                'widgetType': LoadButton,
                'name': 'browseOrient',
                'wcfg': {
                    'buttonType': Tkinter.Button,
                    'title': 'Open views orientation file',
                    'types': [('Views orient', '*_orient.py')],
                    'callback': self.setOrientEntry_cb,
                    'widgetwcfg': {
                        'text': 'BROWSE'
                    }
                },
                'gridcfg': {
                    'row': -1,
                    'sticky': 'we'
                }
            })
            idf.append({
                'name': 'reprfile',
                'required': 1,
                'tooltip':
                "Please type in the path to the _repr.db file\nor click on the BROWSE button to open a file browser",
                'widgetType': Pmw.EntryField,
                'wcfg': {
                    'labelpos': 'w',
                    'label_text': "Representations Filename",
                },
                'gridcfg': {
                    'sticky': 'w'
                }
            })

            idf.append({
                'widgetType': LoadButton,
                'name': 'browseRepr',
                'wcfg': {
                    'buttonType': Tkinter.Button,
                    'title': 'Open views representation file',
                    'types': [('Views orient', '*_repr.db')],
                    'callback': self.setReprEntry_cb,
                    'widgetwcfg': {
                        'text': 'BROWSE'
                    }
                },
                'gridcfg': {
                    'row': -1,
                    'sticky': 'we'
                }
            })

            return idf
Example #48
0
 def getIfd(self, atNames):
     #cylinders
     if not hasattr(self, 'ifd'):
         ifd = self.ifd = InputFormDescr(
             title='Show Hydrogen Bonds as Cylinders')
         ifd.append({
             'name': 'hbondLabel',
             'widgetType': Tkinter.Label,
             'wcfg': {
                 'text':
                 str(len(atNames)) +
                 ' Atoms in hbonds:\n(1=visible, 0 not visible)'
             },
             'gridcfg': {
                 'sticky': 'wens',
                 'columnspan': 2
             }
         })
         ifd.append({
             'name': 'atsLC',
             'widgetType': ListChooser,
             'wcfg': {
                 'entries': atNames,
                 'mode': 'multiple',
                 'title': '',
                 'command': CallBackFunction(self.showHBondLC, atNames),
                 'lbwcfg': {
                     'height': 5,
                     'selectforeground': 'red',
                     'exportselection': 0,
                     'width': 30
                 },
             },
             'gridcfg': {
                 'sticky': 'wens',
                 'row': 2,
                 'column': 0,
                 'columnspan': 2
             }
         })
         ifd.append({
             'name': 'radii',
             'widgetType': ExtendedSliderWidget,
             'wcfg': {
                 'label': 'radii',
                 'minval': .01,
                 'maxval': 1.0,
                 'immediate': 1,
                 'init': .2,
                 'width': 250,
                 'command': self.update,
                 'sliderType': 'float',
                 'entrypackcfg': {
                     'side': 'right'
                 }
             },
             'gridcfg': {
                 'sticky': 'wens',
                 'columnspan': 2
             }
         })
         ifd.append({
             'name': 'length',
             'widgetType': ExtendedSliderWidget,
             'wcfg': {
                 'label': 'length',
                 'minval': .01,
                 'maxval': 5.0,
                 'immediate': 1,
                 'init': 1.0,
                 'width': 250,
                 'command': self.update,
                 'sliderType': 'float',
                 'entrypackcfg': {
                     'side': 'right'
                 }
             },
             'gridcfg': {
                 'sticky': 'wens',
                 'columnspan': 2
             }
         })
         ifd.append({
             'name': 'changeVertsBut',
             'widgetType': Tkinter.Button,
             'wcfg': {
                 'text': 'Set anchors',
                 'command': self.changeDVerts
             },
             'gridcfg': {
                 'sticky': 'wens'
             }
         })
         ifd.append({
             'name': 'changeColorBut',
             'widgetType': Tkinter.Button,
             'wcfg': {
                 'text': 'Change color',
                 'command': self.changeColor
             },
             'gridcfg': {
                 'sticky': 'wes',
                 'row': -1,
                 'column': 1
             }
         })
         ifd.append({
             'name': 'closeBut',
             'widgetType': Tkinter.Button,
             'wcfg': {
                 'text': 'Dismiss',
                 'command': self.dismiss_cb
             },
             'gridcfg': {
                 'sticky': 'wens',
                 'columnspan': 2
             }
         })
Example #49
0
    def buildForm(self, master=None, width=100, height=80, title=None):
        if self.form:
            self.form.deiconify()
            self.createKeyBindings()
            return
        self.master = master
        ifd = self.ifd = InputFormDescr(title=title)
        ifd.append({
            'name': 'fileopen',
            'widgetType': Tkinter.Button,
            'tooltip': "Opens file browser",
            'wcfg': {
                'text': "Save As:",
                'command': self.browseFile,
                'width': 0,
                'height': 0,
            },
            'gridcfg': {
                'sticky': 'w',
                'column': 0
            }
        })
        ifd.append({
            'name': 'filename',
            'widgetType': Pmw.EntryField,
            'tooltip': "type filename",
            'gridcfg': {
                'sticky': 'w',
                #'columnspan': 3},
                'columnspan': 2,
                'row': -1
            },
            'wcfg': {
                'command': self.getFileName,
                #'label_text':'Save As',
                'entry_width': 12,
                'value': self.fileName,
                #'labelpos':'w'}})
            }
        })

        ## ifd.append({'name':'fileopen',
        ##                     'widgetType':Tkinter.Button,
        ##                     'tooltip': "Open file browser",
        ##                     'wcfg':{'text':"...",
        ##                             'command': self.browseFile,
        ##                             'width': 0, 'height': 0,},
        ##                     'gridcfg':{'sticky':'w', 'column':2, 'row':-1}
        ##                     })
        ifd.append({
            'name': 'recordB',
            'widgetType': Tkinter.Checkbutton,
            'tooltip': 'start/stop recording',
            'wcfg': {
                'variable': self.RecVar,
                'bd': 2,
                'image': self.record1Icon,
                'width': self.record1Icon.width(),
                'height': self.record1Icon.height(),
                'indicatoron': 0,
            },
            'gridcfg': {
                'sticky': 'nesw',
                'row': -1
            },
            'command': self.record_cb
        })

        ifd.append({
            'name': 'pauseB',
            'widgetType': Tkinter.Checkbutton,
            'tooltip': 'pause/start recording',
            'wcfg': {
                'variable': self.PauseVar,
                'bd': 2,
                'image': self.pauseIcon,
                'width': self.pauseIcon.width(),
                'height': self.pauseIcon.height(),
                'indicatoron': 0,
            },
            'gridcfg': {
                'sticky': 'nesw',
                'row': -1
            },
            'command': self.pause_cb
        })

        ifd.append({
            'name': 'stopB',
            'widgetType': Tkinter.Button,
            'tooltip': 'stop recording',
            'wcfg': {
                'bd': 2,
                'image': self.stopIcon,
                'width': self.stopIcon.width(),
                'height': self.stopIcon.height(),
            },
            'gridcfg': {
                'sticky': 'nesw',
                'row': -1
            },
            'command': self.stop_cb
        })

        ##         ifd.append({'name': 'recordB',
        ##                     'widgetType': Tkinter.Button,
        ##                     'tooltip':'start/pause recording',
        ##                     'wcfg':{'bd':4,
        ##                             'image':self.recordIcon,
        ##                             'width':self.recordIcon.width(),
        ##                             'height':self.recordIcon.height()
        ##                             },
        ##                     'gridcfg':{'sticky':'nesw','row':-1},
        ##                     'command':self.record_cb})

        ##         ifd.append({'name': 'pauseB',
        ##                     'widgetType': Tkinter.Button,
        ##                     'tooltip':'pause recording',
        ##                     'wcfg':{'bd':4,
        ##                             'image':self.pauseIcon,
        ##                             'width':self.pauseIcon.width(),
        ##                             'height':self.pauseIcon.height()
        ##                             },
        ##                     'gridcfg':{'sticky':'nesw', 'row':-1},
        ##                     'command':self.pause_cb})

        ##         ifd.append({'name': 'modeB',
        ##                     'widgetType': Tkinter.Button,
        ##                     'text':'Change Mode',
        ##                     'tooltip':'opens panel to change video parameters',
        ##                     'wcfg':{'bd':4,
        ##                             'image':self.chmodIcon,
        ##                             'width':self.chmodIcon.width(),
        ##                             'height':self.chmodIcon.height()
        ##                             },
        ##                     'gridcfg':{'sticky':'nesw','row':-1},
        ##                     'command':self.setparams_cb })

        ##         ifd.append({'name': 'closeB',
        ##             'widgetType': Tkinter.Button,
        ##             'text':'Close',
        ##             'tooltip':'closes video recorder',
        ##             'wcfg':{'bd':2,
        ##                     'image':self.closeIcon,
        ##                     'width':self.closeIcon.width(),
        ##                     'height':self.closeIcon.height(),
        ##                     },
        ##             'gridcfg':{'sticky':'nesw','row':-1},
        ##             'command':self.close_cb})
        form = self.form = InputForm(self.master,
                                     None,
                                     descr=ifd,
                                     modal=0,
                                     blocking=0,
                                     closeWithWindow=1,
                                     onDestroy=self.close_cb)
        self.createKeyBindings()
        return form
Example #50
0
    def buildForm(self):
        ifd = self.ifd = InputFormDescr(
            title="Select nodes + change parameters(optional):")
        ifd.append({
            'name': 'keyLab',
            'widgetType': Tkinter.Label,
            'text': 'For Struts Bond detection:',
            'gridcfg': {
                'sticky': 'w'
            }
        })

        ifd.append({
            'name': 'molSet',
            'wtype': StringSelectorGUI,
            'widgetType': StringSelectorGUI,
            'wcfg': {
                'molSet': self.vf.Mols,
                'vf': self.vf,
                'all': 1,
                'crColor': (0., 1., .2),
            },
            'gridcfg': {
                'sticky': 'we',
                'columnspan': 2
            }
        })

        ifd.append({
            'name': 'distCutoff',
            'widgetType': ExtendedSliderWidget,
            'wcfg': {
                'label': 'Residue Spacing Minimum',
                'minval': 1,
                'maxval': 50,
                'init': 6,
                'labelsCursorFormat': '%1d',
                'sliderType': 'int',
                'entrywcfg': {
                    'width': 4
                },
                'entrypackcfg': {
                    'side': 'right'
                }
            },
            'gridcfg': {
                'columnspan': 2,
                'sticky': 'we'
            }
        })
        ifd.append({
            'name': 'distCutoff2',
            'widgetType': ExtendedSliderWidget,
            'wcfg': {
                'label': 'Threshold',
                'minval': 1.0,
                'maxval': 50.0,
                'init': 5.00,
                'labelsCursorFormat': '%1.2f',
                'sliderType': 'float',
                'entrywcfg': {
                    'width': 4
                },
                'entrypackcfg': {
                    'side': 'right'
                }
            },
            'gridcfg': {
                'columnspan': 2,
                'sticky': 'we'
            }
        })
        ifd.append({
            'widgetType': Tkinter.Button,
            'text': 'Ok',
            'wcfg': {
                'bd': 6
            },
            'gridcfg': {
                'sticky': Tkinter.E + Tkinter.W
            },
            'command': self.Accept_cb
        })
        self.form = self.vf.getUserInput(self.ifd, modal=0, blocking=0)
        self.form.root.protocol('WM_DELETE_WINDOW', self.Close_cb)
        self.form.autoSize()
Example #51
0
    def changeDVerts(self, event=None):
        #for all residues in hbonds, pick new donorAttachment
        # and new acceptorAttachment
        entries = []
        ns = ['N', 'C', 'O', 'CA', 'reset']
        for n in ns:
            entries.append((n, None))

        if hasattr(self, 'form2'):
            self.form2.root.tkraise()
            return
        ifd2 = self.ifd2 = InputFormDescr(title='Set Anchor Atoms')
        ifd2.append({
            'name': 'datsLC',
            'widgetType': ListChooser,
            'wcfg': {
                'entries': entries,
                'mode': 'single',
                'title': 'Donor Anchor',
                'command': CallBackFunction(self.setDVerts, entries),
                'lbwcfg': {
                    'height': 5,
                    'selectforeground': 'red',
                    'exportselection': 0,
                    #'lbpackcfg':{'fill':'both', 'expand':1},
                    'width': 30
                },
            },
            'gridcfg': {
                'sticky': 'wens',
                'columnspan': 2
            }
        })
        ifd2.append({
            'name': 'aatsLC',
            'widgetType': ListChooser,
            'wcfg': {
                'entries': entries,
                'mode': 'single',
                'title': 'Acceptor Anchor',
                'command': CallBackFunction(self.setAVerts, entries),
                'lbwcfg': {
                    'height': 5,
                    'selectforeground': 'red',
                    #'lbpackcfg':{'fill':'both', 'expand':1},
                    'exportselection': 0,
                    'width': 30
                },
            },
            'gridcfg': {
                'sticky': 'wens',
                'columnspan': 2
            }
        })
        ifd2.append({
            'name': 'doneBut',
            'widgetType': Tkinter.Button,
            'wcfg': {
                'text': 'Done',
                'command': self.closeChangeDVertLC
            },
            'gridcfg': {
                'sticky': 'wens'
            }
        })
        self.form2 = self.vf.getUserInput(self.ifd2, modal=0, blocking=0)
        self.form2.root.protocol('WM_DELETE_WINDOW', self.closeChangeDVertLC)
Example #52
0
    def buildFormDescr(self, formName):
        if formName == 'infoForm':
            idf = InputFormDescr(title='Command Description')
            idf = InputFormDescr('Documentation')
            idf.append({
                'name': 'cmdDoc',
                'widgetType': Pmw.ScrolledText,
                'wcfg': {
                    'labelpos': 'nw',
                    'label_text': 'command documentation:',
                    'text_width': 50,
                    'text_height': 5
                },
                'gridcfg': {
                    'sticky': 'we'
                }
            })

            idf.append({
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'Dismiss',
                    'command': self.dismissDoc_cb
                },
                'gridcfg': {
                    'sticky': 'we'
                }
            })
            return idf
        elif formName == 'searchForm':
            idf = InputFormDescr(title='Search For Commands')

            idf.append({
                'name': 'searchGroup',
                'widgetType': Pmw.Group,
                'container': {
                    'searchGroup': "w.interior()"
                },
                'wcfg': {
                    'tag_text': 'Search Options'
                },
                'gridcfg': {
                    'sticky': 'wnse',
                    'columnspan': 2
                }
            })

            idf.append({
                'name': 'searchString',
                'widgetType': Pmw.EntryField,
                'parent': 'searchGroup',
                'wcfg': {
                    'label_text': 'Search String',
                    'labelpos': 'w',
                },
                'gridcfg': {
                    'sticky': 'wnse',
                    'columnspan': 2
                }
            })

            idf.append({
                'name': 'caseSensitive',
                'widgetType': Tkinter.Checkbutton,
                'parent': 'searchGroup',
                'wcfg': {
                    'text': 'Case sensitive',
                    'variable': Tkinter.IntVar(),
                },
                'gridcfg': {
                    'sticky': 'w'
                },
            })

            idf.append({
                'name': 'matchGroup',
                'widgetType': Pmw.Group,
                'parent': 'searchGroup',
                'container': {
                    'matchGroup': "w.interior()"
                },
                'wcfg': {
                    'tag_text': 'Match search string to'
                },
                'gridcfg': {
                    'sticky': 'wnse',
                    'columnspan': 2
                }
            })

            idf.append({
                'name': 'matchModName',
                'widgetType': Tkinter.Checkbutton,
                'parent': 'matchGroup',
                'defaultValue': 1,
                'tooltip':
                "The Search String will be matched against the modules name",
                'wcfg': {
                    'text': 'Module Name',
                    'variable': Tkinter.IntVar()
                },
                'gridcfg': {
                    'sticky': 'w'
                },
            })

            idf.append({
                'name': 'matchCmdName',
                'widgetType': Tkinter.Checkbutton,
                'parent': 'matchGroup',
                'defaultValue': 1,
                'tooltip':
                "The Search String will be matched against the commands name",
                'wcfg': {
                    'text': 'Command Name',
                    'variable': Tkinter.IntVar()
                },
                'gridcfg': {
                    'sticky': 'w'
                },
            })

            idf.append({
                'name': 'matchDocString',
                'widgetType': Tkinter.Checkbutton,
                'parent': 'matchGroup',
                'defaultValue': 1,
                'tooltip':
                "The Search String will be matched against the content of the documentation string",
                'wcfg': {
                    'text': 'Documentation String',
                    'variable': Tkinter.IntVar()
                },
                'gridcfg': {
                    'sticky': 'w'
                },
            })

            idf.append({
                'name': 'choices',
                'widgetType': Pmw.RadioSelect,
                'parent': 'searchGroup',
                'defaultValue': 'Default Packages',
                'listtext': ['Default Packages', 'All Packages'],
                'tooltip':
                "Choose where to look for a command: \n- Default packages  \n-All packages on disk which is slower",
                'wcfg': {
                    'labelpos': 'nw',
                    'label_text': 'Search in:',
                    'buttontype': 'radiobutton'
                },
                'gridcfg': {
                    'sticky': 'w'
                }
            })

            idf.append({
                'name': 'search',
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'SEARCH',
                    'command': self.searchCmd_cb
                },
                'gridcfg': {
                    'columnspan': 2
                }
            })

            idf.append({
                'name': 'resultGroup',
                'widgetType': Pmw.Group,
                'container': {
                    'resultGroup': "w.interior()"
                },
                'wcfg': {
                    'tag_text': 'Search Result'
                },
                'gridcfg': {
                    'sticky': 'wnse',
                    'columnspan': 2
                }
            })

            idf.append({
                'name': 'cmdFound',
                'widgetType': kbScrolledListBox,
                'parent': 'resultGroup',
                'tooltip':
                "This widget will list all the commands found with the search string.",
                'wcfg': {
                    'items': [],
                    'listbox_exportselection': 0,
                    'labelpos': 'nw',
                    'label_text': 'Found Commands:',
                    'dblclickcommand': self.loadCmd_cb
                },
                'gridcfg': {
                    'sticky': 'wesn',
                    'columnspan': 2
                }
            })

            idf.append({
                'name': 'info',
                'widgetType': Tkinter.Button,
                'parent': 'resultGroup',
                'tooltip':
                "Display the documentation string of the selected command.",
                'wcfg': {
                    'text': 'INFO',
                    'height': 1,
                    'command': self.info_cb
                },
                'gridcfg': {
                    'sticky': 'wesn'
                }
            })

            idf.append({
                'name': 'load',
                'widgetType': Tkinter.Button,
                'parent': 'resultGroup',
                'tooltip': "Show the selected commands in the application",
                'wcfg': {
                    'text': 'LOAD',
                    'height': 1,
                    'command': self.loadCmd_cb
                },
                'gridcfg': {
                    'sticky': 'wesn',
                    'row': -1
                }
            })

            ##         idf.append({'name':'cmdLoaded',
            ##                     'widgetType':kbScrolledListBox,
            ##                     'parent':'resultGroup',
            ##                     'tooltip':"This widget will list all the commands found with the search \nstring that have already been loaded in the application",
            ##                     'wcfg':{'items':[],
            ##                             'listbox_exportselection':0,
            ##                             'labelpos':'nw',
            ##                             'label_text':'Loaded Commands:',
            ##                             },
            ##                     'gridcfg':{'sticky':'wesn', 'rowspan':2,
            ##                                'column':2, 'row':0}})

            idf.append({
                'name': 'search',
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'DISMISS',
                    'command': self.dismiss_cb
                },
                'gridcfg': {
                    'columnspan': 2
                }
            })
            return idf
Example #53
0
    def buildFormDescr(self, formName):
        ifd = InputFormDescr(title = "AutoGrid/AutoDock Web Services")
        #Web Services Login
        ifd.append({'name':"LoginGroup", 'widgetType':Pmw.Group,
                     'container':{'LoginGroup':'w.interior()'},
                     'wcfg':{'tag_text':'Web Services Location'},
                     'gridcfg':{'sticky':'nswe'}
                    })
        ifd.append({'widgetType':Pmw.ComboBox, 'name':'WS_address',
                    'parent':'LoginGroup',
                    'wcfg':{'scrolledlist_items':
                            ('http://ws.nbcr.net/opal2/services',),
                            'listheight':50, 'dropdown':1, 'history':1, 
                            'autoclear':1},
                     'gridcfg':{'sticky':'ew', 'row':0, 'column':0,
                                'columnspan':3}
                     })

#        ifd.append({'widgetType':Tkinter.Label, 'name':'New_User',
#                    'parent':'LoginGroup', 'wcfg':{'text':'   New Users?',
#                                           'fg':'Blue','cursor':'hand1'},
#                    'gridcfg':{'sticky':'w', 'row':1, 'column':0}
#                    })
#        ifd.append({'widgetType':Tkinter.Label, 'name':'UserName_Label',
#                    'parent':'LoginGroup', 'wcfg':{'text':'User Name'},
#                    'gridcfg':{'sticky':'e', 'row':1, 'column':1}
#                    })
#        ifd.append({'widgetType':Tkinter.Entry, 'name':'UserName_Entry',
#                    'parent':'LoginGroup','wcfg':{},
#                    'gridcfg':{'sticky':'ew', 'row':1, 'column':2}
#                    })
#        ifd.append({'widgetType':Tkinter.Label, 'name':'Password_Label',
#                    'parent':'LoginGroup', 'wcfg':{'text':'Password'},
#                    'gridcfg':{'sticky':'e', 'row':2, 'column':1}
#                    })
#        ifd.append({'widgetType':Tkinter.Entry, 'name':'Password_Entry',
#                    'parent':'LoginGroup', 'wcfg':{'show':'*'},
#                    'gridcfg':{'sticky':'ew', 'row':2, 'column':2}
#                    })
#        ifd.append({'widgetType':Tkinter.Label, 'name':'Remember_Label',
#                    'parent':'LoginGroup',
#                    'wcfg':{'text':'Remember User Name and Password'},
#                    'gridcfg':{'sticky':'e', 'row':3, 'column':0,'columnspan':2}
#                    })
#        self.RememberLogin_var = Tkinter.BooleanVar()
#        ifd.append({'widgetType':Tkinter.Checkbutton, 'name':'Remember_Checkbutton',
#                    'parent':'LoginGroup', 'variable':self.RememberLogin_var,
#                    'gridcfg':{'sticky':'w', 'row':3, 'column':2}
#                    })       
        #AutoGrid group
        ifd.append({'name':"AutoGrid", 'widgetType':Pmw.Group,
                    'container':{'AutoGrid':'w.interior()'},
                    'wcfg':{'tag_text':'AutoGrid'},
                    'gridcfg':{'sticky':'nswe'}
                    })
        
        ifd.append({'widgetType':Tkinter.Button, 'name':'Run_autogrid',
                    'parent':'AutoGrid', 
                    'wcfg':{'text':'Run AutoGrid ',
                            'command':self.startAutogrid},
                    'gridcfg':{'sticky':'w', 'row':0, 'column':0}
                    })

        ifd.append( {'name': 'gpf_entry', 'parent':'AutoGrid',
                     'widgetType':Tkinter.Entry, 
                     'wcfg':{'width':30,'textvariable':self.gpf},
                     'gridcfg':{'sticky':'w','row':0,'column':1}
                     })

        ifd.append({'name': 'browse_gpf', 'widgetType': Tkinter.Button,
                    'parent':'AutoGrid', 'text':'Browse',
                    'command':self.browse_gpf,
                    'gridcfg':{'sticky':'w','row':0, 'column':2}
                    })
        #AutoDock group
        ifd.append({'name':"AutoDock", 'widgetType':Pmw.Group,
                    'container':{'AutoDock':'w.interior()'},
                    'wcfg':{'tag_text':'AutoDock'},
                    'gridcfg':{'sticky':'nswe'}
                    })

        ifd.append({'widgetType':Tkinter.Button, 'name':'Run_autodock',
                    'parent':'AutoDock', 
                    'wcfg':{'text':'Run AutoDock',
                            'command':self.startAutodock},
                    'gridcfg':{'sticky':'w', 'row':0, 'column':0}
                    })

        ifd.append( {'name': 'dpf_entry', 'parent':'AutoDock',
                     'widgetType':Tkinter.Entry, 
                     'wcfg':{'width':30,'textvariable':self.dpf},
                     'gridcfg':{'sticky':'w','row':0,'column':1}
                     })

        ifd.append({'name': 'browse_dpf', 'widgetType': Tkinter.Button,
                    'parent':'AutoDock', 'text':'Browse',
                    'command':self.browse_dpf,
                    'gridcfg':{'sticky':'w','row':0, 'column':2}
                    })

        ifd.append({'name': 'ag_local', 'widgetType': Tkinter.Radiobutton,
                    'parent':'AutoDock', 'text':'Use local grids',
                    'tooltip':"This option sends locally stored grid files with Web Services request",
                    'wcfg':{'variable':self.ad_radio,'value':0},
                    'gridcfg':{'sticky':'w','row':1, 'column':0,'columnspan':2}
                    })

#        ifd.append({'name': 'ag_before', 'widgetType': Tkinter.Radiobutton,
#                    'parent':'AutoDock', 'text':'Run AutoGrid first',
#                    'tooltip':"This option runs AutoGrid Web Services and uses resulting map files for AutoDock",
#                    'wcfg':{'variable':self.ad_radio,'value':1,'state':'disabled'},
#                    'gridcfg':{'sticky':'w','row':2, 'column':0,'columnspan':2}
#                    })

        ifd.append({'name': 'use_remote', 'widgetType': Tkinter.Radiobutton,
                    'parent':'AutoDock', 'text':'Use grids from server directory',
                    'tooltip':"This option copies map files from previous AutoGrid run",
                    'wcfg':{'variable':self.ad_radio,'value':2,},
                    'gridcfg':{'sticky':'w','row':3, 'column':0,'columnspan':2}
                    })

        ifd.append( {'name': 'remote_dir', 'parent':'AutoDock',
                     'widgetType':Tkinter.Entry, 
                     'wcfg':{'width':23,'textvariable':self.prev_dir},
                     'gridcfg':{'sticky':'e','row':3,'column':1,'columnspan':2}
                     })

        #Status
        ifd.append({'name':"StatusGroup", 'widgetType':Pmw.Group,
                    'container':{'StatusGroup':'w.interior()'},
                    'wcfg':{'tag_text':'Web Services Status'},
                    'gridcfg':{'sticky':'nswe'}
                    })
        
        ifd.append({'widgetType':Tkinter.Label, 'name':'status0',
                    'parent':'StatusGroup', 
                    'wcfg':{'text':'   ',},
                    'gridcfg':{'sticky':'w', 'row':0, 'column':0}
                    })

        ifd.append({'widgetType':Tkinter.Label, 'name':'status1',
                    'parent':'StatusGroup', 
                    'wcfg':{'text':'   ',},
                    'gridcfg':{'sticky':'w', 'row':1, 'column':0}
                    })

        ifd.append({'name':'WS_ProgressBar', 'widgetType':Tkinter.Frame,
                    'parent':'StatusGroup', 'wcfg':{'height':30},
                     'gridcfg':{'sticky':'ew', 'row':2,'column':0}
                    })
        
        ifd.append({'widgetType':Tkinter.Label, 'name':'down_label',
                    'parent':'StatusGroup', 
                    'wcfg':{'text':'   ',},
                    'gridcfg':{'sticky':'w', 'row':3, 'column':0}
                    })
        
        return ifd
Example #54
0
    def buildFormDescr(self, formName):
        if formName == 'citationHelp':
            idf = InputFormDescr(title="Choose Package")
            citeKeys = self.vf.showCitation.citations.keys()

            txt = """
 This widget helps you cite the use of appropriate packages in your publication. 
 Based on the information we collected, please cite the following publications:   """

            idf.append({
                'name': 'help',
                'widgetType': Tkinter.Label,
                'wcfg': {
                    'text': txt,
                    'justify': Tkinter.LEFT
                },
                'gridcfg': {
                    'sticky': 'wens',
                    'columnspan': 2
                }
            })

            txt = """ADT/PMV/ViewerFramework:
    Michel F. Sanner. Python: A Programming Language for
    Software Integration and Development. J. Mol. Graphics
    Mod., 1999, Vol 17, February. pp57-61
"""
            #this is the part where we find out which packages are used
            MSMS = False
            isocontour = False
            volRen = False
            APBS = False
            PROSS = False
            if hasattr(self.vf, 'Mols'):
                for mol in self.vf.Mols:
                    if 'secondarystructure' in mol.geomContainer.geoms.keys():
                        PROSS = True
                    if 'MSMS-MOL' in mol.geomContainer.geoms.keys():
                        MSMS = True
            for gridName in self.vf.grids3D:
                if '.potential.dx' in gridName:
                    APBS = True
                grid = self.vf.grids3D[gridName]
                if hasattr(grid, 'isoBarNumber') and grid.isoBarNumber > 0:
                    isocontour = True
                if hasattr(grid, 'volRenGrid'):
                    volRen = True
            if MSMS:
                txt += """
MSMS:                
    Sanner, M.F., Spehner, J.-C., and Olson, A.J. (1996) Reduced
    surface: an efficient way to compute molecular surfaces.
    Biopolymers, Vol. 38, (3),305-320.               
"""
            if APBS:
                txt += """
APBS:           
    Baker NA, Sept D, Joseph S, Holst MJ, McCammon JA. Electrostatics 
    of nanosystems: application to microtubules and the ribosome. 
    /Proc. Natl. Acad. Sci. USA/ *98*, 10037-10041 2001 
"""
            if isocontour:
                txt += """
IsoContour:                
    Bajaj, C, Pascucci, V., Schikore, D., (1996), Fast IsoContouring
    for Improved Interactivity, Proceedings of  ACM Siggraph/IEEE
    Symposium on Volume Visualization, ACM Press, 1996, pages 39 - 46,
    San Francisco, CA      
"""
            if volRen:
                txt += """
Volume Rendering:           
    Bajaj, C, Park, S., Thane, A., (2002), A Parallel Multi-PC
    Volume Rendering System, ICES and CS Technical Report, University
    of Texas, 2002. 
"""
            if PROSS:
                txt += """
Secondary Structure:           
    Srinivasan R, Rose GD. (1999) A physical basis for protein 
    secondary structure. Proc. Natl. Acad. Sci. USA  96, 14258-63.
"""
            idf.append({
                'name': 'citation',
                'widgetType': Pmw.ScrolledText,
                'defaultValue': txt,
                'gridcfg': {
                    'sticky': 'wens',
                    'columnspan': 2
                }
            })

            idf.append({
                'name': 'save',
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'Save As',
                    'command': self.save,
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 2,
                    'column': 0
                }
            })

            idf.append({
                'name': 'dismiss',
                'widgetType': Tkinter.Button,
                'wcfg': {
                    'text': 'DISMISS',
                    'command': self.dismiss_cb,
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 2,
                    'column': 1
                }
            })
            return idf
Example #55
0
    def showForm(self):
        """create formdescr for setAnim
        form to set the animation:
        each frame is a list of geom to display
        """

        entryFrame = []
        for i in range(len(self.framelist)):
            val = 'frame_' + str(i)
            entryFrame.append((val, ))

        if not hasattr(self, 'form_Setanim'):
            ifd = InputFormDescr(title="SetAnimation")
            ifd.append({
                'widgetType': ListChooser,
                'name': 'availableGeom',
                'tooltip': 'geom available in viewer',
                'wcfg': {
                    'mode': 'extended',
                    'lbwcfg': {
                        'exportselection': 1
                    },
                    'command': [(self.toggleExpansion, '<Double-Button-1>')],
                    'commandEvent': None,
                    'title': 'availableGeom'
                },
                'gridcfg': {
                    'row': 0,
                    'column': 0,
                    'sticky': 'wens',
                    'rowspan': 3
                }
            })
            ifd.append({
                'name': 'newframe',
                'widgetType': Tkinter.Button,
                'tooltip': """ Add an empty frame to the animation""",
                'wcfg': {
                    'text': 'NewFrame',
                    'command': self.addframe_cb
                },
                'gridcfg': {
                    'row': 0,
                    'column': 1,
                    'rowspan': 1
                }
            })

            ifd.append({
                'name': 'add',
                'widgetType': Tkinter.Button,
                'tooltip': """ Add the selected geom to selected frame""",
                'wcfg': {
                    'text': 'AddGeom',
                    'command': self.add_cb
                },
                'gridcfg': {
                    'row': 1,
                    'column': 1,
                    'rowspan': 1
                }
            })

            ifd.append({
                'name': 'geomtoload',
                'widgetType': ListChooser,
                'tooltip': """list of frame  the user chose to
                        apply to the pattern""",
                'wcfg': {
                    'entries': entryFrame,
                    'mode': 'extended',
                    'lbwcfg': {
                        'exportselection': 0
                    },
                    'title': 'Frame(geom) to be display'
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 0,
                    'column': 2,
                    'rowspan': 3
                }
            })
            ifd.append({
                'name': 'remove',
                'widgetType': Tkinter.Button,
                'tooltip': """ Remove the selected entry from the
                        commands to be applied to the object when loaded in the application""",
                'wcfg': {
                    'text': 'REMOVE',
                    'width': 10,
                    'command': self.remove_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 0,
                    'column': 3
                }
            })

            ifd.append({
                'name': 'oneup',
                'widgetType': Tkinter.Button,
                'tooltip': """Move the selected entry up one entry""",
                'wcfg': {
                    'text': 'Move up',
                    'width': 10,
                    'command': self.moveup_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 1,
                    'column': 3
                }
            })

            ifd.append({
                'name': 'onedown',
                'widgetType': Tkinter.Button,
                'tooltip': """Move the selected entry down one entry""",
                'wcfg': {
                    'text': 'Move down',
                    'width': 10,
                    'command': self.movedown_cb
                },
                'gridcfg': {
                    'sticky': 'we',
                    'row': 2,
                    'column': 3
                }
            })

            self.form_Setanim = InputForm(self.master,
                                          None,
                                          descr=ifd,
                                          scrolledFrame=0)

            self.lc = self.form_Setanim.descr.entryByName['availableGeom'][
                'widget']
            self.lc2 = self.form_Setanim.descr.entryByName['geomtoload'][
                'widget']
            self.addObject(self.viewer.rootObject, None)
            val = self.form_Setanim.go()
            if val:
                self.assign()
                self.form_Setanim.withdraw()
        else:
            self.form_Setanim.deiconify()
            val = self.form_Setanim.go()
            if val:
                self.assign()
                self.form_Setanim.withdraw()
Example #56
0
 def buildForm(self):
     if hasattr(self, 'ifd'):
         return
     self.torsionType = Tkinter.StringVar()
     self.torsionType.set('1')
     self.ifd = ifd = InputFormDescr(title='Set Torsion Angle')
     ifd.append({
         'name': 'extLabel',
         'widgetType': Tkinter.Label,
         'wcfg': {
             'text': 'Set Angle:\n(180=trans)'
         },
         'gridcfg': {
             'sticky': Tkinter.W + Tkinter.E,
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'extslider',
         'widgetType': ExtendedSliderWidget,
         'wcfg': {
             'label': 'torsion',
             'minval': -360.,
             'maxval': 360.,
             'width': 150,
             'immediate': 1,
             'command': self.slideCallback,
             'sliderType': 'float',
             'entrypackcfg': {
                 'side': 'bottom'
             }
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'typeLabel',
         'widgetType': Tkinter.Label,
         'wcfg': {
             'text': 'Torsion Type'
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'rdbut1',
         'widgetType': Tkinter.Radiobutton,
         'wcfg': {
             'text': 'Absolute',
             'variable': self.torsionType,
             'value': 1,
             'command': self.rdSet
         },
         'gridcfg': {
             'sticky': 'we'
         }
     })
     ifd.append({
         'name': 'rdbut2',
         'widgetType': Tkinter.Radiobutton,
         'wcfg': {
             'text': 'Relative ',
             'variable': self.torsionType,
             'value': 0,
             'command': self.rdSet
         },
         'gridcfg': {
             'sticky': 'we',
             'row': -1,
             'column': 1
         }
     })
     ifd.append({
         'name': 'historyList',
         'widgetType': ListChooser,
         'wcfg': {
             'title': 'TorsionAngle\nTranformation History',
             'mode': 'single',
             'command': self.HLCommand,
             'lbwcfg': {
                 'height': 5,
                 'selectforeground': 'yellow',
                 'exportselection': 0,
                 'width': 30
             },
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'hbut1',
         'widgetType': Tkinter.Button,
         'wcfg': {
             'text': 'Step Back ',
             'command': self.stepBack
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'hbut2',
         'widgetType': Tkinter.Button,
         'wcfg': {
             'text': 'Start Over ',
             'command': self.startOver
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'hbut3',
         'widgetType': Tkinter.Button,
         'wcfg': {
             'text': 'Reset All ',
             'command': self.resetAll
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'angListEnt',
         'widgetType': Tkinter.Entry,
         'wcfg': {
             'width': 5,
             'command': self.getAngList,
             'textvariable': self.newAngList
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'hbut4',
         'widgetType': Tkinter.Button,
         'wcfg': {
             'text': 'Move',
             'command': self.repeat_transTors
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     ifd.append({
         'name': 'hbut5',
         'widgetType': Tkinter.Button,
         'wcfg': {
             'text': 'New Torsion',
             'command': self.new_Tors
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     #ifd.append({'name':'accept',
     #'widgetType': Tkinter.Button,
     #'wcfg':{'text' : 'Accept',
     #'command': self.Accept_cb},
     #'gridcfg':{'sticky':'we'}})
     ifd.append({
         'name': 'done',
         'widgetType': Tkinter.Button,
         'wcfg': {
             'text': 'Done',
             'command': self.Done_cb
         },
         'gridcfg': {
             'sticky': 'we',
             'columnspan': 2
         }
     })
     #'gridcfg':{'sticky':'we','column':1, 'row':-1}})
     self.form = self.vf.getUserInput(ifd, modal=0, blocking=0)
     self.form.root.protocol('WM_DELETE_WINDOW', self.Done_cb)
     self.extslider = self.ifd.entryByName['extslider']['widget']
     self.extslider.draw.bind('<ButtonRelease-1>', self.mouseUp, add='+')
     self.extslider.entry.bind('<Return>', self.mouseUp, add='+')
     self.historyList = self.ifd.entryByName['historyList']['widget'].lb
     #self.historyList.bind("<Double-Button-1>",self.HLCommand)
     self.hbut1 = self.ifd.entryByName['hbut1']['widget']
     self.hbut2 = self.ifd.entryByName['hbut2']['widget']
     self.hbut3 = self.ifd.entryByName['hbut3']['widget']
     self.angListEnt = self.ifd.entryByName['angListEnt']['widget']