author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Thu, 21 Sep 2017 15:02:36 +0300 | |
changeset 1821 | 44a47d255d36 |
parent 1782 | 5b6ad7a7fd9d |
child 1853 | 47a3f39bead0 |
permissions | -rw-r--r-- |
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:
1493
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:
1493
diff
changeset
|
5 |
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
814 | 6 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1493
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> |
814 | 9 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1493
diff
changeset
|
10 |
# See COPYING file for copyrights details. |
814 | 11 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1493
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:
1493
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:
1493
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:
1493
diff
changeset
|
15 |
# of the License, or (at your option) any later version. |
814 | 16 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1493
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:
1493
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:
1493
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:
1493
diff
changeset
|
20 |
# GNU General Public License for more details. |
814 | 21 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1493
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:
1493
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:
1493
diff
changeset
|
24 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
814 | 25 |
|
26 |
import wx |
|
27 |
||
1246 | 28 |
from graphics.GraphicCommons import CONTACT_NORMAL, CONTACT_REVERSE, \ |
29 |
CONTACT_RISING, CONTACT_FALLING, COIL_NORMAL, COIL_REVERSE, COIL_SET, \ |
|
30 |
COIL_RESET, COIL_RISING, COIL_FALLING |
|
31 |
from graphics.LD_Objects import LD_Contact, LD_Coil |
|
32 |
from 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 |
# ------------------------------------------------------------------------------- |
1246 | 35 |
# Set Ladder Element Parmeters 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 |
|
1246 | 38 |
|
39 |
class LDElementDialog(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 LD contact or coil |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
42 |
graphic 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:
1698
diff
changeset
|
44 |
|
1246 | 45 |
def __init__(self, parent, controller, tagname, type): |
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 type: Type of LD element ('contact or 'coil') |
|
52 |
""" |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
53 |
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:
1767
diff
changeset
|
54 |
title=(_("Edit Contact Values") |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
55 |
if type == "contact" |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
56 |
else _("Edit Coil Values"))) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
57 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1247
diff
changeset
|
58 |
# Init common sizers |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
59 |
self._init_sizers(2, 0, (7 if type == "contact" else 9), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
60 |
None, 2, 1) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
61 |
|
1246 | 62 |
# Create label for LD element modifier |
814 | 63 |
modifier_label = wx.StaticText(self, label=_('Modifier:')) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
64 |
self.LeftGridSizer.AddWindow(modifier_label, border=5, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
65 |
flag=wx.GROW | wx.BOTTOM) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
66 |
|
1246 | 67 |
# Create radio buttons for selecting LD element modifier |
68 |
self.ModifierRadioButtons = {} |
|
69 |
first = True |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
70 |
element_modifiers = ([CONTACT_NORMAL, CONTACT_REVERSE, |
1246 | 71 |
CONTACT_RISING, CONTACT_FALLING] |
72 |
if type == "contact" |
|
73 |
else [COIL_NORMAL, COIL_REVERSE, COIL_SET, |
|
74 |
COIL_RESET, COIL_RISING, COIL_FALLING]) |
|
1767
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
75 |
modifiers_label = \ |
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
76 |
[_("Normal"), _("Negated")] + \ |
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
77 |
([_("Set"), _("Reset")] if type == "coil" else []) + \ |
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
78 |
[_("Rising Edge"), _("Falling Edge")] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
79 |
|
1246 | 80 |
for modifier, label in zip(element_modifiers, modifiers_label): |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
81 |
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:
1767
diff
changeset
|
82 |
style=(wx.RB_GROUP if first else 0)) |
1246 | 83 |
radio_button.SetValue(first) |
84 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnModifierChanged, radio_button) |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1247
diff
changeset
|
85 |
self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW) |
1246 | 86 |
self.ModifierRadioButtons[modifier] = radio_button |
87 |
first = False |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
88 |
|
1246 | 89 |
# Create label for LD element variable |
90 |
element_variable_label = wx.StaticText(self, label=_('Variable:')) |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1247
diff
changeset
|
91 |
self.LeftGridSizer.AddWindow(element_variable_label, border=5, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
92 |
flag=wx.GROW | wx.TOP) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
93 |
|
1246 | 94 |
# Create a combo box for defining LD element variable |
1370
ee795a8d4404
Fixed coil and contact dialog to let user select a complex type variable for contact and coil expression
Laurent Bessard
parents:
1259
diff
changeset
|
95 |
self.ElementVariable = wx.ComboBox(self, style=wx.CB_SORT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
96 |
self.Bind(wx.EVT_COMBOBOX, self.OnVariableChanged, |
1246 | 97 |
self.ElementVariable) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
98 |
self.Bind(wx.EVT_TEXT, self.OnVariableChanged, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
99 |
self.ElementVariable) |
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1247
diff
changeset
|
100 |
self.LeftGridSizer.AddWindow(self.ElementVariable, border=5, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
101 |
flag=wx.GROW | wx.TOP) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
102 |
|
1246 | 103 |
# Add preview panel and associated label to sizers |
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1247
diff
changeset
|
104 |
self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
1247
diff
changeset
|
105 |
self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
106 |
|
1246 | 107 |
# Add buttons sizer to sizers |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
108 |
self.MainSizer.AddSizer(self.ButtonSizer, border=20, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
109 |
flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
110 |
|
1246 | 111 |
# Save LD element class |
112 |
self.ElementClass = (LD_Contact if type == "contact" else LD_Coil) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
113 |
|
1246 | 114 |
# Extract list of variables defined in POU |
115 |
self.RefreshVariableList() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
116 |
|
1246 | 117 |
# Set values in ElementVariable |
118 |
for name, (var_type, value_type) in self.VariableList.iteritems(): |
|
119 |
# Only select BOOL variable and avoid input for coil |
|
120 |
if (type == "contact" or var_type != "Input") and \ |
|
121 |
value_type == "BOOL": |
|
122 |
self.ElementVariable.Append(name) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
123 |
|
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
124 |
self.Fit() |
1246 | 125 |
# Normal radio button is default control having keyboard focus |
126 |
self.ModifierRadioButtons[element_modifiers[0]].SetFocus() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
127 |
|
1246 | 128 |
def GetElementModifier(self): |
129 |
""" |
|
130 |
Return modifier selected for LD element |
|
131 |
@return: Modifier selected (None if not found) |
|
132 |
""" |
|
133 |
# Go through radio buttons and return modifier associated to the one |
|
134 |
# that is selected |
|
135 |
for modifier, control in self.ModifierRadioButtons.iteritems(): |
|
136 |
if control.GetValue(): |
|
137 |
return modifier |
|
138 |
return None |
|
814 | 139 |
|
140 |
def SetValues(self, values): |
|
1246 | 141 |
""" |
142 |
Set default LD element parameters |
|
1252 | 143 |
@param values: LD element parameters values |
1246 | 144 |
""" |
145 |
# For each parameters defined, set corresponding control value |
|
814 | 146 |
for name, value in values.items(): |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
147 |
|
1246 | 148 |
# Parameter is LD element variable |
149 |
if name == "variable": |
|
1370
ee795a8d4404
Fixed coil and contact dialog to let user select a complex type variable for contact and coil expression
Laurent Bessard
parents:
1259
diff
changeset
|
150 |
self.ElementVariable.SetValue(value) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
151 |
|
1246 | 152 |
# Set value of other controls |
153 |
elif name == "modifier": |
|
154 |
self.ModifierRadioButtons[value].SetValue(True) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
155 |
|
1246 | 156 |
# Refresh preview panel |
157 |
self.RefreshPreview() |
|
814 | 158 |
|
159 |
def GetValues(self): |
|
1246 | 160 |
""" |
161 |
Return LD element parameters defined in dialog |
|
162 |
@return: {parameter_name: parameter_value,...} |
|
163 |
""" |
|
164 |
values = { |
|
165 |
"variable": self.ElementVariable.GetValue(), |
|
166 |
"modifier": self.GetElementModifier()} |
|
814 | 167 |
values["width"], values["height"] = self.Element.GetSize() |
168 |
return values |
|
169 |
||
1246 | 170 |
def OnModifierChanged(self, event): |
171 |
""" |
|
172 |
Called when LD element modifier changed |
|
173 |
@param event: wx.RadioButtonEvent |
|
174 |
""" |
|
814 | 175 |
self.RefreshPreview() |
176 |
event.Skip() |
|
177 |
||
1246 | 178 |
def OnVariableChanged(self, event): |
179 |
""" |
|
180 |
Called when LD element associated variable changed |
|
181 |
@param event: wx.ComboBoxEvent |
|
182 |
""" |
|
814 | 183 |
self.RefreshPreview() |
184 |
event.Skip() |
|
185 |
||
186 |
def RefreshPreview(self): |
|
1246 | 187 |
""" |
188 |
Refresh preview panel of graphic element |
|
189 |
Override BlockPreviewDialog function |
|
190 |
""" |
|
1698
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
191 |
value = self.ElementVariable.GetValue() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
192 |
|
1246 | 193 |
# Set graphic element displayed, creating a LD element |
194 |
self.Element = self.ElementClass( |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
195 |
self.Preview, |
1246 | 196 |
self.GetElementModifier(), |
1698
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
197 |
value) |
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
198 |
|
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
199 |
button = self.ButtonSizer.GetAffirmativeButton() |
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
200 |
button.Enable(value != "") |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
201 |
|
1246 | 202 |
# Call BlockPreviewDialog function |
203 |
BlockPreviewDialog.RefreshPreview(self) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1698
diff
changeset
|
204 |
|
1698
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
205 |
def OnOK(self, event): |
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
206 |
if self.ElementVariable.GetValue() != "": |
ae3e819252fc
disable empty coils and contacts in LD/SFC editors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
207 |
self.EndModal(wx.ID_OK) |