2#include "kivio_py_stencil.h"
9#include "kivioglobal.h"
10#include "kivio_common.h"
11#include "kivio_connector_point.h"
12#include "kivio_connector_target.h"
13#include "kivio_fill_style.h"
14#include "kivio_intra_stencil_data.h"
15#include "kivio_line_style.h"
16#include "kivio_painter.h"
17#include "kivio_point.h"
18#include "kivio_screen_painter.h"
19#include "kivio_stencil_spawner.h"
20#include "kivio_stencil_spawner_info.h"
21#include "kivio_stencil_spawner_set.h"
23#include "kivio_py_stencil_spawner.h"
25#include "kivio_page.h"
32#include <KoZoomHandler.h>
37 void initkivioc(
void);
40KivioPyStencil::KivioPyStencil()
43 m_pConnectorTargets =
new TQPtrList<KivioConnectorTarget>;
44 m_pConnectorTargets->setAutoDelete(
true);
46 static bool first_time =
true;
54 PyObject* mainmod = PyImport_AddModule(
"__main__");
55 globals = PyModule_GetDict(mainmod);
65 vars = Py_BuildValue(
"{s:d,s:d,s:d,s:d,s:d,s:d,s:{},s:[],s:[],s:{}}",
66 "x", m_x,
"y", m_y,
"w", m_w,
"h", m_h,
"x2", x2,
"y2", y2 ,
"style",
"connectors",
"connector_targets",
"shapes");
72KivioPyStencil::~KivioPyStencil()
77int KivioPyStencil::init( TQString initCode )
79 runPython(kivio_module);
80 if ( !runPython( initCode ) )
83 m_w = getDoubleFromDict( vars,
"w");
84 m_h = getDoubleFromDict( vars,
"h");
85 m_x = getDoubleFromDict( vars,
"x");
86 m_y = getDoubleFromDict( vars,
"y");
96bool KivioPyStencil::loadXML(
const TQDomElement &e )
102 node = e.firstChild();
103 while( !node.isNull() )
105 TQString nodeName = node.nodeName();
107 ele = node.toElement();
109 if( nodeName ==
"PyData" )
111 resizeCode = XmlReadString( ele,
"resizeCode",
"" );
113 TQString sVars = XmlReadString( ele,
"vars",
"" );
115 PyObject* mainmod = PyImport_AddModule(
"__main__");
116 PyObject* gdic = PyModule_GetDict(mainmod);
117 PyObject *ldic = Py_BuildValue(
"{s:s,s:{}}",
"ldic", sVars.latin1() ,
"res");
119 if ( !PyRun_String(
"import pickle\nres = pickle.loads(ldic)", Py_file_input, gdic, ldic) ) {
124 vars = PyDict_GetItemString( ldic,
"res" );
126 runPython(kivio_module);
128 m_w = getDoubleFromDict( vars,
"w");
129 m_h = getDoubleFromDict( vars,
"h");
130 m_x = getDoubleFromDict( vars,
"x");
131 m_y = getDoubleFromDict( vars,
"y");
139 else if( nodeName ==
"KivioConnectorTargetList" )
141 loadConnectorTargetListXML( ele );
144 node = node.nextSibling();
153void KivioPyStencil::loadConnectorTargetListXML(
const TQDomElement &e )
158 KivioConnectorTarget *pTarget;
160 pTarget = m_pConnectorTargets->first();
161 node = e.firstChild();
162 while( !node.isNull() && pTarget)
164 nodeName = node.nodeName();
165 ele = node.toElement();
167 if( nodeName ==
"KivioConnectorTarget" )
169 pTarget->loadXML( ele );
172 pTarget = m_pConnectorTargets->next();
173 node = node.nextSibling();
178TQDomElement KivioPyStencil::saveXML( TQDomDocument &doc )
180 TQDomElement e = doc.createElement(
"KivioPyStencil");
182 XmlWriteString( e,
"id", m_pSpawner->info()->id() );
183 XmlWriteString( e,
"setId", m_pSpawner->set()->id() );
186 TQDomElement dE = doc.createElement(
"PyData");
189 PyObject* mainmod = PyImport_AddModule(
"__main__");
190 PyObject* gdic = PyModule_GetDict(mainmod);
191 PyObject *ldic = Py_BuildValue(
"{s:O,s:{}}",
"ldic", vars ,
"res");
193 const char *dump_code =
"import copy\n"\
196 "for key in ldic.keys():\n"\
198 " cres[key] = copy.deepcopy(ldic[key])\n"\
201 "res = pickle.dumps(cres)\n";
203 if ( !PyRun_String(dump_code, Py_file_input, gdic, ldic) )
206 TQString sVars = PyBytes_AS_STRING( PyDict_GetItemString( ldic,
"res") );
208 XmlWriteString( dE,
"vars", sVars );
209 XmlWriteString( dE,
"resizeCode", resizeCode );
215 TQDomElement clE = doc.createElement(
"KivioConnectorTargetList");
216 TQDomElement targetE;
217 KivioConnectorTarget *pTarget = m_pConnectorTargets->first();
220 targetE = pTarget->saveXML( doc );
221 clE.appendChild( targetE );
223 pTarget = m_pConnectorTargets->next();
225 e.appendChild( clE );
231void KivioPyStencil::updateGeometry()
243 if ( !resizeCode.isEmpty() )
244 runPython(resizeCode);
248 KivioConnectorTarget *pTarget, *pOriginal;
250 TQPtrList<KivioConnectorTarget> *pOriginalTargets = ((KivioPyStencilSpawner*)m_pSpawner)->targets();
252 pTarget = m_pConnectorTargets->first();
253 pOriginal = pOriginalTargets->first();
255 PyObject *targets = PyDict_GetItemString(vars,
"connector_targets");
256 int size = PyList_Size( targets );
259 while( pTarget && pOriginal && i<size )
261 PyObject *target = PyList_GetItem( targets, i );
262 double x = getDoubleFromDict( target,
"x");
263 double y = getDoubleFromDict( target,
"y");
265 pTarget ->setPosition( x, y );
266 pOriginal->setPosition( x, y );
268 pTarget = m_pConnectorTargets->next();
269 pOriginal = pOriginalTargets->next();
275void KivioPyStencil::rescaleShapes( PyObject *o )
277 if ( PyDict_Check(o) ) {
279 PyObject *o_x = PyDict_GetItemString(o,
"x");
281 double x = getDoubleFromDict(o,
"x");
282 x = m_x+(x-old_x)*m_w/old_w;
283 PyDict_SetItemString( o,
"x", Py_BuildValue(
"d", x ) );
286 PyObject *o_y = PyDict_GetItemString(o,
"y");
288 double y = getDoubleFromDict(o,
"y");
289 y = m_y+(y-old_y)*m_h/old_h;
290 PyDict_SetItemString( o,
"y", Py_BuildValue(
"d", y ) );
293 PyObject *o_x2 = PyDict_GetItemString(o,
"x2");
295 double x = getDoubleFromDict(o,
"x2");
296 x = m_x+(x-old_x)*m_w/old_w;
297 PyDict_SetItemString( o,
"x2", Py_BuildValue(
"d", x ) );
302 double y = getDoubleFromDict(o,
"y2");
303 y = m_y+(y-old_y)*m_h/old_h;
304 PyDict_SetItemString( o,
"y2", Py_BuildValue(
"d", y ) );
307 PyObject *o_w = PyDict_GetItemString(o,
"w");
309 double w = getDoubleFromDict(o,
"w");
311 PyDict_SetItemString( o,
"w", Py_BuildValue(
"d", w ) );
314 PyObject *o_h = PyDict_GetItemString(o,
"h");
316 double h = getDoubleFromDict(o,
"h");
318 PyDict_SetItemString( o,
"h", Py_BuildValue(
"d", h ) );
321 PyObject *childs = PyDict_Values( o );
322 int size = PyList_Size( childs );
323 for (
int i=0; i<size; i++ )
324 rescaleShapes(PyList_GetItem(childs,i) );
327 if ( PyList_Check(o) ) {
329 int size = PyList_Size( o );
330 for (
int i=0; i<size; i++ )
331 rescaleShapes( PyList_GetItem(o,i) );
341KivioStencil *KivioPyStencil::duplicate()
343 KivioPyStencil *pNewStencil =
new KivioPyStencil();
344 KivioStencil *pReturn;
346 pNewStencil->m_x = m_x;
347 pNewStencil->m_y = m_y;
348 pNewStencil->m_w = m_w;
349 pNewStencil->m_h = m_h;
351 pNewStencil->old_x = old_x;
352 pNewStencil->old_y = old_y;
353 pNewStencil->old_w = old_w;
354 pNewStencil->old_h = old_h;
356 pNewStencil->m_pSpawner = m_pSpawner;
357 pNewStencil->resizeCode = resizeCode;
360 PyObject* mainmod = PyImport_AddModule(
"__main__");
361 PyObject* gdic = PyModule_GetDict(mainmod);
362 PyObject *ldic = Py_BuildValue(
"{s:O,s:{}}",
"ldic", vars ,
"res");
364 const char *copy_code =
"import copy\n"\
365 "for key in ldic.keys():\n"\
367 " res[key] = copy.deepcopy(ldic[key])\n"\
370 if ( !PyRun_String(copy_code, Py_file_input, gdic, ldic) )
373 pNewStencil->vars = PyDict_GetItemString( ldic,
"res");
374 pNewStencil->runPython(kivio_module);
377 KivioConnectorTarget *pTarget = m_pConnectorTargets->first();
381 pNewStencil->m_pConnectorTargets->append( pTarget->duplicate() );
382 pTarget = m_pConnectorTargets->next();
385 *(pNewStencil->protection()) = *m_pProtection;
386 *(pNewStencil->canProtect()) = *m_pCanProtect;
388 pReturn = pNewStencil;
394void KivioPyStencil::paint( KivioIntraStencilData *d )
399void KivioPyStencil::paintOutline( KivioIntraStencilData *d )
405void KivioPyStencil::paint( KivioIntraStencilData *d,
bool outlined )
407 KoZoomHandler* zoomHandler = d->zoomHandler;
409 PyObject *shapes = PyDict_Values( PyDict_GetItemString( vars,
"shapes" ) );
415 int size = PyList_Size( shapes );
417 for (
int i=0; i<size; i++ ) {
418 PyObject *shape = PyList_GetItem( shapes, i );
419 if ( !PyDict_Check(shape) )
422 int fill = KivioFillStyle::kcsNone;
425 setStyle( d, PyDict_GetItemString( vars,
"style" ) , fill );
426 setStyle( d, shape, fill );
429 setStyle( d, PyDict_GetItemString( shape,
"selected" ) , fill );
432 fill = KivioFillStyle::kcsNone;
434 TQString stype = getStringFromDict( shape,
"type" );
435 stype = stype.lower();
437 double x = zoomHandler->zoomItX(getDoubleFromDict(shape,
"x"));
438 double y = zoomHandler->zoomItY(getDoubleFromDict(shape,
"y"));
439 double w = zoomHandler->zoomItX(getDoubleFromDict(shape,
"w"));
440 double h = zoomHandler->zoomItY(getDoubleFromDict(shape,
"h"));
445 TQPtrList<KivioPoint> points;
446 points.setAutoDelete(
true);
447 PyObject *pyPoints = PyDict_GetItemString( shape,
"points" );
448 if ( pyPoints && PyList_Check(pyPoints) ) {
449 int size = PyList_Size(pyPoints);
450 for (
int i=0; i<size; i++ ) {
451 PyObject *pyPoint = PyList_GetItem(pyPoints,i);
452 double x = zoomHandler->zoomItX(getDoubleFromDict(pyPoint,
"x"));
453 double y = zoomHandler->zoomItY(getDoubleFromDict(pyPoint,
"y"));
454 points.append(
new KivioPoint( x, y, KivioPoint::kptNormal ) );
459 if ( stype ==
"rectangle" ) {
461 d->painter->fillRect( x, y, w, h );
463 d->painter->drawRect( x, y, w, h );
466 if ( stype ==
"textbox" ) {
467 int tf = vTextAlign() | hTextAlign();
469 TQFont f = textFont();
470 f.setPointSizeFloat(f.pointSizeFloat() * (((
float)zoomHandler->zoom()) / 100.0));
472 d->painter->setFont( f );
473 TQString text = getStringFromDict(shape,
"text");
475 if ( !text.isEmpty() ) {
476 d->painter->drawText(
int( x ),
int( y ),
int( w ),
int( h ), tf | TQt::WordBreak, text );
480 if ( stype ==
"arc" ) {
481 double a1 = getDoubleFromDict(shape,
"a1");
482 double a2 = getDoubleFromDict(shape,
"a2");
483 d->painter->drawArc(x,y,w,h,a1,a2);
486 if ( stype ==
"roundrect" ) {
487 double rx = zoomHandler->zoomItX(getDoubleFromDict(shape,
"rx"));
488 double ry = zoomHandler->zoomItY(getDoubleFromDict(shape,
"ry"));
491 d->painter->fillRoundRect( x, y, w, h, rx, ry );
493 d->painter->drawRoundRect( x, y, w, h, rx, ry );
497 if ( stype ==
"linearray" ) {
498 d->painter->drawLineArray(&points);
501 if ( stype ==
"ellipse" ) {
503 d->painter->fillEllipse( x, y, w, h );
505 d->painter->drawEllipse( x, y, w, h );
509 if(stype ==
"polygon") {
510 d->painter->drawPolygon(&points);
513 if(stype ==
"polyline") {
514 d->painter->drawPolyline(&points);
518 KivioConnectorTarget *pTarget = m_pConnectorTargets->first();
522 pTarget->paintOutline( d );
523 pTarget = m_pConnectorTargets->next();
529int KivioPyStencil::runPython(TQString code)
532 view =
dynamic_cast<KivioView*
>(KoDocument::documentList()->first()->views().getFirst());
534 page = view->activePage();
538 const char *ccode = code.latin1();
542 PyObject *v = PyRun_String(
const_cast<char*
>(ccode) , Py_file_input, globals, vars );
549 PyObject *f = PySys_GetObject(
"stdout");
553 ret = PyFile_WriteString(
"\n", f);
563double KivioPyStencil::getDoubleFromDict( PyObject *dict,
const char *key )
565 if (!PyDict_Check(dict))
return 0.0;
567 PyObject *val = PyDict_GetItemString(dict,
const_cast<char*
>(key));
569 if ( PyFloat_Check(val) )
570 return PyFloat_AsDouble( val );
572 if ( PyLong_Check(val) )
573 return PyLong_AsLong( val );
575 if ( PyLong_Check(val) )
576 return PyLong_AsDouble( val );
581TQString KivioPyStencil::getStringFromDict( PyObject *dict,
const char *key )
583 PyObject *val = PyDict_GetItemString(dict,
const_cast<char*
>(key));
584 if ( val && PyBytes_Check(val) )
585 return TQString( PyBytes_AS_STRING(val) );
591KivioCollisionType KivioPyStencil::checkForCollision( KoPoint *pPoint,
double )
593 double px = pPoint->x();
594 double py = pPoint->y();
596 if( !(px < m_x + m_w &&
612int KivioPyStencil::resizeHandlePositions()
615 int mask = KIVIO_RESIZE_HANDLE_POSITION_ALL;
617 if( m_pProtection->at( kpWidth ) )
619 mask &= ~(krhpNE | krhpNW | krhpSW | krhpSE | krhpE | krhpW);
622 if( m_pProtection->at( kpHeight) )
624 mask &= ~(krhpNE | krhpNW | krhpSW | krhpSE | krhpN | krhpS);
634void KivioPyStencil::paintConnectorTargets( KivioIntraStencilData *pData )
637 KivioPainter *painter;
645 targetPic = Kivio::connectorTargetPixmap();
648 KoZoomHandler* zoomHandler = pData->zoomHandler;
649 painter = pData->painter;
651 KivioConnectorTarget *pTarget;
652 pTarget = m_pConnectorTargets->first();
655 x = zoomHandler->zoomItX(pTarget->x());
656 y = zoomHandler->zoomItY(pTarget->y());
658 painter->drawPixmap( x-3, y-3, targetPic );
660 pTarget = m_pConnectorTargets->next();
671KivioConnectorTarget *KivioPyStencil::connectToTarget( KivioConnectorPoint *p,
double threshHold )
678 KivioConnectorTarget *pTarget = m_pConnectorTargets->first();
685 if( px >= tx - threshHold &&
686 px <= tx + threshHold &&
687 py >= ty - threshHold &&
688 py <= ty + threshHold )
692 p->setTarget( pTarget );
696 pTarget = m_pConnectorTargets->next();
702KivioConnectorTarget *KivioPyStencil::connectToTarget( KivioConnectorPoint *p,
int )
704 int id = p->targetId();
706 KivioConnectorTarget *pTarget = m_pConnectorTargets->first();
709 if( pTarget->id() ==
id )
711 p->setTarget(pTarget);
716 pTarget = m_pConnectorTargets->next();
722int KivioPyStencil::generateIds(
int nextAvailable )
724 KivioConnectorTarget *pTarget = m_pConnectorTargets->first();
730 if( pTarget->hasConnections() )
733 pTarget->setId( nextAvailable );
741 pTarget->setId( -1 );
744 pTarget = m_pConnectorTargets->next();
748 return nextAvailable;
751void KivioPyStencil::setStyle( KivioIntraStencilData *d, PyObject *s,
int &fillStyle )
756 if ( !PyDict_Check(s) )
759 KivioPainter *p = d->painter;
760 KoZoomHandler* zoomHandler = d->zoomHandler;
762 PyObject *color = PyDict_GetItemString(s,
"color");
765 TQColor c = readColor(color);
772 color = PyDict_GetItemString(s,
"bgcolor");
775 TQColor c = readColor(color);
782 color = PyDict_GetItemString(s,
"textcolor");
785 TQColor c = readColor(color);
792 PyObject *lineWidth = PyDict_GetItemString(s,
"linewidth");
795 double lw = getDoubleFromDict(s,
"linewidth");
796 p->setLineWidth( zoomHandler->zoomItY(lw) );
799 PyObject *o_fillStyle = PyDict_GetItemString(s,
"fillstyle");
802 TQString sfill = getStringFromDict(s,
"fillstyle");
804 if ( sfill ==
"solid" ) {
805 fillStyle = KivioFillStyle::kcsSolid;
808 if ( sfill ==
"none" ) {
809 fillStyle = KivioFillStyle::kcsNone;
813 TQString sfont = getStringFromDict(s,
"font");
815 int fontSize = (int)getDoubleFromDict(s,
"fontsize");
821 f.setPointSize(fontSize);
822 f.setPointSizeFloat(f.pointSizeFloat() * (((
float)zoomHandler->zoom()) / 100.0));
824 if ( !sfont.isEmpty() ) {
827 f.setFamily(
"times");
833TQColor KivioPyStencil::readColor( PyObject *color )
838 if ( PyBytes_Check(color) ) {
839 return TQColor( PyBytes_AsString(color) );
842 if ( PyList_Check(color) ) {
843 if ( PyList_Size(color) == 3 ) {
844 PyObject *ro = PyList_GetItem(color,0);
845 PyObject *go = PyList_GetItem(color,1);
846 PyObject *bo = PyList_GetItem(color,2);
849 if ( PyNumber_Check(ro) )
850 r = PyLong_AsLong( PyNumber_Long(ro));
851 if ( PyNumber_Check(go) )
852 g = PyLong_AsLong( PyNumber_Long(go));
853 if ( PyNumber_Check(bo) )
854 b = PyLong_AsLong( PyNumber_Long(bo));
856 return TQColor(r,g,b);
865void KivioPyStencil::PyDebug( PyObject * o )
867 kdDebug(43000) <<
"py_debug: " << PyBytes_AsString(PyObject_Str(o)) << endl;
871TQColor KivioPyStencil::fgColor()
873 TQColor color = readColor( PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"color" ) );
874 if ( color.isValid() )
877 return TQColor(0,0,0);
880void KivioPyStencil::setFGColor( TQColor c )
882 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"color" , Py_BuildValue(
"[i,i,i]", c.red(), c.green(), c.blue() ) ) ;
886TQColor KivioPyStencil::bgColor()
888 TQColor color = readColor( PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"bgcolor" ) );
889 if ( color.isValid() )
892 return TQColor(0,0,0);
895void KivioPyStencil::setBGColor( TQColor c )
897 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"bgcolor" , Py_BuildValue(
"[i,i,i]", c.red(), c.green(), c.blue() ) ) ;
901TQColor KivioPyStencil::textColor()
903 TQColor color = readColor( PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"textcolor" ) );
904 if ( color.isValid() )
907 return TQColor(0,0,0);
910void KivioPyStencil::setTextColor( TQColor c )
912 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"textcolor" , Py_BuildValue(
"[i,i,i]", c.red(), c.green(), c.blue() ) ) ;
916double KivioPyStencil::lineWidth()
918 PyObject *lw = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"linewidth" );
920 if ( PyNumber_Check(lw) )
921 return ( PyLong_AsLong( PyNumber_Long(lw)) );
925void KivioPyStencil::setLineWidth(
double w )
927 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"linewidth" , Py_BuildValue(
"f",w ) ) ;
931void KivioPyStencil::setText(
const TQString &s )
933 PyObject *to = PyDict_GetItemString( PyDict_GetItemString(vars,
"shapes"),
"text" );
935 PyDict_SetItemString(to,
"text", Py_BuildValue(
"s", s.latin1() ));
939TQString KivioPyStencil::text()
941 PyObject *to = PyDict_GetItemString( PyDict_GetItemString(vars,
"shapes"),
"text" );
943 return getStringFromDict(to,
"text");
948void KivioPyStencil::setTextFont(
const TQFont &f )
950 double fs = f.pointSizeFloat();
951 TQString family = f.family();
954 int italic = f.italic();
955 int underline= f.underline();
957 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"fontsize" , Py_BuildValue(
"f",fs ) ) ;
958 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"font" , Py_BuildValue(
"s",family.latin1() ) ) ;
959 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"bold" , Py_BuildValue(
"i",bold ) ) ;
960 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"italic" , Py_BuildValue(
"i",italic ) ) ;
961 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"underline" , Py_BuildValue(
"i",underline ) ) ;
964TQFont KivioPyStencil::textFont()
966 PyObject *fn = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"font" );
967 PyObject *fs = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"fontsize" );
968 PyObject *bd = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"bold" );
969 PyObject *it = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"italic" );
970 PyObject *ul = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"underline" );
975 if ( PyNumber_Check(fs))
976 f.setPointSize( PyLong_AsLong( PyNumber_Long(fs)));
979 if ( PyNumber_Check(bd))
980 f.setBold( PyLong_AsLong( PyNumber_Long(bd)));
983 if ( PyNumber_Check(it))
984 f.setItalic( PyLong_AsLong( PyNumber_Long(it)));
987 if ( PyNumber_Check(ul))
988 f.setUnderline( PyLong_AsLong( PyNumber_Long(ul)));
991 if ( PyBytes_Check(fn))
992 f.setFamily( PyBytes_AsString(fn));
997int KivioPyStencil::hTextAlign()
999 PyObject *hta = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"htextalign" );
1002 if ( PyNumber_Check(hta) )
1003 return ( PyLong_AsLong( PyNumber_Long(hta)));
1005 return TQt::AlignHCenter;
1008int KivioPyStencil::vTextAlign()
1010 PyObject *vta = PyDict_GetItemString( PyDict_GetItemString(vars,
"style"),
"vtextalign" );
1013 if ( PyNumber_Check(vta) )
1014 return ( PyLong_AsLong( PyNumber_Long(vta)));
1016 return TQt::AlignVCenter;
1019void KivioPyStencil::setHTextAlign(
int hta)
1021 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"htextalign" , Py_BuildValue(
"i",hta));
1024void KivioPyStencil::setVTextAlign(
int vta)
1026 PyDict_SetItemString( PyDict_GetItemString(vars,
"style") ,
"vtextalign" , Py_BuildValue(
"i",vta));