author | Edouard Tisserant |
Tue, 02 Feb 2021 11:20:54 +0100 | |
branch | svghmi |
changeset 3123 | f8cba959553f |
parent 2228 | 12cb48823b8c |
child 3303 | 0ffb41625592 |
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:
1537
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:
1537
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:
1537
diff
changeset
|
6 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1537
diff
changeset
|
7 |
# Copyright (C) 2012: Edouard TISSERANT and Laurent BESSARD |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1678
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:
1537
diff
changeset
|
9 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1537
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:
1537
diff
changeset
|
11 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1537
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:
1537
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:
1537
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:
1537
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:
1537
diff
changeset
|
16 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1537
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:
1537
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:
1537
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:
1537
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:
1537
diff
changeset
|
21 |
# |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1537
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:
1537
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:
1537
diff
changeset
|
24 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
814 | 25 |
|
1881
091005ec69c4
fix pylint py3k conversion warning: "(no-absolute-import) import missing `from __future__ import absolute_import`"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
26 |
from __future__ import absolute_import |
814 | 27 |
import wx |
1885
570122574a97
replaced normal panel with scrolled panel under project properties
dporopat <denis.poropat@smarteh.si>
parents:
1881
diff
changeset
|
28 |
from wx.lib.scrolledpanel import ScrolledPanel |
814 | 29 |
|
1970
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
30 |
from xmlclass.xmlclass import URI_model |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
31 |
|
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1773
diff
changeset
|
32 |
# ------------------------------------------------------------------------------- |
814 | 33 |
# Helpers |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1773
diff
changeset
|
34 |
# ------------------------------------------------------------------------------- |
814 | 35 |
|
36 |
REQUIRED_PARAMS = ["projectName", "productName", "productVersion", "companyName"] |
|
37 |
||
1773
38fde37c3766
clean-up: fix PEP8 E124 closing bracket does not match visual indentation
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
38 |
[ |
38fde37c3766
clean-up: fix PEP8 E124 closing bracket does not match visual indentation
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
39 |
TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, |
38fde37c3766
clean-up: fix PEP8 E124 closing bracket does not match visual indentation
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
40 |
POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES |
814 | 41 |
] = range(10) |
42 |
||
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1773
diff
changeset
|
43 |
|
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1773
diff
changeset
|
44 |
# ------------------------------------------------------------------------------- |
814 | 45 |
# Project Properties Panel |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1773
diff
changeset
|
46 |
# ------------------------------------------------------------------------------- |
814 | 47 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
48 |
|
814 | 49 |
class ProjectPropertiesPanel(wx.Notebook): |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
50 |
|
814 | 51 |
def AddSizerParams(self, parent, sizer, params): |
52 |
for idx, (name, label) in enumerate(params): |
|
53 |
border = 0 |
|
54 |
if idx == 0: |
|
55 |
border |= wx.TOP |
|
56 |
elif idx == len(params) - 1: |
|
57 |
border |= wx.BOTTOM |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
58 |
|
814 | 59 |
st = wx.StaticText(parent, label=label) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
60 |
sizer.AddWindow(st, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
61 |
flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
62 |
|
814 | 63 |
tc = wx.TextCtrl(parent, style=wx.TE_PROCESS_ENTER) |
64 |
setattr(self, name, tc) |
|
65 |
callback = self.GetTextCtrlChangedFunction(tc, name) |
|
66 |
self.Bind(wx.EVT_TEXT_ENTER, callback, tc) |
|
67 |
tc.Bind(wx.EVT_KILL_FOCUS, callback) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
68 |
sizer.AddWindow(tc, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
69 |
flag=wx.GROW | border | wx.RIGHT) |
814 | 70 |
|
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
71 |
def __init__(self, parent, controller=None, window=None, enable_required=True, scrolling=True): |
1696
8043f32de7b8
make all dialog have non-fixed size
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1678
diff
changeset
|
72 |
wx.Notebook.__init__(self, parent) |
814 | 73 |
|
74 |
self.Controller = controller |
|
75 |
self.ParentWindow = window |
|
76 |
self.Values = None |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
77 |
|
814 | 78 |
# Project Panel elements |
79 |
||
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
80 |
self.ProjectPanel = ScrolledPanel(self, style=wx.TAB_TRAVERSAL) |
1885
570122574a97
replaced normal panel with scrolled panel under project properties
dporopat <denis.poropat@smarteh.si>
parents:
1881
diff
changeset
|
81 |
self.ProjectPanel.SetAutoLayout(1) |
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
82 |
if scrolling: |
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
83 |
self.ProjectPanel.SetupScrolling() |
814 | 84 |
projectpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=5, vgap=15) |
85 |
projectpanel_sizer.AddGrowableCol(1) |
|
86 |
self.ProjectPanel.SetSizer(projectpanel_sizer) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
87 |
|
814 | 88 |
self.AddSizerParams(self.ProjectPanel, projectpanel_sizer, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
89 |
[("projectName", _('Project Name (required):')), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
90 |
("projectVersion", _('Project Version (optional):')), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
91 |
("productName", _('Product Name (required):')), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
92 |
("productVersion", _('Product Version (required):')), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
93 |
("productRelease", _('Product Release (optional):'))]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
94 |
|
814 | 95 |
self.AddPage(self.ProjectPanel, _("Project")) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
96 |
|
814 | 97 |
# Author Panel elements |
98 |
||
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
99 |
self.AuthorPanel = ScrolledPanel(self, style=wx.TAB_TRAVERSAL) |
1885
570122574a97
replaced normal panel with scrolled panel under project properties
dporopat <denis.poropat@smarteh.si>
parents:
1881
diff
changeset
|
100 |
self.AuthorPanel.SetAutoLayout(1) |
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
101 |
if scrolling: |
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
102 |
self.AuthorPanel.SetupScrolling() |
814 | 103 |
authorpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=4, vgap=15) |
104 |
authorpanel_sizer.AddGrowableCol(1) |
|
105 |
self.AuthorPanel.SetSizer(authorpanel_sizer) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
106 |
|
814 | 107 |
self.AddSizerParams(self.AuthorPanel, authorpanel_sizer, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
108 |
[("companyName", _('Company Name (required):')), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
109 |
("companyURL", _('Company URL (optional):')), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
110 |
("authorName", _('Author Name (optional):')), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
111 |
("organization", _('Organization (optional):'))]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
112 |
|
814 | 113 |
self.AddPage(self.AuthorPanel, _("Author")) |
114 |
||
115 |
# Graphics Panel elements |
|
116 |
||
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
117 |
self.GraphicsPanel = ScrolledPanel(self, style=wx.TAB_TRAVERSAL) |
1885
570122574a97
replaced normal panel with scrolled panel under project properties
dporopat <denis.poropat@smarteh.si>
parents:
1881
diff
changeset
|
118 |
self.GraphicsPanel.SetAutoLayout(1) |
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
119 |
if scrolling: |
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
120 |
self.GraphicsPanel.SetupScrolling() |
814 | 121 |
graphicpanel_sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=4, vgap=5) |
122 |
graphicpanel_sizer.AddGrowableCol(0) |
|
123 |
graphicpanel_sizer.AddGrowableRow(3) |
|
124 |
self.GraphicsPanel.SetSizer(graphicpanel_sizer) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
125 |
|
814 | 126 |
pageSize_st = wx.StaticText(self.GraphicsPanel, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
127 |
label=_('Page Size (optional):')) |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
128 |
graphicpanel_sizer.AddWindow( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
129 |
pageSize_st, border=10, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
130 |
flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT | wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
131 |
|
814 | 132 |
pageSize_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5) |
133 |
pageSize_sizer.AddGrowableCol(1) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
134 |
graphicpanel_sizer.AddSizer(pageSize_sizer, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
135 |
flag=wx.GROW | wx.LEFT | wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
136 |
|
814 | 137 |
for name, label in [('PageWidth', _('Width:')), |
138 |
('PageHeight', _('Height:'))]: |
|
139 |
st = wx.StaticText(self.GraphicsPanel, label=label) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
140 |
pageSize_sizer.AddWindow(st, border=12, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
141 |
flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
142 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
143 |
sp = wx.SpinCtrl(self.GraphicsPanel, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
144 |
min=0, max=2**16, style=wx.TE_PROCESS_ENTER) |
814 | 145 |
setattr(self, name, sp) |
146 |
callback = self.GetPageSizeChangedFunction(sp, name) |
|
147 |
self.Bind(wx.EVT_TEXT_ENTER, callback, sp) |
|
148 |
sp.Bind(wx.EVT_KILL_FOCUS, callback) |
|
149 |
pageSize_sizer.AddWindow(sp, flag=wx.GROW) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
150 |
|
814 | 151 |
scaling_st = wx.StaticText(self.GraphicsPanel, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
152 |
label=_('Grid Resolution:')) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
153 |
graphicpanel_sizer.AddWindow(scaling_st, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
154 |
flag=wx.GROW | wx.LEFT | wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
155 |
|
814 | 156 |
scaling_nb = wx.Notebook(self.GraphicsPanel) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
157 |
graphicpanel_sizer.AddWindow(scaling_nb, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
158 |
flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
159 |
|
814 | 160 |
self.Scalings = {} |
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
161 |
for language, translation in [("FBD", _("FBD")), ("LD", _("LD")), ("SFC", _("SFC"))]: |
814 | 162 |
scaling_panel = wx.Panel(scaling_nb, style=wx.TAB_TRAVERSAL) |
163 |
scalingpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5) |
|
164 |
scalingpanel_sizer.AddGrowableCol(1) |
|
165 |
scaling_panel.SetSizer(scalingpanel_sizer) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
166 |
|
814 | 167 |
scaling_controls = [] |
168 |
for idx, (name, label) in enumerate([('XScale', _('Horizontal:')), |
|
169 |
('YScale', _('Vertical:'))]): |
|
170 |
if idx == 0: |
|
171 |
border = wx.TOP |
|
172 |
else: |
|
173 |
border = wx.BOTTOM |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
174 |
|
814 | 175 |
st = wx.StaticText(scaling_panel, 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
|
176 |
scalingpanel_sizer.AddWindow( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
177 |
st, border=10, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
178 |
flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
179 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
180 |
sp = wx.SpinCtrl(scaling_panel, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
181 |
min=0, max=2**16, style=wx.TE_PROCESS_ENTER) |
814 | 182 |
scaling_controls.append(sp) |
183 |
callback = self.GetScalingChangedFunction(sp, language, name) |
|
184 |
self.Bind(wx.EVT_TEXT_ENTER, callback, sp) |
|
185 |
sp.Bind(wx.EVT_KILL_FOCUS, callback) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
186 |
scalingpanel_sizer.AddWindow(sp, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
187 |
flag=wx.GROW | border | wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
188 |
|
814 | 189 |
self.Scalings[language] = scaling_controls |
190 |
scaling_nb.AddPage(scaling_panel, translation) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
191 |
|
814 | 192 |
self.AddPage(self.GraphicsPanel, _("Graphics")) |
193 |
||
194 |
# Miscellaneous Panel elements |
|
195 |
||
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
196 |
self.MiscellaneousPanel = ScrolledPanel(parent=self, |
1886 | 197 |
name='MiscellaneousPanel', |
198 |
style=wx.TAB_TRAVERSAL) |
|
1885
570122574a97
replaced normal panel with scrolled panel under project properties
dporopat <denis.poropat@smarteh.si>
parents:
1881
diff
changeset
|
199 |
self.MiscellaneousPanel.SetAutoLayout(1) |
2228
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
200 |
if scrolling: |
12cb48823b8c
Fix size of ProjectDialog used by PLCOpenEditor
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1973
diff
changeset
|
201 |
self.MiscellaneousPanel.SetupScrolling() |
814 | 202 |
miscellaneouspanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=15) |
203 |
miscellaneouspanel_sizer.AddGrowableCol(1) |
|
204 |
miscellaneouspanel_sizer.AddGrowableRow(1) |
|
205 |
self.MiscellaneousPanel.SetSizer(miscellaneouspanel_sizer) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
206 |
|
814 | 207 |
language_label = wx.StaticText(self.MiscellaneousPanel, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
208 |
label=_('Language (optional):')) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
209 |
miscellaneouspanel_sizer.AddWindow(language_label, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
210 |
flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
211 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
212 |
self.Language = wx.ComboBox(self.MiscellaneousPanel, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
213 |
style=wx.CB_READONLY) |
814 | 214 |
self.Bind(wx.EVT_COMBOBOX, self.OnLanguageChanged, self.Language) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
215 |
miscellaneouspanel_sizer.AddWindow(self.Language, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
216 |
flag=wx.GROW | wx.TOP | wx.RIGHT) |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
217 |
|
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
218 |
description_label = wx.StaticText( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
219 |
self.MiscellaneousPanel, label=_('Content Description (optional):')) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
220 |
miscellaneouspanel_sizer.AddWindow(description_label, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
221 |
flag=wx.BOTTOM | wx.LEFT) |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
222 |
|
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
223 |
self.ContentDescription = wx.TextCtrl( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
224 |
self.MiscellaneousPanel, size=wx.Size(240, 150), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
225 |
style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
226 |
self.Bind(wx.EVT_TEXT_ENTER, self.OnContentDescriptionChanged, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
227 |
self.ContentDescription) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
228 |
self.ContentDescription.Bind(wx.EVT_KILL_FOCUS, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
229 |
self.OnContentDescriptionChanged) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
230 |
miscellaneouspanel_sizer.AddWindow(self.ContentDescription, border=10, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
231 |
flag=wx.GROW | wx.BOTTOM | wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
232 |
|
814 | 233 |
self.AddPage(self.MiscellaneousPanel, _("Miscellaneous")) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
234 |
|
814 | 235 |
for param in REQUIRED_PARAMS: |
236 |
getattr(self, param).Enable(enable_required) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
237 |
|
1537
e8629f0cc93b
Add russian language in Project properties -> Other menu.
Sergey Surkov <surkovsv93@gmail.com>
parents:
814
diff
changeset
|
238 |
languages = ["", "en-US", "fr-FR", "zh-CN", "ru-RU"] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
239 |
|
814 | 240 |
for language in languages: |
241 |
self.Language.Append(language) |
|
242 |
||
243 |
def RefreshView(self): |
|
244 |
if self.Controller is not None: |
|
245 |
self.SetValues(self.Controller.GetProjectProperties()) |
|
246 |
||
247 |
def SetValues(self, values): |
|
248 |
self.Values = values |
|
249 |
for item, value in values.items(): |
|
250 |
if item == "language": |
|
251 |
self.Language.SetStringSelection(value) |
|
252 |
elif item == "contentDescription": |
|
253 |
self.ContentDescription.SetValue(value) |
|
254 |
elif item == "pageSize": |
|
255 |
self.PageWidth.SetValue(value[0]) |
|
256 |
self.PageHeight.SetValue(value[1]) |
|
257 |
elif item == "scaling": |
|
258 |
for language, (x, y) in value.items(): |
|
259 |
if language in self.Scalings: |
|
260 |
self.Scalings[language][0].SetValue(x) |
|
261 |
self.Scalings[language][1].SetValue(y) |
|
262 |
else: |
|
263 |
tc = getattr(self, item, None) |
|
264 |
if tc is not None: |
|
265 |
tc.SetValue(value) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
266 |
|
814 | 267 |
def GetValues(self): |
268 |
values = {} |
|
269 |
for param in ["projectName", "projectVersion", |
|
270 |
"productName", "productVersion", |
|
271 |
"productRelease", "companyName", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
272 |
"companyURL", "authorName", |
814 | 273 |
"organization"]: |
274 |
value = getattr(self, param).GetValue() |
|
275 |
if param in REQUIRED_PARAMS or value != "": |
|
276 |
values[param] = value |
|
277 |
else: |
|
278 |
values[param] = None |
|
279 |
language = self.Language.GetStringSelection() |
|
280 |
if language != "": |
|
281 |
values["language"] = language |
|
282 |
else: |
|
283 |
values["language"] = None |
|
284 |
content_description = self.ContentDescription.GetValue() |
|
285 |
if content_description != "": |
|
286 |
values["contentDescription"] = content_description |
|
287 |
else: |
|
288 |
values["contentDescription"] = None |
|
289 |
values["pageSize"] = (self.PageWidth.GetValue(), self.PageHeight.GetValue()) |
|
290 |
values["scaling"] = {} |
|
291 |
for language in ["FBD", "LD", "SFC"]: |
|
292 |
values["scaling"][language] = (self.Scalings[language][0].GetValue(), |
|
293 |
self.Scalings[language][1].GetValue()) |
|
294 |
return values |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
295 |
|
814 | 296 |
def GetTextCtrlChangedFunction(self, textctrl, name): |
297 |
def TextCtrlChangedFunction(event): |
|
1678
55b6db51eb63
fix clearing project name on opening project properties page.
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
298 |
if self.Controller is not None and self.Values is not None: |
55b6db51eb63
fix clearing project name on opening project properties page.
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
299 |
old_value = self.Values.get(name) |
814 | 300 |
new_value = textctrl.GetValue() |
1972
38e912c8bd31
fix bug with indelible values in some 'optional' fields in project properties panel
Surkov Sergey <surkovsv93@gmail.com>
parents:
1970
diff
changeset
|
301 |
if name in REQUIRED_PARAMS and new_value == "": |
814 | 302 |
new_value = None |
1970
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
303 |
if name == 'companyURL': |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
304 |
if not URI_model.match(new_value): |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
305 |
new_value = None |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
306 |
dialog = wx.MessageDialog(self, _('Invalid URL!\n' |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
307 |
'Please enter correct URL address.'), |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
308 |
_("Error"), wx.OK | wx.ICON_ERROR) |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
309 |
dialog.ShowModal() |
b524b356aa58
add address validation in Company URL field
Surkov Sergey <surkovsv93@gmail.com>
parents:
1881
diff
changeset
|
310 |
dialog.Destroy() |
814 | 311 |
if old_value != new_value: |
312 |
self.Controller.SetProjectProperties(properties={name: new_value}) |
|
313 |
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, |
|
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
314 |
PROJECTTREE, PAGETITLES) |
814 | 315 |
wx.CallAfter(self.RefreshView) |
316 |
event.Skip() |
|
317 |
return TextCtrlChangedFunction |
|
318 |
||
319 |
def GetPageSizeChangedFunction(self, spinctrl, name): |
|
320 |
def PageSizeChangedFunction(event): |
|
321 |
if self.Controller is not None: |
|
322 |
if self.Values is not None: |
|
323 |
old_value = self.Values.get("pageSize") |
|
324 |
else: |
|
325 |
old_value = (0, 0) |
|
326 |
if name == 'PageWidth': |
|
327 |
new_value = (spinctrl.GetValue(), old_value[1]) |
|
328 |
else: |
|
329 |
new_value = (old_value[0], spinctrl.GetValue()) |
|
330 |
if old_value != new_value: |
|
331 |
self.Controller.SetProjectProperties(properties={"pageSize": new_value}) |
|
332 |
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, |
|
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
333 |
PAGETITLES, SCALING) |
814 | 334 |
wx.CallAfter(self.RefreshView) |
335 |
event.Skip() |
|
336 |
return PageSizeChangedFunction |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
337 |
|
814 | 338 |
def GetScalingChangedFunction(self, spinctrl, language, name): |
339 |
def ScalingChangedFunction(event): |
|
340 |
if self.Controller is not None: |
|
341 |
old_value = (0, 0) |
|
342 |
if self.Values is not None: |
|
343 |
scaling = self.Values.get("scaling") |
|
344 |
if scaling is not None: |
|
345 |
old_value = scaling.get(language) |
|
346 |
if name == 'XScale': |
|
347 |
new_value = (spinctrl.GetValue(), old_value[1]) |
|
348 |
else: |
|
349 |
new_value = (old_value[0], spinctrl.GetValue()) |
|
350 |
if old_value != new_value: |
|
351 |
self.Controller.SetProjectProperties(properties={"scaling": {language: new_value}}) |
|
352 |
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, |
|
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
353 |
PAGETITLES, SCALING) |
814 | 354 |
wx.CallAfter(self.RefreshView) |
355 |
event.Skip() |
|
356 |
return ScalingChangedFunction |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
357 |
|
814 | 358 |
def OnLanguageChanged(self, event): |
359 |
if self.Controller is not None: |
|
360 |
if self.Values is not None: |
|
361 |
old_value = self.Values.get("language") |
|
362 |
else: |
|
363 |
old_value = None |
|
364 |
new_value = self.Language.GetStringSelection() |
|
365 |
if new_value == "": |
|
366 |
new_value = None |
|
367 |
if old_value != new_value: |
|
368 |
self.Controller.SetProjectProperties(properties={"language": new_value}) |
|
369 |
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES) |
|
370 |
wx.CallAfter(self.RefreshView) |
|
371 |
event.Skip() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1696
diff
changeset
|
372 |
|
814 | 373 |
def OnContentDescriptionChanged(self, event): |
374 |
if self.Controller is not None: |
|
375 |
if self.Values is not None: |
|
376 |
old_value = self.Values.get("contentDescription") |
|
377 |
else: |
|
378 |
old_value = None |
|
379 |
new_value = self.ContentDescription.GetValue() |
|
380 |
if new_value == "": |
|
381 |
new_value = None |
|
382 |
if old_value != new_value: |
|
383 |
self.Controller.SetProjectProperties(properties={"contentDescription": new_value}) |
|
384 |
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES) |
|
385 |
wx.CallAfter(self.RefreshView) |
|
386 |
event.Skip() |