author | Laurent Bessard |
Tue, 29 May 2012 17:11:37 +0200 | |
changeset 698 | 314af37f7db2 |
parent 676 | 0f10f5091245 |
child 714 | 131ea7f237b9 |
permissions | -rw-r--r-- |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
3 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
4 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
5 |
#based on the plcopen standard. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
6 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
8 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
9 |
#See COPYING file for copyrights details. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
10 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
11 |
#This library is free software; you can redistribute it and/or |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
12 |
#modify it under the terms of the GNU General Public |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
13 |
#License as published by the Free Software Foundation; either |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
14 |
#version 2.1 of the License, or (at your option) any later version. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
15 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
16 |
#This library is distributed in the hope that it will be useful, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
19 |
#General Public License for more details. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
20 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
21 |
#You should have received a copy of the GNU General Public |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
22 |
#License along with this library; if not, write to the Free Software |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
24 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
25 |
import wx |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
26 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
27 |
from graphics import * |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
28 |
from controls import LibraryPanel |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
29 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
30 |
#------------------------------------------------------------------------------- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
31 |
# Create New Block Dialog |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
32 |
#------------------------------------------------------------------------------- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
33 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
34 |
[ID_FBDBLOCKDIALOG, ID_FBDBLOCKDIALOGNAME, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
35 |
ID_FBDBLOCKDIALOGTYPETREE, ID_FBDBLOCKDIALOGTYPEDESC, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
36 |
ID_FBDBLOCKDIALOGINPUTS, ID_FBDBLOCKDIALOGPREVIEW, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
37 |
ID_FBDBLOCKDIALOGEXECUTIONORDER, ID_FBDBLOCKDIALOGEXECUTIONCONTROL, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
38 |
ID_FBDBLOCKDIALOGSTATICTEXT1, ID_FBDBLOCKDIALOGSTATICTEXT2, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
39 |
ID_FBDBLOCKDIALOGSTATICTEXT3, ID_FBDBLOCKDIALOGSTATICTEXT4, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
40 |
ID_FBDBLOCKDIALOGSTATICTEXT5, ID_FBDBLOCKDIALOGSTATICTEXT6, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
41 |
] = [wx.NewId() for _init_ctrls in range(14)] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
42 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
43 |
[CATEGORY, BLOCK] = range(2) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
44 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
45 |
class FBDBlockDialog(wx.Dialog): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
46 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
47 |
if wx.VERSION < (2, 6, 0): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
48 |
def Bind(self, event, function, id = None): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
49 |
if id is not None: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
50 |
event(self, id, function) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
51 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
52 |
event(self, function) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
53 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
54 |
def _init_coll_flexGridSizer1_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
55 |
parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
56 |
parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
57 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
58 |
def _init_coll_flexGridSizer1_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
59 |
parent.AddGrowableCol(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
60 |
parent.AddGrowableRow(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
61 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
62 |
def _init_coll_MainSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
63 |
parent.AddSizer(self.LeftBoxSizer, 1, border=5, flag=wx.GROW|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
64 |
parent.AddSizer(self.RightGridSizer, 1, border=5, flag=wx.GROW|wx.LEFT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
65 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
66 |
def _init_coll_LeftBoxSizer_Items(self, parent): |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
67 |
parent.AddWindow(self.LibraryPanel, 1, border=5, flag=wx.GROW|wx.TOP) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
68 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
69 |
def _init_coll_RightGridSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
70 |
parent.AddSizer(self.RightUpGridSizer, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
71 |
parent.AddWindow(self.staticText6, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
72 |
parent.AddWindow(self.Preview, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
73 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
74 |
def _init_coll_RightGridSizer_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
75 |
parent.AddGrowableCol(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
76 |
parent.AddGrowableRow(2) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
77 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
78 |
def _init_coll_RightUpGridSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
79 |
parent.AddWindow(self.staticText2, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
80 |
parent.AddWindow(self.BlockName, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
81 |
parent.AddWindow(self.staticText3, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
82 |
parent.AddWindow(self.Inputs, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
83 |
parent.AddWindow(self.staticText4, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
84 |
parent.AddWindow(self.ExecutionOrder, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
85 |
parent.AddWindow(self.staticText5, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
86 |
parent.AddWindow(self.ExecutionControl, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
87 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
88 |
def _init_coll_RightUpGridSizer_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
89 |
parent.AddGrowableCol(1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
90 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
91 |
def _init_sizers(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
92 |
self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
93 |
self.MainSizer = wx.BoxSizer(wx.HORIZONTAL) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
94 |
self.LeftBoxSizer = wx.StaticBoxSizer(self.staticbox1, wx.VERTICAL) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
95 |
self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
96 |
self.RightUpGridSizer = wx.FlexGridSizer(cols=2, hgap=5, rows=4, vgap=5) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
97 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
98 |
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
99 |
self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
100 |
self._init_coll_MainSizer_Items(self.MainSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
101 |
self._init_coll_LeftBoxSizer_Items(self.LeftBoxSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
102 |
self._init_coll_RightGridSizer_Items(self.RightGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
103 |
self._init_coll_RightGridSizer_Growables(self.RightGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
104 |
self._init_coll_RightUpGridSizer_Items(self.RightUpGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
105 |
self._init_coll_RightUpGridSizer_Growables(self.RightUpGridSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
106 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
107 |
self.SetSizer(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
108 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
109 |
def _init_ctrls(self, prnt): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
110 |
wx.Dialog.__init__(self, id=ID_FBDBLOCKDIALOG, |
534
d506a353b3d3
Fix dialogs positions to stay on the same screen than parent frame
laurent
parents:
409
diff
changeset
|
111 |
name='FBDBlockDialog', parent=prnt, |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
112 |
size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
113 |
title=_('Block Properties')) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
114 |
self.SetClientSize(wx.Size(600, 400)) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
115 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
116 |
self.staticbox1 = wx.StaticBox(id=ID_FBDBLOCKDIALOGSTATICTEXT1, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
117 |
label=_('Type:'), name='staticBox1', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
118 |
pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
119 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
120 |
self.staticText2 = wx.StaticText(id=ID_FBDBLOCKDIALOGSTATICTEXT2, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
121 |
label=_('Name:'), name='staticText2', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
122 |
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
123 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
124 |
self.staticText3 = wx.StaticText(id=ID_FBDBLOCKDIALOGSTATICTEXT2, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
125 |
label=_('Inputs:'), name='staticText4', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
126 |
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
127 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
128 |
self.staticText4 = wx.StaticText(id=ID_FBDBLOCKDIALOGSTATICTEXT4, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
129 |
label=_('Execution Order:'), name='staticText4', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
130 |
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
131 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
132 |
self.staticText5 = wx.StaticText(id=ID_FBDBLOCKDIALOGSTATICTEXT5, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
133 |
label=_('Execution Control:'), name='staticText5', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
134 |
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
135 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
136 |
self.staticText6 = wx.StaticText(id=ID_FBDBLOCKDIALOGSTATICTEXT6, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
137 |
label=_('Preview:'), name='staticText6', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
138 |
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
139 |
|
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
140 |
self.LibraryPanel = LibraryPanel(self) |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
141 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
142 |
self.BlockName = wx.TextCtrl(id=ID_FBDBLOCKDIALOGNAME, value='', |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
143 |
name='BlockName', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
144 |
size=wx.Size(0, 24), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
145 |
self.Bind(wx.EVT_TEXT, self.OnNameChanged, id=ID_FBDBLOCKDIALOGNAME) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
146 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
147 |
self.Inputs = wx.SpinCtrl(id=ID_FBDBLOCKDIALOGINPUTS, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
148 |
name='Inputs', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
149 |
size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=2, max=20) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
150 |
self.Bind(wx.EVT_SPINCTRL, self.OnInputsChanged, id=ID_FBDBLOCKDIALOGINPUTS) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
151 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
152 |
self.ExecutionOrder = wx.SpinCtrl(id=ID_FBDBLOCKDIALOGEXECUTIONORDER, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
153 |
name='ExecutionOrder', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
154 |
size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
155 |
self.Bind(wx.EVT_SPINCTRL, self.OnExecutionOrderChanged, id=ID_FBDBLOCKDIALOGEXECUTIONORDER) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
156 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
157 |
self.ExecutionControl = wx.CheckBox(id=ID_FBDBLOCKDIALOGEXECUTIONCONTROL, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
158 |
name='ExecutionControl', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
159 |
size=wx.Size(0, 24), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
160 |
self.Bind(wx.EVT_CHECKBOX, self.OnExecutionOrderChanged, id=ID_FBDBLOCKDIALOGEXECUTIONCONTROL) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
161 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
162 |
self.Preview = wx.Panel(id=ID_FBDBLOCKDIALOGPREVIEW, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
163 |
name='Preview', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
164 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
165 |
self.Preview.SetBackgroundColour(wx.Colour(255,255,255)) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
166 |
setattr(self.Preview, "GetDrawingMode", lambda:FREEDRAWING_MODE) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
167 |
setattr(self.Preview, "GetScaling", lambda:None) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
168 |
setattr(self.Preview, "GetBlockType", self.Controler.GetBlockType) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
169 |
setattr(self.Preview, "IsOfType", self.Controler.IsOfType) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
170 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
171 |
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
172 |
if wx.VERSION >= (2, 5, 0): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
173 |
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
174 |
self.Preview.Bind(wx.EVT_PAINT, self.OnPaint) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
175 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
176 |
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
177 |
wx.EVT_PAINT(self.Preview, self.OnPaint) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
178 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
179 |
self._init_sizers() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
180 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
181 |
def __init__(self, parent, controler): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
182 |
self.Controler = controler |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
183 |
self._init_ctrls(parent) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
184 |
self.BlockName.SetValue("") |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
185 |
self.BlockName.Enable(False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
186 |
self.Inputs.Enable(False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
187 |
self.Block = None |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
188 |
self.MinBlockSize = None |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
189 |
self.First = True |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
190 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
191 |
self.PouNames = [] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
192 |
self.PouElementNames = [] |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
193 |
|
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
194 |
self.LibraryPanel.SetControler(controler) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
195 |
setattr(self.LibraryPanel, "_OnTreeItemSelected", self.OnLibraryTreeItemSelected) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
196 |
self.LibraryPanel.SetFocus() |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
197 |
|
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
198 |
def SetBlockList(self, blocklist): |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
199 |
self.LibraryPanel.SetBlockList(blocklist) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
200 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
201 |
def SetPreviewFont(self, font): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
202 |
self.Preview.SetFont(font) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
203 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
204 |
def OnOK(self, event): |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
205 |
selected = self.LibraryPanel.GetSelectedBlock() |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
206 |
block_name = self.BlockName.GetValue() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
207 |
name_enabled = self.BlockName.IsEnabled() |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
208 |
if selected is None: |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
209 |
message = wx.MessageDialog(self, _("Form isn't complete. Valid block type must be selected!"), _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
210 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
211 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
212 |
elif name_enabled and block_name == "": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
213 |
message = wx.MessageDialog(self, _("Form isn't complete. Name must be filled!"), _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
214 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
215 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
216 |
elif name_enabled and not TestIdentifier(block_name): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
217 |
message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
218 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
219 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
220 |
elif name_enabled and block_name.upper() in IEC_KEYWORDS: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
221 |
message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
222 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
223 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
224 |
elif name_enabled and block_name.upper() in self.PouNames: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
225 |
message = wx.MessageDialog(self, _("\"%s\" pou already exists!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
226 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
227 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
228 |
elif name_enabled and block_name.upper() in self.PouElementNames: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
229 |
message = wx.MessageDialog(self, _("\"%s\" element for this pou already exists!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
230 |
message.ShowModal() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
231 |
message.Destroy() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
232 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
233 |
self.EndModal(wx.ID_OK) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
234 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
235 |
def SetMinBlockSize(self, size): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
236 |
self.MinBlockSize = size |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
237 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
238 |
def SetPouNames(self, pou_names): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
239 |
self.PouNames = [pou_name.upper() for pou_name in pou_names] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
240 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
241 |
def SetPouElementNames(self, element_names): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
242 |
self.PouElementNames = [element_name.upper() for element_name in element_names] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
243 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
244 |
def SetValues(self, values): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
245 |
blocktype = values.get("type", None) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
246 |
if blocktype is not None: |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
247 |
self.LibraryPanel.SelectTreeItem(blocktype, values.get("inputs", None)) |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
248 |
for name, value in values.items(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
249 |
if name == "name": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
250 |
self.BlockName.SetValue(value) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
251 |
elif name == "extension": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
252 |
self.Inputs.SetValue(value) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
253 |
elif name == "executionOrder": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
254 |
self.ExecutionOrder.SetValue(value) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
255 |
elif name == "executionControl": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
256 |
self.ExecutionControl.SetValue(value) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
257 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
258 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
259 |
def GetValues(self): |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
260 |
values = self.LibraryPanel.GetSelectedBlock() |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
261 |
if self.BlockName.GetValue() != "": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
262 |
values["name"] = self.BlockName.GetValue() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
263 |
values["width"], values["height"] = self.Block.GetSize() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
264 |
values["extension"] = self.Inputs.GetValue() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
265 |
values["executionOrder"] = self.ExecutionOrder.GetValue() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
266 |
values["executionControl"] = self.ExecutionControl.GetValue() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
267 |
return values |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
268 |
|
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
269 |
def OnLibraryTreeItemSelected(self, event): |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
270 |
values = self.LibraryPanel.GetSelectedBlock() |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
271 |
if values is not None: |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
272 |
blocktype = self.Controler.GetBlockType(values["type"], values["inputs"]) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
273 |
else: |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
274 |
blocktype = None |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
275 |
if blocktype is not None: |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
276 |
self.Inputs.SetValue(len(blocktype["inputs"])) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
277 |
self.Inputs.Enable(blocktype["extensible"]) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
278 |
self.BlockName.Enable(blocktype["type"] != "function") |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
279 |
wx.CallAfter(self.RefreshPreview) |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
280 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
281 |
self.BlockName.Enable(False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
282 |
self.Inputs.Enable(False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
283 |
self.Inputs.SetValue(2) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
284 |
wx.CallAfter(self.ErasePreview) |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
285 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
286 |
def OnNameChanged(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
287 |
if self.BlockName.IsEnabled(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
288 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
289 |
event.Skip() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
290 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
291 |
def OnInputsChanged(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
292 |
if self.Inputs.IsEnabled(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
293 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
294 |
event.Skip() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
295 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
296 |
def OnExecutionOrderChanged(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
297 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
298 |
event.Skip() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
299 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
300 |
def OnExecutionControlChanged(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
301 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
302 |
event.Skip() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
303 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
304 |
def ErasePreview(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
305 |
dc = wx.ClientDC(self.Preview) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
306 |
dc.Clear() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
307 |
self.Block = None |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
308 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
309 |
def RefreshPreview(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
310 |
dc = wx.ClientDC(self.Preview) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
311 |
dc.SetFont(self.Preview.GetFont()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
312 |
dc.Clear() |
676
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
313 |
values = self.LibraryPanel.GetSelectedBlock() |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
314 |
if values is not None: |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
315 |
self.Block = FBD_Block(self.Preview, values["type"], |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
316 |
self.BlockName.GetValue(), |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
317 |
extension = self.Inputs.GetValue(), |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
318 |
inputs = values["inputs"], |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
319 |
executionControl = self.ExecutionControl.GetValue(), |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
320 |
executionOrder = self.ExecutionOrder.GetValue()) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
321 |
width, height = self.MinBlockSize |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
322 |
min_width, min_height = self.Block.GetMinSize() |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
323 |
width, height = max(min_width, width), max(min_height, height) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
324 |
self.Block.SetSize(width, height) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
325 |
clientsize = self.Preview.GetClientSize() |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
326 |
x = (clientsize.width - width) / 2 |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
327 |
y = (clientsize.height - height) / 2 |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
328 |
self.Block.SetPosition(x, y) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
329 |
self.Block.Draw(dc) |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
330 |
else: |
0f10f5091245
Adding search field for finding function or function block in library tree
laurent
parents:
646
diff
changeset
|
331 |
self.Block = None |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
332 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
333 |
def OnPaint(self, event): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
334 |
if self.Block is not None: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
335 |
self.RefreshPreview() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
336 |
event.Skip() |