Added Draw.BeginAlign(), Draw.EndAlign()
added align to a few scripts where it looks nice.
This commit is contained in:
@@ -711,12 +711,14 @@ def draw():
|
||||
Llisted=0
|
||||
size[3]=size[3]-18
|
||||
|
||||
BeginAlign()
|
||||
for k in hot:
|
||||
#hotkeys[k][-1]=Toggle(k, hot.index(k)+10, 4+(20*26)/6*hot.index(k), size[3]-(42), len(k)*8, 20, hotkeys[k][-1].val )
|
||||
hotkeys[k][-1]=Toggle(k, hot.index(k)+10, 78*hot.index(k), size[3]-(47), 78, 24, hotkeys[k][-1].val )
|
||||
l+=len(k)
|
||||
if hotkeys[k][-1].val==1.0:
|
||||
listed=hot.index(k)
|
||||
EndAlign()
|
||||
l=0
|
||||
size[3]=size[3]-4
|
||||
|
||||
@@ -725,8 +727,10 @@ def draw():
|
||||
SCROLL=size[3]/21
|
||||
END=-1
|
||||
if SCROLL < len(hotkeys[hot[listed]][:-1]):
|
||||
BeginAlign()
|
||||
Button('/\\',up,4,size[3]+8,20,14,'Scroll up')
|
||||
Button('\\/',down,4,size[3]-8,20,14,'Scroll down')
|
||||
EndAlign()
|
||||
if (SCROLL+UP)<len(hotkeys[hot[listed]][:-1]):
|
||||
END=(UP+SCROLL)
|
||||
else:
|
||||
@@ -758,8 +762,10 @@ def draw():
|
||||
END=-1
|
||||
|
||||
if SCROLL < len(FINDED):
|
||||
BeginAlign()
|
||||
Button('/\\',up,4,size[3]+8,20,14,'Scroll up')
|
||||
Button('\\/',down,4,size[3]-8,20,14,'Scroll down')
|
||||
EndAlign()
|
||||
if (SCROLL+UP)<len(FINDED):
|
||||
END=(UP+SCROLL-1)
|
||||
else:
|
||||
@@ -779,18 +785,22 @@ def draw():
|
||||
Text(' : '+n[1])
|
||||
l+=1
|
||||
else:
|
||||
BeginAlign()
|
||||
for k in hotL:
|
||||
pos=hotL.index(k)
|
||||
hotkeys['Letters '][0][k][-1]=Toggle(k,pos+20,hotL.index(k)*21, size[3]-(52+18), 21, 18, hotkeys['Letters '][0][k][-1].val )
|
||||
if hotkeys['Letters '][0][k][-1].val==1.0:
|
||||
Llisted=pos
|
||||
EndAlign()
|
||||
size[3]=size[3]-8
|
||||
SCROLL=(size[3]-88)/21
|
||||
END=-1
|
||||
if SCROLL < len(hotkeys['Letters '][0][hotL[Llisted]]):
|
||||
LEN=len(hotkeys['Letters '][0][hotL[Llisted]])
|
||||
BeginAlign()
|
||||
Button('/\\',up,4,size[3]+8,20,14,'Scroll up, you can use arrow or page keys too ')
|
||||
Button('\\/',down,4,size[3]-8,20,14,'Scroll down, you can use arrow or page keys too ')
|
||||
EndAlign()
|
||||
if (UP+SCROLL)<len(hotkeys['Letters '][0][hotL[Llisted]]):
|
||||
END=(UP+SCROLL)
|
||||
else:
|
||||
|
||||
@@ -904,8 +904,10 @@ def draw():
|
||||
glRasterPos2d(60,140)
|
||||
rangename = String("Name: ", EVENT_NONE, 5, 170, 200, 18, rangename.val, 50, "Name for Range Object")
|
||||
drawWidget(widmenu.val)
|
||||
PushButton("Back", EVENT_BACK, 5, 25, 50, 18)
|
||||
PushButton("Finish", EVENT_NEXT, 55, 25, 50, 18)
|
||||
BeginAlign()
|
||||
PushButton("Back", EVENT_BACK, 5, 25, 50, 18, "Choose another shape type")
|
||||
PushButton("Finish", EVENT_NEXT, 55, 25, 50, 18, "Add Objects at the cursor location")
|
||||
EndAlign()
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -107,10 +107,12 @@ static PyObject *Method_String( PyObject * self, PyObject * args );
|
||||
static PyObject *Method_GetStringWidth( PyObject * self, PyObject * args );
|
||||
static PyObject *Method_Text( PyObject * self, PyObject * args );
|
||||
static PyObject *Method_PupMenu( PyObject * self, PyObject * args );
|
||||
/* next three by Campbell: */
|
||||
/* next Five by Campbell: */
|
||||
static PyObject *Method_PupIntInput( PyObject * self, PyObject * args );
|
||||
static PyObject *Method_PupFloatInput( PyObject * self, PyObject * args );
|
||||
static PyObject *Method_PupStrInput( PyObject * self, PyObject * args );
|
||||
static PyObject *Method_BeginAlign( PyObject * self );
|
||||
static PyObject *Method_EndAlign( PyObject * self );
|
||||
/* next by Jonathan Merritt (lancelet): */
|
||||
static PyObject *Method_Image( PyObject * self, PyObject * args);
|
||||
/* CLEVER NUMBUT */
|
||||
@@ -158,6 +160,12 @@ static char Method_Button_doc[] =
|
||||
[tooltip=] The button's tooltip\n\n\
|
||||
This function can be called as Button() or PushButton().";
|
||||
|
||||
static char Method_BeginAlign_doc[] =
|
||||
"Buttons after this function will draw aligned (button layout only)";
|
||||
|
||||
static char Method_EndAlign_doc[] =
|
||||
"Use after BeginAlign() to stop aligning the buttons (button layout only).";
|
||||
|
||||
static char Method_Menu_doc[] =
|
||||
"(name, event, x, y, width, height, default, [tooltip]) - Create a new Menu \
|
||||
button\n\n\
|
||||
@@ -348,6 +356,8 @@ static struct PyMethodDef Draw_methods[] = {
|
||||
MethodDef( Draw ),
|
||||
MethodDef( Register ),
|
||||
{"PushButton", Method_Button, METH_VARARGS, Method_Button_doc},
|
||||
{"BeginAlign", Method_BeginAlign, METH_NOARGS, Method_BeginAlign_doc},
|
||||
{"EndAlign", Method_EndAlign, METH_NOARGS, Method_EndAlign_doc},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -856,6 +866,28 @@ static PyObject *Method_Button( PyObject * self, PyObject * args )
|
||||
return EXPP_incr_ret( Py_None );
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PyObject *Method_BeginAlign( PyObject * self )
|
||||
{
|
||||
uiBlock *block = Get_uiBlock( );
|
||||
|
||||
if (block)
|
||||
uiBlockBeginAlign(block);
|
||||
|
||||
return EXPP_incr_ret( Py_None );
|
||||
}
|
||||
|
||||
static PyObject *Method_EndAlign( PyObject * self )
|
||||
{
|
||||
uiBlock *block = Get_uiBlock( );
|
||||
|
||||
if (block)
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
return EXPP_incr_ret( Py_None );
|
||||
}
|
||||
|
||||
static PyObject *Method_Menu( PyObject * self, PyObject * args )
|
||||
{
|
||||
uiBlock *block;
|
||||
|
||||
@@ -225,6 +225,16 @@ def Exit():
|
||||
Exit the windowing interface.
|
||||
"""
|
||||
|
||||
def BeginAlign():
|
||||
"""
|
||||
Buttons after this function will draw aligned (button layout only).
|
||||
"""
|
||||
|
||||
def EndAlign():
|
||||
"""
|
||||
Use after BeginAlign() to stop aligning the buttons (button layout only).
|
||||
"""
|
||||
|
||||
def Register(draw = None, event = None, button = None):
|
||||
"""
|
||||
Register callbacks for windowing.
|
||||
|
||||
Reference in New Issue
Block a user