author | greg |
Tue, 06 May 2008 15:22:18 +0200 | |
changeset 144 | 7818ec7b5c53 |
parent 142 | 371284c1ad94 |
child 147 | ccc5e683583d |
permissions | -rw-r--r-- |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
1 |
import os, shutil, sys |
20 | 2 |
base_folder = os.path.split(sys.path[0])[0] |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
3 |
sys.path.append(os.path.join(base_folder, "wxsvg", "SVGUIEditor")) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
4 |
sys.path.append(os.path.join(base_folder, "plcopeneditor", "graphics")) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
5 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
6 |
import wx |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
7 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
8 |
from SVGUIControler import * |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
9 |
from SVGUIEditor import * |
37 | 10 |
from FBD_Objects import * |
11 | 11 |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
12 |
from wxPopen import ProcessLogger |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
13 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
14 |
[ID_SVGUIEDITORFBDPANEL, |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
15 |
] = [wx.NewId() for _init_ctrls in range(1)] |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
16 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
17 |
SVGUIFB_Types = {ITEM_CONTAINER : "Container", |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
18 |
ITEM_BUTTON : "Button", |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
19 |
ITEM_TEXT : "TextCtrl", |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
20 |
ITEM_SCROLLBAR : "ScrollBar", |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
21 |
ITEM_ROTATING : "RotatingCtrl", |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
22 |
ITEM_NOTEBOOK : "NoteBook", |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
23 |
ITEM_TRANSFORM : "Transform"} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
24 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
25 |
class _SVGUIEditor(SVGUIEditor): |
37 | 26 |
""" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
27 |
This Class add IEC specific features to the SVGUIEditor : |
37 | 28 |
- FDB preview |
29 |
- FBD begin drag |
|
30 |
""" |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
31 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
32 |
def _init_coll_EditorGridSizer_Items(self, parent): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
33 |
SVGUIEditor._init_coll_EditorGridSizer_Items(self, parent) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
34 |
parent.AddWindow(self.FBDPanel, 0, border=0, flag=wx.GROW) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
35 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
36 |
def _init_ctrls(self, prnt): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
37 |
SVGUIEditor._init_ctrls(self, prnt, False) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
38 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
39 |
self.FBDPanel = wx.Panel(id=ID_SVGUIEDITORFBDPANEL, |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
40 |
name='FBDPanel', parent=self.EditorPanel, pos=wx.Point(0, 0), |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
41 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
42 |
self.FBDPanel.SetBackgroundColour(wx.WHITE) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
43 |
self.FBDPanel.Bind(wx.EVT_LEFT_DOWN, self.OnFBDPanelClick) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
44 |
self.FBDPanel.Bind(wx.EVT_PAINT, self.OnPaintFBDPanel) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
45 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
46 |
setattr(self.FBDPanel, "GetScaling", lambda: None) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
47 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
48 |
self._init_sizers() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
49 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
50 |
def __init__(self, parent, controler = None, fileOpen = None): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
51 |
SVGUIEditor.__init__(self, parent, controler, fileOpen) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
52 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
53 |
self.FBDBlock = None |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
54 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
55 |
def RefreshView(self, select_id = None): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
56 |
SVGUIEditor.RefreshView(self, select_id) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
57 |
self.FBDPanel.Refresh() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
58 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
59 |
def OnPaintFBDPanel(self,event): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
60 |
dc = wx.ClientDC(self.FBDPanel) |
37 | 61 |
dc.Clear() |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
62 |
selected = self.GetSelected() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
63 |
if selected is not None: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
64 |
selected_type = self.Controler.GetElementType(selected) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
65 |
if selected_type is not None: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
66 |
self.FBDBlock = FBD_Block(parent=self.FBDPanel,type=SVGUIFB_Types[selected_type],name=self.Controler.GetElementName(selected)) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
67 |
width, height = self.FBDBlock.GetMinSize() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
68 |
self.FBDBlock.SetSize(width,height) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
69 |
clientsize = self.FBDPanel.GetClientSize() |
37 | 70 |
x = (clientsize.width - width) / 2 |
71 |
y = (clientsize.height - height) / 2 |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
72 |
self.FBDBlock.SetPosition(x, y) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
73 |
self.FBDBlock.Draw(dc) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
74 |
else: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
75 |
self.FBDBlock = None |
37 | 76 |
event.Skip() |
77 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
78 |
def OnFBDPanelClick(self, event): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
79 |
if self.FBDBlock: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
80 |
data = wx.TextDataObject(str((self.FBDBlock.GetType(), "functionBlock", self.FBDBlock.GetName()))) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
81 |
DropSrc = wx.DropSource(self.FBDPanel) |
37 | 82 |
DropSrc.SetData(data) |
83 |
DropSrc.DoDragDrop() |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
84 |
event.Skip() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
85 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
86 |
def OnInterfaceTreeItemSelected(self, event): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
87 |
self.FBDPanel.Refresh() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
88 |
SVGUIEditor.OnInterfaceTreeItemSelected(self, event) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
89 |
|
37 | 90 |
def OnGenerate(self,event): |
91 |
self.SaveProject() |
|
92 |
self.Controler.PlugGenerate_C(sys.path[0],(0,0,4,5),None) |
|
93 |
event.Skip() |
|
94 |
||
95 |
TYPECONVERSION = {"BOOL" : "X", "SINT" : "B", "INT" : "W", "DINT" : "D", "LINT" : "L", |
|
96 |
"USINT" : "B", "UINT" : "W", "UDINT" : "D", "ULINT" : "L", "REAL" : "D", "LREAL" : "L", |
|
97 |
"STRING" : "B", "BYTE" : "B", "WORD" : "W", "DWORD" : "D", "LWORD" : "L", "WSTRING" : "W"} |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
98 |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
99 |
CTYPECONVERSION = {"BOOL" : "IEC_BOOL", "UINT" : "IEC_UINT", "STRING" : "IEC_STRING", "REAL" : "IEC_REAL"} |
37 | 100 |
CPRINTTYPECONVERSION = {"BOOL" : "d", "UINT" : "d", "STRING" : "s", "REAL" : "f"} |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
101 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
102 |
class RootClass(SVGUIControler): |
37 | 103 |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
104 |
def __init__(self): |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
105 |
SVGUIControler.__init__(self) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
106 |
filepath = os.path.join(self.PlugPath(), "gui.xml") |
37 | 107 |
|
12 | 108 |
if os.path.isfile(filepath): |
37 | 109 |
svgfile = os.path.join(self.PlugPath(), "gui.svg") |
110 |
if os.path.isfile(svgfile): |
|
111 |
self.SvgFilepath = svgfile |
|
12 | 112 |
self.OpenXMLFile(filepath) |
13
f1f0edbeb313
More precise design for plugins.... to be continued...
etisserant
parents:
12
diff
changeset
|
113 |
else: |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
114 |
self.CreateNewInterface() |
12 | 115 |
self.SetFilePath(filepath) |
116 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
117 |
def GetElementIdFromName(self, name): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
118 |
element = self.GetElementByName(name) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
119 |
if element is not None: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
120 |
return element.getid() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
121 |
return None |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
122 |
|
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
123 |
_View = None |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
124 |
def _OpenView(self, logger): |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
125 |
if not self._View: |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
126 |
def _onclose(): |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
127 |
self._View = None |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
128 |
def _onsave(): |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
129 |
self.GetPlugRoot().SaveProject() |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
130 |
self._View = _SVGUIEditor(self.GetPlugRoot().AppFrame, self) |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
131 |
self._View._onclose = _onclose |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
132 |
self._View._onsave = _onsave |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
133 |
self._View.Show() |
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
134 |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
135 |
def _ImportSVG(self, logger): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
136 |
if not self._View: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
137 |
dialog = wx.FileDialog(self.GetPlugRoot().AppFrame, "Choose a SVG file", os.getcwd(), "", "SVG files (*.svg)|*.svg|All files|*.*", wx.OPEN) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
138 |
if dialog.ShowModal() == wx.ID_OK: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
139 |
svgpath = dialog.GetPath() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
140 |
if os.path.isfile(svgpath): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
141 |
shutil.copy(svgpath, os.path.join(self.PlugPath(), "gui.svg")) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
142 |
else: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
143 |
logger.write_error("No such SVG file: %s\n"%svgpath) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
144 |
dialog.Destroy() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
145 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
146 |
def _ImportXML(self, logger): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
147 |
if not self._View: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
148 |
dialog = wx.FileDialog(self.GetPlugRoot().AppFrame, "Choose a XML file", os.getcwd(), "", "XML files (*.xml)|*.xml|All files|*.*", wx.OPEN) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
149 |
if dialog.ShowModal() == wx.ID_OK: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
150 |
xmlpath = dialog.GetPath() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
151 |
if os.path.isfile(xmlpath): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
152 |
shutil.copy(xmlpath, os.path.join(self.PlugPath(), "gui.xml")) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
153 |
else: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
154 |
logger.write_error("No such XML file: %s\n"%xmlpath) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
155 |
dialog.Destroy() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
156 |
|
65 | 157 |
PluginMethods = [ |
82
d7b4dd1f543f
Beremiz layout improved for wx2.8 by inserting all control in TreeCtrl
lbessard
parents:
73
diff
changeset
|
158 |
{"bitmap" : os.path.join("images","HMIEditor"), |
65 | 159 |
"name" : "HMI Editor", |
160 |
"tooltip" : "HMI Editor", |
|
105
434aed8dc58d
Added ability to override plugin methods with arbitrary python code (methods.py) when loading plugins
etisserant
parents:
82
diff
changeset
|
161 |
"method" : "_OpenView"}, |
82
d7b4dd1f543f
Beremiz layout improved for wx2.8 by inserting all control in TreeCtrl
lbessard
parents:
73
diff
changeset
|
162 |
{"bitmap" : os.path.join("images","ImportSVG"), |
65 | 163 |
"name" : "Import SVG", |
164 |
"tooltip" : "Import SVG", |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
165 |
"method" : "_ImportSVG"}, |
82
d7b4dd1f543f
Beremiz layout improved for wx2.8 by inserting all control in TreeCtrl
lbessard
parents:
73
diff
changeset
|
166 |
{"bitmap" : os.path.join("images","ImportDEF"), |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
167 |
"name" : "Import XML", |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
168 |
"tooltip" : "Import XML", |
139 | 169 |
"method" : "_ImportXML"}, |
65 | 170 |
] |
38
8cb20bc13a91
SVGUI's DefEditor now runs and generate C code. Swapped __I with __Q
etisserant
parents:
37
diff
changeset
|
171 |
|
37 | 172 |
def OnPlugSave(self): |
12 | 173 |
self.SaveXMLFile() |
174 |
return True |
|
37 | 175 |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
176 |
def GenerateProgramHeadersPublicVars(self, elements): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
177 |
text = """ void OnPlcOutEvent(wxEvent& event); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
178 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
179 |
void Retrieve(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
180 |
void Publish(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
181 |
void Initialize(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
182 |
""" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
183 |
# text += " void Print();\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
184 |
return text |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
185 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
186 |
def GenerateIECVars(self, elements): |
37 | 187 |
text = "" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
188 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
189 |
text += "volatile int out_state_%d;\n"%element.getid() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
190 |
text += "volatile int in_state_%d;\n"%element.getid() |
37 | 191 |
text +="\n" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
192 |
current_location = "_".join(map(str, self.GetCurrentLocation())) |
37 | 193 |
#Declaration des variables |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
194 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
195 |
block_infos = GetBlockType(SVGUIFB_Types[GetElementType(element)]) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
196 |
block_id = element.getid() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
197 |
for i, input in enumerate(block_infos["inputs"]): |
37 | 198 |
element_c_type = CTYPECONVERSION[input[1]] |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
199 |
variable = "__Q%s%s_%d_%d"%(TYPECONVERSION[input[1]], current_location, block_id, i + 1) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
200 |
text += "%s %s;\n"%(element_c_type, variable) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
201 |
text += "%s _copy%s;\n"%(element_c_type, variable) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
202 |
for i, output in enumerate(block_infos["outputs"]): |
37 | 203 |
element_c_type = CTYPECONVERSION[output[1]] |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
204 |
variable = "__I%s%s_%d_%d"%(TYPECONVERSION[output[1]], current_location, block_id, i + 1) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
205 |
text += "%s %s;\n"%(element_c_type, variable) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
206 |
text += "%s _copy%s;\n"%(element_c_type, variable) |
37 | 207 |
text +="\n" |
208 |
return text |
|
209 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
210 |
def GenerateGlobalVarsAndFuncs(self, elements, size): |
141 | 211 |
text = "#include \"iec_types.h\"\n\n" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
212 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
213 |
text += self.GenerateIECVars(elements) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
214 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
215 |
text += """IMPLEMENT_APP_NO_MAIN(SVGViewApp); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
216 |
IMPLEMENT_WX_THEME_SUPPORT; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
217 |
SVGViewApp *myapp = NULL; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
218 |
pthread_t wxMainLoop; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
219 |
""" |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
220 |
# text += "pthread_t wxMainLoop,automate;\n" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
221 |
text += """int myargc = 0; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
222 |
char** myargv = NULL; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
223 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
224 |
#define UNCHANGED 1 |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
225 |
#define PLC_BUSY 2 |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
226 |
#define CHANGED 3 |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
227 |
#define GUI_BUSY 4 |
138 | 228 |
|
229 |
bool refreshing = false; |
|
230 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
231 |
void* InitWxEntry(void* args) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
232 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
233 |
wxEntry(myargc,myargv); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
234 |
return args; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
235 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
236 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
237 |
""" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
238 |
# text += """void* SimulAutomate(void* args) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
239 |
#{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
240 |
# while(1){ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
241 |
# myapp->frame->m_svgCtrl->IN_"+self.BusNumber+"(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
242 |
# //printf(\"AUTOMATE\\n\"); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
243 |
# myapp->frame->m_svgCtrl->OUT_"+self.BusNumber+"(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
244 |
# sleep(1); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
245 |
# } |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
246 |
# return args; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
247 |
#} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
248 |
# |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
249 |
#""" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
250 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
251 |
text += """bool SVGViewApp::OnInit() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
252 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
253 |
#ifndef __WXMSW__ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
254 |
setlocale(LC_NUMERIC, "C"); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
255 |
#endif |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
256 |
""" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
257 |
#text += " frame = new MainFrame(NULL, wxT(\"Program\"),wxDefaultPosition, wxSize(%d, %d));\n"%size |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
258 |
text += """ frame = new MainFrame(NULL, wxT("Program"),wxDefaultPosition, wxDefaultSize); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
259 |
myapp = this; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
260 |
""" |
39 | 261 |
# text += " pthread_create(&automate, NULL, SimulAutomate, NULL);\n" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
262 |
text += """ return true; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
263 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
264 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
265 |
extern "C" { |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
266 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
267 |
int __init_%(location)s(int argc, char** argv) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
268 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
269 |
myargc = argc; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
270 |
myargv = argv; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
271 |
pthread_create(&wxMainLoop, NULL, InitWxEntry, NULL); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
272 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
273 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
274 |
void __cleanup_%(location)s() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
275 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
276 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
277 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
278 |
void __retrieve_%(location)s() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
279 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
280 |
if(myapp){ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
281 |
myapp->frame->m_svgCtrl->Retrieve(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
282 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
283 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
284 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
285 |
void __publish_%(location)s() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
286 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
287 |
if(myapp){ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
288 |
myapp->frame->m_svgCtrl->Publish(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
289 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
290 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
291 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
292 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
293 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
294 |
IEC_STRING wxStringToIEC_STRING(wxString s) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
295 |
{ |
141 | 296 |
IEC_STRING res = {0,""}; |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
297 |
int i; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
298 |
for(i = 0; i<s.Length() && i<STR_MAX_LEN; i++) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
299 |
res.body[i] = s.GetChar(i); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
300 |
res.len = i; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
301 |
return res; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
302 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
303 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
304 |
"""%{"location" : "_".join(map(str, self.GetCurrentLocation()))} |
37 | 305 |
|
306 |
return text |
|
307 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
308 |
def GenerateProgramEventTable(self, elements): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
309 |
text = "" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
310 |
#text += "wxEVT_PLCOUT = wxNewEventType();\n\n"; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
311 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
312 |
text += """BEGIN_DECLARE_EVENT_TYPES() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
313 |
DECLARE_LOCAL_EVENT_TYPE( EVT_PLC, wxNewEventType() ) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
314 |
END_DECLARE_EVENT_TYPES() |
37 | 315 |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
316 |
DEFINE_LOCAL_EVENT_TYPE( EVT_PLC ) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
317 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
318 |
""" |
37 | 319 |
#Event Table Declaration |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
320 |
text += "BEGIN_EVENT_TABLE(Program, SVGUIWindow)\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
321 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
322 |
element_type = GetElementType(element) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
323 |
element_name = element.getname() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
324 |
if element_type == ITEM_BUTTON: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
325 |
text += " EVT_BUTTON (SVGUIID(\"%s\"), Program::On%sClick)\n"%(element_name, element_name) |
142 | 326 |
elif element_type in [ITEM_SCROLLBAR, ITEM_ROTATING, ITEM_TRANSFORM]: |
327 |
text += " EVT_COMMAND_SCROLL_THUMBTRACK (SVGUIID(\"%s\"), Program::On%sChanging)\n"%(element_name, element_name) |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
328 |
elif element_type == ITEM_NOTEBOOK: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
329 |
text += " EVT_NOTEBOOK_PAGE_CHANGED (SVGUIID(\"%s\"), Program::On%sTabChanged)\n"%(element_name, element_name) |
142 | 330 |
text += " EVT_CUSTOM(EVT_PLC, wxID_ANY, Program::OnPlcOutEvent)\n" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
331 |
text += "END_EVENT_TABLE()\n\n" |
37 | 332 |
return text |
333 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
334 |
def GenerateProgramInitFrame(self, elements): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
335 |
text = """MainFrame::MainFrame(wxWindow *parent, const wxString& title, const wxPoint& pos,const wxSize& size, long style): wxFrame(parent, wxID_ANY, title, pos, size, style) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
336 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
337 |
m_svgCtrl = new Program(this); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
338 |
if (m_svgCtrl->LoadFiles(wxT("%s"), wxT("%s"))) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
339 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
340 |
Show(true); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
341 |
m_svgCtrl->SetFocus(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
342 |
m_svgCtrl->SetFitToFrame(true); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
343 |
m_svgCtrl->RefreshScale(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
344 |
m_svgCtrl->InitScrollBars(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
345 |
m_svgCtrl->Initialize(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
346 |
m_svgCtrl->Update(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
347 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
348 |
else |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
349 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
350 |
printf("Error while opening files\\n"); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
351 |
exit(0); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
352 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
353 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
354 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
355 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
356 |
"""%(self.GetSVGFilePath(), self.GetFilePath()) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
357 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
358 |
return text |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
359 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
360 |
def GenerateProgramInitProgram(self, elements): |
37 | 361 |
text = "Program::Program(wxWindow* parent):SVGUIWindow(parent)\n{\n" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
362 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
363 |
text += " out_state_%d = UNCHANGED;\n"%element.getid() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
364 |
text += " in_state_%d = UNCHANGED;\n"%element.getid() |
37 | 365 |
text += "}\n\n" |
366 |
return text |
|
367 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
368 |
def GenerateProgramEventFunctions(self, elements): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
369 |
text = "" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
370 |
current_location = "_".join(map(str, self.GetCurrentLocation())) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
371 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
372 |
element_type = GetElementType(element) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
373 |
element_state = " in_state_%d = %s;\n"%(element.getid(), "%s") |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
374 |
element_name = element.getname() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
375 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
376 |
if element_type == ITEM_BUTTON: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
377 |
text += """void Program::On%sClick(wxCommandEvent& event) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
378 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
379 |
SVGUIButton* button = (SVGUIButton*)GetElementByName(wxT("%s"));\n"""%(element_name, element_name) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
380 |
text += element_state%"GUI_BUSY" |
138 | 381 |
text += " _copy__IX%s_%d_1 = button->GetToggle();\n"%(current_location, element.getid()) |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
382 |
text += element_state%"CHANGED" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
383 |
text += " event.Skip();\n}\n\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
384 |
elif element_type == ITEM_ROTATING: |
142 | 385 |
text += """void Program::On%sChanging(wxScrollEvent& event) |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
386 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
387 |
SVGUIRotatingCtrl* rotating = (SVGUIRotatingCtrl*)GetElementByName(wxT("%s")); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
388 |
"""%(element_name, element_name) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
389 |
text += element_state%"GUI_BUSY" |
138 | 390 |
text += " _copy__ID%s_%d_1 = rotating->GetAngle();\n"%(current_location, element.getid()) |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
391 |
text += element_state%"CHANGED" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
392 |
text += " event.Skip();\n}\n\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
393 |
elif element_type == ITEM_NOTEBOOK: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
394 |
text += """void Program::On%sTabChanged(wxNotebookEvent& event) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
395 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
396 |
SVGUINoteBook* notebook = (SVGUINoteBook*)GetElementByName(wxT("%s")); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
397 |
"""%(element_name, element_name) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
398 |
text += element_state%"GUI_BUSY" |
138 | 399 |
text += " _copy__IB%s_%d_1 = notebook->GetCurrentPage();\n"%(current_location, element.getid()) |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
400 |
text += element_state%"CHANGED" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
401 |
text += " event.Skip();\n}\n\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
402 |
elif element_type == ITEM_TRANSFORM: |
142 | 403 |
text += """void Program::On%sChanging(wxScrollEvent& event) |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
404 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
405 |
SVGUITransform* transform = (SVGUITransform*)GetElementByName(wxT("%s")); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
406 |
"""%(element_name, element_name) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
407 |
text += element_state%"GUI_BUSY" |
138 | 408 |
text += " _copy__ID%s_%d_1 = transform->GetX();\n"%(current_location, element.getid()) |
409 |
text += " _copy__ID%s_%d_2 = transform->GetY();\n"%(current_location, element.getid()) |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
410 |
text += element_state%"CHANGED" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
411 |
text += " event.Skip();\n}\n\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
412 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
413 |
text += "/* OnPlcOutEvent update GUI with provided IEC __Q* PLC output variables */\n" |
138 | 414 |
text += """void Program::OnPlcOutEvent(wxEvent& event) |
415 |
{ |
|
416 |
SVGUIElement* element; |
|
142 | 417 |
|
138 | 418 |
refreshing = true; |
419 |
||
420 |
wxMutexGuiEnter(); |
|
421 |
""" |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
422 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
423 |
element_type = GetElementType(element) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
424 |
texts = {"location" : current_location, "id" : element.getid()} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
425 |
|
138 | 426 |
text += """ if (__sync_bool_compare_and_swap (&out_state_%(id)d, CHANGED, GUI_BUSY)) |
427 |
{ |
|
428 |
element = (SVGUIElement*)GetElementById(wxT("%(id)d")); |
|
429 |
||
430 |
if (_copy__QX%(location)s_%(id)d_1 != element->IsVisible()) { |
|
431 |
if (_copy__QX%(location)s_%(id)d_1) |
|
432 |
element->Show(); |
|
433 |
else |
|
434 |
element->Hide(); |
|
435 |
} |
|
436 |
if (_copy__QX%(location)s_%(id)d_2 != element->IsEnabled()) { |
|
437 |
if (_copy__QX%(location)s_%(id)d_2) |
|
438 |
element->Enable(); |
|
439 |
else |
|
440 |
element->Disable(); |
|
441 |
} |
|
442 |
"""%texts |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
443 |
if element_type == ITEM_BUTTON: |
138 | 444 |
text += """ if (_copy__QX%(location)s_%(id)d_3 != ((SVGUIButton*)element)->GetToggle()) |
445 |
((SVGUIButton*)element)->SetToggle(_copy__QX%(location)s_%(id)d_3); |
|
446 |
"""%texts |
|
447 |
elif element_type == ITEM_TEXT: |
|
448 |
text += """ if (((SVGUITextCtrl*)element)->GetValue().compare(_copy__QX%(location)s_%(id)d_3)) |
|
449 |
{ |
|
450 |
wxString str = wxString::FromAscii(_copy__QB%(location)s_%(id)d_3); |
|
451 |
((SVGUITextCtrl*)element)->SetText(str); |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
452 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
453 |
"""%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
454 |
elif element_type == ITEM_SCROLLBAR: |
138 | 455 |
text += """ if (_copy__QW%(location)s_%(id)d_3 != ((SVGUIScrollBar*)element)->GetThumbPosition() || |
456 |
_copy__QW%(location)s_%(id)d_4 != ((SVGUIScrollBar*)element)->GetThumbSize() || |
|
457 |
_copy__QW%(location)s_%(id)d_5 != ((SVGUIScrollBar*)element)->GetRange()) |
|
458 |
((SVGUIScrollBar*)element)->Init_ScrollBar(_copy__QW%(location)s_%(id)d_3, _copy__QW%(location)s_%(id)d_4, _copy__QW%(location)s_%(id)d_5); |
|
459 |
"""%texts |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
460 |
elif element_type == ITEM_ROTATING: |
138 | 461 |
text += """ if (_copy__QD%(location)s_%(id)d_3 != ((SVGUIRotatingCtrl*)element)->GetAngle()) |
462 |
((SVGUIRotatingCtrl*)element)->SetAngle(_copy__QD%(location)s_%(id)d_3); |
|
463 |
"""%texts |
|
464 |
elif element_type == ITEM_NOTEBOOK: |
|
465 |
text += """ if (_copy__QB%(location)s_%(id)d_3 != ((SVGUINoteBook*)element)->GetCurrentPage()) |
|
466 |
((SVGUINoteBook*)element)->SetCurrentPage(_copy__QB%(location)s_%(id)d_3); |
|
467 |
"""%texts |
|
468 |
elif element_type == ITEM_TRANSFORM: |
|
469 |
text += """ if (_copy__QD%(location)s_%(id)d_3 != ((SVGUITransform*)element)->GetX() || |
|
470 |
copy__QD%(location)s_%(id)d_4 != ((SVGUITransform*)element)->GetY()) |
|
471 |
transform->Move(_copy__QD%(location)s_%(id)d_3, _copy__QD%(location)s_%(id)d_4); |
|
472 |
if (_copy__QD%(location)s_%(id)d_5 != ((SVGUITransform*)element)->GetXScale() || |
|
473 |
copy__QD%(location)s_%(id)d_6 != ((SVGUITransform*)element)->GetYScale()) |
|
474 |
transform->Scale(_copy__QD%(location)s_%(id)d_5, _copy__QD%(location)s_%(id)d_6); |
|
475 |
if (_copy__QD%(location)s_%(id)d_7 != ((SVGUITransform*)element)->GetAngle()) |
|
476 |
transform->Rotate(_copy__QD%(location)s_%(id)d_7); |
|
477 |
"""%texts |
|
478 |
text += " __sync_bool_compare_and_swap (&out_state_%(id)d, GUI_BUSY, UNCHANGED);\n }\n"%texts |
|
479 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
480 |
text += """ wxMutexGuiLeave(); |
138 | 481 |
|
482 |
refreshing = false; |
|
483 |
||
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
484 |
event.Skip(); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
485 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
486 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
487 |
""" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
488 |
return text |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
489 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
490 |
def GenerateProgramPrivateFunctions(self, elements): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
491 |
current_location = "_".join(map(str, self.GetCurrentLocation())) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
492 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
493 |
text = "void Program::Retrieve()\n{\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
494 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
495 |
element_type = GetElementType(element) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
496 |
texts = {"location" : current_location, "id" : element.getid()} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
497 |
block_infos = GetBlockType(SVGUIFB_Types[GetElementType(element)]) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
498 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
499 |
text += """ do{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
500 |
if ( __sync_val_compare_and_swap (&in_state_%(id)d, CHANGED, PLC_BUSY) == CHANGED){ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
501 |
"""%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
502 |
for i, output in enumerate(block_infos["outputs"]): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
503 |
texts["type"] = TYPECONVERSION[output[1]] |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
504 |
texts["pin"] = i + 1 |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
505 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
506 |
variable = "__I%(type)s%(location)s_%(id)d_%(pin)d"%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
507 |
text +=" %s = _copy%s;\n"%(variable, variable) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
508 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
509 |
text += """ } |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
510 |
else { |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
511 |
break; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
512 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
513 |
""" |
39 | 514 |
#If GUI did change data while publishing, do it again (in real-time this should be avoided with priority stuff) |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
515 |
text += " }while(__sync_val_compare_and_swap (&in_state_%(id)s, PLC_BUSY, UNCHANGED) != PLC_BUSY);\n"%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
516 |
text += "}\n\n" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
517 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
518 |
text += """void Program::Publish() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
519 |
{ |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
520 |
bool refresh = false; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
521 |
""" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
522 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
523 |
element_type = GetElementType(element) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
524 |
texts = {"location" : current_location, "id" : element.getid()} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
525 |
block_infos = GetBlockType(SVGUIFB_Types[GetElementType(element)]) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
526 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
527 |
text += """ if ( __sync_bool_compare_and_swap (&out_state_%(id)d, UNCHANGED, PLC_BUSY) || |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
528 |
__sync_bool_compare_and_swap (&out_state_%(id)d, CHANGED, PLC_BUSY)) { |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
529 |
"""%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
530 |
for i, input in enumerate(block_infos["inputs"]): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
531 |
texts["type"] = TYPECONVERSION[input[1]] |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
532 |
texts["pin"] = i + 1 |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
533 |
variable = "__Q%(type)s%(location)s_%(id)d_%(pin)d"%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
534 |
text += " if (_copy%s != %s) {\n"%(variable, variable) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
535 |
text += " _copy%s = %s;\n"%(variable, variable) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
536 |
text += " out_state_%(id)d = CHANGED;\n }\n"%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
537 |
text += """ if (out_state_%(id)d == CHANGED) { |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
538 |
refresh = true; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
539 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
540 |
else { |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
541 |
out_state_%(id)d = UNCHANGED; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
542 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
543 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
544 |
"""%texts |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
545 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
546 |
text += """ /*Replace this with determinist signal if called from RT*/; |
138 | 547 |
if (refresh && !refreshing) { |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
548 |
wxCommandEvent event( EVT_PLC ); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
549 |
ProcessEvent(event); |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
550 |
} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
551 |
}; |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
552 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
553 |
""" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
554 |
|
138 | 555 |
text += """void Program::Initialize() |
556 |
{ |
|
557 |
SVGUIElement* element; |
|
558 |
""" |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
559 |
for element in elements: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
560 |
element_type = GetElementType(element) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
561 |
texts = {"location" : current_location, "id" : element.getid()} |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
562 |
|
138 | 563 |
text += """ |
564 |
element = (SVGUIElement*)GetElementById(wxT("%(id)d")); |
|
565 |
__QX%(location)s_%(id)d_1 = 1; |
|
566 |
_copy__QX%(location)s_%(id)d_1 = 1; |
|
567 |
__QX%(location)s_%(id)d_2 = 1; |
|
568 |
_copy__QX%(location)s_%(id)d_2 = 1; |
|
569 |
"""%texts |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
570 |
if element_type == ITEM_BUTTON: |
138 | 571 |
text += " _copy__IX%(location)s_%(id)d_1 = ((SVGUIButton*)element)->GetToggle();\n"%texts |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
572 |
elif element_type == ITEM_TEXT: |
138 | 573 |
text += " _copy__IB%(location)s_%(id)d_1 = ((SVGUITextCtrl*)element)->GetValue();\n"%texts |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
574 |
elif element_type == ITEM_SCROLLBAR: |
138 | 575 |
text += " _copy__IW%(location)s_%(id)d_1 = ((SVGUIScrollBar*)element)->GetThumbPosition();\n"%texts |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
576 |
elif element_type == ITEM_ROTATING: |
138 | 577 |
text += " _copy__ID%(location)s_%(id)d_1 = ((SVGUIRotatingCtrl*)element)->GetAngle();\n"%texts |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
578 |
elif element_type == ITEM_NOTEBOOK: |
138 | 579 |
text += " _copy__IB%(location)s_%(id)d_1 = ((SVGUINoteBook*)element)->GetCurrentPage();\n"%texts |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
580 |
elif element_type == ITEM_TRANSFORM: |
138 | 581 |
text += " _copy__ID%(location)s_%(id)d_1 = ((SVGUITransform*)element)->GetX();\n"%texts |
582 |
text += " _copy__ID%(location)s_%(id)d_2 = ((SVGUITransform*)element)->GetY();\n"%texts |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
583 |
text += "}\n\n" |
37 | 584 |
|
585 |
#DEBUG Fonction d'affichage |
|
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
586 |
# fct += "void Program::Print()\n{\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
587 |
# for element in elementsTab: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
588 |
# infos = element.getElementAttributes() |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
589 |
# for info in infos: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
590 |
# if info["name"] == "id": |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
591 |
# element_id = str(info["value"]) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
592 |
# type = element.GetElementInfos()["type"] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
593 |
# FbdBlock = self.GetBlockType(type) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
594 |
# element_num_patte = 1 |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
595 |
# for input in FbdBlock["inputs"]: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
596 |
# element_type = TYPECONVERSION[input[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
597 |
# c_type = CPRINTTYPECONVERSION[input[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
598 |
# var = "_copy__Q"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
599 |
# fct +=" printf(\""+var+": %"+c_type+"\\n\","+var+");\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
600 |
# element_num_patte +=1 |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
601 |
# element_num_patte = 1 |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
602 |
# for output in FbdBlock["outputs"]: |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
603 |
# element_type = TYPECONVERSION[output[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
604 |
# c_type = CPRINTTYPECONVERSION[output[1]] |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
605 |
# var = "_copy__I"+element_type+self.BusNumber+"_"+element_id+"_"+str(element_num_patte) |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
606 |
# fct +=" printf(\""+var+": %"+c_type+"\\n\","+var+");\n" |
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
607 |
# element_num_patte +=1 |
37 | 608 |
#fct +=" wxPostEvent(Program,wxEVT_PLCOUT);\n" |
44
1f5407c0263f
Various changes to make SVGUI plugin generated code eventually compile
etisserant
parents:
43
diff
changeset
|
609 |
# fct +="};\n\n" |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
610 |
return text |
37 | 611 |
|
612 |
def PlugGenerate_C(self, buildpath, locations, logger): |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
613 |
progname = "SVGUI_%s"%"_".join(map(str, self.GetCurrentLocation())) |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
614 |
self.GenerateProgram((0, 0), buildpath, progname) |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
615 |
Gen_C_file = os.path.join(buildpath, progname+".cpp" ) |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
616 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
617 |
status, result, err_result = ProcessLogger(logger, "wx-config --cxxflags", no_stdout=True).spin() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
618 |
if status: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
619 |
logger.write_error("Unable to get wx cxxflags\n") |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
620 |
cxx_flags = result.strip() + " -I../matiec/lib" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
621 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
622 |
status, result, err_result = ProcessLogger(logger, "wx-config --libs", no_stdout=True).spin() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
623 |
if status: |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
624 |
logger.write_error("Unable to get wx libs\n") |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
625 |
libs = result.strip() + " -lwxsvg" |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
626 |
|
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
627 |
return [(Gen_C_file, cxx_flags)],libs,True |
13
f1f0edbeb313
More precise design for plugins.... to be continued...
etisserant
parents:
12
diff
changeset
|
628 |
|
12 | 629 |
def BlockTypesFactory(self): |
73 | 630 |
def generate_svgui_block(generator, block, body, link, order=False): |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
631 |
name = block.getinstanceName() |
42 | 632 |
block_id = self.GetElementIdFromName(name) |
12 | 633 |
if block_id == None: |
634 |
raise ValueError, "No corresponding block found" |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
635 |
type = block.gettypeName() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
636 |
block_infos = GetBlockType(type) |
43 | 637 |
current_location = ".".join(map(str, self.GetCurrentLocation())) |
73 | 638 |
if not generator.ComputedBlocks.get(name, False) and not order: |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
639 |
for num, variable in enumerate(block.inputVariables.getvariable()): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
640 |
connections = variable.connectionPointIn.getconnections() |
12 | 641 |
if connections and len(connections) == 1: |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
642 |
parameter = "%sQ%s%s.%d.%d"%("%", TYPECONVERSION[block_infos["inputs"][num][1]], current_location, block_id, num+1) |
12 | 643 |
value = generator.ComputeFBDExpression(body, connections[0]) |
644 |
generator.Program += (" %s := %s;\n"%(parameter, generator.ExtractModifier(variable, value))) |
|
73 | 645 |
generator.ComputedBlocks[block] = True |
12 | 646 |
if link: |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
647 |
connectionPoint = link.getposition()[-1] |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
648 |
for num, variable in enumerate(block.outputVariables.getvariable()): |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
649 |
blockPointx, blockPointy = variable.connectionPointOut.getrelPositionXY() |
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
650 |
if block.getx() + blockPointx == connectionPoint.getx() and block.gety() + blockPointy == connectionPoint.gety(): |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
651 |
return "%sI%s%s.%d.%d"%("%", TYPECONVERSION[block_infos["outputs"][num][1]], current_location, block_id, num+1) |
12 | 652 |
raise ValueError, "No output variable found" |
653 |
else: |
|
654 |
return None |
|
11 | 655 |
|
138 | 656 |
def initialise_block(type, name, block = None): |
43 | 657 |
block_id = self.GetElementIdFromName(name) |
658 |
if block_id == None: |
|
659 |
raise ValueError, "No corresponding block found" |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
660 |
block_infos = GetBlockType(type) |
43 | 661 |
current_location = ".".join(map(str, self.GetCurrentLocation())) |
662 |
variables = [] |
|
138 | 663 |
if block is not None: |
664 |
input_variables = block.inputVariables.getvariable() |
|
665 |
output_variables = block.outputVariables.getvariable() |
|
666 |
else: |
|
667 |
input_variables = None |
|
668 |
output_variables = None |
|
43 | 669 |
for num, (input_name, input_type, input_modifier) in enumerate(block_infos["inputs"]): |
138 | 670 |
if input_variables is not None and num < len(input_variables): |
671 |
connections = input_variables[num].connectionPointIn.getconnections() |
|
672 |
if input_variables is None or connections and len(connections) == 1: |
|
673 |
variables.append((input_type, None, "%sQ%s%s.%d.%d"%("%", TYPECONVERSION[input_type], current_location, block_id, num+1), None)) |
|
43 | 674 |
for num, (output_name, output_type, output_modifier) in enumerate(block_infos["outputs"]): |
47
fd45c291fed0
PLC and plugins compilation with gcc now starts (and fail).
etisserant
parents:
44
diff
changeset
|
675 |
variables.append((output_type, None, "%sI%s%s.%d.%d"%("%", TYPECONVERSION[input_type], current_location, block_id, num+1), None)) |
43 | 676 |
return variables |
677 |
||
12 | 678 |
return [{"name" : "SVGUI function blocks", "list" : |
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
679 |
[{"name" : "Container", "type" : "functionBlock", "extensible" : False, |
138 | 680 |
"inputs" : [("Show","BOOL","none"),("Enable","BOOL","none")], |
681 |
"outputs" : [], |
|
42 | 682 |
"comment" : "SVGUI Container", |
43 | 683 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 684 |
{"name" : "Button", "type" : "functionBlock", "extensible" : False, |
138 | 685 |
"inputs" : [("Show","BOOL","none"),("Enable","BOOL","none"),("Toggle","BOOL","none")], |
686 |
"outputs" : [("State","BOOL","none")], |
|
42 | 687 |
"comment" : "SVGUI Button", |
43 | 688 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 689 |
{"name" : "TextCtrl", "type" : "functionBlock", "extensible" : False, |
138 | 690 |
"inputs" : [("Show","BOOL","none"),("Enable","BOOL","none"),("SetText","STRING","none")], |
691 |
"outputs" : [("Text","STRING","none")], |
|
42 | 692 |
"comment" : "SVGUI Text Control", |
43 | 693 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 694 |
{"name" : "ScrollBar", "type" : "functionBlock", "extensible" : False, |
138 | 695 |
"inputs" : [("Show","BOOL","none"),("Enable","BOOL","none"),("SetThumb","UINT","none"),("SetRange","UINT","none"),("SetPosition","UINT","none")], |
696 |
"outputs" : [("Position","UINT","none")], |
|
42 | 697 |
"comment" : "SVGUI ScrollBar", |
43 | 698 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 699 |
{"name" : "NoteBook", "type" : "functionBlock", "extensible" : False, |
138 | 700 |
"inputs" : [("Show","BOOL","none"),("Enable","BOOL","none"),("SetSelected","BOOL","none")], |
701 |
"outputs" : [("Selected","UINT","none")], |
|
42 | 702 |
"comment" : "SVGUI Notebook", |
43 | 703 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 704 |
{"name" : "RotatingCtrl", "type" : "functionBlock", "extensible" : False, |
138 | 705 |
"inputs" : [("Show","BOOL","none"),("Enable","BOOL","none"),("SetAngle","REAL","none")], |
706 |
"outputs" : [("Angle","REAL","none")], |
|
42 | 707 |
"comment" : "SVGUI Rotating Control", |
43 | 708 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 709 |
{"name" : "Transform", "type" : "functionBlock", "extensible" : False, |
138 | 710 |
"inputs" : [("Show","BOOL","none"),("Enable","BOOL","none"),("SetX","REAL","none"),("SetY","REAL","none"),("SetXScale","REAL","none"),("SetYScale","REAL","none"),("SetAngle","REAL","none")], |
711 |
"outputs" : [("X","REAL","none"),("Y","REAL","none")], |
|
42 | 712 |
"comment" : "SVGUI Transform", |
43 | 713 |
"generate" : generate_svgui_block, "initialise" : initialise_block}, |
37 | 714 |
]} |
715 |
] |
|
137
187a4e2412e5
Modifying svgui plugin for following new SVGUIEditor version
lbessard
parents:
105
diff
changeset
|
716 |