Commit 33c0ff63 authored by Maxime Perrotin's avatar Maxime Perrotin

Add Continuous Signal icon in editor

parent c0c6f027
......@@ -343,3 +343,53 @@ As before, also make sure that the parent symbol (here: state) can recursively
parse the new child.
### Create an icon for the palette
To be able to use the new symbol in the graphical editor you need to create
an icon that will be displayed in the palette of the GUI.
The icons are specified in SVG format (in the `icons/` directory) using
the *inkscape* tool and must be exporte to PNG.
The filename must be the same as the class name of your symbol, but with
lowercases.
Our class is named `ContinuousSignal` so we will create `continuoussignal.png`.
The following properties apply when exporting to PNG:
* width 46
* height 35
* 90 DPI
Add the resulting filename inside the Qt resource file: `opengeode.qrc`. This
file lists all files that are "embedded" in the application. This was done to
avoid external files, making the distribution of the tools easier to handle.
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/comment.png</file>
<file>icons/decision.png</file>
<file>icons/decisionanswer.png</file>
<file>icons/input.png</file>
... add the new file here (`continuoussignal.png`)
To compile this resource file to get a Python file, run:
make compile-all
You then need to specify in which palette(s) this new icon is available.
This is done in `opengeode.py`.
First add the new symbol (*ContinuousSignal*) to the list of imports:
from sdlSymbols import(Input, Output, Decision, DecisionAnswer, Task,
ProcedureCall, TextSymbol, State, Start, Join, Label, Procedure,
ProcedureStart, ProcedureStop, StateStart, Connect, Process,
ContinuousSignal)
Then edit the `ACTION` look-up table to specify which scenes can use the
symbol. In our case, the process, state and clipboard scenes. You can decide
at which place it will appear graphically - it respects the ordering of the
list.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg3021"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="provided.svg"
inkscape:export-filename="/home/maxime/taste/tool-src/misc/opengeode/decisionanswer.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs3023">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-3.3870489 : 23.541286 : 1"
inkscape:vp_y="-82.859071 : 600.97062 : 0"
inkscape:vp_z="63.902198 : 22.144734 : 1"
inkscape:persp3d-origin="30.920448 : 18.035246 : 1"
id="perspective4009" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="9.8994949"
inkscape:cx="2.889681"
inkscape:cy="33.181829"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1242"
inkscape:window-height="693"
inkscape:window-x="604"
inkscape:window-y="274"
inkscape:window-maximized="0"
showguides="true"
inkscape:guide-bbox="true">
<inkscape:grid
type="xygrid"
id="grid4049" />
</sodipodi:namedview>
<metadata
id="metadata3026">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
x="20.285713"
y="23.857143"
id="text3878"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3880"
x="20.285713"
y="23.857143" /></text>
<g
style="font-size:10px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
id="text4189"
transform="matrix(1.1002507,0,0,1.0477242,-7.179942,4.921764)">
<text
xml:space="preserve"
style="font-size:23.30111503999999911px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:STIX Math;-inkscape-font-specification:STIX Math"
x="9.5300884"
y="18.672895"
id="text3020"
sodipodi:linespacing="125%"
transform="scale(0.78012041,1.2818534)"><tspan
sodipodi:role="line"
id="tspan3022"
x="9.5300884"
y="18.672895">&lt;</tspan></text>
<text
xml:space="preserve"
style="font-size:23.30111503999999911px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:STIX Math;-inkscape-font-specification:STIX Math"
x="-65.684357"
y="-5.7694364"
id="text3020-1"
sodipodi:linespacing="125%"
transform="matrix(-0.77990267,-0.01935333,0.02883653,-1.2814957,0,0)"><tspan
sodipodi:role="line"
id="tspan3022-0"
x="-65.684357"
y="-5.7694364">&lt;</tspan></text>
</g>
<path
style="fill:#0000ff;stroke:#0000dc;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 25,28 0,10 0,0"
id="path4198-4"
inkscape:connector-curvature="0" />
<path
style="fill:#0000ff;stroke:#0000dc;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 25,3 0,10 0,0"
id="path4198-4-3"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:10px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
x="14"
y="25"
id="text4763"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4765"
x="14"
y="25"
style="font-size:10px;font-style:normal">x=5</tspan></text>
<text
xml:space="preserve"
style="font-size:37.84977341px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="-113.5493"
y="35.931526"
id="text3016"
sodipodi:linespacing="125%"
transform="scale(0.52840482,1.8924884)"><tspan
sodipodi:role="line"
id="tspan3018"
x="-113.5493"
y="35.931526" /></text>
</g>
</svg>
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/comment.png</file>
<file>icons/continuoussignal.png</file>
<file>icons/decision.png</file>
<file>icons/decisionanswer.png</file>
<file>icons/input.png</file>
......
This diff is collapsed.
......@@ -71,7 +71,8 @@ from PySide import QtSvg
from genericSymbols import(Symbol, Comment, Cornergrabber, Connection)
from sdlSymbols import(Input, Output, Decision, DecisionAnswer, Task,
ProcedureCall, TextSymbol, State, Start, Join, Label, Procedure,
ProcedureStart, ProcedureStop, StateStart, Connect, Process)
ProcedureStart, ProcedureStop, StateStart, Connect, Process,
ContinuousSignal)
from TextInteraction import EditableText
# Icons and png files generated from the resource file:
......@@ -153,19 +154,20 @@ G_SYMBOLS = set()
# Lookup table used to configure the context-dependent toolbars
ACTIONS = {
'block': [Process, Comment, TextSymbol],
'process': [Start, State, Input, Connect, Task, Decision, DecisionAnswer,
Output, ProcedureCall, TextSymbol, Comment, Label,
Join, Procedure],
'process': [Start, State, Input, Connect, ContinuousSignal, Task, Decision,
DecisionAnswer, Output, ProcedureCall, TextSymbol, Comment,
Label, Join, Procedure],
'procedure': [ProcedureStart, Task, Decision,
DecisionAnswer, Output, ProcedureCall, TextSymbol,
Comment, Label, Join, ProcedureStop],
'statechart': [],
'state': [StateStart, State, Input, Connect, Task, Decision,
DecisionAnswer, Output, ProcedureCall, TextSymbol, Comment,
Label, Join, ProcedureStop, Procedure],
'state': [StateStart, State, Input, Connect, ContinuousSignal, Task,
Decision, DecisionAnswer, Output, ProcedureCall, TextSymbol,
Comment, Label, Join, ProcedureStop, Procedure],
'clipboard': [Start, State, Input, Connect, Task, Decision, DecisionAnswer,
Output, ProcedureCall, TextSymbol, Comment, Label,
Join, Procedure, Process, StateStart, ProcedureStop],
Join, Procedure, Process, StateStart, ProcedureStop,
ContinuousSignal],
'lander': [],
'asn1': []
}
......
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2015-12-02 16:22:58
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2015-12-04 11:46:02
import sys
from antlr3 import *
......
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2015-12-02 16:22:58
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2015-12-04 11:46:01
import sys
from antlr3 import *
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment