author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Fri, 29 Jun 2018 13:36:32 +0300 | |
changeset 2237 | c5104f88a21f |
parent 1878 | fb73a6b6622d |
child 2587 | c67488bd8134 |
permissions | -rwxr-xr-x |
814 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
4 |
# This file is part of Beremiz, a Integrated Development Environment for |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
5 |
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
6 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
7 |
# Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
8 |
# Copyright (C) 2017: Andrey Skvortsov <andrej.skvortzov@gmail.com> |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
9 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
10 |
# See COPYING file for copyrights details. |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
11 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
12 |
# This program is free software; you can redistribute it and/or |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
13 |
# modify it under the terms of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
14 |
# as published by the Free Software Foundation; either version 2 |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
15 |
# of the License, or (at your option) any later version. |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
16 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
17 |
# This program is distributed in the hope that it will be useful, |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
18 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
19 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
20 |
# GNU General Public License for more details. |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
21 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
22 |
# You should have received a copy of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
23 |
# along with this program; if not, write to the Free Software |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1487
diff
changeset
|
24 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
814 | 25 |
|
1853
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
26 |
|
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
27 |
from __future__ import absolute_import |
814 | 28 |
import wx |
29 |
||
1245 | 30 |
from graphics.GraphicCommons import CONNECTOR, CONTINUATION |
31 |
from graphics.FBD_Objects import FBD_Connector |
|
1853
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
32 |
from dialogs.BlockPreviewDialog import BlockPreviewDialog |
814 | 33 |
|
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
34 |
# ------------------------------------------------------------------------------- |
1245 | 35 |
# Set Connection Parameters Dialog |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
36 |
# ------------------------------------------------------------------------------- |
814 | 37 |
|
1249 | 38 |
|
1245 | 39 |
class ConnectionDialog(BlockPreviewDialog): |
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
40 |
""" |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
41 |
Class that implements a dialog for defining parameters of a connection graphic |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
42 |
element |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
43 |
""" |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
44 |
|
1245 | 45 |
def __init__(self, parent, controller, tagname, apply_button=False): |
46 |
""" |
|
47 |
Constructor |
|
48 |
@param parent: Parent wx.Window of dialog for modal |
|
49 |
@param controller: Reference to project controller |
|
50 |
@param tagname: Tagname of project POU edited |
|
51 |
@param apply_button: Enable button for applying connector modification |
|
52 |
to all connector having the same name in POU (default: False) |
|
53 |
""" |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
54 |
BlockPreviewDialog.__init__(self, parent, controller, tagname, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
55 |
title=_('Connection Properties')) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
56 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1249
diff
changeset
|
57 |
# Init common sizers |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
58 |
self._init_sizers(2, 0, 7, 1, 0, None) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
59 |
|
1245 | 60 |
# Create label for connection type |
814 | 61 |
type_label = wx.StaticText(self, label=_('Type:')) |
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1249
diff
changeset
|
62 |
self.LeftGridSizer.AddWindow(type_label, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
63 |
|
1245 | 64 |
# Create radio buttons for selecting connection type |
1246 | 65 |
self.TypeRadioButtons = {} |
1245 | 66 |
first = True |
67 |
for type, label in [(CONNECTOR, _('Connector')), |
|
68 |
(CONTINUATION, _('Continuation'))]: |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
69 |
radio_button = wx.RadioButton(self, label=label, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
70 |
style=(wx.RB_GROUP if first else 0)) |
1245 | 71 |
radio_button.SetValue(first) |
72 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button) |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1249
diff
changeset
|
73 |
self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW) |
1246 | 74 |
self.TypeRadioButtons[type] = radio_button |
1245 | 75 |
first = False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
76 |
|
1245 | 77 |
# Create label for connection name |
814 | 78 |
name_label = wx.StaticText(self, label=_('Name:')) |
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1249
diff
changeset
|
79 |
self.LeftGridSizer.AddWindow(name_label, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
80 |
|
1245 | 81 |
# Create text control for defining connection name |
814 | 82 |
self.ConnectionName = wx.TextCtrl(self) |
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
83 |
self.ConnectionName.SetMinSize(wx.Size(200, -1)) |
814 | 84 |
self.Bind(wx.EVT_TEXT, self.OnNameChanged, self.ConnectionName) |
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1249
diff
changeset
|
85 |
self.LeftGridSizer.AddWindow(self.ConnectionName, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
86 |
|
1245 | 87 |
# Add preview panel and associated label to sizers |
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
88 |
self.Preview.SetMinSize(wx.Size(-1, 100)) |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
89 |
self.LeftGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW) |
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
90 |
self.LeftGridSizer.AddWindow(self.Preview, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
91 |
|
1245 | 92 |
# Add buttons sizer to sizers |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
93 |
self.MainSizer.AddSizer( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
94 |
self.ButtonSizer, border=20, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
95 |
flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
96 |
self.ColumnSizer.RemoveSizer(self.RightGridSizer) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
97 |
|
1245 | 98 |
# Add button for applying connection name modification to all connection |
99 |
# of POU |
|
856
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
100 |
if apply_button: |
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
101 |
self.ApplyToAllButton = wx.Button(self, label=_("Propagate Name")) |
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
102 |
self.ApplyToAllButton.SetToolTipString( |
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
103 |
_("Apply name modification to all continuations with the same name")) |
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
104 |
self.Bind(wx.EVT_BUTTON, self.OnApplyToAll, self.ApplyToAllButton) |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
105 |
self.ButtonSizer.AddWindow(self.ApplyToAllButton, flag=wx.LEFT) |
1245 | 106 |
else: |
107 |
self.ConnectionName.ChangeValue( |
|
108 |
controller.GenerateNewName( |
|
1878
fb73a6b6622d
fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1853
diff
changeset
|
109 |
tagname, None, "Connection%d", 0)) |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
110 |
self.Fit() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
111 |
|
1245 | 112 |
# Connector radio button is default control having keyboard focus |
1246 | 113 |
self.TypeRadioButtons[CONNECTOR].SetFocus() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
114 |
|
1249 | 115 |
def GetConnectionType(self): |
116 |
""" |
|
117 |
Return type selected for connection |
|
118 |
@return: Type selected (CONNECTOR or CONTINUATION) |
|
119 |
""" |
|
120 |
return (CONNECTOR |
|
121 |
if self.TypeRadioButtons[CONNECTOR].GetValue() |
|
122 |
else CONTINUATION) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
123 |
|
814 | 124 |
def SetValues(self, values): |
1245 | 125 |
""" |
126 |
Set default connection parameters |
|
127 |
@param values: Connection parameters values |
|
128 |
""" |
|
129 |
# For each parameters defined, set corresponding control value |
|
814 | 130 |
for name, value in values.items(): |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
131 |
|
1245 | 132 |
# Parameter is connection type |
814 | 133 |
if name == "type": |
1246 | 134 |
self.TypeRadioButtons[value].SetValue(True) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
135 |
|
1245 | 136 |
# Parameter is connection name |
814 | 137 |
elif name == "name": |
138 |
self.ConnectionName.SetValue(value) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
139 |
|
1245 | 140 |
# Refresh preview panel |
814 | 141 |
self.RefreshPreview() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
142 |
|
814 | 143 |
def GetValues(self): |
1245 | 144 |
""" |
145 |
Return connection parameters defined in dialog |
|
146 |
@return: {parameter_name: parameter_value,...} |
|
147 |
""" |
|
148 |
values = { |
|
1249 | 149 |
"type": self.GetConnectionType(), |
1245 | 150 |
"name": self.ConnectionName.GetValue()} |
151 |
values["width"], values["height"] = self.Element.GetSize() |
|
814 | 152 |
return values |
153 |
||
1245 | 154 |
def TestConnectionName(self): |
155 |
""" |
|
156 |
Test that connection name is valid |
|
157 |
@return: True if connection name is valid |
|
158 |
""" |
|
814 | 159 |
message = None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
160 |
|
1245 | 161 |
# Get connection name typed by user |
814 | 162 |
connection_name = self.ConnectionName.GetValue() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
163 |
|
1245 | 164 |
# Test that a name have been defined |
814 | 165 |
if connection_name == "": |
166 |
message = _("Form isn't complete. Name must be filled!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
167 |
|
1245 | 168 |
# If an error have been identify, show error message dialog |
814 | 169 |
if message is not None: |
1245 | 170 |
self.ShowErrorMessage(message) |
171 |
# Test failed |
|
856
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
172 |
return False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
173 |
|
1245 | 174 |
# Return result of element name test |
175 |
return self.TestElementName(connection_name) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
176 |
|
856
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
177 |
def OnOK(self, event): |
1245 | 178 |
""" |
179 |
Called when dialog OK button is pressed |
|
180 |
Test if connection name is valid |
|
181 |
@param event: wx.Event from OK button |
|
182 |
""" |
|
183 |
# Close dialog if connection name is valid |
|
184 |
if self.TestConnectionName(): |
|
814 | 185 |
self.EndModal(wx.ID_OK) |
186 |
||
856
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
187 |
def OnApplyToAll(self, event): |
1245 | 188 |
""" |
189 |
Called when Apply To All button is pressed |
|
190 |
Test if connection name is valid |
|
191 |
@param event: wx.Event from OK button |
|
192 |
""" |
|
193 |
# Close dialog if connection name is valid |
|
194 |
if self.TestConnectionName(): |
|
856
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
195 |
self.EndModal(wx.ID_YESTOALL) |
b64e436f000e
Adding button in ConnectionDialog to propagate connection name modification to all connections with the same name in POU
Laurent Bessard
parents:
814
diff
changeset
|
196 |
|
814 | 197 |
def OnTypeChanged(self, event): |
1245 | 198 |
""" |
199 |
Called when connection type changed |
|
200 |
@param event: wx.RadioButtonEvent |
|
201 |
""" |
|
814 | 202 |
self.RefreshPreview() |
203 |
event.Skip() |
|
204 |
||
205 |
def OnNameChanged(self, event): |
|
1245 | 206 |
""" |
207 |
Called when connection name value changed |
|
208 |
@param event: wx.TextEvent |
|
209 |
""" |
|
814 | 210 |
self.RefreshPreview() |
211 |
event.Skip() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
212 |
|
814 | 213 |
def RefreshPreview(self): |
1245 | 214 |
""" |
215 |
Refresh preview panel of graphic element |
|
216 |
Override BlockPreviewDialog function |
|
217 |
""" |
|
218 |
# Set graphic element displayed, creating a FBD connection element |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
219 |
self.Element = FBD_Connector(self.Preview, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
220 |
self.GetConnectionType(), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
221 |
self.ConnectionName.GetValue()) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
222 |
|
1245 | 223 |
# Call BlockPreviewDialog function |
224 |
BlockPreviewDialog.RefreshPreview(self) |