示例#1
0
def thisobject(sel1):	
	"""
	Show all the instances of this object
	if it is an unique object (only one instance possible)
	then goto allfields
	"""
	global data
	global block
	global commlst
	global commdct
	seldt=data.dt[sel1]
	
	Prompt='hit a button for:'+sel1
	stay=1
	index=slashcomment.getobjectindex(block,sel1)
	a=slashcomment.slashcomment()
	keyshere=a.keyshere(commdct[index][0])
	while stay:
		if 'unique-object' in keyshere:
			allfields(sel1,0)
			return
		DescrObjs=[]
		for i in range(0,len(seldt)):
			DescrObjs.append((seldt[i][1],i))
		DescrObjs.append(('-- Go up in menu --','#up#'))
		sel2=tui1.RadioButtons(Prompt,DescrObjs)
		if sel2=='#up#':return
		allfields(sel1,sel2)
示例#2
0
def editfield(sel1,sel2,sel3):
	"""
	Edit this field
	different types of field entries(key, object-list, real) 
	will result in diffferent interactions.
	"""
	global dirty
	global data
	global block
	global commdct
	print sel1
	index=slashcomment.getobjectindex(block,sel1)
	#-----key-----
	a=slashcomment.slashcomment()
	keyshere=a.keyshere(commdct[index][sel3])
	if 'key' in keyshere:
		#go to keyselection routine
		val=keyselection(commdct[index][sel3])
	elif 'object-list' in keyshere:
		val=objselection(commdct[index][sel3]['object-list'][0])
	elif 'autosizable' in keyshere:
		# button for 1.autosize and 2.enter number
		DescrObjs=[]
		DescrObjs.append(('autosize','autosize'))
		DescrObjs.append(('Enter a number','#EnterNumber#'))
		Prompt='Select an Option :' 
		autosizeselection=tui1.RadioButtons(Prompt,DescrObjs)
		if autosizeselection=='autosize':
			val=autosizeselection
		else:
			Prompt='Enter new Value'
			val=tui1.TextEntry(Prompt)		
	else:
		Prompt='Enter new Value'
		val=tui1.TextEntry(Prompt)
	try:
		slashcomment.checkVal(val,commdct[index][sel3])
		data.dt[sel1][sel2][sel3]=val
		dirty=True
		keeplooping=False
		return keeplooping
	except "anError",descr:
		print descr
		tmp=raw_input('hit RETURN to continue')
		keeplooping=True
		return keeplooping