author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Wed, 04 Oct 2023 16:24:00 +0200 | |
branch | python3 |
changeset 3854 | d29d67e86532 |
parent 3750 | f62625418bff |
permissions | -rw-r--r-- |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1554
diff
changeset
|
1 |
#!/usr/bin/env python |
814 | 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:
1554
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:
1554
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:
1554
diff
changeset
|
6 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1554
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:
1554
diff
changeset
|
9 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1554
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:
1554
diff
changeset
|
11 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1554
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:
1554
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:
1554
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:
1554
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:
1554
diff
changeset
|
16 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1554
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:
1554
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:
1554
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:
1554
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:
1554
diff
changeset
|
21 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1554
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:
1554
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:
1554
diff
changeset
|
24 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
814 | 25 |
|
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3303
diff
changeset
|
26 |
|
814 | 27 |
import wx |
28 |
||
1252 | 29 |
from graphics.SFC_Objects import SFC_Transition |
1853
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1847
diff
changeset
|
30 |
from dialogs.BlockPreviewDialog import BlockPreviewDialog |
814 | 31 |
|
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
32 |
# ------------------------------------------------------------------------------- |
1252 | 33 |
# Set Transition Parameters Dialog |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
34 |
# ------------------------------------------------------------------------------- |
814 | 35 |
|
1252 | 36 |
|
37 |
class SFCTransitionDialog(BlockPreviewDialog): |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
38 |
""" |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
39 |
Class that implements a dialog for defining parameters of a transition graphic |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
40 |
element |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
41 |
""" |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
42 |
|
1252 | 43 |
def __init__(self, parent, controller, tagname, connection=True): |
44 |
""" |
|
45 |
Constructor |
|
46 |
@param parent: Parent wx.Window of dialog for modal |
|
47 |
@param controller: Reference to project controller |
|
48 |
@param tagname: Tagname of project POU edited |
|
49 |
@param connection: True if transition value can be defined by a |
|
50 |
connection (default: True) |
|
51 |
""" |
|
52 |
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
|
53 |
title=_('Edit transition')) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
54 |
|
1252 | 55 |
# Init common sizers |
56 |
self._init_sizers(2, 0, 8, None, 2, 1) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
57 |
|
1252 | 58 |
# Create label for transition type |
814 | 59 |
type_label = wx.StaticText(self, label=_('Type:')) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
60 |
self.LeftGridSizer.Add(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
|
61 |
|
1252 | 62 |
# Create combo box for selecting reference value |
63 |
reference = wx.ComboBox(self, style=wx.CB_READONLY) |
|
64 |
reference.Append("") |
|
65 |
for transition in controller.GetEditedElementTransitions(tagname): |
|
66 |
reference.Append(transition) |
|
67 |
self.Bind(wx.EVT_COMBOBOX, self.OnReferenceChanged, reference) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
68 |
|
1252 | 69 |
# Create Text control for defining inline value |
70 |
inline = wx.TextCtrl(self) |
|
71 |
self.Bind(wx.EVT_TEXT, self.OnInlineChanged, inline) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
72 |
|
1252 | 73 |
# Create radio buttons for selecting power rail type |
74 |
self.TypeRadioButtons = {} |
|
75 |
first = True |
|
76 |
for type, label, control in [('reference', _('Reference'), reference), |
|
77 |
('inline', _('Inline'), inline), |
|
78 |
('connection', _('Connection'), None)]: |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
79 |
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
|
80 |
style=(wx.RB_GROUP if first else 0)) |
1252 | 81 |
radio_button.SetValue(first) |
82 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button) |
|
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
83 |
self.LeftGridSizer.Add(radio_button, flag=wx.GROW) |
1252 | 84 |
if control is not None: |
85 |
control.Enable(first) |
|
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
86 |
self.LeftGridSizer.Add(control, flag=wx.GROW) |
1252 | 87 |
self.TypeRadioButtons[type] = (radio_button, control) |
88 |
first = False |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
89 |
|
1252 | 90 |
# Create label for transition priority |
814 | 91 |
priority_label = wx.StaticText(self, label=_('Priority:')) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
92 |
self.LeftGridSizer.Add(priority_label, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
93 |
|
1252 | 94 |
# Create spin control for defining priority value |
814 | 95 |
self.Priority = wx.SpinCtrl(self, min=0, style=wx.SP_ARROW_KEYS) |
96 |
self.Bind(wx.EVT_TEXT, self.OnPriorityChanged, self.Priority) |
|
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
97 |
self.LeftGridSizer.Add(self.Priority, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
98 |
|
1252 | 99 |
# Add preview panel and associated label to sizers |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
100 |
self.RightGridSizer.Add(self.PreviewLabel, flag=wx.GROW) |
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
101 |
self.RightGridSizer.Add(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
|
102 |
|
1252 | 103 |
# Add buttons sizer to sizers |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2591
diff
changeset
|
104 |
self.MainSizer.Add( |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
105 |
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
|
106 |
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
|
107 |
|
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
108 |
self.Fit() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
109 |
|
1252 | 110 |
# Reference radio button is default control having keyboard focus |
111 |
self.TypeRadioButtons["reference"][0].SetFocus() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
112 |
|
1252 | 113 |
def GetTransitionType(self): |
114 |
""" |
|
115 |
Return type selected for SFC transition and associated value |
|
116 |
@return: Type selected and associated value (None if no value) |
|
117 |
""" |
|
118 |
# Go through radio buttons and return type and value associated to the |
|
119 |
# one that is selected |
|
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3303
diff
changeset
|
120 |
for type, (radio, control) in self.TypeRadioButtons.items(): |
1252 | 121 |
if radio.GetValue(): |
122 |
if isinstance(control, wx.ComboBox): |
|
123 |
return type, control.GetStringSelection() |
|
124 |
elif isinstance(control, wx.TextCtrl): |
|
125 |
return type, control.GetValue() |
|
126 |
else: |
|
127 |
return type, None |
|
128 |
return None, None |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
129 |
|
1252 | 130 |
def SetValues(self, values): |
131 |
""" |
|
132 |
Set default SFC transition parameters |
|
133 |
@param values: Transition parameters values |
|
134 |
""" |
|
135 |
# Extract transition value according to type |
|
136 |
type_value = values.get("value", None) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
137 |
|
1252 | 138 |
# For each parameters defined, set corresponding control value |
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3303
diff
changeset
|
139 |
for name, value in list(values.items()): |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
140 |
|
1252 | 141 |
# Parameter is SFC transition priority |
142 |
if name == "priority": |
|
143 |
self.Priority.SetValue(values["priority"]) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
144 |
|
1252 | 145 |
# Parameter is SFC transition type |
146 |
elif name == "type": |
|
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3303
diff
changeset
|
147 |
for type, (radio, control) in self.TypeRadioButtons.items(): |
1252 | 148 |
radio.SetValue(type == value) |
149 |
if control is not None: |
|
150 |
# Enable associated control to type and set value |
|
151 |
control.Enable(type == value) |
|
152 |
if type == value: |
|
153 |
if isinstance(control, wx.ComboBox): |
|
154 |
control.SetStringSelection(type_value) |
|
155 |
elif isinstance(control, wx.TextCtrl): |
|
156 |
control.ChangeValue(type_value) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
157 |
|
1252 | 158 |
# Refresh preview panel |
2591
5f685bcd3ad6
Fixed refresh problem following 9c5f835b031e, 9622418ac28c, c67488bd8134 : force redraw only through EVT_PAINT event and use wxPaintDC, as described in wx documentation
Edouard Tisserant
parents:
2587
diff
changeset
|
159 |
self.RefreshPreview() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
160 |
|
1252 | 161 |
def GetValues(self): |
162 |
""" |
|
163 |
Return SFC transition parameters defined in dialog |
|
164 |
@return: {parameter_name: parameter_value,...} |
|
165 |
""" |
|
1739
ec153828ded2
clean-up: fix PEP8 E203 whitespace before ':' and whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
166 |
values = {"priority": self.Priority.GetValue()} |
1252 | 167 |
values["type"], values["value"] = self.GetTransitionType() |
168 |
values["width"], values["height"] = self.Element.GetSize() |
|
169 |
return values |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
170 |
|
1252 | 171 |
def OnOK(self, event): |
172 |
""" |
|
173 |
Called when dialog OK button is pressed |
|
174 |
Test if parameters defined are valid |
|
175 |
@param event: wx.Event from OK button |
|
176 |
""" |
|
177 |
message = None |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
178 |
|
1252 | 179 |
# Get transition type and value associated |
180 |
type, value = self.GetTransitionType() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
181 |
|
1252 | 182 |
# Test that value associated to type is defined |
183 |
if type != "connection" and value == "": |
|
184 |
message = _("Form isn't complete. %s must be filled!") % type |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
185 |
|
1252 | 186 |
# Show error message if an error is detected |
187 |
if message is not None: |
|
188 |
self.ShowErrorMessage(message) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
189 |
|
1252 | 190 |
else: |
191 |
# Call BlockPreviewDialog function |
|
192 |
BlockPreviewDialog.OnOK(self, event) |
|
193 |
||
194 |
def OnTypeChanged(self, event): |
|
195 |
""" |
|
196 |
Called when transition type changed |
|
197 |
@param event: wx.RadioButtonEvent |
|
198 |
""" |
|
199 |
# Refresh sensibility of control associated to transition types |
|
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
3303
diff
changeset
|
200 |
for _type, (radio, control) in self.TypeRadioButtons.items(): |
1252 | 201 |
if control is not None: |
202 |
control.Enable(radio.GetValue()) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
203 |
|
1252 | 204 |
# Refresh preview panel |
2591
5f685bcd3ad6
Fixed refresh problem following 9c5f835b031e, 9622418ac28c, c67488bd8134 : force redraw only through EVT_PAINT event and use wxPaintDC, as described in wx documentation
Edouard Tisserant
parents:
2587
diff
changeset
|
205 |
self.RefreshPreview() |
1252 | 206 |
event.Skip() |
207 |
||
208 |
def OnReferenceChanged(self, event): |
|
209 |
""" |
|
210 |
Called when SFC transition reference value changed |
|
211 |
@param event: wx.ComboBoxEvent |
|
212 |
""" |
|
2591
5f685bcd3ad6
Fixed refresh problem following 9c5f835b031e, 9622418ac28c, c67488bd8134 : force redraw only through EVT_PAINT event and use wxPaintDC, as described in wx documentation
Edouard Tisserant
parents:
2587
diff
changeset
|
213 |
self.RefreshPreview() |
1252 | 214 |
event.Skip() |
215 |
||
216 |
def OnInlineChanged(self, event): |
|
217 |
""" |
|
218 |
Called when SFC transition inline value changed |
|
219 |
@param event: wx.TextEvent |
|
220 |
""" |
|
2591
5f685bcd3ad6
Fixed refresh problem following 9c5f835b031e, 9622418ac28c, c67488bd8134 : force redraw only through EVT_PAINT event and use wxPaintDC, as described in wx documentation
Edouard Tisserant
parents:
2587
diff
changeset
|
221 |
self.RefreshPreview() |
1252 | 222 |
event.Skip() |
223 |
||
224 |
def OnPriorityChanged(self, event): |
|
225 |
""" |
|
226 |
Called when block inputs number changed |
|
227 |
@param event: wx.SpinEvent |
|
228 |
""" |
|
2591
5f685bcd3ad6
Fixed refresh problem following 9c5f835b031e, 9622418ac28c, c67488bd8134 : force redraw only through EVT_PAINT event and use wxPaintDC, as described in wx documentation
Edouard Tisserant
parents:
2587
diff
changeset
|
229 |
self.RefreshPreview() |
2587
c67488bd8134
Fixed preview drawing/refresh problem in sfc/ld/fbd graphical element creation dialogs on windows (introduced in 9c5f835b031e, continuation of 9622418ac28c)
Edouard Tisserant
parents:
1853
diff
changeset
|
230 |
event.Skip() |
c67488bd8134
Fixed preview drawing/refresh problem in sfc/ld/fbd graphical element creation dialogs on windows (introduced in 9c5f835b031e, continuation of 9622418ac28c)
Edouard Tisserant
parents:
1853
diff
changeset
|
231 |
|
c67488bd8134
Fixed preview drawing/refresh problem in sfc/ld/fbd graphical element creation dialogs on windows (introduced in 9c5f835b031e, continuation of 9622418ac28c)
Edouard Tisserant
parents:
1853
diff
changeset
|
232 |
def DrawPreview(self): |
1252 | 233 |
""" |
234 |
Refresh preview panel of graphic element |
|
235 |
Override BlockPreviewDialog function |
|
236 |
""" |
|
237 |
# Set graphic element displayed, creating a SFC transition |
|
814 | 238 |
self.Element = SFC_Transition(self.Preview) |
1252 | 239 |
self.Element.SetType(*self.GetTransitionType()) |
240 |
self.Element.SetPriority(self.Priority.GetValue()) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
241 |
|
1252 | 242 |
# Call BlockPreviewDialog function |
2587
c67488bd8134
Fixed preview drawing/refresh problem in sfc/ld/fbd graphical element creation dialogs on windows (introduced in 9c5f835b031e, continuation of 9622418ac28c)
Edouard Tisserant
parents:
1853
diff
changeset
|
243 |
BlockPreviewDialog.DrawPreview(self) |