You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koffice/kivio/kiviopart/stencils/Flowcharting/BasicFlowcharting/PyStencil.spy

113 lines
2.9 KiB

<?xml version="1.0"?>
<KivioPyStencil creator="vi">
<KivioPyStencilSpawnerInfo>
<Author data="Dmitry Poplavsky"/>
<Title data="Python"/>
<Id data="Python"/>
<Description data="Basic flowcharting card tqshape"/>
<Version data="0.1"/>
<Web data="www.thekompany.com"/>
<Email data="dima@kde.org"/>
<AutoUpdate data="off"/>
</KivioPyStencilSpawnerInfo>
<init code="Python">
<![CDATA[
# defined variables : x, y, w, h, x2=x+w, y2=y+h
x=70
y=40
w=100
h=100
x2=x+w
y2=y+w
style = {
"color" : "blue",
"bgcolor" : "white",
"linewidth" : 1,
}
connections = []
connector_targets = [ { "x":x+2, "y":y-2 },
{ "x":x+2, "y":y2-2 },
{ "x":x2-2, "y":y+2 },
{ "x":x2-2, "y":y2-2 },
{ "x": x+w/2, "y":y }
]
tqshapes = {
"rect" :{
"type" : "Rectangle",
"fillstyle" : "solid",
"x" : x+2,
"y" : y+2,
"w" : w-4,
"h" : w-4
},
"rect2" :{
"type" : "Rectangle",
"color" : [250,40,40],
"bgcolor" : "darkgreen",
"selected" : { "bgcolor" : "blue", "fillstyle":"solid" },
"fillstyle" : "solid",
"x" : x+w-35,
"y" : y+h-35,
"w" : 20,
"h" : 20
},
"rect3" :{
"type" : "Ellipse",
"color" : [250,40,40],
"selected" : { "color":[40,200,40] },
"x" : x+15,
"y" : y+15,
"w" : 20,
"h" : 20,
"rx": 15,
"ry": 15
},
"text" : {
"type" : "TextBox",
"x" : x+5,
"y" : y+5,
"w" : w-10,
"h" : h-10,
"text" : "2"
}
}
]]>
</init>
<resize>
<![CDATA[
# as default all coords are scalled, and this code will be runned
# defined variables : x, y, w, h, x2=x+w, y2=y+h and all variables , defined in <init>
connector_targets = [ { "x":x+2, "y":y-2 },
{ "x":x+2, "y":y2-2 },
{ "x":x2-2, "y":y+2 },
{ "x":x2-2, "y":y2-2 },
{ "x":(x+x2)/2, "y":y }
]
tqshapes["rect2"]["x"] = x+w-35
tqshapes["rect2"]["y"] = y+h-35
tqshapes["rect2"]["w"] = 20
tqshapes["rect2"]["h"] = 20
if ( tqshapes["text"]["text"] == "1" ):
stencil = curLayer().firstStencil()
stencil.setText( "x:"+str(x)+" y:"+str(y) )
]]>
</resize>
</KivioPyStencil>