本文整理汇总了Python中mglutil.gui.InputForm.Tk.gui.InputFormDescr类的典型用法代码示例。如果您正苦于以下问题:Python InputFormDescr类的具体用法?Python InputFormDescr怎么用?Python InputFormDescr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InputFormDescr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: guiCallback
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)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:29,代码来源:gridCommands.py
示例2: test_thumbwheel
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()
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:31,代码来源:test_InputForm.py
示例3: guiCallback
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)
开发者ID:jackygrahamez,项目名称:DrugDiscovery-Home,代码行数:31,代码来源:gridCommands.py
示例4: buildFormDescr
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
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:28,代码来源:viewsCommands.py
示例5: buildInputFormDescr
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
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:27,代码来源:picker.py
示例6: getInt
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']
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:8,代码来源:moveTk.py
示例7: buildFormDescr
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
开发者ID:ruschecker,项目名称:DrugDiscovery-Home,代码行数:11,代码来源:extrusionCommands.py
示例8: test_inputform_groupwidgetsdefault
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()
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:12,代码来源:test_InputForm.py
示例9: guiCallback
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)
开发者ID:mvysotskiy,项目名称:ePMV,代码行数:59,代码来源:crystalCommands.py
示例10: buildInputFormDescr
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
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:15,代码来源:picker.py
示例11: buildFormDescr
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
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:15,代码来源:vectfieldCommands.py
示例12: guiCallback
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)
开发者ID:ruschecker,项目名称:DrugDiscovery-Home,代码行数:28,代码来源:deleteCommands.py
示例13: test_inputForm_notebook
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()
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:52,代码来源:test_InputForm.py
示例14: guiCallback
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)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:33,代码来源:customizeVFGUICommands.py
示例15: buildFormDescr
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
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:32,代码来源:helpCommands.py
示例16: doit
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
开发者ID:jackygrahamez,项目名称:DrugDiscovery-Home,代码行数:41,代码来源:trajectoryCommands.py
示例17: test_scrolledText
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()
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:21,代码来源:test_InputForm.py
示例18: buildFormDescr
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
开发者ID:jackygrahamez,项目名称:DrugDiscovery-Home,代码行数:22,代码来源:visionCommands.py
示例19: doit
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)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:23,代码来源:serverCommands.py
示例20: createDescr
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
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:39,代码来源:test_InputForm.py
注:本文中的mglutil.gui.InputForm.Tk.gui.InputFormDescr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论