Esempio n. 1
0
def sheetGraph2(name, update=None, below=0):
	""" 'prints' a slider to the sheet.

	takes three parameters:
	-> a name for this UI element
	-> an optional 'update' function that's called when change happens
	-> whether this element should be positioned 'below' the box or to the right (the default)
	"""
	return OutputInsertsOnSheet.printCurve2(name, getSelf(), update, below)
Esempio n. 2
0
def sheetProperty(name, callback=None):
	OutputInsertsOnSheet.printProperty(getSelf(), name, callback)
	try:
		p = StandardFluidSheet.findVisualElementWithName(getSelf().root, getSelf().outputInsertsOnSheet_knownComponents["_property_%s"%name])
		cc = p.outputInsertsOnSheet_providedComponent.component
	

		@muchLater(20)
		def validate(cc, p):
			cc.validate()
			cc.doLayout()

			for c in cc.getComponents():
				c.doLayout()
			p.dirty=1

		validate(cc, p)
	except:
		pass
Esempio n. 3
0
def sheetXY(name, initialValue=None, update=None, below=0):
	""" 'prints' a slider to the sheet.

	takes four parameters:
	-> a name for this UI element
	-> an optional 'initial value" which is a Vector2(x,y) with components between 0 and 1
	-> an optional 'update' function that's called when change happens
	-> whether this element should be positioned 'below' the box or to the right (the default)
	"""
	r=OutputInsertsOnSheet.printXYSlider(name, getSelf(), update, below)
	if (OutputInsertsOnSheet.lastWasNew and initialValue):
		r.set(initialValue)
	return r
Esempio n. 4
0
def sheetLazy(name, initialValue=None, below=0):
	""" 'prints' a lazy-box to the sheet.

	takes four parameters:
	-> a name for this UI element
	-> an optional 'initial value" which is a number between 0 and 1.0
	-> whether this element should be positioned 'below' the box or to the right (the default)
	"""

	r = OutputInsertsOnSheet.printLazy(name, getSelf(), below)
	if (OutputInsertsOnSheet.lastWasNew and initialValue):
		r.set(initialValue)
	return r
Esempio n. 5
0
def sheetCombo(name, initialValue=None, update=None, below=0):
	""" 'prints' a combo box to the sheet.

	takes four parameters: 
	-> a name for this UI element
	-> an optional 'initial value" which is a tuple such as ( ["a", "b", "c"], 0 ), where ["a", "b", "c"] are the menu items and 0 is the index of the default selection
	-> an optional 'update' function that's called when a new selection occurs
	-> whether this element should be positioned 'below' the box or to the right (the default)

	this will return an object that can be used to query and set the selected item.

	Typical usage pattern is:
	myVariable = sheetCombo("myVariable", ( ["A", "B", "C"], 0)).value()

	Note that the selected item is persisted accross restarts of Field and is stored in the sheet itself.
	"""

	r = OutputInsertsOnSheet.printCombo(name, getSelf(), update, below)
	if (OutputInsertsOnSheet.lastWasNew and initialValue):
		r.setValues(initialValue[0], initialValue[1])
	return r
Esempio n. 6
0
def sheetGraph(name, update=None, below=0):
	""" 'prints' a curve editor to the sheet --- use sheetGraph2, it's better"""	
	return OutputInsertsOnSheet.printCurve(name, getSelf(), update, below)